Legacy configurations

Next to the default, property based, configuration of Alfred Object Storage, other configurations are supported to support legacy behavior.

Once again, this is for legacy support and will possibly be deprecated and dropped in the future.

Setup using both property and XML configuration

Alfred Object Storage ships with a default Alfresco to Swarm connector instance that can be configured by providing properties in the alfresco-global.properties file. An overview of the configurable properties is available in the configuration parameters section.

To make Alfresco use this default connector instance, we need to overwrite Alfresco’s contentService bean to redirect content store requests to the Swarm Content Storage connector. Furthermore the contentStoresToClean bean needs to be overwritten to redirect delete requests to the Swarm Content Storage connector.
A valid Spring configuration file that configures Alfresco to use the Swarm Content Storage connector, is provided in the example configuration section.

Example configuration

  • alfresco-global.properties

    objectstorage.cluster.name=cluster-name
    objectstorage.cluster.hosts=swarm-host-1, swarm-host-2, swarm-host-3
    objectstorage.cluster.domain=swarm-domain
    objectstorage.cluster.bucket=swarm-bucket
    
    objectstorage.cluster.swarm.default-lifepoint=[] minreps=2, maxreps=3, deletable=no
    objectstorage.cluster.swarm.retention-period=-1
    
    objectstorage.http.max-connections=200
    objectstorage.http.max-host-connections=100
    objectstorage.http.timeout=10000
    objectstorage.http.retry-per-host=3
    
  • classpath*:alfresco/extension/*-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="contentService" parent="baseContentService">
            <property name="store">
                <ref bean="swarmContentStore"/>
            </property>
        </bean>    
        <bean id="contentStoresToClean" class="java.util.ArrayList">
            <constructor-arg>
                <list>
                    <ref bean="swarmContentStore"/>
                </list>
            </constructor-arg>
        </bean>
    </beans>
    

Setup using Spring context file

An alternative way to setup the Alfresco to Swarm connector, is by constructing the required Spring beans yourself. To setup Alfresco’s content store with the Alfred Object Storage connector, you need to:

  1. Define a new swarmStoreAdapter bean (with class = eu.xenit.alfresco.swarm.SwarmStoreAdapter) with configuration described in the configuration parameters section.
  2. Define a new customContentStore bean (with class = eu.xenit.alfresco.customstore.CASContentStore) using the swarmStoreAdapter defined in step 1.
  3. Override the contentService bean to redirect the store requests to the new bean customContentStore. If it’s necessary to handle mutable/immutable storage, you would use the dualContentStore as intermediary bean to do the indirection (as in the example file).
  4. Override the contentStoresToClean to redirect the delete document requests to the new customContentStore bean.

Example configuration

  • classpath*:alfresco/extension/*-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>
        <import resource="crypto-beans.xml" />        
        <bean id="contentService" parent="baseContentService">
          <property name="store">
              <ref bean="dualContentStore" />
          </property>
        </bean>    
        <bean id="dualContentStore" class="eu.xenit.alfresco.dualstore.DualContentStore">
            <property name="mutableStore">
                <ref bean="encrypedContentStoreLazy" />
            </property>
            <property name="immutableStore">
                <ref bean="fileContentStore" />
            </property>
        </bean>    
        <bean id="encrypedContentStoreLazy" class="org.springframework.aop.framework.ProxyFactoryBean">
           <property name="targetSource">
             <bean class="org.springframework.aop.target.LazyInitTargetSource">
               <property name="targetBeanName"><idref local="encrypedContentStore"/></property>
             </bean>
           </property>
        </bean>        
        <bean id="encrypedContentStore" class="org.alfresco.enterprise.repo.content.cryptodoc.impl.CryptoContentStore" lazy-init="true" init-method="init">
            <property name="contentStore" ref="swarmContentStore" />
            <property name="keyGenerationService" ref="xenit.cryptodoc.keyGenerationService" />
            <property name="contentCryptoEngineService" ref="xenit.cryptodoc.cryptoEngineService" />
            <property name="contentDataDAO" ref="contentDataDAO"/>
            <property name="descriptorService" ref="DescriptorService" />
            <property name="storeName"><value>Encrypted SWARM Content Store</value></property>
            <property name="cryptodocLicense" ref="xenit.cryptodoc.license" />
        </bean>         
        <bean id="swarmContentStore" class="eu.xenit.alfresco.customstore.CASContentStore">
            <constructor-arg index="0">
                <ref bean="swarmStoreAdapter" />
            </constructor-arg>
        </bean>    
        <bean id="swarmStoreAdapter" class="eu.xenit.alfresco.swarm.SwarmStoreAdapter">        
             <!-- clusterName -->
             <constructor-arg index="0" value="test"/>    
             <!-- list of clusterNodes -->
             <constructor-arg index="1">
                 <list>
                    <value>192.168.6.90</value>
                    <value>192.168.6.91</value>
                    <value>192.168.6.92</value>    
                </list>
             </constructor-arg>    
             <!-- maxTotalNbrOfConnections -->
             <constructor-arg index="2" value="60"/>             
             <!-- maxNbrOfConnectionsPerHost -->
             <constructor-arg index="3" value="20"/>             
             <!-- timeout (used for both socketTimeout and connectionTimeout; in milliseconds; 0 = no timeout) -->
             <constructor-arg index="4" value="5000"/>
             <!-- maxNbrOfClusterAccessAttempts -->
             <constructor-arg index="5" value="3"/>
             <!-- lifePoint parameter, cfr. CAStor Application Guide -->
             <constructor-arg index="6" value="[] reps=3, deletable=no"/>             
             <!-- daysToKeepBeforeDelete -->
             <constructor-arg index="7" value="50"/>             
             <!-- swarmDomain -->
             <constructor-arg index="8" value="test"/>    
             <!-- swarmBucket -->
             <constructor-arg index="9" value="bu1"/>          
             <!-- connectionTimeToLive (in milliseconds) -->
             <constructor-arg index="10" value="5000"/>      
        </bean>   
        <bean id="contentStoresToClean" class="java.util.ArrayList">
            <constructor-arg>
                <list>
                    <ref bean="swarmContentStore"/>
                </list>
            </constructor-arg>
        </bean>    
    </beans>
    

Configuration parameters

Complete list of configuration parameters for the SwarmStoreAdapter.

When using the default setup, configure the property with ‘Property key’ in the alfresco-global.properties.
When using the Spring configuration setup, inject the values in your swarmStoreAdapter bean. The constructor index of the parameter matches the index of the property in this table.

Property key Default value Description
objectstorage.cluster.name Name of the SWARM cluster.
objectstorage.cluster.hosts list of the IP of each SWARM node.
objectstorage.http.max-connections 200 maximum total of connections to SWARM cluster allowed simultaneously.
objectstorage.http.max-host-connections 100 maximum total of connections per route value.
objectstorage.http.timeout 10000 (= 10 sec) used for both socketTimeout and connectionTimeout; in milliseconds; 0 = no timeout.
objectstorage.http.retry-per-host 3 Number of attempts to access each SWARM node consecutively before raising an error.
objectstorage.cluster.swarm.default-lifepoint [] minreps=2, maxreps=3, deletable=no lifePoint parameter, cfr. Swarm Application Guide
objectstorage.cluster.swarm.retention-period -1 number of days that the document should be kept in SWARM after it has been deleted in Alfresco. Setting this to a negative value will disable the delete functionality.
objectstorage.cluster.domain SWARM domain name to use when storing/retrieving documents.
objectstorage.cluster.bucket SWARM bucket name to use when storing/retrieving documents. Leave blank to create immutable objects.
objectstorage.http.connection-time-to-live 10000 (= 10 sec) used for connection time to live; in milliseconds; 0 = no timeout.

Immutable versus named objects

There are two modes to store documents possible in Swarm:

  • Immutable objects
    • they get assigned a random UUID when stored
    • they cannot be updated
    • they cannot be placed in a bucket
    • they cannot be deleted (!)
  • Named objects
    • this connectors assigs a random name
    • they can be updated
    • they must be placed in a bucket

The two modes are supported by this connector. You can configure to use “immutable objects” by leaving the property bucketName blank or empty. Providing a value for bucketName, sets up the connector to use Named objects

Caveat: you need to start from a clean Alfresco (no content, wiped database). If you don’t, Alfresco will search for existing content in the swarm cluster and won’t be able to find this.

Setting up Alfresco to S3 connector

The current S3 connector was developed using AWS Java SDK. It can be used with any storage backend which understands the same API. To setup the Alfresco to S3 connector, one of the following options can be used.

Default setup

Alfred Object Storage ships with a default Alfresco to S3 connector instance that can be configured by providing properties in the alfresco-global.properties file. An overview of the configurable properties is available in the configuration parameters.

Similarly to the Swarm connector, to make Alfresco use this default connector instance, we need to overwrite Alfresco’s contentService bean to redirect content store requests to the S3 Content
Storage connector. Furthermore the contentStoresToClean bean needs to be overwritten to redirect delete requests to the S3 Content Storage connector.

Example configuration S3

  • alfresco-global.properties

      objectstorage.rootStore=mys3ContentStore
      objectstorage.stores=mys3ContentStore
      objectstorage.store.mys3ContentStore.type=s3
      objectstorage.store.mys3ContentStore.value.accessKey=
      objectstorage.store.mys3ContentStore.value.secretKey=
      objectstorage.store.mys3ContentStore.value.bucketName=
      objectstorage.store.mys3ContentStore.value.bucketLocation=
      objectstorage.store.mys3ContentStore.value.endpoint=
    

Configuration parameters S3

Complete list of configuration parameters for the S3StoreAdapter.

Credentials to S3 are as described in https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html. The region used by the connector is EU_WEST_1.

Property key Default value Description
secretKey Secret key to S3.
accessKey Access key to S3.
bucketName Name of the S3 bucket where Alfresco should write to and read from.
bucketLocation Location of the S3 bucket where Alfresco should write to and read from.
endpoint Used with s3Proxy, in unit tests or in local setups. Leave empty for AWS.