Re: Re: enhancement request for Ant event builder task
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Very nice. Just a couple comments... At 11:40 AM 9/16/2003 +0200, you wrote: >Jacob Kjome <[email protected]> wrote: > > > I'd be very open to a change like this. However, I don't see it as a > > priority. If you are willing to modify the code (from the current > > CVS) to add this capability (as an optional parameter), I'll surely > > review it and check it in if it passes muster. >Yep, the code is changed and I generated a patch (rdiff) against the head of >CVS. I included the patch as an attachment to this E-Mail. > >It is now possible to have a task like this: > ><events > sourceout="myOutDir" > descriptor="myOptionsDir/events.xml" > template="myOptionsDir/myEventTemplate.template"/> > >The algorithm to choose the template is as follows: >1. Choose the template attribute inside the Ant task. If the attribute is >absent: >2. Choose the template attribute inside the <build-events> tag. I've never actually bothered to use the "template" attribute of the <build-events> tag. I noticed that you set the loading of the value of this in the following way... br = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(cs.template))); That will load whatever the value is relative to the EventBuilder class. What have you used as a sample value for the "template" attribute? Is it a fully qualified path to the file from the root of the classloader such as?... <build-events pkg="org.enhydra.barracuda.config.events" template="/org/enhydra/barracuda/config/BConfig.template"> ... </build-events> The above would work, but only with the pre-pended forward slash ("/") because of the way that Class.getResourceAsStream() works. I think this might need to be modified to be... br = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(cs.template))); That way, the path can be changed to not require the pre-pended forward slash.... <build-events pkg="org.enhydra.barracuda.config.events" template="org/enhydra/barracuda/config/BConfig.template"> ... </build-events> I think that makes more sense. Can you test and modify your patch if needed? Oh, and try to make sure you use spaces instead of tabs with a 4 spaces indentation. > If the >attribute is absent: >3. Fallback and choose "EventBuilder.template". Everything else looks pretty good. I await your changes before I'll test it out. Jake >Thorsten