AnsweredAssumed Answered

Trouble with custom transformation

Question asked by randomman on Sep 20, 2007
Latest reply on Sep 20, 2007 by randomman
I'm trying to get a custom transformer (Abiword: msword -> xhtml) working on Alfresco 2.1 on Linux. It's almost there but failing at the final hurdle resulting in no errors but with an empty file being created in Alfresco.

If I use my command line manually, i get the expected results. In reference to a previous post on here, I also tried creating a simple shell script with two inputs that runs the full command line. No joy.

If I perform the transform in the Web Client (resulting in an empty file being created) and then look at the contents of the temp directory, I see three files:

RuntimeExecutableContentTransformer_source_19263.doc
RuntimeExecutableContentTransformer_source_19263.xhtml
RuntimeExecutableContentTransformer_target_19264.xhtml

There's the doc I started with, a mystery file with the correct results in (but with the same filename as the source instead of target) and finally the empty file that goes into Alfresco.  I want the middle file to be my result file not the empty one.

Has anyone else experienced this? Is this a bug or some quirk of using Abiword? I've tried all sorts different command lines in the transformation bean config and nothing seems to work. If anyone is interested in helping,  I've included my config code below:

<?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.Abiword.XHTML" 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>abiword –help</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>abiword –to=xhtml –print=${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/msword</value></constructor-arg>
                <constructor-arg><value>application/xhtml+xml</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>
</beans>

Outcomes