cancel
Showing results for 
Search instead for 
Did you mean: 

Extend spacesbootstrap

thaneshk
Champ in-the-making
Champ in-the-making
Hi,

I wanted to be able to create a couple of default spaces during the initalization of my custom application. Therefore i did the following. I already have a custom model in place and working.

I created custom-context.xml and placed it in alfresco/extension and added the following lines

<bean id="spacesBootstrap" parent="spacesStoreImporter">            <property name="bootstrapViews">                <list>                    <props>                        <prop key="path">/</prop>                        <prop key="location">alfresco/extension/bootstrap/spaces.xml</prop>                        <prop key="messages">alfresco/extension/messages/bootstrap-spaces</prop>                    </props>                    <props>                        <prop key="path">/</prop>                        <prop key="location">alfresco/bootstrap/system.xml</prop>                    </props>                    <props>                        <prop key="path">/</prop>                        <prop key="location">alfresco/bootstrap/categories.xml</prop>                    </props>                    <props>                        <prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>                        <prop key="location">alfresco/bootstrap/tutorial.xml</prop>                        <prop key="messages">alfresco/messages/bootstrap-tutorial</prop>                    </props>                    <props>                        <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}</prop>                        <prop key="location">alfresco/templates/software_engineering_project.xml</prop>                        <prop key="messages">alfresco/messages/bootstrap-templates</prop>                    </props>                    <props>                        <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</prop>                        <prop key="location">alfresco/templates/content_template_examples.xml</prop>                    </props>                </list>            </property>    </bean>    ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I also added spaces.xml from alfresco/bootstrap to alfresco/extension/bootstrap and did the same for bootstrap-spaces.properties

The following is spaces.xml

<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"           xmlns:cm="http://www.alfresco.org/model/content/1.0"           xmlns:app="http://www.alfresco.org/model/application/1.0">    <!– NOTE: all replaced properties referenced from repository.properties file must also be              mapped in the bootstrap-context.xml spacesBootstrap/configuration section –>   <cm:folder view:childName="${spaces.company_home.childname}">        <view:acl view:inherit="false">            <view:ace view:access="ALLOWED">                <view:authority>GROUP_EVERYONE</view:authority>                <view:permission>Consumer</view:permission>            </view:ace>        </view:acl>      <app:uifacets />      <cm:name>${spaces.company_home.name}</cm:name>      <app:icon>space-icon-default</app:icon>      <cm:title>${spaces.company_home.name}</cm:title>      <cm:description>${spaces.company_home.description}</cm:description>      <cm:contains>         <cm:folder view:childName="${spaces.dictionary.childname}">            <app:uifacets />            <cm:name>${spaces.dictionary.name}</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>${spaces.dictionary.name}</cm:title>            <cm:description>${spaces.dictionary.description}</cm:description>            <cm:contains>               <cm:folder view:childName="${spaces.templates.childname}">                  <app:uifacets />                  <cm:name>${spaces.templates.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.templates.name}</cm:title>                  <cm:description>${spaces.templates.description}</cm:description>               </cm:folder>               <cm:folder view:childName="${spaces.templates.content.childname}">                  <app:uifacets />                  <cm:name>${spaces.templates.content.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.templates.content.name}</cm:title>                  <cm:description>${spaces.templates.content.description}</cm:description>               </cm:folder>               <cm:folder view:childName="${spaces.savedsearches.childname}">                        <view:acl view:inherit="false">                            <view:ace view:access="ALLOWED">                                <view:authority>GROUP_EVERYONE</view:authority>                                <view:permission>Contributor</view:permission>                            </view:ace>                        </view:acl>                  <app:uifacets />                  <cm:name>${spaces.savedsearches.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.savedsearches.name}</cm:title>                  <cm:description>${spaces.savedsearches.description}</cm:description>               </cm:folder>            </cm:contains>         </cm:folder>            <cm:folder view:childName="${spaces.guest_home.childname}">                <view:acl view:inherit="false">                    <view:ace view:access="ALLOWED">                        <view:authority>guest</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                    <view:ace view:access="ALLOWED">                        <view:authority>GROUP_EVERYONE</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                </view:acl>                <app:uifacets />            <cm:name>${spaces.guest_home.name}</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>${spaces.guest_home.name}</cm:title>            <cm:description>${spaces.guest_home.description}</cm:description><!– PART I ADDED –>            </cm:folder>              <cm:folder view:childName="cm:digital_assets">                <view:acl view:inherit="false">                    <view:ace view:access="ALLOWED">                        <view:authority>guest</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                    <view:ace view:access="ALLOWED">                        <view:authority>GROUP_EVERYONE</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                </view:acl>                <app:uifacets />            <cm:name>${spaces.xpflow_dam.name}</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>${spaces.xpflowdam.name}</cm:title>            <cm:description>${spaces.xpflowdam.description}</cm:description>            <cm:contains>               <cm:folder view:childName="cm:thumbnails">                        <view:acl view:inherit="false">                            <view:ace view:access="ALLOWED">                                <view:authority>GROUP_EVERYONE</view:authority>                                <view:permission>Contributor</view:permission>                            </view:ace>                        </view:acl>                  <app:uifacets />                  <cm:name>${spaces.xpflowthumbnail.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.xpflowthumbnail.name}</cm:title>                  <cm:description>${spaces.xpflowthumbnail.description}</cm:description>               </cm:folder>            </cm:contains>            </cm:folder>       </cm:contains>   </cm:folder></view:view>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

