AnsweredAssumed Answered

Need help with my-transformers-context.xml syntax

Question asked by hikenboots on Feb 28, 2006
I'm trying to write a wordperfect to plain text transformer so that Alfresco can search wordperfect documents.  I'm just trying to modify the example located at http://www.alfresco.org/mediawiki/index.php/Content_Transformations

I'm using a compiled executable, wpd2text, from libwpd.sourceforge.net.  It's syntax is ` /usr/local/bin/wpd2text somedocument.wpd` and it spits the plain text straight to std out.  Works great from the shell..

Qustions:
1.  Where does Alfresco look for the wpd2text executable and where should I place it.
2.  wpd2text doesn't accept a target parameter but dumps to std out so how can I accomodate this within <value>wpd2text '${target}' '${source}'</value>

my-transformers-context.xml reads as follows:
<?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.Wpd2text.Text" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer" parent="baseContentTransformer">
      <property name="checkCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key=".*">
                        <value>wpd2text</value>
                    </entry>
                </map>
            </property>
            <property name="errorCodes">
               <value>2</value>
            </property>
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Linux">
                        <value>wpd2text '${target}' '${source}'</value>
                    </entry>
                    <entry key="Windows.*">
                        <value>wpd2text '${target}' '${source}'</value>
                    </entry>
                </map>
            </property>
            <property name="errorCodes">
               <value>2</value>
            </property>
         </bean>
      </property>
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey" >
                <constructor-arg><value>application/vnd.wordperfect</value></constructor-arg>
                <constructor-arg><value>text/plain</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>


</beans>

Outcomes