Re: extended xslt task - use URIResolvers to create DependSet
On Nov 1, 2008, at 12:48 AM, Robert Koberg wrote: I can't find 'org.apache.env.Which diagnostics' -- the closest thing I can find is Xalan (of which I have the latest in the ant lib dir). I did find this when I checked out commons-xml and built it. Don't know if this provides more info (or if anybody is even listening to me :) ), but here is the output: --- org.apache.env.Which diagnostics --- # BEGIN: Which report Which.version=Which.java:($Revision: 226174 $) WhichJar.java: ($Revision: 225992 $) Which.special-note=No -projects provided, using DEFAULT_PROJECTS java.version=1.6.0_07 file.encoding=MacRoman java.ext.dirs=/Library/Java/Extensions:/System/Library/Java/ Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/ Home/lib/ext java.class.path=/Users/rkobergmac/Documents/workspace/ant-core/dist/ lib/ant-launcher.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/activation.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/ant-antlr.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/ant-antunit-1.1.jar:/Users/rkobergmac/Documents/workspace/ant- core/dist/lib/ant-apache-bcel.jar:/Users/rkobergmac/Documents/ workspace/ant-core/dist/lib/ant-apache-bsf.jar:/Users/rkobergmac/ Documents/workspace/ant-core/dist/lib/ant-apache-log4j.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/ant-apache-oro.jar:/ Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ant-apache- regexp.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ant- apache-resolver.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/ant-commons-logging.jar:/Users/rkobergmac/Documents/workspace/ ant-core/dist/lib/ant-commons-net.jar:/Users/rkobergmac/Documents/ workspace/ant-core/dist/lib/ant-jai.jar:/Users/rkobergmac/Documents/ workspace/ant-core/dist/lib/ant-javamail.jar:/Users/rkobergmac/ Documents/workspace/ant-core/dist/lib/ant-jdepend.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/ant-jmf.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/ant-jsch.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/ant-junit.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/ant-launcher.jar:/ Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ant- netrexx.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ ant-nodeps.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ ant-swing.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ ant-testutil.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/ lib/ant-trax.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/ lib/ant.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ antlr-3.1.1-runtime.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/antlr-3.1.1.jar:/Users/rkobergmac/Documents/workspace/ant- core/dist/lib/bcel-5.2.jar:/Users/rkobergmac/Documents/workspace/ant- core/dist/lib/bsf.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/commons-logging-1.1.1.jar:/Users/rkobergmac/Documents/ workspace/ant-core/dist/lib/commons-logging-adapters-1.1.1.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/commons-logging- api-1.1.1.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ commons-net-1.4.1.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/jakarta-oro-2.0.8.jar:/Users/rkobergmac/Documents/workspace/ ant-core/dist/lib/jakarta-regexp-1.5.jar:/Users/rkobergmac/Documents/ workspace/ant-core/dist/lib/jdepend-2.9.jar:/Users/rkobergmac/ Documents/workspace/ant-core/dist/lib/js.jar:/Users/rkobergmac/ Documents/workspace/ant-core/dist/lib/jsch-20081026.jar:/Users/ rkobergmac/Documents/workspace/ant-core/dist/lib/junit-3.8.2.jar:/ Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ log4j-1.2.15.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/ lib/mail.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ NetRexxC.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ resolver.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ saxon9.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ serializer.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ stringtemplate-3.2.jar:/Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/which.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/ lib/xalan.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ xercesImpl.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ xml-apis.jar:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ xsltc.jar Which.status=.ok-present os.name=Mac OS X java.vendor=Apple Inc. sun.boot.class.path=/System/Library/Frameworks/JavaVM.framework/ Versions/1.6.0/Classes/classes.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.6.0/Classes/ui.jar:/System/Library/ Frameworks/JavaV
Re: extended xslt task - use URIResolvers to create DependSet
BTW, here is the output from ant -diagnostics. As I mentioned before, I do have the class (org.apache.tools.ant.taskdefs.optional.CachingTraXLiaison) that is not being found in the ant-nodeps.jar (I even unzipped it to check). I modified the org.apache.tools.ant.taskdefs.XSLTProcess to choose the new liaison class if it sees an xslcache attribute on the xslt task, which occurs. Output includes 'optional tasks : not available', but I have every jar necessary in the $ANT_HOME/lib dir. I think this is being printed because Diagnostics defines this: private static final String TEST_CLASS = "org.apache.tools.ant.taskdefs.optional.Test"; Which does not exist in the optional package. I can't find 'org.apache.env.Which diagnostics' -- the closest thing I can find is Xalan (of which I have the latest in the ant lib dir). Any ideas why it can't find the class (stack trace in previous message)? rkmbp:test-xsl-cache rkobergmac$ ant -diagnostics --- Ant diagnostics report --- Apache Ant version 1.8.0alpha compiled on October 31 2008 --- Implementation Version --- core tasks : 1.8.0 optional tasks : not available --- ANT PROPERTIES --- ant.version: Apache Ant version 1.8.0alpha compiled on October 31 2008 ant.java.version: 1.6 ant.core.lib: /Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ ant.jar ant.home: /Users/rkobergmac/Documents/workspace/ant-core/dist --- ANT_HOME/lib jar listing --- ant.home: /Users/rkobergmac/Documents/workspace/ant-core/dist activation.jar (55147 bytes) ant-antlr.jar (5752 bytes) ant-antunit-1.1.jar (35776 bytes) ant-apache-bcel.jar (8611 bytes) ant-apache-bsf.jar (3939 bytes) ant-apache-log4j.jar (3044 bytes) ant-apache-oro.jar (39627 bytes) ant-apache-regexp.jar (3762 bytes) ant-apache-resolver.jar (4071 bytes) ant-commons-logging.jar (3910 bytes) ant-commons-net.jar (48541 bytes) ant-jai.jar (21348 bytes) ant-javamail.jar (7855 bytes) ant-jdepend.jar (8132 bytes) ant-jmf.jar (6593 bytes) ant-jsch.jar (39257 bytes) ant-junit.jar (101682 bytes) ant-launcher.jar (12962 bytes) ant-netrexx.jar (9881 bytes) ant-nodeps.jar (409235 bytes) ant-swing.jar (6751 bytes) ant-testutil.jar (15157 bytes) ant-trax.jar (7012 bytes) ant.jar (1397588 bytes) antlr-3.1.1-runtime.jar (116205 bytes) antlr-3.1.1.jar (1513525 bytes) bcel-5.2.jar (59 bytes) bsf.jar (113369 bytes) commons-logging-1.1.1.jar (60841 bytes) commons-logging-adapters-1.1.1.jar (26520 bytes) commons-logging-api-1.1.1.jar (52313 bytes) commons-net-1.4.1.jar (180792 bytes) jakarta-oro-2.0.8.jar (65261 bytes) jakarta-regexp-1.5.jar (33028 bytes) jdepend-2.9.jar (82818 bytes) js.jar (756883 bytes) jsch-20081026.jar (211917 bytes) junit-3.8.2.jar (120640 bytes) log4j-1.2.15.jar (391834 bytes) mail.jar (371264 bytes) NetRexxC.jar (355931 bytes) resolver.jar (84091 bytes) saxon9.jar (5024396 bytes) serializer.jar (278281 bytes) stringtemplate-3.2.jar (172023 bytes) xalan.jar (1760887 bytes) xercesImpl.jar (1223877 bytes) xml-apis.jar (194354 bytes) xsltc.jar (1871313 bytes) --- USER_HOME/.ant/lib jar listing --- user.home: /Users/rkobergmac No such directory. --- Tasks availability --- wlrun : Not Available (the implementation class is not present) stlist : Not Available (the implementation class is not present) starteam : Not Available (the implementation class is not present) stylebook : Not Available (the implementation class is not present) stlabel : Not Available (the implementation class is not present) stcheckin : Not Available (the implementation class is not present) stcheckout : Not Available (the implementation class is not present) ejbc : Not Available (the implementation class is not present) wlstop : Not Available (the implementation class is not present) ddcreator : Not Available (the implementation class is not present) A task being missing/unavailable should only matter if you are trying to use it --- org.apache.env.Which diagnostics --- Not available. Download it at http://xml.apache.org/commons/ --- XML Parser information --- XML Parser : org.apache.xerces.jaxp.SAXParserImpl XML Parser Location: /Users/rkobergmac/Documents/workspace/ant-core/ dist/lib/xercesImpl.jar Namespace-aware parser : org.apache.xerces.jaxp.SAXParserImpl $JAXPSAXParser Namespace-aware parser Location: /Users/rkobergmac/Documents/workspace/ ant-core/dist/lib/xercesImpl.jar --- System properti
Re: extended xslt task - use URIResolvers to create DependSet
Hi, I am trying to test out the caching for the xslt task, but running into some basic problem. I have built ant to include my code changes and additions. But, I am getting a class not found exception. The ant- nodeps.jar in the dist/lib dir contains the class that is not being found. I don't get it. The ant home (below) contains the jar that contains the class -- what am I missing?? Running ant with -verbose gives: rkmbp:test-xsl-cache rkobergmac$ export ANT_HOME=/Users/rkobergmac/ Documents/workspace/ant-core/distrkmbp:test-xsl-cache rkobergmac$ export PATH=/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/ bin:/usr/X11/bin:/System/Library/Frameworks/JavaVM.framework/Versions/ 1.6/Home/bin:$ANT_HOME/bin rkmbp:test-xsl-cache rkobergmac$ echo $PATH /sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/ bin:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:/ Users/rkobergmac/Documents/workspace/ant-core/dist/bin rkmbp:test-xsl-cache rkobergmac$ ant -verbose Apache Ant version 1.8.0alpha compiled on October 31 2008 Buildfile: /Users/rkobergmac/Documents/workspace/ant-core/test-xsl- cache/build.xml Detected Java version: 1.6 in: /System/Library/Frameworks/ JavaVM.framework/Versions/1.6.0/Home Detected OS: Mac OS X parsing buildfile /Users/rkobergmac/Documents/workspace/ant-core/test- xsl-cache/build.xml with URI = file:/Users/rkobergmac/Documents/ workspace/ant-core/test-xsl-cache/build.xml Project base dir set to: /Users/rkobergmac/Documents/workspace/ant- core/test-xsl-cache Build sequence for target(s) `ant-docs-1' is [ant-docs-1] Complete build sequence is [ant-docs-1, ] ant-docs-1: parsing buildfile jar:file:/Users/rkobergmac/Documents/workspace/ant- core/dist/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/Users/rkobergmac/Documents/workspace/ant-core/dist/lib/ ant.jar!/org/apache/tools/ant/antlib.xml [mkdir] Skipping /Users/rkobergmac/Documents/workspace/ant-core/ test-xsl-cache/out because it already exists. [xslt] java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.optional.CachingTraXLiaison [xslt] at java.net.URLClassLoader$1.run(URLClassLoader.java:200) [xslt] at java.security.AccessController.doPrivileged(Native Method) [xslt] at java.net.URLClassLoader.findClass(URLClassLoader.java: 188) [xslt] at java.lang.ClassLoader.loadClass(ClassLoader.java:316) [xslt] at java.lang.ClassLoader.loadClass(ClassLoader.java:251) [xslt] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) [xslt] at java.lang.Class.forName0(Native Method) [xslt] at java.lang.Class.forName(Class.java:169) [xslt] at org.apache.tools.ant.taskdefs.XSLTProcess.loadClass(XSLTProcess.java: 556) [xslt] at org .apache .tools.ant.taskdefs.XSLTProcess.resolveProcessor(XSLTProcess.java:541) [xslt] at org.apache.tools.ant.taskdefs.XSLTProcess.getLiaison(XSLTProcess.java: 777) [xslt] at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:301) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: extended xslt task - use URIResolvers to create DependSet
Hi again, What do you think about using a xml cache file like below (xml instance followed by XML schema). Since the same XSL (xsl:include/ xsl:import) and XML (from the doc/document function) files can be used in several different, it would make sense to allow the cache file to be reused in multiple xslt tasks. Using an XML doc with IDs and IDREF can reduce the redundancy of the same file(s) being reused in multiple and/or different transformations. (and speed up finding the appropriate reference) perhaps this is how the xslt task is extended in a build file like so: The existence of this attribute (whatever it is named :) ) indicates the use of the caching/spying trax liason ? Here is an example instance of a reusable cache doc followed by an XML schema: 78f43t84t y8734qr 437hr88qr3 c7834fr4g hq378d43 dh78234 http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified"> type="xs:anyURI"/> type="xs:anyURI"/> type="xs:anyURI"/> On Oct 27, 2008, at 4:37 PM, Dominique Devienne wrote: On Mon, Oct 27, 2008 at 11:51 AM, Robert Koberg <[EMAIL PROTECTED]> wrote: I would love to use a properties implementation that [...] Is something like this available now in Ant? Maybe not exactly what you want, but have a look at PropertySet (and ). If not, would the commons configuration be OK as a dependency? That's an easy *NO* ;-) Ant is used to build Commons, so that would be a circular dependency. Ant lives at the very bottom of the dependency stack in Gump, so can't depend on anything else. The few exceptions are checked in JARs for the XML parser in lib/ (and JUnit in lib/optional/, because unit testing is so integral to Ant). * new class name TraxCachingLiason -- ideas? CachingTraxLiaison - but then again, all badly chosen names in Ant are mine (TM) ;-) I used that name so it would show up next to TraxLiaison in the javadoc :) I'm afraid this is a tough name to come up with. Caching doesn't convey the right idea here IMHO. Sure, the impl uses caching of the dependencies, but that's an implementation detail. You're adding additional "Smart's" to , to avoid unnecessary transforms, by "spying" on URI resolving. So maybe a SpyResolverTraxLiaison? ;) I don't have a better suggestion... --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: extended xslt task - use URIResolvers to create DependSet
On Oct 27, 2008, at 11:04 AM, Stefan Bodewig wrote: On Sun, 26 Oct 2008, Robert Koberg <[EMAIL PROTECTED]> wrote: * where is the DependSet being checked in the transformation(s)? I can't find it :) Guessing, since I didn't follow the discussion: nowhere. deletes the target files if it thinks they are outdated, so the way dependset factors into the transformation is by removing the target file and thus making it appear out of date WRT the source file. OK, got it. So it sounds like a DependSet is not appropriate for this type of thing * I will need to write to the file system to maintain the cache. What would be a good way of handling this? Should I create a directory in the baseDir for all transforms. Then a directory per xslt task. Inside that dir create a properties file per transform? How would you do it? Make it an attribute with some reasonable default (your descriptions sounds good, but how would you define "per xslt task"? use the stylesheet's name?). See the selector for example. The templates' URIResolver could work like the selector. But the transformer's URIResolver is different. Since it is at a per transform level it is not really the same (where the transform can happen over all XML files in some src dir). I would love to use a properties implementation that allowed getting a subset of properties based on 'startsWith' see: http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/AbstractConfiguration.html#getKeys(java.lang.String) ?? I did a search in the ant source and did not find 'org.apache.commons.configuration' Example props file: main1.xsl.templates.import1.xsl = 6873gf43gf main1.xsl.templates.include1.xsl = 7fg34gry main1.xsl.transformer.mainSource1.xml.abc.xml = 823478fr87134 main1.xsl.transformer.mainSource1.xml.foo.xml = 1y83gf8734 (probably using paths in the key names ??) So, for example, SomeImplOfAbstractConfiguration.getKeys("main1.xsl.templates") returns the keys to check for the templates recomplile and to perform the transform. Is something like this available now in Ant? If not, would the commons configuration be OK as a dependency? I bet it would be useful in other places ?? Definitely open to ideas for this :) * new class name TraxCachingLiason -- ideas? CachingTraxLiaison - but then again, all badly chosen names in Ant are mine (TM) ;-) I used that name so it would show up next to TraxLiaison in the javadoc :) thanks for your input, -Rob Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
extended xslt task - use URIResolvers to create DependSet
Hi, I am looking at extending the xslt task to allow for an enhanced check to determine whether a transform should proceed. Currently there are 2 options for checking whether a transform should proceed. The first just checks the XML and XSL Source against the output file. The 2cnd uses a DependSet. While the DependSet can check the transform at a deeper level, it is inconvenient to set up. Also, in many ways it is impractical, because, for example, a directory containing src XML files could have each reference their own set of files (through the document function). We discussed this a bit on the user list here: http://marc.info/?t=122418056700022&r=1&w=2 Specifically: http://marc.info/?l=ant-user&m=122418293609849&w=2 Basically, I want to use 2 URIResolvers instances (of CachingURIResolver ?) in addition to the the checks for the primary XML and XSL Source: 1. Set one on the TransformerFactory to resolve import/include. If this check turns out to not be up to date, proceed with all transforms skipping the next check. 2. Set another one on the Transformer to resolve document(). If the factories test is up to date, then check the dependencies accumulated through this resolver. These resolvers would gather up their dependencies to track for subsequent transforms. Some questions: * where is the DependSet being checked in the transformation(s)? I can't find it :) * I will need to write to the file system to maintain the cache. What would be a good way of handling this? Should I create a directory in the baseDir for all transforms. Then a directory per xslt task. Inside that dir create a properties file per transform? How would you do it? * new class name TraxCachingLiason -- ideas? best, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT: META-INF/services - was Re: bug: jar task with nested service does not create META-INF/services
OK, sounds good. And apologies for this OT response, but what do you guys think of using this? I just found out about it and really like it, but have only read a few articles. Any pros or cons? Perhaps it is a nice, clean way for Ant to go? best, -Rob On Wed, 2008-02-27 at 15:15 +, Peter Reilly wrote: > Thanks, > this has already been noticed and a fix will be in ant 1.7.1. > > In the meantime, the nested element should not be used. > > Peter > > > On Wed, Feb 27, 2008 at 3:12 PM, Robert Koberg <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I am trying to use the nested service element in the jar class. It > > produces a META-INF/service rather than META-INF/services: > > > > > > /** > > * Write SPI Information to JAR > > */ > > private void writeServices(ZipOutputStream zOut) throws IOException > > { > > Iterator serviceIterator; > > Service service; > > > > serviceIterator = serviceList.iterator(); > > while (serviceIterator.hasNext()) { > >service = (Service) serviceIterator.next(); > >//stolen from writeManifest > >super.zipFile(service.getAsStream(), zOut, > > "META-INF/service/" + service.getType(), > > System.currentTimeMillis(), null, > > ZipFileSet.DEFAULT_FILE_MODE); > > } > > } > > > > Bug? > > > > best, > > -Rob > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bug: jar task with nested service does not create META-INF/services
Hi, I am trying to use the nested service element in the jar class. It produces a META-INF/service rather than META-INF/services: /** * Write SPI Information to JAR */ private void writeServices(ZipOutputStream zOut) throws IOException { Iterator serviceIterator; Service service; serviceIterator = serviceList.iterator(); while (serviceIterator.hasNext()) { service = (Service) serviceIterator.next(); //stolen from writeManifest super.zipFile(service.getAsStream(), zOut, "META-INF/service/" + service.getType(), System.currentTimeMillis(), null, ZipFileSet.DEFAULT_FILE_MODE); } } Bug? best, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resources & Introspection
Hi, I don't know if this is of interest, but I have made some custom tasks and types for XSLT. (I would think these could be used to get a resource from a jar) - for example: - SourceType (have implemented a XmlDomType) - create a top-level DOM (dom4j, JDOM, etc...) Document that can be used in multiple XSLT tasks. The reason was to avoid reparsing a common XML file for multiple transforms. - TemplatesType - create a top level Templates object that can be used in multiple XSLT tasks. This type can also take a UriResolverType for both the factory (resolves xsl:import/includes) and the transformer (resolves document function calls) - UriResolverType - can be assigned to a TemplatesType. I have implemented a FallbackUriResolver which allows you to set a default directory to look in first and if a file is not found, it falls back to an alternate directory. Additionally I have made a Lucene indexer and search type. The search type can be assigned to a UriResolver where a can be used in the document function (document('fieldName: matchValue')) and get search results back as XML for use in the transform. Of interest? best, -Rob Matt Benson wrote: --- Antoine Levy-Lambert <[EMAIL PROTECTED]> wrote: Hello Matt and others, I want to change the xslt task, so that the stylesheet can be either a regular file or a zip entry (or may be even any resource). This brings me to point : we do not have yet a syntax to generate resources from attributes, do we ? My dream : styleresource="zip:file:foo/bar/my.zip!alpha/beta/style.xml"/> No! It was my dream first and you can't have it! :) I agree wholeheartedly. IIRC myself, Stefan, and probably others took part in a discussion of this nature some time ago... though I'm too frustrated by my slow home internet connection to find the thread ATM. Maybe we can get some momentum behind this. I think the simplest approach would be to default to file; but let the colon-delimited prefix represent a defined type in the project, e.g. file, url... and look it up. At the time I believe I was able to convince Stefan that this belonged in IntrospectionHelper; sounds like you agree. -Matt which would mean of course take from foo/bar/my.zip the entry alpha/beta/style.xml and use it to transform somedata.xml into someresult.html. Any ideas ? Regards, Antoine - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ssh patch going to be applied?
Hi, I was looking at using the sshexec task again, but I still get the 'Auth cancel' error when doing more than one sshexec. Is the patch suggested here: http://www.ant-tasks.com/msg/23789.html able to be applied? Or possibly any of the other fixes mentioned? best, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bus Error - custom task/type - when using taglib.xml
Jack Woehr wrote: Robert Koberg wrote: Strange though that this only comes up with Ant (from what I could find through google). I have not had problems loading XML files from jars or using namespaces in XML processing (the only thing different when using the taglib.xml). I wonder if it has to do with Ant's non-standard way of dealing with namespaces?? It has to do with some native code doing an illegal address access. Now, is the native code in the JVM or in some library Ant calls which uses native code? I don't think I am hitting native code. I am just using the JDK and the latest Xalan. Are any of the XML libraries associated with processing which you are doing composed in part of native code that you had to compile on your OS X box? (Or had to download pre-built?) no. If not, one supposes it's the JVM. OK How would you report this to Apple? Isn't there a bug report system associated with the page from which one periodically voluntarily downloads the updated OS X JVM? Not that I can see. There is a general apple java mailing list though. I guess I will post it there. thanks for your help, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bus Error - custom task/type - when using taglib.xml
Jack Woehr wrote: Robert Koberg wrote: * a random hang (build stops with no error/exception) when running in -verbose mode * a random Bus Error when not in -verbose mode. Neither Ant nor any pure Java application does bus errors. They can only come from a bug the Java VM itself or libraries (either JDK or third-party) using native code. OK. Apple just doesn't like java :) Strange though that this only comes up with Ant (from what I could find through google). I have not had problems loading XML files from jars or using namespaces in XML processing (the only thing different when using the taglib.xml). I wonder if it has to do with Ant's non-standard way of dealing with namespaces?? How would you report this to Apple? thanks, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bus Error - custom task/type - when using taglib.xml
Hi, I have some custom tasks and types. They work fine when I declare them in the build file. But if I use package specific taglib.xml's and reference them by namespace in the build file I get: * a random hang (build stops with no error/exception) when running in -verbose mode * a random Bus Error when not in -verbose mode. By random I mean the hang/error occurs at different places in the build once targets get called (the projects is initialized). I have seen some bug reports about this dealing wiht custom tasks/types and it seems to occur only on Mac OS X (I am using 10.4.2 - the latest) with JDK 1.5.0. I don't know if this is just a failing on Apples part or if it points to something deeper. Is there something known to cause this problem? I don't know how to track this down. Any ideas? thanks, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: task namespaces
I guess an obvious question is what happens when something like this occurs: ... Does the build fail? -Rob Steve Loughran wrote: [EMAIL PROTECTED] wrote: Robert Koberg <[EMAIL PROTECTED]> wrote .. Peter Reilly wrote: To allow easy use, the nested elements caused by java reflection on objects are placed in two namespaces - the default ant namespace (antlib: org.apache.tools.ant) and the namespace of the object that holds the nested element. I wonder what this means re XML Namespace specificationits obviously not possible to declare 2 default namespaces via markup. also, without going through the spec explicitly I am unsure if an element can legally exist in 2 namespaces at once. this is one for xml-dev no doubt; as an aside, my build systems operate on and consume a wide variety of markup with many processors (Ant being one of them)... I tend to explicitly declare my default namespaces to ensure disambiguation. cheers, Jim Fuller I have a build process that patches xsd files to deal with different interpretations of the ##other namespace between xerces and .net. nobody understands namespaces consistently. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: task namespaces
Peter Reilly wrote: To allow easy use, the nested elements caused by java reflection on objects are placed in two namespaces - the default ant namespace (antlib: org.apache.tools.ant) and the namespace of the object that holds the nested element. This explains it, thanks - ignore my email that asks this question. best, -Rob For example, the if task from ant-contrib extends ConditionBase, so it has nested elements like - equals. The rules above allow the following: the args are equal They are not equal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: task namespaces
[EMAIL PROTECTED] wrote: Phil Weighill Smith <[EMAIL PROTECTED]> wrote .. the only way those unprefixed elements are in some other namespace is if it is declared at some encapsulating parent element. for example; http://www.example.org/someanturi";> otherwise, if an xmlns declaration does not exist those elements belong to n1: namespace. OK, now I am confused. I have not looked at or used namespaces in Ant yet, but this would seem to be a problem. Would there not need to be a default namespace, otherwise how would the XML parser know what to do? action and http in a default namespace would certainly have totally different meanings to an underlying app. If you use namespaces, does ant require a default namespace. Does ant put a default namespace in behind the scenes? In any case, it would be best to prefix elements that are in the same namespace with the appropriate namespace-prefix. best, -Rob hth, Jim Fuller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: task namespaces
[EMAIL PROTECTED] wrote: Steve Loughran <[EMAIL PROTECTED]> wrote .. this action is a direct element; default NS or local ns? this is my new test, in the new ns What confuses me here is that the ns of a nested element (not a type, an element) is what? local? or Ant's main ns? 'An XML namespace declaration remains in scope for the element on which it is declared and all of its descendants, unless it is overridden or undeclared on one of those descendants' so and are in the n1: namespace. I think you meant they are *not* in the n1: namespace, right? best, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:
Steve Loughran wrote: I finally sat down and did schema validation, because couldnt handle the complexity of namespaces very well, and I had a pressing need to do things. 1. Moderate refactoring of XMLValidateTask to get it all to work; a few places where careful subclassing can integrate with this (fairly complex) task. You can also use the JARV task: http://iso-relax.sourceforge.net/JARV/antTask.html 2. I create my own XML parser factory. I dont know if this is really needed; the docs were inconsistent. Particularly JAXP1.3 says you had better ask for validating and namespace aware. So I did. NB: xmlvalidate docs say it is not namespace aware by default. I think it is now, as the factory is. 3. An inadequate number of tests. I'll add more as I use it, but more are welcome. 4. No running of these inadequate tests on anything other than Xerces . Do we ever test ant with other XML Parsers? I'd like to try it on Java-5-retail , as it were; to see what sun broke. JAXP1.3 says it ships with rudimentary xinclude support. Is this true? Does xerces handle it as well, or is it just a xalan thingy. I'd like an XInclude task if we could pull it off, to make my fairly complex xml workflow tractable (building up WSDL files from multiple XSDs). Xerces handles the XInclude. You can take advantage of it by setting the system property: org.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration best, -Rob -steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FTP Optional Task
Hi, The FTP task (or more likely commons-net) definitely works in mysterious ways (log files don't tell much). I use it to FTP to various servers (windows/? and linux/wu-ftp) and what I have seen is that you have to set up the task differentlty for different types of servers and ftp servers -- by trial and error :( Generally, for linux the following works for me: the above won't work if I set the @timediffauto to true (even though the user has write access) -- one file gets sent and then hangs on the second. I have also tried the modified selector for the fileset (since it doesn't rely on remote files). This fails on linux (I forget the error -- something like command not supported). But using the modified selector with a windows server does work. For windows, even though I have write access, I can't use the @depends=true, but can use the modified selector: best, -Rob Pierre Grimaud wrote: Hi everyone, First of all, many thanks for the great team and the outstanding product (ant!) it delivers for now quite a while. What would I do without ant, I have no clue, but certainly a little less. Anyways... I recently changed my production environment for my personal website so now I have to push files over FTP (across the internet) instead of a shared network drive. I had a quick look at the FTP task and was pleased as it seemed to address all that I needed and some more. After a few days of testing and looking at some forums, it appears I cannot use it productively as of now, for a number of reasons, all of which I am willing to investigate and fix, to the best of my abilities of course. This email is an attempt for a first contact with the Ant developpers community, in order to figure out : 1. how to submit a patch, 2. how to work with the latest (to ensure that my patch could be integrated in the build without versioning and merging nightmares), 3. To make sure no one is working on those same problems, making my efforts effectively useless. Well, I hope I will get an answer to all three of these questions with this email. Disclaimer: I haven't had a look at the source code yet. Let's now get to the core of my problems with the optional FTP task: 1. After transferrig a few files, the FTP task usually fails with one of the two messages: 1a. [SocketException: Connection reset]. I know that the timeouts on my ftp server are quite aggressive (1 min), but I have never had any problems with any of the FTP clients I have ever used, but for Ant's, possibly indicating a possible improvement. 1b. [could not put file: 500 ORT not understood]. This one obviously looks like a communication problem, but for the fact that it never happens on the same file or at the same time. Again, it is the first time I see that message, after some long month of interactnig with my server with other ftp clients. All of these problems could be partially fixed by defining an "auto-retry on fail option", although it wouldn't really address the bugs and it would worsen the following problem quite a bit. 2. The transfer (with the depends="yes" option) is still extremely slow. This is of course due in part to my 128k DSL upload capabilities, but what I have seen in the debug mode seems to indicate that it still could be improved. I will now switch to pure speculation mode. The timestamp check for a file takes around 1 second on my machine, making the entire task pretty sluggish as I have hundreds of files. Instead of checking the timestamp one file by one file, it should be possible to get all the timestamps directories by directories, avoiding unnecessary roundtrips. Of course, this should be optional as it could actually worsen the performance on some cases. Oh well, I will stop here for today and will ask the community if any of these problems are known, or acknowledged, or even in the process of being fixed. If not, I will be happy to proceed. Thanks again for the great tool. Pierre GRIMAUD [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to get custom task object?
Hi, I am trying to create some custom types and tasks, but having a problem getting back the custom task object to reset some values. My custom task is coming in as an UnknownElement. I then try to cast to my object using UnknownElement.getRealThing() (or getTask), but it gives me a null. How do you get a custom task object? Task[] tasks = target.getTasks(); Target clonedTarget = new Target(); clonedTarget.setProject(lsb); for (int i=0; i < tasks.length; i++) { Task task = tasks[i]; String name = task.getTaskName(); if (name.equals("xsltransform")) { UnknownElement unElem = (UnknownElement) task; /* This next line sets xslTransform == null */ XslTransform xslTransform = (XslTransform) unElem.getRealThing(); //XslTransform xslTransform = (XslTransform) unElem.getTask(); xslTransform.setOutputStream(response.getOutputStream()); } clonedTarget.addTask(task); } thanks, -Rob p.s. I created a XslTemplates top-level type that can be referenced by an XslTransform task. This allows for two things; a cache of templates objects, and the ability to set a URIResolver on the Templates object to resolve xsl:import/include and a URIResolver on the Transformer object to resolve calls from the XSL document function. If anyone is interested I can provide them (though I am sure they would need work...). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: howto trigger an Ant build within java]
Hi, I am looking into using Ant (v1.6.0) more in my webapp so I can offer offline publishing equivalents. I am transforming some config XML into a build file. I then want to load that build file into a new org.apache.tools.ant.Project. The build.xml gets produce properly (it runs successfully from the command line). How do I load the build file and create an ant project, then trigger a particular target to execute? The build file uses only Core Tasks (and an xmlcatalog). Is there a simple example somewhere? I have tried searching with google but getting too many hits that don't cover what I am looking for. Here is what I have tried: org.apache.tools.ant.Project antProject = new org.apache.tools.ant.Project(); AntXMLContext antContext = new AntXMLContext(antProject); File f = lsbProject.lookup("build.xml").getFile(); System.out.println("build.xml: " + f); antContext.setBuildFile(f); System.out.println("project name: " + antContext.getCurrentProjectName()); Vector targets = antContext.getTargets(); for (Enumeration e = targets.elements(); e.hasMoreElements();) { Target target = (Target) e.nextElement(); System.out.println(target.getName() + " : " + target.getDescription()); } -- the System.outs produce: build.xml: c:\home\app\projects\grok\build.xml project name: null : null -- thanks for any help, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
howto trigger an Ant build within java
[resending -- didn't seem to make it through] Hi, I am looking into using Ant (v1.6.0) more in my webapp so I can offer offline publishing equivalents. I am transforming some config XML into a build file. I then want to load that build file into a new org.apache.tools.ant.Project. The build.xml gets produce properly (it runs successfully from the command line). How do I load the build file and create an ant project, then trigger a particular target to execute? The build file uses only Core Tasks (and an xmlcatalog). Is there a simple example somewhere? I have tried searching with google but getting too many hits that don't cover what I am looking for. Here is what I have tried: org.apache.tools.ant.Project antProject = new org.apache.tools.ant.Project(); AntXMLContext antContext = new AntXMLContext(antProject); File f = lsbProject.lookup("build.xml").getFile(); System.out.println("build.xml: " + f); antContext.setBuildFile(f); System.out.println("project name: " + antContext.getCurrentProjectName()); Vector targets = antContext.getTargets(); for (Enumeration e = targets.elements(); e.hasMoreElements();) { Target target = (Target) e.nextElement(); System.out.println(target.getName() + " : " + target.getDescription()); } -- the System.outs produce: build.xml: c:\home\app\projects\grok\build.xml project name: null : null -- thanks for any help, -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: howto trigger an Ant build within java
[moving to dev list] Jim Fuller wrote: From: Robert Koberg [mailto:[EMAIL PROTECTED] Sent: 29 January 2004 02:49 To: user@ant.apache.org Subject: howto trigger an Ant build within java I am looking into using Ant (v1.6.0) more in my webapp so I can offer offline publishing equivalents. I am transforming some config XML into a build file. I then want to load that build file into a new org.apache.tools.ant.Project. The build.xml gets produce properly (it runs successfully from the command line). So the transformation of config file is happening in your app which ultimately generates a build file, which in turn you would like to simply run ant on ? The configs are held in memory(jdom) and eventually I would like to use /something/ like a chained transformation to go from the configs to an ant build in memory and run the build on a user chosen target. I would use the build file to present a 'nav' tree similar to what eclipse does. The user clicks on a target to do things like generate a site/folder/page or promote to a vhost stage (local or remote) based on their config. How do I load the build file and create an ant project, then trigger a particular target to execute? The build file uses only Core Tasks (and an xmlcatalog). Is there a simple example somewhere? I have tried Hello Rob, If you are physically generating the build file then just use the launcher in the http://nagoya.apache.org/gump/javadoc/ant/build/javadocs/index.html org.apache.tools.ant.launch package. Though perhaps you want more control yes, more control Which is where I can highly recc the use of jelly http://jakarta.apache.org/commons/jelly/ I will look into this. I have found that there are some 'gotchas' with such dynamic instantiation and running of a build direct from ant api, though this could be down to my own limited knowledge. Yes, I have seen some warnings on this. I was hoping there would be a way to do this with ant and still be safe. I will move this to the dev list and see if someone there can help. best, -Rob Cheers, Jim Fuller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: XML, XSL, and Ant
Hi, > -Original Message- > From: Kyle Adams [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 23, 2003 8:30 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > > We should be able to change this if SAXSource is supported, I'll take > > a stab at it - but I will need testers before I'm willing to merge my > > changes into the 1.6 branch. If I'd send you a changed ant-trax.jar, > > could you test it in your Ant 1.6beta environment? > > No problem - I've got a simple test case already setup that's currently > failing, so I'm all set for testing :-) I have not downloaded ANT's source, so I don't know how it works. But, does it use XMLFilters for the transformation? If so, you can set the EntityResolver there. Otherwise, I believe you would need to run the Transformer resolved Sources through an XMLReader or XMLFilter that has an EntityResolver set. Best, -Rob > > Kyle > > _ > > Kyle Adams | Java Developer | Gordon Food Service | 616-717-6162 > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CVS Commit with ANT
Hi, Shouldn't you do a 'cvs update' first? And if so, what happens if you get a conflict? And if not, what happens if a change has been made and it won't let you commit? ? -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]