Re: AW: [Fwd: Some Thoughts on Ant 1.3 and 2.0]

2005-05-25 Thread Jesse Glick

The Schema file is there to support GUI tools for example. They
could prompt for required attributes,


This would be nice!


let you select enumerated attributes from a list,


FWIW, NetBeans would not need this - currently loads the 
EnumeratedAttribute subclass on the fly and uses it for code completion. 
But having this information in a static declarative format might be better.


Relying on such a format might not be a good idea unless it were widely 
used and easy to create, though - I think it's pretty common to just 
write a one-off task that you use in a script as needed, and it's nice 
for a tool to be able to offer code completion and other structural help 
with such a custom task. (E.g. NB analyzes custom tasks when you run a 
script which defines them, as a heuristic.) The nice thing about apt is 
that it could ensure that all the needed info is right there in the 
java.lang.Class - not good for general docs but nice for finding 
required attributes and that sort of thing. Not available for JDK 
1.2-1.4 though.


BTW I just had a thought - should use of EnumeratedAttribute be required 
for JDK 5 users? Maybe you should be able to just do something like


public enum WhenEmptyAction {fail, create, skip}
public class SomeTask {
public void setWhenempty(WhenEmptyAction action) {...}
public void execute() {...}
}


require integer attributes to really contain numbers ...


I think the signature of the task class already handles this case, 
right? setSomething(int)?


[EMAIL PROTECTED] wrote:

How the IDEs solve that at the moment?


For required attributes, you can't solve it that I know of, without 
hardcoding attribute names for well-known tasks (or trying to parse the 
HTML tables in the docs, or something icky like that).


-J.

--
[EMAIL PROTECTED]   x22801   netbeans.org   ant.apache.org
if I had known it was harmless I would have killed it myself


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: [Fwd: Some Thoughts on Ant 1.3 and 2.0]

2005-05-24 Thread Jan . Materne
 (*) Extension tasks
 
 Make extending Ant as simple as possible, i.e. drop a jar file in a
 specific directory (ANT_HOME/ext globally or ~/.ant/ext on a user by
 user basis).
 
 This jar file must include taskdefs to define the tasks, Schema
 files to describe the tasks and documentation in the XML format we
 agreed on.
 
 The Schema file is there to support GUI tools for example. They could
 prompt for required attributes, let you select enumerated attributes
 from a list, require integer attributes to really contain numbers ...


First is done with AntLibs and autoloading via xml-namespaces.
But I like the 3rd paragraph - but could be be done via java source?
- annotations and XDoclet/apt generates such a file
- something like

  public interface ConfigurationCheck {
  /** Returns all names of required attributes. */
  public static String[] getRequiredAttributes();

  /** Returns all names of required nested elements. */
  public static String[] getRequiredElements();

  /** This instance is valid, means all required values are set
correctly. */
  public boolean validate();
  }


How the IDEs solve that at the moment?


Jan