Class RBMap
- All Implemented Interfaces:
RBEConfigObject,Cloneable
- Group mapping - to organize agents into groups for the purpose of rulebase assignment.
- Rulebase mapping - to map rulebases to agents or groups of agents.
- Command mapping - to delegate the rulebase mapping function to an external command.
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).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this object.booleanCompares two rulebase maps.String[]getAgentRulebases(String agent, String autoGroup) Returns a list of rulebases for specified agent and the default group that this agent is belongs to.Returns the attributes of this RBMap.longReturns the checksum of this RBMap.String[]Returns the commands in the set of commands mapping.Returns file extension based on the configuration object type.String[]Returns the group names that has a group mapping.getMemberForCommand(String command) Returns the agent or group that uses the command.String[]getMembersForRulebase(String rulebase) Returns all the members that uses the specified rulebase.String[]getMembersInGroup(String group) Returns all the members in the specified group.getName()Returns the name for this RBMap.String[]Returns the rulebases that has a rulebase mapping.voidremoveCommand(String command) Removes a command mapping for the specified command.voidremoveGroup(String group) Removes a group mapping for the specified group.voidremoveRulebase(String rulebase) Removes a rulebase mapping for the specified rulebase.voidSets the attributes of this RBMap.voidsetMemberForCommand(String command, String member) Maps a command to the specified agent or group.voidsetMembersForRulebase(String rulebase, String[] members) Maps rulebases to the specified list of agents or groups.voidsetMembersInGroup(String group, String[] members) Maps a group to the specified list of agents or groups.voidDeprecated.voidWrites the rulebase map in XML representation to Writer in XML.
-
Field Details
-
FILE_EXTENSION
File extension for the rulebase map.- See Also:
-
ruleBaseMapName
Default name for rulebase map. -
ruleBaseMapFileName
Default filename for rulebase map.
-
-
Constructor Details
-
RBMap
public RBMap()Construct an empty rulebase map. -
RBMap
protected RBMap(COM.TIBCO.hawk.config.rbengine.rbmap.impl.RBMapUiModel rbMapUiModel) -
RBMap
Create a RBMap from the reader. The reader contains a rulebase map in an XML format. This constructor is useful when recreating a RBMap from RBMapXML object:RBMap schedules = new RBMap(aRBMapXML.getXMLReader());- Parameters:
reader- a reader which contain the rulebase map in XML format.- Throws:
RBMapException- if not able to create rulebase map from the reader.
-
-
Method Details
-
getFileExtension
Returns file extension based on the configuration object type.- Specified by:
getFileExtensionin interfaceRBEConfigObject- Returns:
- the file extension of the configuration object
-
getChecksum
public long getChecksum()Returns the checksum of this RBMap.- Specified by:
getChecksumin interfaceRBEConfigObject
-
setName
Deprecated.Sets the name of this RBMap. -
getName
Returns the name for this RBMap.- Specified by:
getNamein interfaceRBEConfigObject
-
setAttributes
Sets the attributes of this RBMap. -
getAttributes
Returns the attributes of this RBMap. -
getGroups
Returns the group names that has a group mapping. The groups returned can be used for getting members in the groups.- Returns:
- an array of group names that has a mapping defined for that group. Empty array if no group mapping is defined.
- See Also:
-
getMembersInGroup
Returns all the members in the specified group.- Parameters:
group- the group whose members will be retrieved.- Returns:
- an array of member names that belongs to the specified group. Empty array if the specified group has no mapping defined.
- Throws:
IllegalArgumentException- if group is null or does not start with a "+".- See Also:
-
setMembersInGroup
Maps a group to the specified list of agents or groups.- Parameters:
group- the group name for the mapping.members- a list of agents or groups that the group will contains.- Throws:
IllegalArgumentException- if the group or the members is null. A group must start with a "+".- See Also:
-
removeGroup
Removes a group mapping for the specified group.- Parameters:
group- the group of which the mapping to be removed. If group is null or does not exist, the operation is ignored.- See Also:
-
getRulebases
Returns the rulebases that has a rulebase mapping. The rulebases returned can be used for getting members in the rulebases.- Returns:
- an array of rulebases that has a mapping defined for that rulebase. Empty array if no rulebase mapping is defined.
- See Also:
-
getMembersForRulebase
Returns all the members that uses the specified rulebase.- Parameters:
rulebase- the rulebase whose members will be retrieved.- Returns:
- an array of member names that uses the specified rulebase.. Empty array if the specified rulebase has no mapping defined.
- Throws:
IllegalArgumentException- if rulebase is null.- See Also:
-
setMembersForRulebase
Maps rulebases to the specified list of agents or groups.- Parameters:
group- the group name for the mapping.members- a list of agents or groups that will use the rulebase.- Throws:
IllegalArgumentException- if the rulebase or the members is null.- See Also:
-
removeRulebase
Removes a rulebase mapping for the specified rulebase.- Parameters:
rulebase- the rulebase of which the mapping to be removed. If rulebase is null or does not exist, the operation is ignored.- See Also:
-
getCommands
Returns the commands in the set of commands mapping. The commands returned can be used for getting members for a command.- Returns:
- an array of commands that has a mapping defined for that commands. Empty array if no commands mapping is defined.
- See Also:
-
getMemberForCommand
Returns the agent or group that uses the command.- Parameters:
command- the command whose agent or group will be retrieved.- Returns:
- the agent or group that uses the specified command for generating rulebases.
- Throws:
IllegalArgumentException- if command is null.- See Also:
-
setMemberForCommand
Maps a command to the specified agent or group. If the same command is used for another agent or group, it will be replaced by the new mapping.- Parameters:
command- the command for the mapping.members- an agent or group that will use the command.- Throws:
IllegalArgumentException- if the command or the members is null.- See Also:
-
removeCommand
Removes a command mapping for the specified command.- Parameters:
command- the command of which the mapping to be removed. If command is null or does not exist, the operation is ignored.- See Also:
-
toXML
Writes the rulebase map in XML representation to Writer in XML.- Specified by:
toXMLin interfaceRBEConfigObject- Throws:
RBEConfigObjectException
-
equals
Compares two rulebase maps. The result is true if the argument is not null and is a rulebase map object has the same group, rulebase, and command mappings. -
clone
Returns a copy of this object.- Overrides:
clonein classObject- Returns:
- a copy of this object.
- Throws:
CloneNotSupportedException
-
getAgentRulebases
Returns a list of rulebases for specified agent and the default group that this agent is belongs to. The list of rulebases for an agent include rulebases for all the groups that agent belongs.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 agent3getAgentRulebases(java.lang.String,java.lang.String)will return both rulebase1 and rulebase2 for agent1.- Parameters:
agent- the agent or group whose rulebases to be retrieved.autoGroup- the automatic group that the agent is in.- Returns:
- a list of rulebases for specified agent and its autoGroup.
- See Also:
-