cancel
Showing results for 
Search instead for 
Did you mean: 
resplin
Elite Collaborator
Elite Collaborator

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.


Content Store Selector


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.


Configuration example


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.


Configuration summary


  1. Define two new file stores.
  2. Declare storeSelectorContentStore to be the system's primary content store.
  3. Declare the mapping between store names and store instances.
  4. Add the extra stores to the list to be handled by the eagerContentStoreCleaner.

Define the new file stores


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>

Make storeSelectorContentStore the primary content store



<bean id='contentService' parent='baseContentService'>
   <property name='store'>
       <ref bean='storeSelectorContentStore' />
   </property>
</bean>

Declare the mapping between store names and store instances


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>

Using the new store


The cm:storeName property can be set in number of ways:


  • Manually, by exposing this property so its value can be set by either the Explorer or Share clients
  • Running a script action that sets the cm:storeName property value within the script
  • Using a rule that runs a script action to set the property

Expected behaviour:


  • When the cm:storeSelector aspect is not present or is removed, the content is copied to a new location in the 'default' store.
  • When the cm:storeSelector aspect is added or changed, the content is copied to the named store.
  • Under normal circumstances, a trail of content will be left in the stores, just as it would be if the content were being modified.  The normal processes to clean up the orphaned content will be followed.

Full configuration example


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>
   ...
3 Comments