ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: How to: Converting a property value into something else?
Date Wed, 03 Jul 2002 23:05:27 GMT
Just did a full checkout of JBoss, and I can't find no <subst> task... Am I
missing something? --DD

PS: BTW, they do something quite slick to make entity includes much more
useful, and almost better than <import>: By using

ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol

to start Ant, they allow to use a new kind of URL which looks up it file
stream in the Java classpath (I'm guessing):

<!DOCTYPE project [
  <!ENTITY buildmagic SYSTEM
           "resource://org/jboss/tools/buildmagic/common.xml">
]>

You then just have to play with the classpath and organize your build
snippets/fragment as you would classes then. Pretty cool!!! Here's the
summary from the article at
http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/ :

The Java 2 Core API depends heavily on the URL class. A deep understanding
of the internals of the java.net.URL architecture allows you to exploit
those dependencies by creating reusable, plug-in protocol handlers. Once you
build a protocol handler you can use it in any Java VM, creating URL objects
that refer to your new protocol. It takes very little work at deployment
time to enable your handler: just let the VM know about your handler by
defining the java.protocol.handler.pkgs system property, and make sure your
handler implementation is available off the classpath. 

Using a custom protocol handler can often save you vast amounts of time and
effort when designing and implementing Java architectures to access
stream-based resources. The java.net.URL architecture is already built,
already a part of all Java 1.x+installations, and used by many parts of the
Java Core API, Extension APIs, and third-party packages. There's no reason
not to exploit this architecture whenever possible.

-----Original Message-----
From: Diane Holt [mailto:holtdl@yahoo.com] 
Sent: Wednesday, July 03, 2002 5:25 PM
To: Ant Users List
Subject: RE: How to: Converting a property value into something else?

Oh right -- forgot it was a dual-purpose property (which means you
couldn't have the ${line.separator}'s in there either, right, since you
need them all on the same line for when it's the arg). Hmm, hate to say
it, but, looks like <script> would be your friend in this case.

> Ant is lacking some simple regex formatting of properties IMHO.

I agree -- that's why I started trying to get the <subst> task together.
But it was too late in the game for 1.5, so it got shelved, and I've not
gotten back to it yet. But I did see that JBoss has one (even has the same
name), when I was checking their stuff out (came up in another thread),
and I think I remember seeing it did regexp. Maybe you could see about
picking that up on its own?

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message