-
-
Notifications
You must be signed in to change notification settings - Fork 97
Custom node type phpcr:managed
JCR defines node types which can be thought of a kind of schema for the repository's nodes. These types define the properties and children a node can have. JCR defines a set of node types that can be readily used. Some node types like nt:file restrict the set of allowed properties others like nt:unstructured allow any kind of properties and child nodes.
The PHPCR ODM stores with every node the alias of the document the node corresponds to. Therefore it adds a property named phpcr:alias to the node. If you use a node type like nt:file that does not allow free properties the node can not be saved when there are additional properties. Since the ODM uses the information stored in the property to construct the proper class when a node is read we need to find a way to store that property with all nodes managed by the ODM.
The node type phpcr:managed defines that property. When this node type is registered with the repository we can simply add that type to the node when the node is created.
Due to a limitation of the current (2.2.5) Jackrabbit implementation we cannot register a node type remotely, e.g. using Jackalope. Actually you need a small java program that connects to the repository in process. To register the node type when using jackrabbit-standalone follow the following steps:
- Get the node type definition file phpcr.cnd from [TBD] ...
- Get the load-cnd.jar from [TBD] ...
- Stop your Jackrabbit server
- Run the following command (for non-*nix-type systems the syntax is slightly different):
java -cp load-cnd.jar:jackrabbit-standalone-2.x.y.jar Main file:///path/to/your/jackrabbit/jackrabbit phpcr.cnd
The file-URL must point to your jackrabbit directory on the filesystem. This is usually created by jackrabbit on the first start.