Content Store Selector

cancel
Showing results for 
Search instead for 
Did you mean: 

Content Store Selector

resplin
Intermediate
0 3 7,024

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>
   ...
About the Author
Angel Borroy is Hyland Developer Evangelist. Over the last 15 years, he has been working as a software architect on Java, BPM, document management and electronic signatures. He has been working with Alfresco during the last years to customize several implementations in large organizations and to provide add-ons to the Community based on Record Management and Electronic Signature. He writes (sometimes) on his personal blog http://angelborroy.wordpress.com. He is (proud) member of the Order of the Bee.
3 Comments
brunofernandes
Member II

Hi,

As for the new community version of alfresco 201911 GA is it possible to configure the content store selector, or will it still be only available in the enterprise edition?

If this feature isnt available in the comunity edition is there any way to define multiple stores in diferent filesystems

Best regards 

 

angelborroy
Alfresco Employee

This feature is still only Enterprise.

You can try this addon for Community from @afaust to evaluate is that fits with your requirements:

https://github.com/Acosix/alfresco-simple-content-stores

brunofernandes
Member II

Hi ,

I will give it a try.

Thank you very much