W3C home > Mailing lists > Public > xproc-dev@w3.org > July 2011

RE: Trouble configuring custom extension in xmlcalabash

From: Geert Josten <geert.josten@daidalos.nl>
Date: Thu, 21 Jul 2011 09:05:58 +0200
To: Romain Deltour <rdeltour@gmail.com>, "XProc Dev (xproc-dev@w3.org)" <xproc-dev@w3.org>
Message-ID: <B26C615F8546A84C81165A7BC8BE61A020F39D7D5D@EXMBXC01.ms-hosting.nl>
Thanks Romain.

I was reluctant to try it that way, as I was expecting I would have to add all dependent libs of calabash on the classpath as well, but that doesn’t seem necessary. ☺

I also tried replacing –cp with –Xbootstrap/a: but then it runs until the extension and throws the exception that it couldn’t find calabash classes being referenced from the extension. Adding calabash to the bootstrap search path as well, made things worse: it can’t find the calabash dependencies any more (like saxon, quite necessary). Apparently the class-path setting within the calabash.jar is respected when loading it with –cp, but not when loading it with bootstrap.. :P

So I will stick to loading calabash through –cp and call the Main class, instead of using –jar..

Kind regards,
Geert

Van: Romain Deltour [mailto:rdeltour@gmail.com]
Verzonden: donderdag 21 juli 2011 8:55
Aan: Geert Josten; XProc Dev (xproc-dev@w3.org)
Onderwerp: Re: Trouble configuring custom extension in xmlcalabash

From the Java command line launcher doc:
http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html


-jar
   (...)
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.


Romain.

Le 21 juil. 11 à 08:49, Romain Deltour a écrit :


You're right, it seems that your configuration is fine, but that the "only" issue is that the class cannot be found.

Can you try:

java -cp lib\grtjn-xproc-utils.jar:lib\calabash.jar -Dcom.xmlcalabash.phonehome=false -Djava.util.logging.config.file=logging.properties com.xmlcalabash.drivers.Main -c lib/configuration.xml -i source=%INPUTFILE% src\nl\grtjn\xproc\ebook\main.xpl

I'm really not sure, but could it be that the Java "cp" option is not used when trying to execute a Jar (instead of a main class) ?

Romain.

Le 21 juil. 11 à 08:12, Geert Josten a écrit :


Hi Alex,

Thanks for your time!

You are right, I didn’t edit extension-library.xml within calabash.jar, but I did declare the step in a library of my own which I thought would suffice. Doesn’t it? It essentially comes down to this:

<p:library version="1.0"
               xmlns:p="http://www.w3.org/ns/xproc"
               xmlns:ut="http://grtjn.nl/ns/xproc/util">

               <p:declare-step type="ut:env">
                              <p:output port="result"/>
               </p:declare-step>

</p:library>

I also didn’t edit the configuration.xml within calabash.jar, but provided my own one on the command-line, containing this:

<xproc-config xmlns="http://xmlcalabash.com/ns/configuration"
                     xmlns:p="http://www.w3.org/ns/xproc"
                     xmlns:ut="http://grtjn.nl/ns/xproc/util">

<implementation type="ut:env"
                              class-name="nl.grtjn.xproc.util.osutils.Env"/>

</xproc-config>

These two bits don’t seem to be the problem, though. I can use <ut:env/> within my pipes, and it knows it should look for the class nl.grtjn.xproc.util.osutils.Env. And I am certain it is added properly to my own jar, as when I use the same jar command to add it to calabash.jar it all works. It just doesn’t work when I have the class in a separate jar and pass it to java as follows:

java -cp lib\grtjn-xproc-utils.jar -Dcom.xmlcalabash.phonehome=false -Djava.util.logging.config.file=logging.properties -jar lib\calabash.jar -D -c lib/configuration.xml -i source=%INPUTFILE% src\nl\grtjn\xproc\ebook\main.xpl

I would rather not rely on a patched or self-compiled calabash. I would prefer just providing a separate jar and config to make it work. Am I overlooking something obvious?

Kind regards,
Geert

Van: xproc-dev-request@w3.org<mailto:xproc-dev-request@w3.org> [mailto:xproc-dev-request@w3.org] Namens Alex Muir
Verzonden: donderdag 21 juli 2011 1:24
Aan: Geert Josten
CC: XProc Dev (xproc-dev@w3.org<mailto:xproc-dev@w3.org>)
Onderwerp: Re: Trouble configuring custom extension in xmlcalabash

Well you didn't mention editing extension-library.xml

Given a new step created I edited 2 files like follows

1. extension-library.xml

<p:declare-step type="mh:StoreAsText" version="1.0">
    <p:input port="source"/>
    <p:output port="result" primary="false"/>
    <p:option name="href" required="true" cx:type="xsd:anyURI"/>
    <p:option name="version" select="'1.0'" cx:type="xsd:string"/>
  </p:declare-step>


 2. configuration.xml

<implementation type="mh:StoreAsText"
  class-name="com.xmlcalabash.extensions.StoreAsText"/>


--
Alex Muir
Instructor | Program Organizer - University Technology Student Work Experience Building
University of the Gambia
http://sites.utg.edu.gm/alex/<https://sites.google.com/a/utg.edu.gm/utsweb/>

Low budget software development benefiting development in the Gambia, West Africa
Experience of a lifetime, come to Gambia and Join UTSWEB - http://sites.utg.edu.gm/utsweb/<https://sites.google.com/a/utg.edu.gm/utsweb/>


Received on Thursday, 21 July 2011 07:06:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 July 2011 07:06:25 GMT