|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.types.DataType | +--org.apache.anteater.test.BaseDataType | +--org.apache.anteater.test.Group
A Group is a scoping mechanism for Anteater data types and tasks. A group
acts as a container for sets of Anteater objects, where member objects can
access each other. So, for example, ActionTask
tasks will
automatically use any Logger
s or Session
s defined in the
group they belong to.
Since a Group is a BaseDataType
, and that implements Groupable
, Groups can belong to groups. This is exploited to implement
group inheritance, where Groups inherit properties, loggers and
sessions from their "parent" Group, where a Group's "parent" is the Group it
belongs to.
The inheritance rules are as follows:
There is a default, primordial Group to which all Groups and Tasks belong,
unless otherwise specified. This is defined in DefaultGroup.getDefaultGroup(org.apache.tools.ant.Project)
, and is overridden by any group defined with
id 'default'.
Field Summary | |
protected String |
_id
|
protected ArrayList |
_loggers
List of LoggerFactory objects. |
protected ArrayList |
_namespaces
List of Namespace objects. |
protected ArrayList |
_props
List of Property objects. |
protected ArrayList |
_sessions
List of Session objects. |
protected ArrayList |
_tasks
List of BaseTask objects. |
protected ArrayList |
_uses
List of Feature s required by this group's actions. |
Fields inherited from class org.apache.anteater.test.BaseDataType |
debug, debugWasSet |
Fields inherited from class org.apache.tools.ant.types.DataType |
checked, description, ref |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
Group()
|
Method Summary | |
void |
add(Groupable o)
Add a Groupable Anteater object to this group. |
void |
addConfiguredGroup(Group childGroup)
Set this object as the ancestor of a group. |
void |
addLogger(LoggerFactory loggerFactory)
Add a <logger .../> to the group. |
void |
addNamespace(Namespace ns)
Add a <namespace/> to the group. |
void |
addProperty(org.apache.tools.ant.taskdefs.Property p)
Add an Ant Property to the group. |
void |
addSession(Session session)
Add a <session/> to the group. |
void |
addTask(BaseTask task)
Add a BaseTask , eg <httpRequest>, to the session. |
void |
addUses(Uses uses)
|
Group |
getGroup()
Return our ancestor Group, or a DefaultGroup if we are group with
id 'default'. |
String |
getId()
Retrieve the id which Ant refers to this object by. |
ArrayList |
getLoggers()
Retrieve Loggers. |
ArrayList |
getNamespaces()
Return a set of Properties, representing those either native to this Group, or inherited from a subgroup. |
ArrayList |
getProperties()
Return a set of Properties, representing those either native to this Group, or inherited from a subgroup. |
Session |
getSession()
|
ArrayList |
getUses()
|
void |
setGroup(Group group)
Set the parent group of this group. |
void |
setId(String id)
Set Ant id. |
void |
setInherits(String group)
Set the parent group of this group. |
String |
toString()
String representation of the group, for debugging. |
Methods inherited from class org.apache.anteater.test.BaseDataType |
debug, getDataTypeName, getDebug, getRef, print, println, setDebug, setGroup, setRefid |
Methods inherited from class org.apache.tools.ant.types.DataType |
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, tooManyAttributes |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, log, log, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected ArrayList _sessions
Session
objects.
protected ArrayList _loggers
LoggerFactory
objects.
protected ArrayList _tasks
BaseTask
objects.
protected ArrayList _props
Property
objects.
protected ArrayList _namespaces
Namespace
objects.
protected ArrayList _uses
Feature
s required by this group's actions.
protected String _id
Constructor Detail |
public Group()
Method Detail |
public void setGroup(Group group)
setGroup
in interface Groupable
setGroup
in class BaseDataType
group
- Group object to add this task to.addConfiguredGroup(org.apache.anteater.test.Group)
public void setInherits(String group)
setGroup(org.apache.anteater.test.Group)
.
public void add(Groupable o)
Groupable
Anteater object to this group.
This method is called mainly from BaseTask.setGroup(Group)
.
o
- A Session
, LoggerFactory
, Task
or Namespace
.
public void addConfiguredGroup(Group childGroup)
childGroup
- the group which will have this object as an ancestor.setGroup(org.apache.anteater.test.Group)
public void addSession(Session session)
<session/>
to the group.
public void addLogger(LoggerFactory loggerFactory)
<logger .../>
to the group.
public void addUses(Uses uses)
public void addTask(BaseTask task)
BaseTask
, eg <httpRequest>, to the session. Or
conversely, make available all objects in the Group (loggers
, sessions
and properties
to the
Task.
task
- Task to add to group.public void addProperty(org.apache.tools.ant.taskdefs.Property p)
public void addNamespace(Namespace ns)
<namespace/>
to the group.
public ArrayList getUses()
public ArrayList getLoggers()
public ArrayList getNamespaces()
public ArrayList getProperties()
public Session getSession()
public Group getGroup()
DefaultGroup
if we are group with
id 'default'.
our ancestor will just blindly adopt a 'default' group as parent. However
in our case, we could BE the 'default' group, so we check for that here.
getGroup
in class BaseDataType
public String toString()
toString
in class Object
public void setId(String id)
public String getId()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |