When implementing a content management solution it is common to have some content, such as sites, that is part of the solution. To load this content into the repository when the solution is first deployed we use bootstrapping. To bootstrap content means to load it once into the repository. Besides bootstrapping sites, it is also common to bootstrap folders, files, categories, rules, permissions, users, and groups. There are two ways in which content can be boostrapped (imported) into the repository via an AMP or JAR module extension. There is patch based bootstrapping that is triggered based on the Alfresco schema version and is not linked to the module version. Patch bootstrapping can, for example, be used for database schema upgrades. But it can also be used to bootstrap Share sites and other types of content. Then we have the importer module component that is used more often as the bootstrapping happens when the module (i.e. AMP or JAR) is deployed into the repository. The execution of the importer component is tied to a specific version of the module, which is handy when a module evolves incrementally.
Both the patch approach and the importer module component approach uses a specific XML format to describe what content that should be imported and where it should go in the repository. When you export content from the repository it will be descibed in this XML format. Exported content usually comes packaged in an Alfresco Content Package (ACP), which is just a ZIP file, and it contains this XML file plus the binary files for the content.
The following sections will show the type of XML needed for importing different types of content and the associated Spring beans, in these samples we use the patch approach.
Let’s start bootstrapping some users and groups as they are usually used also when bootstrapping permissions and sites. Normally users and groups would be imported via a directory sync, but let’s just bootstrap them manually for demonstration purposes. Sometimes you also need special users that aren’t in the directory, such as test users.