Yesterday i tagged version Beta 1 of jackalope-jackrabbit, our PHP Content Repository (PHPCR) implementation. PHPCR is an API to manage tree-structured data, modelled after the Java Content Repository JCR specification. Time to summarize what jackalope can do today. For people already familiar with Jackalope, I summarize the recent changes at the bottom.
State of Jackalope-Jackrabbit
The basic node API is implemented and working fully. You can do direct access to paths and walk the tree hierarchy and read and write data. All data types including binary streams are supported.
We do support the workspace and session write operations including cross-workspace synchronization of nodes.
Queries can be expressed in the JCR-SQL2 language as well as the query object model. Additionally, jackalope provides a fluent query builder on top of the query object model. Most features of query are supported, the exceptions being query parameters and storing a query as stored query.
Exporting the repository to the standard “system” format and also the “document” format works, as does re-importing any repository dump (including those generated by Java JCR implementations).
Node type definitions can be inspected and are used to restrict allowed data when used. Both the CND file format and the object model to define custom node types are supported.
The observation journal is a log of everything that happened in the repository since a specified timestamp. It can be filtered to just see events an application is interested in. Filtering is for example done by repository path and by type of event like adding, changing, moving or removing.
Versioning is implemented and working. You can make nodes versionable, create new versions, inspect the version history to see old versions and restore old versions. Activities and version labels however are not yet implemented.
Session scoped locks are implemented. They allow to block a node, and optionally its subtree, to synchronize operations.
We did not yet implement open scoped locks, but that should not be too hard to do.
Besides building PHP content management, Jackalope-Jackrabbit can also be used to connect PHP applications to the Java jackrabbit based systems Magnolia CMS and Adobe CQ (currently called Adobe Experience Manager)
A couple of optional PHPCR features are not (yet) implemented :
- Permissions and capabilities: Checks whether the current user is allowed to do an operation
- Same Name Siblings: multiple children of the same node each having the same name
- Shareable nodes: would allow a node to have more than one parent
- Access Control Lists (ACL), because Jackrabbit does not expose this feature over the remoting protocol jackalope uses
- Lifecycle mmanagement
- Retention and Hold
- Transactions, because Jackrabbit does not expose this feature.
It is not a design decision not to support those features. We would be happy about contributions to those features, though right now we focus on stabilizing and improving the features already supported.
The RepositoryFactoryInterface was defining static methods. This is not legal PHP but the interpreter accepted it. We changed them to class methods and require the factory to have a no-argument constructor. Instead of
you now need to do
$factory = new JackalopeRepositoryFactoryJackrabbit; $factory->getRepository();
Jackalope now supports the SessionInterface::cloneFrom method and NodeInterface::update methods. This allows to copy a node into a different namespace, modify it there and then synchronize the changes back. With this, you can build workflow concepts.
The observation journal now is now usable. We figured out how to only get the events you actually care about when using the skipTo method. You can now use jackalope-jackrabbit as a message queue.
You have now commands to move a node, to touch (= create) a node and properties and to list the node types present in your repository.
The CLI commands are reorganized to a logical naming schema. We grouped them by what they affect: phpcr:node:, phpcr:workspace: and phpcr:node-type:*. We now differentiate between workspace:purge that deletes the whole repository and node:remove that can only delete a subtree but never “/”.
Besides some performance tweaks, we implemented the new PHPCR NodeInterface::getNodeNames method. This method allows to get the names of children of a node without actually needing to fetch them from the backend. Perfect for showing a list of nodes without the overhead.
Node Type Definition
We can now convert between the CND file format and node type objects and back. This means you can register node types in jackalope-jackrabbit by using the node type API.
The import and export got improved to work more reliable and some bugs are fixed. Jackalope-jackrabbit takes more effort now to avoid same name siblings from being created. If they should still happen to be created, deletion is fixed to be able to delete them. We fixed issues with the types of values returned by queries.
Preliminary Adobe CQ support
We already have Magnolia CMS support since last year. Adobe CQ is another CMS built on top of the commercial distribution of Jackrabbit called CRX. We tested compatibility with CRX and jackalope can now read and write data from that content repository.