proper.io
Class Ant

java.lang.Object
  extended by proper.io.Ant

public class Ant
extends java.lang.Object

A little helper class to retrieve Data from ANT-files.
For some reasons the placeholders in the java-tags are not expanded, which means that we'll do it ourselves.

Version:
$Revision: 1.3 $
Author:
FracPete

Field Summary
static java.lang.String ARG
          the name of argument-tag
static java.lang.String CLASSNAME
          the name of the attribute for the Java class
static java.lang.String JAVA
          the name of java-tag
static java.lang.String VALUE
          the name of the attribute for the value
 
Constructor Summary
Ant(java.io.File file)
          initializes the object
Ant(java.lang.String filename)
          initializes the object
 
Method Summary
 java.lang.String expand(java.lang.String arg)
          expands the properties in the given String and returns the expanded version
 java.util.Vector expand(java.util.Vector args)
          expands the properties in the given Vector and returns the expanded version
 java.util.Vector getAntTargets()
          returns all targets as AntTarget-Instances
 java.util.Vector getAntTargets(CluderInterface cluder)
          returns the targets that fit the In/Excluder as AntTarget-Instances.
 java.util.Vector getArguments(org.apache.tools.ant.Task task)
          returns all the arguments (if any) from the given Java-task, NULL if not found (automatically expanded!)
 java.lang.String getClassname(org.apache.tools.ant.Task task)
          returns the classname of the given Java-task, NULL if not found (automatically expanded)
 java.lang.String getFilename()
          returns the filename of the current ANT file, can be NULL
 java.util.Vector getJavaTasks(java.lang.String target)
          returns all the java calls of the given target, NULL if not found
 java.lang.String getName()
          returns the name of the project, NULL if not set
 org.apache.tools.ant.Project getProject()
          returns the Project instance
 java.util.Vector getProperties()
          returns the names of all the Properties in the ANT file
 java.util.Vector getProperties(CluderInterface cluder)
          returns the names of all the Properties in the ANT file, that match the given Cluder (Includer/Excluder)
 java.lang.String getProperty(java.lang.String property)
          returns the value of the given property, NULL if not found
 org.apache.tools.ant.Target getTarget(java.lang.String target)
          retrieves the given Target, NULL if not found
 java.util.Vector getTargets()
          returns the names of all the targets in the ANT file
 java.util.Vector getTargets(CluderInterface cluder)
          returns the names of all the targets in the ANT file, that fullfil the Cluder (Includer/Excluder)
 java.util.Vector getTasks(java.lang.String target)
          returns the Tasks of the given target, NULL if not found
 boolean isLoaded()
          returns whether the ANT file was loaded correctly
static void main(java.lang.String[] args)
          for testing only
 boolean reload()
          tries to reload the ANT file
 void setProperty(java.lang.String property, java.lang.String value)
          sets the value of the given property (must already exist!)
 java.lang.String toString()
          returns part of the ANT file in a string representation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME
the name of the attribute for the Java class

See Also:
Constant Field Values

VALUE

public static final java.lang.String VALUE
the name of the attribute for the value

See Also:
Constant Field Values

JAVA

public static final java.lang.String JAVA
the name of java-tag

See Also:
Constant Field Values

ARG

public static final java.lang.String ARG
the name of argument-tag

See Also:
Constant Field Values
Constructor Detail

Ant

public Ant(java.lang.String filename)
initializes the object

Parameters:
filename - the ANT-file to analyze

Ant

public Ant(java.io.File file)
initializes the object

Parameters:
file - the ANT-file to analyze
Method Detail

getFilename

public java.lang.String getFilename()
returns the filename of the current ANT file, can be NULL


isLoaded

public boolean isLoaded()
returns whether the ANT file was loaded correctly


reload

public boolean reload()
tries to reload the ANT file


getName

public java.lang.String getName()
returns the name of the project, NULL if not set


getProject

public org.apache.tools.ant.Project getProject()
returns the Project instance


getTarget

public org.apache.tools.ant.Target getTarget(java.lang.String target)
retrieves the given Target, NULL if not found


getTargets

public java.util.Vector getTargets()
returns the names of all the targets in the ANT file


getTargets

public java.util.Vector getTargets(CluderInterface cluder)
returns the names of all the targets in the ANT file, that fullfil the Cluder (Includer/Excluder)


getAntTargets

public java.util.Vector getAntTargets()
returns all targets as AntTarget-Instances

See Also:
AntTarget

getAntTargets

public java.util.Vector getAntTargets(CluderInterface cluder)
returns the targets that fit the In/Excluder as AntTarget-Instances. Only targets containing a Java-Task are considered

See Also:
AntTarget

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
sets the value of the given property (must already exist!)


getProperty

public java.lang.String getProperty(java.lang.String property)
returns the value of the given property, NULL if not found


getProperties

public java.util.Vector getProperties()
returns the names of all the Properties in the ANT file


getProperties

public java.util.Vector getProperties(CluderInterface cluder)
returns the names of all the Properties in the ANT file, that match the given Cluder (Includer/Excluder)


getTasks

public java.util.Vector getTasks(java.lang.String target)
returns the Tasks of the given target, NULL if not found

See Also:
Task

expand

public java.lang.String expand(java.lang.String arg)
expands the properties in the given String and returns the expanded version


expand

public java.util.Vector expand(java.util.Vector args)
expands the properties in the given Vector and returns the expanded version


getJavaTasks

public java.util.Vector getJavaTasks(java.lang.String target)
returns all the java calls of the given target, NULL if not found


getClassname

public java.lang.String getClassname(org.apache.tools.ant.Task task)
returns the classname of the given Java-task, NULL if not found (automatically expanded)


getArguments

public java.util.Vector getArguments(org.apache.tools.ant.Task task)
returns all the arguments (if any) from the given Java-task, NULL if not found (automatically expanded!)


toString

public java.lang.String toString()
returns part of the ANT file in a string representation

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
for testing only