<?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="classpath:alfresco/replicating-content-services-context.xml" />
   -->
    
   <bean id="mimetypeMap" class="org.alfresco.repo.content.MimetypeMap" init-method="init" >
      <constructor-arg>
         <ref bean="repoConfigService" />
      </constructor-arg>
   </bean>
   
   <!-- Content Transformations -->
   <bean id="transformer.StringExtracter" class="org.alfresco.repo.content.transform.StringExtractingContentTransformer" />
   <bean id="transformer.BinaryPassThrough" class="org.alfresco.repo.content.transform.BinaryPassThroughContentTransformer" />
   <bean id="transformer.PdfBox" class="org.alfresco.repo.content.transform.PdfBoxContentTransformer" />
   <bean id="transformer.Poi" class="org.alfresco.repo.content.transform.PoiHssfContentTransformer" />
   <bean id="transformer.TextMining" class="org.alfresco.repo.content.transform.TextMiningContentTransformer" />
   <bean id="transformer.HtmlParser" class="org.alfresco.repo.content.transform.HtmlParserContentTransformer" />
   <bean id="transformer.OpenOffice" class="org.alfresco.repo.content.transform.UnoContentTransformer" init-method="init">
      <property name="mimetypeService">
         <ref bean="mimetypeMap" />
      </property>
   </bean>
   <bean id="transformer.complex.OpenOffice.PdfBox" class="org.alfresco.repo.content.transform.ComplexContentTransformer">
      <property name="mimetypeService">
         <ref bean="mimetypeMap" />
      </property>
      <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">
      <property name="mimetypeMap">
         <ref bean="mimetypeMap" />
      </property>
   </bean>
   -->
   <bean id="transformer.ImageMagick" class="org.alfresco.repo.content.transform.magick.ImageMagickContentTransformer" init-method="init">
      <property name="mimetypeMap">
         <ref bean="mimetypeMap" />
      </property>
      <property name="executer">
         <bean name="transformer.ImageMagick.Command" class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Linux">
                        <value>imconvert ${source} ${options} ${target}</value>
                    </entry>
                    <entry key="*">
                        <value>imconvert "${source}" ${options} "${target}"</value>
                    </entry>
                </map>
            </property>
            <property name="defaultProperties">
                <props>
                    <prop key="options"></prop>
                </props>
            </property>
         </bean>
      </property>
   </bean>

   <!-- Content Transformation Regisitry -->
   <bean id="contentTransformerRegistry" class="org.alfresco.repo.content.transform.ContentTransformerRegistry" >
      <constructor-arg>
         <ref bean="mimetypeMap" />
      </constructor-arg>
      <!-- explicit transformations to use -->
      <property name="explicitTransformations">
         <list>
            <list>
               <value>application/msword</value>   <!-- from mimetype -->
               <value>text/plain</value>           <!-- to mimetype -->
               <ref bean="transformer.TextMining" />
            </list>
            <list>
               <value>application/pdf</value>
               <value>text/plain</value>
               <ref bean="transformer.PdfBox" />
            </list>
         </list>
      </property>
      <!-- transformers to fall back on in the event that an explicit transformation isn't defined -->
      <property name="transformers">
         <list>
            <ref bean="transformer.StringExtracter" />
            <ref bean="transformer.BinaryPassThrough" />
            <ref bean="transformer.PdfBox" />
            <ref bean="transformer.Poi" />
            <ref bean="transformer.TextMining" />
            <ref bean="transformer.HtmlParser" />
            <ref bean="transformer.OpenOffice" />
<!--            <ref bean="transformer.JMagick" /> -->
            <ref bean="transformer.ImageMagick" />
            <ref bean="transformer.complex.OpenOffice.PdfBox" />
         </list>
      </property>
   </bean>

   <bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" >
      <constructor-arg>
         <ref bean="mimetypeMap" />
      </constructor-arg>
      <!-- metadata extracters -->
      <property name="extracters">
         <list>
		    <bean class="org.alfresco.repo.content.metadata.PdfBoxMetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.OfficeMetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.HtmlMetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.StringMetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.MP3MetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracter" />
		    <bean class="org.alfresco.repo.content.metadata.UnoMetadataExtracter" >
		       <constructor-arg>
        	      <ref bean="mimetypeMap" />
		       </constructor-arg>
		    </bean>
         </list>
      </property>
   </bean>
   
   <bean id="fileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>${dir.contentstore}</value>
      </constructor-arg>
   </bean>

   <bean id="contentService" class="org.alfresco.repo.content.RoutingContentService" init-method="init">
      <property name="transactionService">
          <ref bean="transactionComponent" />
      </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>
   </bean>

</beans>
