AnsweredAssumed Answered

Using Ant to perform content conversions

Question asked by dafletcha on Mar 13, 2006
Latest reply on Mar 17, 2006 by derek
I'm trying to hook up the DITA Open Toolkit (which runs on Ant) to Alfresco. For now, I just want to enable XML->PDF transforms.

I've created a "my-transformers-context.xml file", but I have some questions. Here's how my transform bean is defined:

(I've edited my original post. I'm now using a 2-step transform: xml to fo, fo to pdf)

<bean     id="transformer.DITA-OT.xml2fo"
         class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer"
        parent="baseContentTransformer">
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
         <value>c:\ant\bin\workday_publish -f workday_build.xml -DAlfresco.input.filename='${source}' -DAlfresco.output.filename='${target}' dita.Alfresco.xml2fo</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>text/xml</value></constructor-arg>
                <constructor-arg><value>text/fo</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>

   <bean    id="transformer.DITA-OT.fo2pdf"
         class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer"
        parent="baseContentTransformer">
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
         <value>c:\ant\bin\workday_publish -f workday_build.xml -DAlfresco.input.filename='${source}' -DAlfresco.output.filename='${target}' dita.Alfresco.fo2pdf</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>text/fo</value></constructor-arg>
                <constructor-arg><value>application/pdf</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>

   <bean     id="transformer.complex.DITA-XML.PDF"
          class="org.alfresco.repo.content.transform.ComplexContentTransformer"
         parent="baseContentTransformer" >
      <property name="transformers">
         <list>
            <ref bean="transformer.DITA-OT.xml2fo" />
            <ref bean="transformer.DITA-OT.fo2pdf" />
         </list>
      </property>
      <property name="intermediateMimetypes">
         <list>
            <value>text/fo</value>
         </list>
      </property>
   </bean>


BTW, I've added text/fo to mimetype-map.xml.

I've turned on debugging for org.alfresco.repo.action, and here's what I see:

09:57:14,281 DEBUG [org.alfresco.repo.action.executer.TransformActionExecuter] No transformer found to execute rule:
   reader: ContentAccessor[ contentUrl=store://2006/3/14/9/f628d6a4-b383-11da-932f-69d192a6ffa4.bin, mimetype=text/xml, size=2595, encoding=UTF-8]
   writer: ContentAccessor[ contentUrl=store://2006/3/14/9/f7eddf66-b383-11da-932f-69d192a6ffa4.bin, mimetype=application/pdf, size=0, encoding=UTF-8]
   action: ParameterizedItem[ title='transform.title', description='transform.description']

So I guess there's something wrong with my bean definitions? Why isn't my transformer found by the system?


Thanks in advance for any help.

Outcomes