Alfresco Content Store Selector

Content store selector

The content store selector provides users with a mechanism to bind content with
a specific content store. Alfresco provides the flexibility to have multiple content
stores, and you can decide what content needs to be stored in which store. This
is very useful in a scenario where you need to store different folder data in a
completely different store. You get the flexibility to place the less read, old conten
to any slow disk and all new content to any fast disk.

Using the content store selector

Follow the steps mentioned here to enable the content store selector:

1. Create a content store selector context file in <Alfresco_home>/shared/classes/alfresco/extension. A sample context file is provided with support files of this book.

2. Define the store as you require by defining beans, as shown in the following code sample:

<bean id=”projectMarketingContentStore” class=”org.alfresco.repo.
content.filestore.FileContentStore”>
 <constructor-arg>
 <value>${dir.root}/storeProjectA</value>
 </constructor-arg>
</bean>

3. List all the store beans with a store name that will be visible in the user
interface in the storeSelectorContentStore bean. Take a look at the
sample code snippet:

<bean id=”storeSelectorContentStore” parent=”storeSelectorContentS
toreBase”>
 <property name=”defaultStoreName”>
 <value>default</value>
 </property>
 <property name=”storesByName”>
 <map>
 <entry key=”default”>
 <ref bean=”fileContentStore” />
 </entry>
 <entry key=”projectMarketing”>
 <ref bean=”projectMarketingContentStore ” />
 </entry>
 …
 <bean>
4. Configure the eagerOrphanCleanup bean to map this list, so all this
additional content store can be cleaned up in the same fashion as the
default content store.
5. Set a proper scheduler cron expression for the system.content.
orphanCleanup.cronExpression property in alfresco-global.
properties.
6. Now restart Alfresco.
7. For Share, you need to enable the cm:storeSelector aspect and
cm:storeName, which is a property associated with this aspect.
Find the aspects tag in the share-config-custom.xml file located at
<ALFRESCO_HOME>/tomcat/shared/classes/alfresco/web-extension
and below the storeSelector aspect, add it in the list as shown in the
following code snippet:
<aspects>
 <!– Aspects that a user can see –>
 <visible>
 ..
 <aspect name=”cm:storeSelector” />
 </visible>
 ..
</aspects>
Also define the user-friendly name of the aspect in the slingshot.
properties file to be shown in the Share user interface.
 aspect.cm_storeSelector=Store Selector

8. Now apply this aspect to any content and set the storeName based on the
store you want the content to be in, for example if you want to store all
marketing documents in the projectMarketing store, set the storeName
value to projectMarketing as defined in the store selector bean. The file will
be copied from the default content store to the new content store. If no value
is specified in storeName, it takes the default. The file in the old content
store will remain as it is, but it will be marked as orphan so the cleanup
process can clean these documents.