Modifier and Type | Field and Description |
---|---|
private static final String | ANT_PROPERTY_TASK
special name of ant's property task -property. |
private String | antLibCurrentUri
current antlib uri |
private Stack | antLibStack
Stack of antlib contexts used to resolve definitions while processing antlib |
private final Hashtable | antTypeTable
Map from component name to anttypedefinition |
private static final String | BUILD_SYSCLASSPATH_ONLY
string used to control build.syspath policy only |
private final HashSet | checkedNamespaces
Set of namespaces that have been checked for antlibs |
public static final String | COMPONENT_HELPER_REFERENCE
reference under which we register ourselves with a project -ant.ComponentHelper |
private static Properties[] | |
private static final String | ERROR_NO_TASK_LIST_LOAD
Error string when the file taskdefs/defaults.properties cannot be found |
private static final String | ERROR_NO_TYPE_LIST_LOAD
Error string when the typedefs/defaults.properties cannot be found |
private ComponentHelper | next
this does not appear to be used anywhere in the Ant codebase even via its accessors |
private Project | project
Project that owns a component helper |
private boolean | rebuildTaskClassDefinitions
flag to rebuild taskClassDefinitions |
private boolean | rebuildTypeClassDefinitions
flag to rebuild typeClassDefinitions |
private final Map | restrictedDefinitions
Map of component name to lists of restricted definitions |
private final Hashtable | taskClassDefinitions
Map of tasks generated from antTypeTable |
private final Hashtable | typeClassDefinitions
Map of types generated from antTypeTable |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public void | addDataTypeDefinition(String
The name of the datatype.
Must not be typeName, Class<?> null .The full name of the class implementing the datatype.
Must not be typeClass)null .Adds a new datatype definition. |
public void | addDataTypeDefinition(AntTypeDefinition
an def)AntTypeDefinition value.Describe |
public void | addTaskDefinition(String
The name of the task to add.
Must not be taskName, Class<?> null .The full name of the class implementing the task.
Must not be taskClass)null .Adds a new task definition to the project. |
private synchronized void | checkNamespace(String
the name of the component, which should include a URI
prefix if it is in a namespace componentName)Called for each component name, check if the associated URI has been examined for antlibs. |
public void | checkTaskClass(final Class<?>
The class to be checked.
Must not be taskClass)null .Checks whether or not a class is suitable for serving as Ant task. |
public Object | Returns: the created component.The Unknown Element creating this component. ue, String Namespace URI. Also available as ue.getNamespace(). ns, String The component type,
Also available as ue.getComponentName(). componentType)Factory method to create the components. |
public Object | Returns: the class if found or null if not.the name of the component, if
the component is in a namespace, the
name is prefixed with the namespace uri and ":". componentName)Create an object for a component. |
public Object | Returns: an instance of the specified data type, ornull if
the data type name is not recognised.The name of the data type to create an instance of.
Must not be typeName)null .Creates a new instance of a data type. |
private Task | Returns: an instance of the specified task, ornull if
the task name is not recognised.The name of the task to create an instance of.
Must not be taskType)null .Creates a new instance of a task. |
public Task | Returns: an instance of the specified task, ornull if
the task name is not recognised.The name of the task to create an instance of.
Must not be taskType)null .Creates a new instance of a task. |
public String | Returns: a string containing as much diagnostics info as possible.component name. componentName, String component type, used in error messages type)Handler called to do decent diagnosis on instantiation failure. |
public void | enterAntLib(String
the uri that is associated with this antlib. uri)Called at the start of processing an antlib. |
public void | |
private List | Returns: the (possibly empty) list of definitionsprefix to match off prefix)Create a list of all definitions that match a prefix, usually the URI of a library |
public Hashtable | Returns: a map of from datatype name to datatype definition (String toAntTypeDefinition ).Returns the current datatype definition hashtable. |
private synchronized Set | |
private ClassLoader | |
public Class | Returns: the class if found or null if not.the name of the component, if
the component is in a namespace, the
name is prefixed with the namespace uri and ":". componentName)Return the class of the component name. |
public static ComponentHelper | Returns: the project component for a specific project.the project. project)Find a project component for a specific project, creating it if it does not exist. |
public String | |
public Hashtable | Returns: a map of from type name to implementing class (String to Class).Returns the current type definition hashtable. |
private static synchronized Properties | Returns: a mapping from definition names to class namestrue for typedefs, false for taskdefs type)Load default task or type definitions - just the names, no class loading. |
public AntTypeDefinition | Returns: the ant definition or null if not present.the name of the component. componentName)Return the antTypeDefinition for a componentName. |
public String | Returns: a description of the element type.The element to describe.
Must not be element)null .Returns a description of the type of the given element. |
public String | Returns: a description of the element type.The element to describe.
Must not be o, boolean null .whether to use a brief description. brief)Returns a description of the type of the given element. |
public static String | Returns: a description of the element type.The optional Project instance. p, Object The element to describe.
Must not be o, boolean null .whether to use a brief description. brief)Convenient way to get some element name even when you may not have a Project context. |
public ComponentHelper | |
public Project | |
private Map | |
public List | Returns: the list of restricted definitions for a particular name.the name to use. componentName)This returns a list of restricted definitions for a name. |
public Hashtable | Returns: a map of from task name to implementing class (String to Class).Returns the current task definition hashtable. |
private static String | |
public void | initDefaultDefinitions()
This method is initialization code implementing the original ant component loading from /org/apache/tools/ant/taskdefs/default.properties and /org/apache/tools/ant/types/default.properties. |
public void | initSubProject(ComponentHelper
the component helper of the parent project. helper)Used with creating child projects. |
private void | |
private void | |
private void | printClassNotFound(PrintWriter out, String classname, boolean optional, String dirListing)
Print class not found. |
private void | printNotLoadDependentClass(PrintWriter out, boolean optional, NoClassDefFoundError ncdfe, String dirListing)
Print could not load dependent class. |
private void | printUnknownDefinition(PrintWriter out, String componentName, String dirListing)
Print unknown definition.forking |
private boolean | Returns: true if the two definitions are the same.the new definition. def, AntTypeDefinition the old definition. old)Check if two definitions are the same. |
public void | setNext(ComponentHelper
the next chained component helper. next)Set the next chained component helper. |
public void | |
private void | updateDataTypeDefinition(AntTypeDefinition
the definition to update or insert. def)Update the component definition table with a new or modified definition. |
private void | updateRestrictedDefinition(AntTypeDefinition def)
update the restricted definition table with a new or modified definition. |
private boolean | Returns: true if exposed type of definition is present.the definition to test. def)Check if definition is a valid definition--it may be a definition of an optional task that does not exist. |
ANT_PROPERTY_TASK | back to summary |
---|---|
private static final String ANT_PROPERTY_TASK special name of ant's property task -property. There is some contrived work here to enable this early. |
antLibCurrentUri | back to summary |
---|---|
private String antLibCurrentUri current antlib uri |
antLibStack | back to summary |
---|---|
private Stack<String> antLibStack Stack of antlib contexts used to resolve definitions while processing antlib |
antTypeTable | back to summary |
---|---|
private final Hashtable<String, AntTypeDefinition> antTypeTable Map from component name to anttypedefinition |
BUILD_SYSCLASSPATH_ONLY | back to summary |
---|---|
private static final String BUILD_SYSCLASSPATH_ONLY string used to control build.syspath policy only |
checkedNamespaces | back to summary |
---|---|
private final HashSet<String> checkedNamespaces Set of namespaces that have been checked for antlibs |
COMPONENT_HELPER_REFERENCE | back to summary |
---|---|
public static final String COMPONENT_HELPER_REFERENCE reference under which we register ourselves with a project -ant.ComponentHelper |
defaultDefinitions | back to summary |
---|---|
private static Properties[] defaultDefinitions |
ERROR_NO_TASK_LIST_LOAD | back to summary |
---|---|
private static final String ERROR_NO_TASK_LIST_LOAD Error string when the file taskdefs/defaults.properties cannot be found |
ERROR_NO_TYPE_LIST_LOAD | back to summary |
---|---|
private static final String ERROR_NO_TYPE_LIST_LOAD Error string when the typedefs/defaults.properties cannot be found |
next | back to summary |
---|---|
private ComponentHelper next this does not appear to be used anywhere in the Ant codebase even via its accessors |
project | back to summary |
---|---|
private Project project Project that owns a component helper |
rebuildTaskClassDefinitions | back to summary |
---|---|
private boolean rebuildTaskClassDefinitions flag to rebuild taskClassDefinitions |
rebuildTypeClassDefinitions | back to summary |
---|---|
private boolean rebuildTypeClassDefinitions flag to rebuild typeClassDefinitions |
restrictedDefinitions | back to summary |
---|---|
private final Map<String, List<AntTypeDefinition>> restrictedDefinitions Map of component name to lists of restricted definitions |
taskClassDefinitions | back to summary |
---|---|
private final Hashtable<String, Class<?>> taskClassDefinitions Map of tasks generated from antTypeTable |
typeClassDefinitions | back to summary |
---|---|
private final Hashtable<String, Class<?>> typeClassDefinitions Map of types generated from antTypeTable |
ComponentHelper | back to summary |
---|---|
protected ComponentHelper() Creates a new ComponentHelper instance. |
addDataTypeDefinition | back to summary |
---|---|
public void addDataTypeDefinition(String typeName, Class<?> typeClass) Adds a new datatype definition. Attempting to override an existing definition with an equivalent one (i.e. with the same classname) results in a verbose log message. Attempting to override an existing definition with a different one results in a warning log message, but the definition is changed. |
addDataTypeDefinition | back to summary |
---|---|
public void addDataTypeDefinition(AntTypeDefinition def) Describe
|
addTaskDefinition | back to summary |
---|---|
public void addTaskDefinition(String taskName, Class<?> taskClass) Adds a new task definition to the project. Attempting to override an existing definition with an equivalent one (i.e. with the same classname) results in a verbose log message. Attempting to override an existing definition with a different one results in a warning log message.
|
checkNamespace | back to summary |
---|---|
private synchronized void checkNamespace(String componentName) Called for each component name, check if the associated URI has been examined for antlibs.
|
checkTaskClass | back to summary |
---|---|
public void checkTaskClass(final Class<?> taskClass) throws BuildException Checks whether or not a class is suitable for serving as Ant task. Ant task implementation classes must be public, concrete, and have a no-arg constructor.
|
createComponent | back to summary |
---|---|
public Object createComponent(UnknownElement ue, String ns, String componentType) throws BuildException Factory method to create the components. This should be called by UnknownElement.
|
createComponent | back to summary |
---|---|
public Object createComponent(String componentName) Create an object for a component. |
createDataType | back to summary |
---|---|
public Object createDataType(String typeName) throws BuildException Creates a new instance of a data type.
|
createNewTask | back to summary |
---|---|
private Task createNewTask(String taskType) throws BuildException Creates a new instance of a task.
|
createTask | back to summary |
---|---|
public Task createTask(String taskType) throws BuildException Creates a new instance of a task. Called from Project.createTask(), which can be called by tasks.
|
diagnoseCreationFailure | back to summary |
---|---|
public String diagnoseCreationFailure(String componentName, String type) Handler called to do decent diagnosis on instantiation failure. |
enterAntLib | back to summary |
---|---|
public void enterAntLib(String uri) Called at the start of processing an antlib.
|
exitAntLib | back to summary |
---|---|
public void exitAntLib() Called at the end of processing an antlib. |
findTypeMatches | back to summary |
---|---|
private List Create a list of all definitions that match a prefix, usually the URI of a library
|
getAntTypeTable | back to summary |
---|---|
public Hashtable Returns the current datatype definition hashtable. The returned hashtable is "live" and so should not be modified.
|
getCheckedNamespace | back to summary |
---|---|
private synchronized Set |
getClassLoader | back to summary |
---|---|
private ClassLoader getClassLoader(ClassLoader classLoader) |
getComponentClass | back to summary |
---|---|
public Class Return the class of the component name. |
getComponentHelper | back to summary |
---|---|
public static ComponentHelper getComponentHelper(Project project) Find a project component for a specific project, creating it if it does not exist.
|
getCurrentAntlibUri | back to summary |
---|---|
public String getCurrentAntlibUri()
|
getDataTypeDefinitions | back to summary |
---|---|
public Hashtable Returns the current type definition hashtable. The returned hashtable is "live" and so should not be modified. |
getDefaultDefinitions | back to summary |
---|---|
private static synchronized Properties getDefaultDefinitions(boolean type) throws BuildException Load default task or type definitions - just the names, no class loading. Caches results between calls to reduce overhead.
|
getDefinition | back to summary |
---|---|
public AntTypeDefinition getDefinition(String componentName) Return the antTypeDefinition for a componentName.
|
getElementName | back to summary |
---|---|
public String getElementName(Object element) Returns a description of the type of the given element. This is useful for logging purposes. |
getElementName | back to summary |
---|---|
public String getElementName(Object o, boolean brief) Returns a description of the type of the given element. This is useful for logging purposes. |
getElementName | back to summary |
---|---|
public static String getElementName(Project p, Object o, boolean brief) Convenient way to get some element name even when you may not have a Project context. |
getNext | back to summary |
---|---|
public ComponentHelper getNext() Get the next chained component helper.
|
getProject | back to summary |
---|---|
public Project getProject() Get the project.
|
getRestrictedDefinition | back to summary |
---|---|
private Map
|
getRestrictedDefinitions | back to summary |
---|---|
public List This returns a list of restricted definitions for a name. The returned List is "live" and so should not be modified. Also, the returned list may be modified asynchronously. Any access must be guarded with a lock on the list itself.
|
getTaskDefinitions | back to summary |
---|---|
public Hashtable Returns the current task definition hashtable. The returned hashtable is "live" and so should not be modified. Also, the returned table may be modified asynchronously. |
getUnmappedElementName | back to summary |
---|---|
private static String getUnmappedElementName(Class<?> c, boolean brief) |
initDefaultDefinitions | back to summary |
---|---|
public void initDefaultDefinitions() This method is initialization code implementing the original ant component loading from /org/apache/tools/ant/taskdefs/default.properties and /org/apache/tools/ant/types/default.properties. |
initSubProject | back to summary |
---|---|
public void initSubProject(ComponentHelper helper) Used with creating child projects. Each child project inherits the component definitions from its parent.
|
initTasks | back to summary |
---|---|
private void initTasks() Load ant's tasks. |
initTypes | back to summary |
---|---|
private void initTypes() Load ant's datatypes. |
printClassNotFound | back to summary |
---|---|
private void printClassNotFound(PrintWriter out, String classname, boolean optional, String dirListing) Print class not found. |
printNotLoadDependentClass | back to summary |
---|---|
private void printNotLoadDependentClass(PrintWriter out, boolean optional, NoClassDefFoundError ncdfe, String dirListing) Print could not load dependent class. |
printUnknownDefinition | back to summary |
---|---|
private void printUnknownDefinition(PrintWriter out, String componentName, String dirListing) Print unknown definition.forking |
sameDefinition | back to summary |
---|---|
private boolean sameDefinition(AntTypeDefinition def, AntTypeDefinition old) Check if two definitions are the same.
|
setNext | back to summary |
---|---|
public void setNext(ComponentHelper next) Set the next chained component helper.
|
setProject | back to summary |
---|---|
public void setProject(Project project) Sets the project for this component helper.
|
updateDataTypeDefinition | back to summary |
---|---|
private void updateDataTypeDefinition(AntTypeDefinition def) Update the component definition table with a new or modified definition.
|
updateRestrictedDefinition | back to summary |
---|---|
private void updateRestrictedDefinition(AntTypeDefinition def) update the restricted definition table with a new or modified definition. |
validDefinition | back to summary |
---|---|
private boolean validDefinition(AntTypeDefinition def) Check if definition is a valid definition--it may be a definition of an optional task that does not exist.
|