This class also provide static wrappers for common introspection.
Modifier and Type | Class and Description |
---|---|
public static class | ProjectHelper.OnMissingExtensionPoint
Possible value for target's onMissingExtensionPoint attribute. |
Modifier and Type | Field and Description |
---|---|
public static final String | ANT_ATTRIBUTE_URI
The URI for ant specific attributes |
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 | ANTLIB_URI
The URI for defined types/tasks - the format is antlib:<package> |
private List | |
public static final String | HELPER_PROPERTY
Name of JVM system property which provides the name of the ProjectHelper class to use. |
private Vector | |
private static final ThreadLocal | |
private static final ThreadLocal | |
public static final String | PROJECTHELPER_REFERENCE
name of project helper reference that we add to a project |
public static final String | SERVICE_ID
The service identifier in jars which provide Project Helper implementations. |
private static final ThreadLocal | |
public static final String | USE_PROJECT_NAME_AS_TARGET_PREFIX
constant to denote use project name as target prefix |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public static BuildException | 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 exceptionthe build exception, if the build exception
does not include ex, Location the location of the calling task (may be null) newLocation)Add location to build exception. |
public static void | addText(Project
The project containing the target.
Must not be project, Object null .The target object to be configured.
Must not be target, char[] null .A character array of the text within the element.
Will not be buf, int null .The start element in the array. start, int The number of characters to read from the array. count)Adds the content of #PCDATA sections to an element. |
public static void | |
public boolean | Returns: booleanResource 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. |
public boolean | Returns: true if the helper supports itthe file expected to be parsed (never buildFile)null )Check if the helper supports the kind of file. |
public static void | configure(Object
The target object to be configured.
Must not be target, AttributeList null .A list of attributes to configure within the target.
Must not be attrs, Project null .The project containing the target.
Must not be project)null .
Deprecated
since 1.6.x.
Use IntrospectionHelper for each property.
Configures an object using an introspection handler.
|
public static void | configureProject(Project
The project to configure. Must not be project, File null .A build file giving the project's configuration.
Must not be buildFile)null .Configures the project with the contents of the specified build file. |
public static String | Returns: The element name of the componentThe stringified form for {uri, name} componentName)extract the element name from a component name |
public static String | Returns: The uri or "" if not presentThe stringified form for {uri, name} componentName)extract a uri from a component name |
public static String | Returns: The stringified form of the ns nameThe namespace URI uri, String The localname name)Map a namespaced {uri,name} to an internal string format. |
public static ClassLoader | Returns: the current context class loader, ornull
if the context class loader is unavailable.
Deprecated
since 1.6.x.
Use LoaderUtils.getContextClassLoader()
JDK1.1 compatible access to the context class loader.
|
public static String | |
public static String | Returns: the configured prefix or nullThe prefix to prepend to imported target names. |
public String | Returns: the name of the default file (nevernull )The file name of the build script to be parsed if none specified on the command line |
public List | Returns: a list of three element string arrays where the first element is the name of the extensionpoint, the second the name of the target and the third the name of the enum like classOnMissingExtensionPoint .Extension stack. |
public Vector | |
public static ProjectHelper | Returns: an project helper, nevernull Get the first project helper found in the classpath |
public static boolean | Returns: booleanWhether the current file should be read in include as opposed to import mode. |
public static String | Returns: the converted value.the xml namespace uri. ns)Convert an attribute namespace to a "component name". |
public void | parse(Project
The project for the resulting ProjectHelper to configure.
Must not be project, Object null .The source for XML configuration. A helper must support
at least File, for backward compatibility. Helpers may
support URL, InputStream, etc or specialized types. source)Parses the project file, configuring the project as it goes. |
public UnknownElement | Returns: UnknownElementProject containingProject, Resource 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
Text to parse. Must not be value, Vector<String> null .List to add text fragments to.
Must not be fragments, Vector<String> null .List to add property names to.
Must not be propertyRefs)null .
Deprecated
since 1.6.x.
Use PropertyHelper.
Parses a string containing ${xxx} style property
references into two lists.
|
public static String | Returns: the original string with the properties replaced, ornull if the original string is null .The project containing the properties to replace.
Must not be project, String null .The string to be scanned for property references.
May be value)null .
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 | Returns: the original string with the properties replaced, ornull if the original string is null .The container project. This is used solely for
logging purposes. Must not be project, String null .The string to be scanned for property references.
May be value, Hashtable<String, Object> null , in which case this
method returns immediately with no effect.Mapping (String to Object) of property names to their
values. Must not be keys)null .
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 void | resolveExtensionOfAttributes(Project
The project containing the target. Must not be
project)null .Check extensionStack and inject all targets having extensionOf attributes into extensionPoint. |
public static void | setCurrentPrefixSeparator(String
String sep)Sets the separator between the prefix and the target name. |
public static void | |
public static void | setInIncludeMode(boolean
boolean includeMode)Sets whether the current file should be read in include as opposed to import mode. |
public static void | storeChild(Project
Project containing the objects.
May be project, Object null .Parent object to add child to.
Must not be parent, Object null .Child object to store in parent.
Should not be child, String null .Name of element which generated the child.
May be tag)null , in which case
the child is not stored.Stores a configured child element within its parent object. |
ANT_ATTRIBUTE_URI | back to summary |
---|---|
public static final String ANT_ATTRIBUTE_URI The URI for ant specific attributes
|
ANT_CORE_URI | back to summary |
---|---|
public static final String ANT_CORE_URI The URI for ant name space |
ANT_CURRENT_URI | back to summary |
---|---|
public static final String ANT_CURRENT_URI The URI for antlib current definitions |
ANT_TYPE | back to summary |
---|---|
public static final String ANT_TYPE Polymorphic attribute |
ANTLIB_URI | back to summary |
---|---|
public static final String ANTLIB_URI
Deprecated use MagicNames.ANTLIB_PREFIX The URI for defined types/tasks - the format is antlib:<package> |
extensionStack | back to summary |
---|---|
private List<String[]> extensionStack |
HELPER_PROPERTY | back to summary |
---|---|
public static final String HELPER_PROPERTY
Deprecated use MagicNames.PROJECT_HELPER_CLASS Name of JVM system property which provides the name of the ProjectHelper class to use. |
importStack | back to summary |
---|---|
private Vector<Object> importStack |
inIncludeMode | back to summary |
---|---|
private static final ThreadLocal<Boolean> inIncludeMode |
prefixSeparator | back to summary |
---|---|
private static final ThreadLocal<String> prefixSeparator |
PROJECTHELPER_REFERENCE | back to summary |
---|---|
public static final String PROJECTHELPER_REFERENCE
Deprecated use MagicNames.REFID_PROJECT_HELPER name of project helper reference that we add to a project |
SERVICE_ID | back to summary |
---|---|
public static final String SERVICE_ID
Deprecated use MagicNames.PROJECT_HELPER_SERVICE The service identifier in jars which provide Project Helper implementations. |
targetPrefix | back to summary |
---|---|
private static final ThreadLocal<String> targetPrefix |
USE_PROJECT_NAME_AS_TARGET_PREFIX | back to summary |
---|---|
public static final String USE_PROJECT_NAME_AS_TARGET_PREFIX constant to denote use project name as target prefix
|
ProjectHelper | back to summary |
---|---|
public ProjectHelper() |
addLocationToBuildException | back to summary |
---|---|
public static BuildException addLocationToBuildException(BuildException ex, Location newLocation) Add location to build exception.
|
addText | back to summary |
---|---|
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.
|
addText | back to summary |
---|---|
public static void addText(Project project, Object target, String text) throws BuildException Adds the content of #PCDATA sections to an element.
|
canParseAntlibDescriptor | back to summary |
---|---|
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 This implementation returns false.
|
canParseBuildFile | back to summary |
---|---|
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.
|
configure | back to summary |
---|---|
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.
|
configureProject | back to summary |
---|---|
public static void configureProject(Project project, File buildFile) throws BuildException Configures the project with the contents of the specified build file.
|
extractNameFromComponentName | back to summary |
---|---|
public static String extractNameFromComponentName(String componentName) extract the element name from a component name |
extractUriFromComponentName | back to summary |
---|---|
public static String extractUriFromComponentName(String componentName) extract a uri from a component name |
genComponentName | back to summary |
---|---|
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. |
getContextClassLoader | back to summary |
---|---|
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.
|
getCurrentPrefixSeparator | back to summary |
---|---|
public static String getCurrentPrefixSeparator() The separator between the prefix and the target name. May be set by <import>'s prefixSeparator attribute.
|
getCurrentTargetPrefix | back to summary |
---|---|
public static String getCurrentTargetPrefix() The prefix to prepend to imported target names. May be set by <import>'s as attribute.
|
getDefaultBuildFile | back to summary |
---|---|
public String getDefaultBuildFile() The file name of the build script to be parsed if none specified on the command line
|
getExtensionStack | back to summary |
---|---|
public List Extension stack. Used to keep track of targets that extend extension points.
|
getImportStack | back to summary |
---|---|
public Vector Import stack. Used to keep track of imported files. Error reporting should display the import path. |
getProjectHelper | back to summary |
---|---|
public static ProjectHelper getProjectHelper() Get the first project helper found in the classpath
|
isInIncludeMode | back to summary |
---|---|
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.
|
nsToComponentName | back to summary |
---|---|
public static String nsToComponentName(String ns) Convert an attribute namespace to a "component name". |
parse | back to summary |
---|---|
public void parse(Project project, Object source) throws BuildException Parses the project file, configuring the project as it goes.
|
parseAntlibDescriptor | back to summary |
---|---|
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.
|
parsePropertyString | back to summary |
---|---|
public static void parsePropertyString(String value, Vector<String> fragments, Vector<String> propertyRefs) throws BuildException
Deprecated since 1.6.x. Use PropertyHelper. Parses a string containing As of Ant 1.8.0 this method is never invoked by any code inside of Ant itself.
|
replaceProperties | back to summary |
---|---|
public static String replaceProperties(Project project, String value) throws BuildException
Deprecated since 1.6.x. Use project.replaceProperties(). Replaces
|
replaceProperties | back to summary |
---|---|
public static String replaceProperties(Project project, String value, Hashtable<String, Object> keys) throws BuildException
Deprecated since 1.6.x. Use PropertyHelper. Replaces
|
resolveExtensionOfAttributes | back to summary |
---|---|
public void resolveExtensionOfAttributes(Project project) throws BuildException Check extensionStack and inject all targets having extensionOf attributes into extensionPoint. This method allow you to defer injection and have a powerful control of extensionPoint wiring. This should be invoked by each concrete implementation of ProjectHelper when the root "buildfile" and all imported/included buildfile are loaded.
|
setCurrentPrefixSeparator | back to summary |
---|---|
public static void setCurrentPrefixSeparator(String sep) Sets the separator between the prefix and the target name.
|
setCurrentTargetPrefix | back to summary |
---|---|
public static void setCurrentTargetPrefix(String prefix) Sets the prefix to prepend to imported target names.
|
setInIncludeMode | back to summary |
---|---|
public static void setInIncludeMode(boolean includeMode) Sets whether the current file should be read in include as opposed to import mode.
|
storeChild | back to summary |
---|---|
public static void storeChild(Project project, Object parent, Object child, String tag) Stores a configured child element within its parent object.
|
This class behaves like a Java 1.5 Enum class.
Modifier and Type | Field and Description |
---|---|
public static final ProjectHelper. | FAIL
fail if the extension-point is not defined |
public static final ProjectHelper. | IGNORE
ignore the extensionOf attribute if the extension-point is not defined |
private final String | |
private static final ProjectHelper. | |
public static final ProjectHelper. | WARN
warn if the extension-point is not defined |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public String | |
public String | |
public static ProjectHelper. |
FAIL | back to summary |
---|---|
public static final ProjectHelper. fail if the extension-point is not defined |
IGNORE | back to summary |
---|---|
public static final ProjectHelper. ignore the extensionOf attribute if the extension-point is not defined |
name | back to summary |
---|---|
private final String name |
values | back to summary |
---|---|
private static final ProjectHelper. |
WARN | back to summary |
---|---|
public static final ProjectHelper. warn if the extension-point is not defined |
OnMissingExtensionPoint | back to summary |
---|---|
private OnMissingExtensionPoint(String name) |
name | back to summary |
---|---|
public String name() |
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of the object.
|
valueOf | back to summary |
---|---|
public static ProjectHelper. |