Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
3.2Content Store
This is an Enterprise-only feature.
The following describes capabilities that are available in the Alfresco v3.2 Enterprise release.
The Content Store Selector provides a mechanism to control the store used for the content file associated with a particular content item.
By applying the cm:storeSelector aspect and setting its cm:storeName property to the name of a selectable store,
the content will be automatically moved from its current location to the new store. The store does not, therefore, store content itself, it defines and manages those stores that are available for selection.
This allows storage polices to be implemented to control which underlying physical storage is used, based on your applications needs or business policies.
For example, if you have a fast (and expensive) local disk, you can use this to store the files that you want to ensure
are served for best performance; however, infrequently used files may be stored on lower cost, slower storage.
In this example, we will define two additional file stores in addition to the standard default file store.
By setting the cm:storeName to property to either of these new stores or the default store, the content
is automatically moved from its existing store to the relevant new store.
The following configuration snippet defines two new stores. In this case, the physical location is relative to the dir.root property defined in alfresco-global.properties file. Note: The value for a new store directory may be a valid UNC path.
<bean id='firstSharedFileContentStore' class='org.alfresco.repo.content.filestore.FileContentStore'>
<constructor-arg>
<value>${dir.root}/storeA</value>
</constructor-arg>
</bean>
<bean id='secondSharedFileContentStore' class='org.alfresco.repo.content.filestore.FileContentStore'>
<constructor-arg>
<value>${dir.root}/storeB</value>
</constructor-arg>
</bean>
<bean id='contentService' parent='baseContentService'>
<property name='store'>
<ref bean='storeSelectorContentStore' />
</property>
</bean>
The list of stores is defined by the <property name='storesByName'> property. Any stores you want to be available to the storeSelectorContentStore should be listed under this property.
<bean id='storeSelectorContentStore' parent='storeSelectorContentStoreBase'>
<property name='defaultStoreName'>
<value>default</value>
</property>
<property name='storesByName'>
<map>
<entry key='default'>
<ref bean='fileContentStore' />
</entry>
<entry key='storeA'>
<ref bean='firstSharedFileContentStore' />
</entry>
<entry key='storeB'>
<ref bean='secondSharedFileContentStore' />
</entry>
</map>
</property>
</bean>
The cm:storeName property can be set in number of ways:
Expected behaviour:
The following shows the complete configuration example. This should be saved as a extension, for example, <extension>\sample-content-store-selector-context.xml.
Note: The list of stores available can be set by updating the list under the <property name='storesByName'> property.
sample-content-store-selector-context.xml
<beans>
<bean id='firstSharedFileContentStore' class='org.alfresco.repo.content.filestore.FileContentStore'>
<constructor-arg>
<value>${dir.root}/storeA</value>
</constructor-arg>
</bean>
<bean id='secondSharedFileContentStore' class='org.alfresco.repo.content.filestore.FileContentStore'>
<constructor-arg>
<value>${dir.root}/storeB</value>
</constructor-arg>
</bean>
<bean id='storeSelectorContentStore' parent='storeSelectorContentStoreBase'>
<property name='defaultStoreName'>
<value>default</value>
</property>
<property name='storesByName'>
<map>
<entry key='default'>
<ref bean='fileContentStore' />
</entry>
<entry key='storeA'>
<ref bean='firstSharedFileContentStore' />
</entry>
<entry key='storeB'>
<ref bean='secondSharedFileContentStore' />
</entry>
</map>
</property>
</bean>
<bean id='contentService' parent='baseContentService'>
<property name='store'>
<ref bean='storeSelectorContentStore' />
</property>
</bean>
<bean id='eagerContentStoreCleaner' class='org.alfresco.repo.content.cleanup.EagerContentStoreCleaner' init-method='init'>
<property name='eagerOrphanCleanup' >
<value>${system.content.eagerOrphanCleanup}</value>
</property>
<property name='stores' >
<list>
<ref bean='fileContentStore' />
<ref bean='firstSharedFileContentStore' />
<ref bean='secondSharedFileContentStore' />
</list>
</property>
<property name='listeners' >
<ref bean='deletedContentBackupListeners' />
</property>
</bean>
</beans>
web-client-config-custom.xml
...
<config evaluator='aspect-name' condition='cm:storeSelector'>
<property-sheet>
<show-property name='cm:storeName' component-generator='StoreSelectorGenerator' />
</property-sheet>
</config>
<config evaluator='string-compare' condition='Action Wizards'>
<aspects>
<aspect name='cm:storeSelector'/>
</aspects>
</config>
...