ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: setting task attributes from properties
Date Thu, 29 Mar 2007 09:31:19 GMT
Vladimir Egorov wrote:
> Hi Ant Users,
> 
> I would like to change the value of a task attribute on the fly, without
> editing Ant xml file, by setting a runtime system property like this:
> 
>   junit.showoutput=true --> get junit to show test output by default
>   java.fork=true --> fork by default
>   etc.
> 
> While this can be implemented for an individual task, I believe that it
> should be done in core Ant, so that it works for all tasks without extra
> work for task developers.
> 
> Do Ant Users feel this would be useful to have in core Ant? Has anyone
> asked for this? Is there an extension mechanism in Ant that can be used
> to do this? Is there a property-to-xml convention that would take care
> of the nested elements?

Occasionally there are some 'magic' switches to change behaviour of 
javac, but otherwise they are left alone

Now -gratuitous product placement time- our little SmartFrog deployment 
framework does let you do late binding of existing attributes, because 
all you are building up is a template on a template on a template, 
presetdef taken to the n-th degree,

So I have a template for an Xmpp component


XmppComponent extends Prim {
     xmppSchema extends XmppSchema;
     serviceName LAZY server;
     port 5222;
     requireEncryption true;
     resource "SmartFrog";
     presence false;
     useTLS false;
}

which I can extend to one with a classname (as the name of the 
implementing class is just another attribute)

XmppClient extends XmppComponent {
     sfClass "org.smartfrog.services.xmpp.XmppClientImpl";
}

and then define one for google:

GoogleChatClient extends XmppClient {
     server "talk.google.com";
     serviceName "gmail.com";
}

This is still abstract, it needs a user and password.

In any deployment descriptor I can do something called 'placement', 
where I patch in a new value to the base system. So, to turn on useTLS 
everywhere, I go

XmppComponent:useTLS true;

This is very powerful, but at the same time, very dangerous. Why? 
Because now the state of your system depends on the order of the files 
you read in, and all their values. It is still declarative, but a lot 
harder to work out what the declarations will be, as any placement can 
change the behaviour of any other template.


So
1. I see the value in the idea -we use it at work
2. I also think its very dangerous


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


Mime
View raw message