Content Mirror

27
Content Mirror Plone Content Serialization to a Structured/Relational Database

description

 

Transcript of Content Mirror

Page 1: Content Mirror

Content Mirror

Plone Content Serialization to a Structured/Relational Database

Page 2: Content Mirror

 Who am I

Kapil Thangavelu

    Lives in Washington, DC

       Works with Python              Uses zope3, sqlalchemy, repoze, z3c

Page 3: Content Mirror

What is this talk about  

Rethinking How to Use PloneData Portability

Developer Productivity

Page 4: Content Mirror

What its not about

Using relational database with Plone

Page 5: Content Mirror

Product vs. Framework

2003, First Plone conference NOLA, paul everitt posed the question.

Page 6: Content Mirror

The Product Won

Plone does alot of out the box, with alot of knobs and customization possible through the web.

Page 7: Content Mirror

More Complexity

- Features are great if your using them.- Size Matters- Orthogonality Maters

Page 8: Content Mirror

Complexity Measured

"I have measured out my life in coffee spoons", The Love song of J Alrefd Prufrock, TS. Eliot

(1m x 40r x 5d x 50w )/60 = 166h

The Plone Tax, aka time spent waiting on restarts

Page 9: Content Mirror

Simplicity is Good

- Pay for What You Use

- We can build fast, interactive applications

- Developer Productivity and the Learning Curve Matters  - Simple things have a better chance of being correct

Page 10: Content Mirror

Separating Deployment

2am December 6th 2002, Amsterdam, infrae zope3 sprint

Page 11: Content Mirror

Static Deployment

CMFDeployment - Flexible Static Deployment, Filtering, transforms, deployment skins, rendering, urlresolution.

http://plone.org/products/cmfdeployment

From Plone 1.0 - Plone 3.1

Page 12: Content Mirror

Data Deployment

Entransit, provides data deployment, with features like rollback in a workspace based site structure.

.. requires particular site structure/layout according to workgroups, provides advanced features like rollback of a deployment.

Page 13: Content Mirror

Too Complex

Still too complex, needs to work out of the box.

operation and setup need to be dirt simple regardless of the internal complexity (like a product ;-)

Page 14: Content Mirror

ContentMirror

 "A facility for mirroring the content of a Plone site into a structured external datastore."  - automated, transparent, synchronous serialization.   - default source, Archetypes Content   - default target, Relational Databases

Page 15: Content Mirror

ContentMirror

Supports Plone 2.5 - Plone 3.1 Support different Databases ( tested with Postgresql & Mysql )

Work out of the Box

Strong Test Coverage

Easy to Extend

Page 16: Content Mirror

Bootstrapping

 - Load the Archetypes - Transform to Database Schema - Create Peer Class

Page 17: Content Mirror

Schema Transformationtransform archetypes schemas into relational tables Using SQLAlchemy Uses a default schema ( dublin core, relations, files, identity ) each type gets its own table with common fields factored out

Page 18: Content Mirror

Peer BasedEach content type's class has a corresponding, database persisted class (orm mapped), with corresponding attributes. The peer/domain class can be specified or autogenerated (default).

Page 19: Content Mirror

Event Based

In order to serialize content as changes are happening in the CMS, we integrate into the application server's event stream and subscribe to content events. The subscribers in turn create sync operations via an operation factory.

Page 20: Content Mirror

Files

Don't copy files without need Stored in the database by default

Page 21: Content Mirror

Containment

Adjacency List Model  Modified Preorder Tree TraversalLightweight Mapper for Site Maps (use eager join option )

Page 22: Content Mirror

Relations

Archetypes

Bidirectional

Generic Between Types

Custom Attributes

Content Mirror

Relations Table

Doesn't support custom attributes without customization.

Page 23: Content Mirror

Installation   <configure xmlns="http://namespaces.zope.org/zope"            xmlns:db="http://namespaces.objectrealms.net/rdb"           xmlns:ore="http://namespaces.objectrealms.net/mirror">     <!-- setup a database connection -->   <db:engine url="postgres://localhost/contentmirror"             name="mirror-db"             echo="True"/>   <!-- associate the connection to the db structures -->   <db:bind engine="mirror-db"           metadata="ore.contentmirror.schema.metadata" /></configure>

Page 24: Content Mirror

Finishing Installation

# generate a schema ./bin/zopectl run Products/ContentMirror/ddl.py postgres  # create the database./bin/createdb mirror-example # load up the schema./bin/psql mirror-example < db.sql # bulk load the existing content./bin/zopectl run Products/ContentMirror/bulk.py portal

Page 25: Content Mirror

Playing with Content Demo

 SQL Command Line

 Django Admin Interface

Page 26: Content Mirror

Resources

Source Code, Issue Tracker, Documentation http://code.google.com/p/contentmirror Mailing Listhttp://groups.google.com/group/contentmirror 99% unit test coverage / 48 tests / Doctests

Page 27: Content Mirror

Questions   

?