cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco module bootstrap import

pascalt
Champ in-the-making
Champ in-the-making
Hi,

I i'm working on a Alfresco Module and i have a question concerning the bootstrap import procedure.

When i'd like to add for example an ftl file to the email templates space in the data dictionary via an acp file, it doesn't show after deployment.
When i start with a fresh repository, it does deploy.

Is this normal behaviour?

Thnx in advance!
3 REPLIES 3

frederick
Champ in-the-making
Champ in-the-making
I'm not very familiar with the bootstrap system, but to my knowledge, module bootstraps work differently from regular bootstraps.

If you want to include a bootstrap in a module, your bean must use the class org.alfresco.repo.module.ImporterModuleComponent. When the modules are started, this ModuleComponent will run (by default executeOnceOnly = true), and the bootstrap will be performed.

Here's a bean definition of the Records Management module from Alfresco that bootstraps several spaces and content:

    
<bean id="rm.bootstrapSpaces" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
        <property name="moduleId" value="recordsManagement" />
        <property name="name" value="bootstrapSpaces" />
        <property name="description" value="Initial data requirements" />
        <property name="sinceVersion" value="1.0" />
        <property name="appliesFromVersion" value="1.0" />
        <!– Data properties –>
        <property name="importer" ref="spacesBootstrap"/>
        <property name="bootstrapViews">
            <list>
                <props>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</prop>
                    <prop key="location">alfresco/module/recordsManagement/bootstrap/rm_templates.xml</prop>
                </props>
                <props>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}</prop>
                    <prop key="location">alfresco/module/recordsManagement/bootstrap/rm_javascripts.xml</prop>
                </props>
                <props>
                    <prop key="path">/cm:categoryRoot/cm:generalclassifiable</prop>
                    <prop key="location">alfresco/module/recordsManagement/bootstrap/rm_categories.xml</prop>
                </props>
                <!– <props>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}</prop>
                    <prop key="location">alfresco/module/recordsManagement/bootstrap/rm_file_plan.xml</prop>
                </props> –>
                <props>
                    <prop key="path">/${spaces.company_home.childname}</prop>
                    <prop key="location">alfresco/module/recordsManagement/bootstrap/records_space.acp</prop>
                </props>
            </list>
        </property>
    </bean>

pascalt
Champ in-the-making
Champ in-the-making
Thnx for the help!
I've also been looking at the record management module on how to construct my bootstrap import.

This is my bootstrap, which should work, but it only does when i deploy it on a fresh Alfresco install:


<bean id="myModule.bootstrap" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
  
   <!– Module Details –>
   <property name="moduleId" value="myModule" />
   <property name="name" value="myModuleBootstrap" />
   <property name="description" value="My Modules initial data requirements" />
   <property name="sinceVersion" value="1.0" />
   <property name="appliesFromVersion" value="1.0" />
  
   <!– Data properties –>
   <property name="importer" ref="spacesBootstrap"/>
   <property name="bootstrapViews">
      <list>
         <props>
            <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.email.childname}</prop>
            <prop key="location">alfresco/module/myModule/bootstrap/Templates.acp</prop>
         </props>
      </list>
   </property>

</bean>

frederick
Champ in-the-making
Champ in-the-making
The module registry remembers the last time a module component was executed. Since the ImporterModuleComponent is set to execute only once, it will not attempt to import if this date is not null.
When you empty your repository, this registry will be removed as well.

For testing purposes, you could try setting executeOnceOnly to false like this in your bootstrap bean:


<property name="executeOnceOnly" value="false" />