Hello, We have a problem in Torque with Texen's PropertiesUtil in that it relied on templatePath == null to determine whether to load properties from the file system or classpath.
The reason it broke for us is that we want to let users specify via their build.properties whether to use Torque from the classpath or from the file system. And with the current PropertiesUtil, we have to have two separate targets, target-template with templatePath set and target-classpath with templatePath not set and useClasspath=true. We would like to have just one target, with both the templatePath set and the useClasspath=true. Based on this, Texen sets up the Velocity's resource managers nicely and works for everything except this PropertiesUtil. So, there are two fixes. The Apache CVS seems to be down, so I can't do a diff of my current patch, so I've attached the entire PropertiesUtil (it's small), where basically I ignore the generator's templatePath and instead first try to load off the file system, then if that fails, try to load off the classpath. I think this accurately portrays what should happen and this patch works great for our needs. When I can do the diff, I'll submit it along with a minor change I made to Generator...I deprecated getTemplatePath as I don't think anyone should use it, it breaks stuff as I just explained above. Also, I can think of a better patch, but don't know if I could implement it. Ideally, PropertiesUtil should go to the Velocity ResourceManager to get the properties and hence rely on Velocity's configured behavior instead of it's own ad hoc algorithm. There is a ContentResource class that looks like it would work...it returns a string, which I could put into a stream, and load the properties from the stream. However, I don't know an easy way to get a ContentResource from Velocity...there's Velocity.getTemplate, but no Velocity.getContent or the like. Is a method like Velocity.getContent a possible addition? Or is there another way to get the content resource back that I haven't found? I'd greatly appreciate it if someone could point me the way, as I think it's a better patch than the current one. Thanks, Stephen
PropertiesUtil.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
