| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectorg.apache.tools.ant.ProjectHelperpublic class ProjectHelperextends java.lang.ObjectField Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
Constructor Summary | |
| |
Method Summary | |
static BuildException |
|
static void | |
static void | |
static void | |
static void |
|
static String |
|
static String |
|
static String |
|
static ClassLoader |
|
Vector |
|
static ProjectHelper |
|
void | |
static void |
|
static String |
|
static String |
|
static void |
|
public static final String ANTLIB_URI
The URI for defined types/tasks - the format is antlib:
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 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 BuildException addLocationToBuildException(BuildException ex, Location newLocation)
Add location to build exception.
- Parameters:
ex- the build exception, if the build exception does not includenewLocation- the location of the calling task (may be null)
- Returns:
- a new build exception based in the build exception with location set to newLocation. If the original exception did not have a location, just return the build exception
public static void addText(Project project, Object target, String text) throws BuildException
Adds the content of #PCDATA sections to an element.
- Parameters:
project- The project containing the target. Must not benull.target- The target object to be configured. Must not benull.text- Text to add to the target. May benull, in which case this method call is a no-op.
- Throws:
BuildException- if the target object doesn't accept text
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.
- Parameters:
project- The project containing the target. Must not benull.target- The target object to be configured. Must not benull.buf- A character array of the text within the element. Will not benull.start- The start element in the array.count- The number of characters to read from the array.
- Throws:
BuildException- if the target object doesn't accept text
public static void configure(Object target,
AttributeList attrs,
Project project)
throws BuildExceptionDeprecated. Use IntrospectionHelper for each property
Configures an object using an introspection handler.
- Parameters:
target- The target object to be configured. Must not benull.attrs- A list of attributes to configure within the target. Must not benull.project- The project containing the target. Must not benull.
- Throws:
BuildException- if any of the attributes can't be handled by the target
public static void configureProject(Project project, File buildFile) throws BuildException
Deprecated. Use the non-static parse method
Configures the project with the contents of the specified XML file.
- Parameters:
project- The project to configure. Must not benull.buildFile- An XML file giving the project's configuration. Must not benull.
- Throws:
BuildException- if the configuration is invalid or cannot be read
public static String extractNameFromComponentName(String componentName)
extract the element name from a component name
- Parameters:
componentName- The stringified form for {uri, name}
- Returns:
- The element name of the component
public static String extractUriFromComponentName(String componentName)
extract a uri from a component name
- Parameters:
componentName- The stringified form for {uri, name}
- Returns:
- The uri or "" if not present
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.
- Parameters:
uri- The namepace URIname- The localname
- Returns:
- The stringified form of the ns name
public static ClassLoader getContextClassLoader()
Deprecated. Use LoaderUtils.getContextClassLoader()
JDK1.1 compatible access to the context class loader. Cut&paste from JAXP.
- Returns:
- the current context class loader, or
nullif the context class loader is unavailable.
public Vector getImportStack()
EXPERIMENTAL WILL_CHANGE Import stack. Used to keep track of imported files. Error reporting should display the import path.
- Returns:
- the stack of import source objects.
public static ProjectHelper getProjectHelper() throws BuildException
Discovers a project helper instance. Uses the same patterns as JAXP, commons-logging, etc: a system property, a JDK1.3 service discovery, default.
- Returns:
- a ProjectHelper, either a custom implementation if one is available and configured, or the default implementation otherwise.
- Throws:
BuildException- if a specified helper class cannot be loaded/instantiated.
public void parse(Project project, Object source) throws BuildException
Parses the project file, configuring the project as it goes.
- Parameters:
project- The project for the resulting ProjectHelper to configure. Must not benull.source- The source for XML configuration. A helper must support at least File, for backward compatibility. Helpers may support URL, InputStream, etc or specialized types.
- Throws:
BuildException- if the configuration is invalid or cannot be read
- Since:
- Ant1.5
public static void parsePropertyString(String value,
Vector fragments,
Vector propertyRefs)
throws BuildExceptionDeprecated. 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.nullentries in the first list indicate a property reference from the second list.
- Parameters:
value- Text to parse. Must not benull.fragments- List to add text fragments to. Must not benull.propertyRefs- List to add property names to. Must not benull.
- Throws:
BuildException- if the string contains an opening${without a closing}
public static String replaceProperties(Project project, String value) throws BuildException
Deprecated. Use project.replaceProperties()
Replaces${xxx}style constructions in the given value with the string value of the corresponding properties.
- Parameters:
project- The project containing the properties to replace. Must not benull.value- The string to be scanned for property references. May benull.
- Returns:
- the original string with the properties replaced, or
nullif the original string isnull.
- Throws:
BuildException- if the string contains an opening${without a closing}
- Since:
- 1.5
public static String replaceProperties(Project project, String value, Hashtable keys) throws BuildException
Deprecated. Use PropertyHelper
Replaces${xxx}style constructions in the given value with the string value of the corresponding data types.
- Parameters:
project- The container project. This is used solely for logging purposes. Must not benull.value- The string to be scanned for property references. May benull, in which case this method returns immediately with no effect.keys- Mapping (String to String) of property names to their values. Must not benull.
- Returns:
- the original string with the properties replaced, or
nullif the original string isnull.
- Throws:
BuildException- if the string contains an opening${without a closing}
public static void storeChild(Project project, Object parent, Object child, String tag)
Stores a configured child element within its parent object.
- Parameters:
project- Project containing the objects. May benull.parent- Parent object to add child to. Must not benull.child- Child object to store in parent. Should not benull.tag- Name of element which generated the child. May benull, in which case the child is not stored.