Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ofbiz Jackrabbit architecture description

TODO: Update

In the next few lines I would like to describe the architecture diagram and explain why I did choose chose this way to integrate Jackrabbit in OFBiz.

The design is based on the Jackrabbit OCM (ObjectContentMapping) Package which gives us the ability to map objects to the content repository. Choosing this approach makes us more flexible to use different types of content. I.e. it’s possible to create different Content Objects with specific fields for blogs, forums, Products, Files, partys and so on.

In the current release I avoid any connections to the database, that makes the implementation absolute independent from the split into two parts. The framework implementation, which contains some abstract classes and interfaces which have to be implemented to made JCR available in OFBiz. The application side represents the concrete Jackrabbit implementation.I chose this separation to specify an independent framework side which could handle every JCR implementation (not only Jackrabbit). The concrete Jackrabbit implementation is found in the application (content) area because this part combines OFBiz (Database, Structure) with Jackrabbit. The framework shouldn’t now something about content types or content structures this information is related to the application site.

Framework side – An interface to JCR implementations

OfbizRepositoryMapping <<interface>>

The OfbizRepositoryMapping is the connection between any JCR implementation and OFBiz.

JcrHelpAbstract

This abstract class is the top class for the content operations. For now we differentiate between file and “normal” text content, because files and text contents are stored in different ways in the repository. In the future there might be more specialisation.

The class contains methods which have the same implementation in both cases. Furthermore the JcrHelperAbstract has a relation to the OfbizRepositoryMapping. It doesn’t matter which JCR implementation we use since the JcrHelpers always work with the right one.

JcrFileHelperAbstract, JcrTextHelperAbstract

Theses classes represent the methods for either the file or the text content. We have one Object for files and one for text because they need different implementation of methods and to give a user a clear separation between the different content types.

JcrFileHelperInterface, JcrTextHelperInterface

These classes seem obsolete, but imagine you have more than one JCR implementation. If you use one of the JcrHelper implementations you can simply implement against the interfaces. Should you start using another JCR implementation there is not that much to change. The code becomes much more maintainable.

Note: Adding methods is a little bit more work because they have to be added in the abstract class and in the interface as well, but the maintainable reason was more important.

...

 Application side

...

 OfbizRepositoryMappingJackrabbit

Is the concrete implementation for the connection between OFBiz and Jackrabbit. The class defines the structure of the content in the repository (See tree structure image).

JcrFileHelperJackrabbit, JcrTextHelperJackrabbit

They extend an abstract helper class and implement the interface. The helper classes use the OfbizRepositoryMappingJackrabbit methods to work with the repository. The helper classes also have methods for permission checking and handle tasks which are not directly related to the content repository.

JcrEvents, JcrWorker, JcrServices

and the example implementation

The Framework provides interfaces which should be implemented to make a JCR repository available in OFBiz. Furthermore the JCR reference implementation Jackrabbit can be found in the framework.

...

org.ofbiz.jcr.access

...

This package contains interfaces to connect to the Jackrabbit OCM.

The RepositoryAccess class creates the OCM connection and provides methods for CRUD operations. The CRUD operations are defined in the ContentWriter and ContentReader classes.

The VersionManager is responsible for all versioning related operations and is used by the ContentReader/Writer to grant access to versioned nodes.

...

org.ofbiz.jcr.orm

...

The ORM (OfbizRepositoryMapping) package is the OFBiz abstraction of the content objects. The OfbizRepositoryMapping interface is used by the ContentReader/Writer to interact with the ObjectContentMappingManager.

...

org.ofbiz.jcr.loader

...

Contains all classes to start the jcr/jackrabbit container, register everything in the JNDI and make sure that all additional namespaces and nodeTypes a registered.

...

org.ofbiz.jcr.util

...

The util classes contain static methods, which helps to work with the content repository.

...

org.ofbiz.jcr.handler

...

The repository need an own handler with no overhead, to stream (i.e.) images to a webpage.

...

org.ofbiz.jcr.security

...

Provide some security functions to control the repository access.

...

 Application side

...

For now there are no application related implementations. It is conceivable that we have a application related content database connection or different Content Workers which provide additional functionality for the specific context.These are classes can instantiate the helper objects and work with them.-

Still to be done

Ideas

  • Propagate and enforce OfBiz permissions, roles and users to JCR
  • Expose the JCR part via WebDAV (and/or some RESTish service)
  • JCR contents shall always be revisioned
  • Prevent duplication of properties between OfBiz and JCR
  • Explore Content Addressable Storage CAS options to prevent duplicate contents
  • Use this opportunity to create a simple workflow for OfBiz CMS Contents (or externalize to a CMS that provides a workflow)

...