This page describes data source definition of a Magnolia Content type. A data source defines how content type items are persisted.
The Magnolia Content Types module is currently available as a Developer Preview. Development for the first official release is still underway.
This developer preview brings several powerful features. Please try it out and feel free to send us your feedback and suggestions based on your experience.
We are working to finalize the module as soon as possible.
optional, default is
The type of the data source. If the value is JCR, the definition class must implement JcrDataSourceDefinition.
The name of the JCR workspace to store the content items.
When the definition item is loaded, and if there is no workspace registered by the given name and the
optional, default is
The root path for content type items in the given JCR workspace.
A list of JCR namespace names.
A JCR namespace name.
When the definition item is loaded, and if the given JCR namespace hasn't been registered yet, the system will register the namespace.
optional , default is
If set to
JCR name spaces, node types and node type definitions
model, explained in more detail on the Content type Model definition page, defines which
nodeType is used. The model itself does not define the nature of the node type. In the example above the
nodetype chosen is
Let's assume that the
nodetype has not been registered yet. How to make sure that the model can utilize it?
There are two approaches.
- All specifications in the YAML file.
- Using the the
nodeTypeDefinitionand XML-based node type definition.
All specifications in the YAML file
The example above defines all the JCR parameters in one YAML file. In most cases this is the recommended approach.
If you intend to use a JCR namespace that hasn't been defined yet, you can define the new namespace, for example
mt, with the
In the above example, assuming that
mt:tourGuide has not been registered yet, the system will automatically register a new node type with the given namespace
mt, and the new node type inherits from the Magnolia
mgnl:content node type.
nodeTypeDefinition and XML-based node type definition
nodeTypeDefinition property you can define a path to an XML file to define a JCR node type definition.
Using an XML file allows you to define various JCR namespace and node type definitions. Node type definitions based on an XML file can be more complex than the automatically generated node types, which inherit from
Example of an XML-based node type definition:Example of a content type definition referencing an XML-based node type definition:
Access to JCR workspaces is controlled by role-based access control lists (ACLs).
When the system detects and registers a new JCR workspace from a data source definition, it also automatically updates the
superuser role by adding an ACL for the given workspace and granting read/write permissions for the
In a production system, if you want to provide anonymous website visitors with (read) access to a specific JCR workspace, you must update the
anonymous role by adding an ACL for the workspace.
For further information please read:
Interfaces and classes
The base DataSourceDefinition interface is agnostic of any data source type. To specify a JCR data source, Magnolia provides the JcrDataSourceDefinition interface and the ConfiguredJcrDataSourceDefinition implementation class.
For DataSourceDefinition the ConfiguredJcrDataSourceDefinition is the default implementation class via type mapping on the XML-based module descriptor of the
By default Magnolia expects you to configure properties for ConfiguredJcrDataSourceDefinition to define a JCR data source.