AnsweredAssumed Answered

multiple transformers precedence

Question asked by dommarco on May 6, 2011
Hi all,

I would like to use a new transformer for the conversion between WORD (application/msword) and text.
The transformer it's correctly registered but looking at the page:

http://localhost:8080/alfresco/service/mimetypes?mimetype=*

the registered transformer is still the default TextMiningContentTransformer

How do I replace a default conversion? I was thinking that transformation code put in the extension directory should override default transformer. Am I wrong?

The transformer code is:


<?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="transformer.worker.Word2Txt" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker" >
                <property name="mimetypeService">
                        <ref bean="mimetypeService" />
                </property>
                <property name="checkCommand">
                        <bean class="org.alfresco.util.exec.RuntimeExec">
                                <property name="commandsAndArguments">
                                        <map>
                                                <entry key=".*">
                                                        <list>
                                                                <value>ls</value>
                                                                <value>/usr/local/bin/catdoc</value>
                                                        </list>
                                                </entry>
                                        </map>
                                </property>
                        </bean>
                </property>

                <property name="transformCommand">
                        <bean class="org.alfresco.util.exec.RuntimeExec">
                                <property name="commandsAndArguments">
                                        <map>
                                                <entry key=".*">
                                                        <list>
                                                                <value>/usr/local/bin/catdoc</value>
                                                                <value>${source}</value>
                                                                <value>'>'</value>
                                                                <value>${target}</value>
                                                        </list>
                                                </entry>
                                        </map>
                                </property>
<property name="errorCodes">
                                        <value>1,2</value>
                                </property>
                        </bean>
                </property>
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
                <property name="sourceMimetype"><value>application/msword</value></property>
                <property name="targetMimetype"><value>text/plain</value></property>
            </bean>
         </list>
      </property>

<bean id="transformer.Word2Txt" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
        <property name="worker">
        <ref bean="transformer.worker.Word2Txt" />
        </property>
</bean>
</beans>

Best Regards,
-rochi

Outcomes