<?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="fileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>${dir.contentstore}</value>
      </constructor-arg>
   </bean>
   
   <!-- deleted content will get pushed into this store, where it can be cleaned up at will -->
   <bean id="deletedContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>${dir.contentstore.deleted}</value>
      </constructor-arg>
   </bean>
   <!-- bean to move deleted content into the the backup store -->
   <bean id="deletedContentBackupListener" class="org.alfresco.repo.content.cleanup.DeletedContentBackupCleanerListener" >
      <property name="store">
         <ref bean="deletedContentStore" />
      </property>
   </bean>
   <!-- Performs the content cleanup -->
   <bean id="contentStoreCleaner" class="org.alfresco.repo.content.cleanup.ContentStoreCleaner" >
      <property name="dictionaryService">
         <ref bean="dictionaryService" />
      </property>
      <property name="nodeDaoService" >
         <ref bean="nodeDaoService" />
      </property>
      <property name="avmNodeDAO">
      	  <ref bean="avmNodeDAO"/>
      </property>
      <property name="transactionService" >
         <ref bean="transactionComponent" />
      </property>
      <property name="protectDays" >
         <value>14</value>
      </property>
      <property name="stores" >
         <list>
            <ref bean="fileContentStore" />
         </list>
      </property>
      <property name="listeners" >
         <list>
            <ref bean="deletedContentBackupListener" />
         </list>
      </property>
   </bean>

   <bean id="contentService" class="org.alfresco.repo.content.RoutingContentService" init-method="init">
      <property name="transactionService">
          <ref bean="transactionComponent" />
      </property>
      <property name="retryingTransactionHelper">
          <ref bean="retryingTransactionHelper"/>
      </property>
      <property name="dictionaryService">
          <ref bean="dictionaryService" />
      </property>
      <property name="nodeService">
          <ref bean="nodeService" />
      </property>
      <property name="transformerRegistry">
          <ref bean="contentTransformerRegistry" />
      </property>
      <property name="store">
          <ref bean="fileContentStore" />
      </property>
      <property name="policyComponent">
          <ref bean="policyComponent" />
      </property>
      <property name="avmService">
          <ref bean="avmService"/>
      </property>
      <property name="imageMagickContentTransformer">
         <ref bean="transformer.ImageMagick" />
      </property>
   </bean>
    
    <bean id="mimetypeConfigService" class="org.alfresco.config.xml.XMLConfigService" init-method="init">
        <constructor-arg>
            <bean class="org.alfresco.config.source.UrlConfigSource">
                <constructor-arg>
                    <list>
                        <value>classpath:alfresco/mimetype/mimetype-map.xml</value>
                        <value>classpath:alfresco/mimetype/mimetype-map-openoffice.xml</value>
                    </list>
                </constructor-arg>
            </bean>
        </constructor-arg>
    </bean>

   <bean id="mimetypeService" class="org.alfresco.repo.content.MimetypeMap" init-method="init" >
      <constructor-arg>
         <ref bean="mimetypeConfigService" />
      </constructor-arg>
   </bean>
   
   <bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
   <bean id="openOfficeConnectionTester" class="org.alfresco.util.OpenOfficeConnectionTester" init-method="checkConnection" >
      <property name="connection">
         <ref bean="openOfficeConnection" />
      </property>
      <property name="strict">
         <value>false</value>
      </property>
   </bean>
   
   <!-- Metadata Extraction Regisitry -->
   <bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" />
   
   <!-- Abstract bean definition defining base definition for all metadata extracters -->
   <bean id="baseMetadataExtracter"
         class="org.alfresco.repo.content.metadata.AbstractMetadataExtracter"
         abstract="true"
         init-method="register">
      <property name="registry">
         <ref bean="metadataExtracterRegistry" />
      </property>
      <property name="mimetypeService">
         <ref bean="mimetypeService" />
      </property>
   </bean>
   
   <!-- Content Metadata Extracters -->
   <bean class="org.alfresco.repo.content.metadata.PdfBoxMetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.OfficeMetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.MailMetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.HtmlMetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.MP3MetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracter" parent="baseMetadataExtracter" />
   <bean class="org.alfresco.repo.content.metadata.OpenOfficeMetadataExtracter" parent="baseMetadataExtracter" init-method="init" >
      <property name="connection">
         <ref bean="openOfficeConnection" />
      </property>
   </bean>
   

   <!-- Content Transformation Regisitry -->
   <bean id="contentTransformerRegistry" class="org.alfresco.repo.content.transform.ContentTransformerRegistry" />

   <!-- Abstract bean definition defining base definition for all transformers -->
   <bean id="baseContentTransformer"
         class="org.alfresco.repo.content.transform.AbstractContentTransformer"
         abstract="true"
         init-method="register">
      <property name="mimetypeService">
         <ref bean="mimetypeService" />
      </property>
      <property name="registry">
         <ref bean="contentTransformerRegistry" />
      </property>
   </bean>
   
   <!-- Content Transformations -->
   <bean id="transformer.StringExtracter"
         class="org.alfresco.repo.content.transform.StringExtractingContentTransformer"
         parent="baseContentTransformer" />

   <bean id="transformer.BinaryPassThrough"
         class="org.alfresco.repo.content.transform.BinaryPassThroughContentTransformer"
         parent="baseContentTransformer" />

   <bean id="transformer.PdfBox"
         class="org.alfresco.repo.content.transform.PdfBoxContentTransformer"
         parent="baseContentTransformer" >
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey" >
                <constructor-arg><value>application/pdf</value></constructor-arg>
                <constructor-arg><value>text/plain</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>

   <bean id="transformer.Poi"
         class="org.alfresco.repo.content.transform.PoiHssfContentTransformer"
         parent="baseContentTransformer" />

   <bean id="transformer.TextMining"
         class="org.alfresco.repo.content.transform.TextMiningContentTransformer"
         parent="baseContentTransformer" >
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey" >
                <constructor-arg><value>application/msword</value></constructor-arg>
                <constructor-arg><value>text/plain</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>

   <bean id="transformer.HtmlParser"
         class="org.alfresco.repo.content.transform.HtmlParserContentTransformer"
         parent="baseContentTransformer" />

   <bean id="transformer.OpenOffice"
         class="org.alfresco.repo.content.transform.OpenOfficeContentTransformer"
         parent="baseContentTransformer" >
      <property name="connection">
         <ref bean="openOfficeConnection" />
      </property>
      <property name="documentFormatsConfiguration">
         <value>classpath:alfresco/mimetype/openoffice-document-formats.xml</value>
      </property>
   </bean>

   <bean id="transformer.complex.OpenOffice.PdfBox"
        class="org.alfresco.repo.content.transform.ComplexContentTransformer"
        parent="baseContentTransformer" >
      <property name="transformers">
         <list>
            <ref bean="transformer.OpenOffice" />
            <ref bean="transformer.PdfBox" />
         </list>
      </property>
      <property name="intermediateMimetypes">
         <list>
            <value>application/pdf</value>
         </list>
      </property>
   </bean>

   <!--
   <bean id="transformer.JMagick" class="org.alfresco.repo.content.transform.magick.JMagickContentTransformer" init-method="init" />
   </bean>
   -->

   <bean id="transformer.ImageMagick"
        class="org.alfresco.repo.content.transform.magick.ImageMagickContentTransformer"
        parent="baseContentTransformer"
        init-method="init">
      <property name="executer">
         <bean name="transformer.ImageMagick.Command" class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
                        <value>imconvert "${source}" ${options} "${target}"</value>
                    </entry>
                    <entry key=".*">
                        <value>convert ${source} ${options} ${target}</value>
                    </entry>
                </map>
            </property>
            <property name="defaultProperties">
                <props>
                    <prop key="options"></prop>
                </props>
            </property>
         </bean>
      </property>
   </bean>

</beans>
