You are here

Bootstrapping Files/Spaces using XML

It is possible to bootstrap files and spaces by using XML files.

An alternative to the ACP import is to explicitly reference files through XML.

    <bean id="customSpacesBootstrap" parent="spacesStoreImporter" singleton="true" >
      <property name="useExistingStore">
      <property name="bootstrapViews">
            <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${}</prop>
            <prop key="location">alfresco/module/yourmodule/bootstrap/config_email_templates.xml</prop>

In the code sample, config_email_templates.xml contains the actual file references, as well as all file and folder properties. All predetermined files and folders will be placed in the Company Home/Data Dictionary/Email Templates space.

Property values

useExistingStore If false the content will not be imported if the store exists
bootstrapViews What you want to import and where it comes from

It is convenient to use a global property value for the property useExistingStore in order to control bootstrapping on Alfresco startup. If the store does not yet exist (the very first time a new alfresco installation starts up), the data will aways be bootstrapped, no matter the value, but from that moment on the store exists, and setting this to false means the next time Alfresco reboots these files will not be overridden with those on the classpath. Set it to true again and on the next reboot the classpath files are loaded.

XML imports can only replace/update/delete files that have their UUID set.

Examples of how to bootstrap data to other stores or to see all the available options, can be found in the file import-export-context.xml.

Another example is shown here:

    <view:view xmlns:view=""
      xmlns:cm="" xmlns:app=""
      <cm:folder view:childName="cm:My First Folder">
        <app:uifacets />
        <cm:name>My First Folder</cm:name>
        <cm:title>My First Folder</cm:title>
          <cm:content view:childName="cm:custom_email_template.ftl">
              <cm:titled />
              <cm:author />
              <app:inlineeditable />
              <cm:description>This is a custom email template.</cm:description>
              <cm:title>My first email template</cm:title>

In the code sample, you see a folder is being added, containing a single Freemarker template file. You can add multiple files and folders on the top level, or in sub-folders this way. Aspects can also be set on the new folder. Another example can be found in the file config/alfresco/bootstrap/spaces.xml. The bootstrap directory also contains many other examples.

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.