Save This Page
Home » apache-ant-1.8.1 » org.apache.tools » ant » [javadoc | source]
org.apache.tools.ant
public class: ProjectHelper [javadoc | source]
java.lang.Object
   org.apache.tools.ant.ProjectHelper

Direct Known Subclasses:
    ProjectHelperImpl, ProjectHelper2

Configures a Project (complete with Targets and Tasks) based on a build file. It'll rely on a plugin to do the actual processing of the file.

This class also provide static wrappers for common introspection.
Field Summary
public static final  String ANT_CORE_URI    The URI for ant name space 
public static final  String ANT_CURRENT_URI    The URI for antlib current definitions 
public static final  String ANTLIB_URI    The URI for defined types/tasks - the format is antlib: 
public static final  String ANT_TYPE    Polymorphic attribute 
public static final  String HELPER_PROPERTY    Name of JVM system property which provides the name of the ProjectHelper class to use. 
public static final  String SERVICE_ID    The service identifier in jars which provide Project Helper implementations. 
public static final  String PROJECTHELPER_REFERENCE    name of project helper reference that we add to a project 
Constructor:
 public ProjectHelper() 
Method from org.apache.tools.ant.ProjectHelper Summary:
addLocationToBuildException,   addText,   addText,   canParseAntlibDescriptor,   canParseBuildFile,   configure,   configureProject,   extractNameFromComponentName,   extractUriFromComponentName,   genComponentName,   getContextClassLoader,   getCurrentPrefixSeparator,   getCurrentTargetPrefix,   getDefaultBuildFile,   getExtensionStack,   getImportStack,   getProjectHelper,   isInIncludeMode,   parse,   parseAntlibDescriptor,   parsePropertyString,   replaceProperties,   replaceProperties,   setCurrentPrefixSeparator,   setCurrentTargetPrefix,   setInIncludeMode,   storeChild
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.ProjectHelper Detail:
 public static BuildException addLocationToBuildException(BuildException ex,
    Location newLocation) 
    Add location to build exception.
 public static  void addText(Project project,
    Object target,
    String text) throws BuildException 
    Adds the content of #PCDATA sections to an element.
 public static  void addText(Project project,
    Object target,
    char[] buf,
    int start,
    int count) throws BuildException 
    Adds the content of #PCDATA sections to an element.
 public boolean canParseAntlibDescriptor(Resource r) 
    Whether this instance of ProjectHelper can parse an Antlib descriptor given by the URL and return its content as an UnknownElement ready to be turned into an Antlib task.

    This method should not try to parse the content of the descriptor, the URL is only given as an argument to allow subclasses to decide whether they can support a given URL scheme or not.

    Subclasses that return true in this method must also override parseAntlibDescriptor .

    This implementation returns false.

 public boolean canParseBuildFile(Resource buildFile) 
    Check if the helper supports the kind of file. Some basic check on the extension's file should be done here.
 public static  void configure(Object target,
    AttributeList attrs,
    Project project) throws BuildException 
Deprecated! since - 1.6.x. Use IntrospectionHelper for each property.

    Configures an object using an introspection handler.
 public static  void configureProject(Project project,
    File buildFile) throws BuildException 
    Configures the project with the contents of the specified build file.
 public static String extractNameFromComponentName(String componentName) 
    extract the element name from a component name
 public static String extractUriFromComponentName(String componentName) 
    extract a uri from a component name
 public static String genComponentName(String uri,
    String name) 
    Map a namespaced {uri,name} to an internal string format. For BC purposes the names from the ant core uri will be mapped to "name", other names will be mapped to uri + ":" + name.
 public static ClassLoader getContextClassLoader() 
Deprecated! since - 1.6.x. Use LoaderUtils.getContextClassLoader()

    JDK1.1 compatible access to the context class loader. Cut & paste from JAXP.
 public static String getCurrentPrefixSeparator() 
    The separator between the prefix and the target name.

    May be set by <import>'s prefixSeperator attribute.

 public static String getCurrentTargetPrefix() 
    The prefix to prepend to imported target names.

    May be set by <import>'s as attribute.

 public String getDefaultBuildFile() 
    The file name of the build script to be parsed if none specified on the command line
 public List getExtensionStack() 
    Extension stack. Used to keep track of targets that extend extension points.
 public Vector getImportStack() 
    Import stack. Used to keep track of imported files. Error reporting should display the import path.
 public static ProjectHelper getProjectHelper() 
    Get the first project helper found in the classpath
 public static boolean isInIncludeMode() 
    Whether the current file should be read in include as opposed to import mode.

    In include mode included targets are only known by their prefixed names and their depends lists get rewritten so that all dependencies get the prefix as well.

    In import mode imported targets are known by an adorned as well as a prefixed name and the unadorned target may be overwritten in the importing build file. The depends list of the imported targets is not modified at all.

 public  void parse(Project project,
    Object source) throws BuildException 
    Parses the project file, configuring the project as it goes.
 public UnknownElement parseAntlibDescriptor(Project containingProject,
    Resource source) 
    Parse the given URL as an antlib descriptor and return the content as something that can be turned into an Antlib task.
 public static  void parsePropertyString(String value,
    Vector fragments,
    Vector propertyRefs) throws BuildException 
Deprecated! since - 1.6.x. Use PropertyHelper.

    Parses a string containing ${xxx} style property references into two lists. The first list is a collection of text fragments, while the other is a set of string property names. null entries in the first list indicate a property reference from the second list.

    As of Ant 1.8.0 this method is never invoked by any code inside of Ant itself.

 public static String replaceProperties(Project project,
    String value) throws BuildException 
Deprecated! since - 1.6.x. Use project.replaceProperties().

    Replaces ${xxx} style constructions in the given value with the string value of the corresponding properties.
 public static String replaceProperties(Project project,
    String value,
    Hashtable keys) throws BuildException 
Deprecated! since - 1.6.x. Use PropertyHelper.

    Replaces ${xxx} style constructions in the given value with the string value of the corresponding data types.
 public static  void setCurrentPrefixSeparator(String sep) 
    Sets the separator between the prefix and the target name.
 public static  void setCurrentTargetPrefix(String prefix) 
    Sets the prefix to prepend to imported target names.
 public static  void setInIncludeMode(boolean includeMode) 
    Sets whether the current file should be read in include as opposed to import mode.
 public static  void storeChild(Project project,
    Object parent,
    Object child,
    String tag) 
    Stores a configured child element within its parent object.