This documentation is still in progress. We are working hard to update all our screenshots to the new Magnolia 6 style. Please bear with us.
The Content Importer module allows you to bootstrap content from the file system into the JCR. The module adds bootstrapping capabilities for light modules. You can import content during development, distribution and deployment of light modules. For example, import sample content for a new template so authors can immediately see how the template works.
Magnolia monitors the bootstrap directory on the file system. When Magnolia detects a change, it sends a message to the Tasks app to the superuser account. The superuser can then import the content. This allows you to import content in a controlled way, ensuring that no existing content is overridden by accident.
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency> <groupId>info.magnolia.content</groupId> <artifactId>magnolia-content-importer</artifactId> <version>1.0.2</version> </dependency>
Pre-built jars are also available for download. See Installing a module for help.
How content import works
To demonstrate how content import works, we bootstrap a
cruise-manager page into the
/travel/about/careers section in the Pages app.
To create a bootstrap file for testing, create a page in the Pages app, export it and save the file to a temporary location on your computer. Next, delete the page in the Pages app and then add the file to your bootstrap directory on the file system. See Importing and exporting JCR data for bootstrapping for more.
Here's how bootstrapping files from the file system works in the UI:
An XML file is added to the bootstrap directory. See Setting the bootstrap directory.
Example : Add
A message is logged to the user:
- A task is sent to the Tasks app.
Example: Import request task and Import action for
cruise-managerpage in the Tasks app.
superuserassigns himself the task and clicks Import to import the content into the corresponding workspace in the repository. He can also Reject or Abort the import.
- The bootstrapped content is available in the relevant app.
Example: Cruise Manager page in Pages app.
- The bootstrap directory is monitored and a new task sent to the Tasks app when a change in the XML is detected.
- Observation only occurs if the bootstrap directory is set in the
- Bootstrap files are only detected on a running instance. The directory is not observed on startup. Only add bootstraps after starting Magnolia.
- Deletions are not removed automatically. To remove content, delete it in the JCR and the bootstrap directory.
- Only XML files are observed. All other extensions are filtered out.
Setting the bootstrap directory
- Install the Content Importer module.
- Set the content bootstrap directory. Observation will not take place until the property is added.
To set the bootstrap directory add the
magnolia.content.bootstrap.dir property in the
magnolia.properties file. The bootstrap directory can reside anywhere on the file system and can be named anything you like.
Example: Setting the bootstrap directory as a subdirectory of the resources directory.
Subdirectories of the bootstrap directory are also monitored. You can structure your bootstrap files within the bootstrap directory.
The module is configured in
No configuration changes are required unless you customize the implementation.
Content Import Request task
The Content Import Request task displays in the Tasks app.
This task is configured in
|Content Import Request|
Users who can view and assign tasks.
Please note that at least one user or one group (see the next property) should be defined for bootstrap messages to be displayed. The default configuration comes with
User groups who can view and assign tasks.
Message view displayed in detail view.
Content Import Request message view
The Content Import Request message view is displayed to the user who opens a task. The view is mapped to the Content Import Request task in the
taskView property (above).
The Import (
approve) action uses a custom action implementation class that is responsible for importing the bootstrap file into the JCR. With this exception, it is a standard message view definition.
content message view is configured in
Message views folder.
Message view name.
Form definition node.
Text fields (read only):
Actions definition node.
Action bar definition.