public class RBMap extends java.lang.Object implements RBEConfigObject, java.lang.Cloneable
Rulebases mapping contains a set of rulebase mappings. A rulebase mapping maps a rulebase to a list of agents or groups, or combination agents and groups.
Commands mapping contains a set of command mappings. A command mapping maps a command to a list of agents or groups, or combination agents and groups.
The agents and/or groups in a mapping are referred to as members of that mapping.
Methods that involve using a member may use an agent or a group as an argument.
For example, in setMembersInGroup(String group, String[] members)
, each member in the
array can represent either an agent or a group.
The Command mapping can be used as an alternate or a supplement to the main mapping portion
of the rulebase map. To use command mapping, it is required to turn on the
'useCommandMapping' flag in the rulebase map attributes by calling
Attributes.setUseCommandMapping(boolean, boolean)
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FILE_EXTENSION
File extension for the rulebase map.
|
static java.lang.String |
ruleBaseMapFileName
Default filename for rulebase map.
|
static java.lang.String |
ruleBaseMapName
Default name for rulebase map.
|
Constructor and Description |
---|
RBMap()
Construct an empty rulebase map.
|
RBMap(java.io.Reader reader)
Create a RBMap from the reader.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a copy of this object.
|
boolean |
equals(java.lang.Object obj)
Compares two rulebase maps.
|
java.lang.String[] |
getAgentRulebases(java.lang.String agent,
java.lang.String autoGroup)
Returns a list of rulebases for specified agent and the default group that this agent is belongs to.
|
Attributes |
getAttributes()
Returns the attributes of this RBMap.
|
long |
getChecksum()
Returns the checksum of this RBMap.
|
java.lang.String[] |
getCommands()
Returns the commands in the set of commands mapping.
|
java.lang.String |
getFileExtension()
Returns file extension based on the configuration object type.
|
java.lang.String[] |
getGroups()
Returns the group names that has a group mapping.
|
java.lang.String |
getMemberForCommand(java.lang.String command)
Returns the agent or group that uses the command.
|
java.lang.String[] |
getMembersForRulebase(java.lang.String rulebase)
Returns all the members that uses the specified rulebase.
|
java.lang.String[] |
getMembersInGroup(java.lang.String group)
Returns all the members in the specified group.
|
java.lang.String |
getName()
Returns the name for this RBMap.
|
java.lang.String[] |
getRulebases()
Returns the rulebases that has a rulebase mapping.
|
void |
removeCommand(java.lang.String command)
Removes a command mapping for the specified command.
|
void |
removeGroup(java.lang.String group)
Removes a group mapping for the specified group.
|
void |
removeRulebase(java.lang.String rulebase)
Removes a rulebase mapping for the specified rulebase.
|
void |
setAttributes(Attributes p)
Sets the attributes of this RBMap.
|
void |
setMemberForCommand(java.lang.String command,
java.lang.String member)
Maps a command to the specified agent or group.
|
void |
setMembersForRulebase(java.lang.String rulebase,
java.lang.String[] members)
Maps rulebases to the specified list of agents or groups.
|
void |
setMembersInGroup(java.lang.String group,
java.lang.String[] members)
Maps a group to the specified list of agents or groups.
|
void |
setName(java.lang.String name)
Deprecated.
|
void |
toXML(java.io.Writer writer)
Writes the rulebase map in XML representation to Writer in XML.
|
public static final java.lang.String FILE_EXTENSION
public static java.lang.String ruleBaseMapName
public static java.lang.String ruleBaseMapFileName
public RBMap()
public RBMap(java.io.Reader reader) throws RBMapException
RBMap schedules = new RBMap(aRBMapXML.getXMLReader());
reader
- a reader which contain the rulebase map in XML format.RBMapException
- if not able to create rulebase map from the reader.public java.lang.String getFileExtension()
getFileExtension
in interface RBEConfigObject
public long getChecksum()
getChecksum
in interface RBEConfigObject
public void setName(java.lang.String name)
public java.lang.String getName()
getName
in interface RBEConfigObject
public void setAttributes(Attributes p)
public Attributes getAttributes()
public java.lang.String[] getGroups()
public java.lang.String[] getMembersInGroup(java.lang.String group)
group
- the group whose members will be retrieved.java.lang.IllegalArgumentException
- if group is null or does not start with a "+".public void setMembersInGroup(java.lang.String group, java.lang.String[] members)
group
- the group name for the mapping.members
- a list of agents or groups that the group will contains.java.lang.IllegalArgumentException
- if the group or the members is null.
A group must start with a "+".public void removeGroup(java.lang.String group)
group
- the group of which the mapping to be removed.
If group is null or does not exist, the operation is ignored.public java.lang.String[] getRulebases()
public java.lang.String[] getMembersForRulebase(java.lang.String rulebase)
rulebase
- the rulebase whose members will be retrieved.java.lang.IllegalArgumentException
- if rulebase is null.public void setMembersForRulebase(java.lang.String rulebase, java.lang.String[] members)
group
- the group name for the mapping.members
- a list of agents or groups that will use the rulebase.java.lang.IllegalArgumentException
- if the rulebase or the members is null.public void removeRulebase(java.lang.String rulebase)
rulebase
- the rulebase of which the mapping to be removed.
If rulebase is null or does not exist, the operation is ignored.public java.lang.String[] getCommands()
public java.lang.String getMemberForCommand(java.lang.String command)
command
- the command whose agent or group will be retrieved.java.lang.IllegalArgumentException
- if command is null.public void setMemberForCommand(java.lang.String command, java.lang.String member)
command
- the command for the mapping.members
- an agent or group that will use the command.java.lang.IllegalArgumentException
- if the command or the members is null.public void removeCommand(java.lang.String command)
command
- the command of which the mapping to be removed.
If command is null or does not exist, the operation is ignored.public void toXML(java.io.Writer writer) throws RBEConfigObjectException
toXML
in interface RBEConfigObject
RBEConfigObjectException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare withpublic java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String[] getAgentRulebases(java.lang.String agent, java.lang.String autoGroup)
If a group is specified, then the rulebases for the group is returned and the autogroup is ignored.
When generating the rulebases, the rulebase map may or may not use command mapping to generate the
rulebases. This depends on the setting in the Attributes. Refere to Attributes.setUseCommandMapping(boolean, boolean)
for more details.
This method is use by the RulebaseEngine MicroAgent to generate the list of rulebases that will be loaded during startup.
For example, with the following rulebase and group mappings:
rulebase1 agent1 agent2 rulebase2 +group1 +group1 agent1 agent2 agent3
getAgentRulebases
will return both rulebase1 and rulebase2 for agent1.
agent
- the agent or group whose rulebases to be retrieved.autoGroup
- the automatic group that the agent is in.Copyright © 2000-2019 TIBCO Inc. All Rights Reserved.