boostrap-spaces.xml

# Labels used in bootstrap Space definitionsspaces.company_home.name=XPspaces.company_home.description=The XP root space spaces.dictionary.name=Data Dictionaryspaces.dictionary.description=User managed definitionsspaces.templates.name=Space Templatesspaces.templates.description=Space templatesspaces.templates.content.name=Presentation Templatesspaces.templates.content.description=Presentation templatesspaces.savedsearches.name=Saved Searchesspaces.savedsearches.description=Saved Searchesspaces.guest_home.name=Guest Homespaces.guest_home.description=The guest root spacespaces.xpflowdam.name=Digital Asset Storagespaces.xpflowdam.description=Area to store Digital Assetsspaces.xpflowthumbnail.name=Thumbnail Storagespaces.xpflowthumbnail.description=Area to Store Digital Assets' Thumbnails‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Now custom.properties





# Spaces Configuration

spaces.store=workspace://SpacesStore
spaces.company_home.childname=app:xpflow
spaces.guest_home.childname=app:guest_home
spaces.dictionary.childname=app:dictionary
spaces.templates.childname=app:space_templates
spaces.templates.content.childname=app:content_templates
spaces.savedsearches.childname=app:saved_searches
spaces.xpflowdam.childname=cm:xpflowdam
spaces.xpflowthumbnail.childname=cm:xpthumbnail

the solution works fine if i put the child name of the space in the spaces.xml.so instead of putting ${spaces.xpflowdam.childname} if i put cm:xpflow, everything works fine. But when i put "${spaces.xpflowdam.childname}" and expect it to get the value from custom.properties it doesnt and i cant load the application after refreshing the db.Why is this happening. Any ideas?Cheers-Thanesh‍‍‍‍‍‍‍‍‍‍‍‍
4 REPLIES 4

felipe
Champ in-the-making
Champ in-the-making
Hello,
It's probably not the solution for your problem, but you have a little error on your spaces.xml file
– <cm:name>${spaces.xpflow_dam.name}</cm:name> –
must be replace by
– <cm:name>${spaces.xpflowdam.name}</cm:name> –
the _ on your name.

Good work.

davidc
Star Contributor
Star Contributor
I looked over your configuration and couldn't see anything wrong outside of the fix suggested by felipe.  Did that work for you?

felipe
Champ in-the-making
Champ in-the-making
Hello,
I'm working on the same approach than thaneshk in order to create a custom space at bootstrap.
I don't really understand how your custom.properties is referred by Alfresco?
Is that file automaticly read?

A solution if you don't want to modify the repository.properties (if you work with the Alfresco's source code), that I use too, is to put the content of custom.properties in the bootstrap-spaces.properties you 've overridden. 

I've a little question too.
All seems to work fine but I don't see the space in the web client???

Anyone can help me please? Thanks.

lnagra
Champ in-the-making
Champ in-the-making
Hi,

I would be interested to know if either felipe or thaneshk got this to work successfully.

I am trying to create spaces and categories at bootstrap in Alfresco ECMS 1.4. We had this working successfully by modifying /alfresco/bootstrap/categories.xml and /alfresco/bootstrap/spaces.xml in Alfresco 1.2.

However, this approach doesn't work very well for upgrading at a later date and it would be nice to try keeping our code seperate from Alfresco's.

I have created a JAR that contains:

alfresco.extension.custom-bootstrap-context.xml
alfresco.extension.bootstrap.custom-categories.xml
alfresco.extension.bootstrap.custom-spaces.xml
alfresco.extension.messages.custom-bootstrap-spaces

The idea is to have the -context.xml read automatically and refer to the custom-categories.xml and custom-spaces.xml

e.g.

alfresco.extension.custom-bootstrap-context.xml

<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'><beans>   <bean id="spacesBootstrap" parent="spacesStoreImporter">               <property name="bootstrapViews">                   <list>                       <props>                           <prop key="path">/</prop>                           <prop key="location">alfresco/extension/bootstrap/custom-spaces.xml</prop>                           <prop key="messages">alfresco/extension/messages/custom-bootstrap-spaces</prop>                       </props>                       <props>                           <prop key="path">/</prop>                           <prop key="location">alfresco/extension/bootstrap/custom-categories.xml</prop>                       </props>                   </list>               </property>   </bean>    </beans>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

e.g.

alfresco.extension.bootstrap.custom-spaces.xml


<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"           xmlns:cm="http://www.alfresco.org/model/content/1.0"           xmlns:app="http://www.alfresco.org/model/application/1.0">    <!– NOTE: all replaced properties referenced from repository.properties file must also be              mapped in the bootstrap-context.xml spacesBootstrap/configuration section –>   <cm:folder view:childName="${spaces.company_home.childname}">        <view:acl view:inherit="false">            <view:ace view:access="ALLOWED">                <view:authority>GROUP_EVERYONE</view:authority>                <view:permission>Consumer</view:permission>            </view:ace>        </view:acl>      <app:uifacets />      <cm:name>${spaces.company_home.name}</cm:name>      <app:icon>space-icon-default</app:icon>      <cm:title>${spaces.company_home.name}</cm:title>      <cm:description>${spaces.company_home.description}</cm:description>      <cm:contains>         <cm:folder view:childName="${spaces.dictionary.childname}">            <app:uifacets />            <cm:name>${spaces.dictionary.name}</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>${spaces.dictionary.name}</cm:title>            <cm:description>${spaces.dictionary.description}</cm:description>            <cm:contains>               <cm:folder view:childName="${spaces.templates.childname}">                  <app:uifacets />                  <cm:name>${spaces.templates.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.templates.name}</cm:title>                  <cm:description>${spaces.templates.description}</cm:description>               </cm:folder>               <cm:folder view:childName="${spaces.templates.content.childname}">                  <app:uifacets />                  <cm:name>${spaces.templates.content.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.templates.content.name}</cm:title>                  <cm:description>${spaces.templates.content.description}</cm:description>               </cm:folder>               <cm:folder view:childName="${spaces.savedsearches.childname}">                        <view:acl view:inherit="false">                            <view:ace view:access="ALLOWED">                                <view:authority>GROUP_EVERYONE</view:authority>                                <view:permission>Contributor</view:permission>                            </view:ace>                        </view:acl>                  <app:uifacets />                  <cm:name>${spaces.savedsearches.name}</cm:name>                  <app:icon>space-icon-default</app:icon>                  <cm:title>${spaces.savedsearches.name}</cm:title>                  <cm:description>${spaces.savedsearches.description}</cm:description>               </cm:folder>            </cm:contains>         </cm:folder>            <cm:folder view:childName="${spaces.guest_home.childname}">                <view:acl view:inherit="false">                    <view:ace view:access="ALLOWED">                        <view:authority>guest</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                    <view:ace view:access="ALLOWED">                        <view:authority>GROUP_EVERYONE</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                </view:acl>                <app:uifacets />            <cm:name>${spaces.guest_home.name}</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>${spaces.guest_home.name}</cm:title>            <cm:description>${spaces.guest_home.description}</cm:description>            </cm:folder>            <cm:folder view:childName="Published">                <view:acl view:inherit="false">                    <view:ace view:access="ALLOWED">                        <view:authority>guest</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                    <view:ace view:access="ALLOWED">                        <view:authority>GROUP_EVERYONE</view:authority>                        <view:permission>Consumer</view:permission>                    </view:ace>                </view:acl>                <app:uifacets />            <cm:name>"Published"</cm:name>            <app:icon>space-icon-default</app:icon>            <cm:title>"Published</cm:title>            <cm:description>"The space for all published content"</cm:description>            </cm:folder>      </cm:contains>   </cm:folder></view:view>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I've dropped the packaged JAR into a clean Alfresco exploded tomcat install in WEB-INF/lib

They don't appear to show. Is this because the bootstrap has already happened?

Is this approach the recommended method for seperating bootstrap configuration from Alfresco code?

Is there a way to force the bootstrap to occur?

Many thanks,

Lakhdip