|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.mobilitools.smi.goodies.RegionManager
MobiliTools $Name: $, $Id: RegionManager.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
A RegionManager instance makes it possible to deploy and manage agents,
as well as lookup agents and agent systems, through the MAF infrastructure
(i.e. implementations of MAFAgentSystem and MAFFinder interfaces).
Localization of MAFAgentSystem and MAFFinder servers is based on the
CORBA naming service.
If one naming service is running for each region, then regions must be
interconnected by federating the naming services in the naming context
of region name bindings.
RegionManager can also be run as a standalone programme in order to create
a set of agents in various existing agencies, by specifying a property file
or XML file where all necessary definitions will be read from.
Constructor Summary | |
RegionManager()
|
|
RegionManager(org.omg.CORBA.ORB orb)
|
Method Summary | |
Name |
createAgent(Location location,
java.lang.String classname,
java.lang.String codebase,
Name name,
java.lang.String place,
org.omg.CfMAF.AgentProfile profile,
java.io.Serializable agent_data,
java.lang.Object argObj)
Creates an agent at the specified agent system location. |
Name |
createAgent(java.lang.String region,
Name agency,
java.lang.String classname,
java.lang.String codebase,
Name name,
java.lang.String place,
org.omg.CfMAF.AgentProfile profile,
java.io.Serializable agent_data,
java.lang.Object[] arguments)
Creates an agent in the named agency of the specified region. |
void |
deploy(java.util.Properties props)
Performs agent creations specified by the provided properties. |
void |
deployFromPropFile(java.lang.String file)
Parses the specified property file in order to make the specified agent creations. |
void |
deployFromXMLFile(java.lang.String file)
Parses the specified XML file in order to make the specified agent creations. |
Location |
findAgency(java.lang.String region,
Name agency)
|
Location |
findAgent(java.lang.String region,
Name agent)
|
java.util.Properties |
getAgentProperties(java.lang.String region,
Name name)
|
boolean |
isRunning(Location location,
Name agent)
|
boolean |
isRunning(java.lang.String region,
Name agent)
|
Location[] |
listAgencies(java.lang.String region,
java.util.Properties properties)
|
Location[] |
listAgentLocations(java.lang.String region,
java.util.Properties properties)
|
Name[] |
listAgentNames(java.lang.String region,
java.util.Properties properties)
|
Name[] |
listAgentsIn(Location location)
|
Name[] |
listAgentsIn(Location location,
org.omg.CfMAF.AgentProfile profile)
|
static void |
main(java.lang.String[] args)
Creates/deploys agents in existing agencies, from definitions read from a property file or an XML file. |
void |
moveAgent(Location from_location,
Name agent,
Location to_location,
java.lang.String place)
Moves an agent to the specified location. |
void |
moveAgent(java.lang.String from_region,
Name agent,
java.lang.String to_region,
Name to_agency,
java.lang.String place)
Moves an agent to the named agency in the specified region. |
void |
resumeAgent(Location location,
Name agent)
Resumes the activity of the specified agent residing at the specified location. |
void |
resumeAgent(java.lang.String region,
Name agent)
Resumes the activity of the specified agent in the specified region. |
void |
suspendAgent(Location location,
Name agent)
Suspends the activity of the specified agent residing at the specified location. |
void |
suspendAgent(java.lang.String region,
Name agent)
Suspends the activity of the specified agent in the specified region. |
void |
terminateAgency(Location location)
Terminates the specified agency in the specified region. |
void |
terminateAgency(java.lang.String region,
Name agency)
Terminates the specified agency in the specified region. |
void |
terminateAgent(Location location,
Name agent)
Terminates the specified agent in the specified region. |
void |
terminateAgent(java.lang.String region,
Name agent)
Terminates the specified agent in the specified region. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RegionManager(org.omg.CORBA.ORB orb) throws BadOperation
public RegionManager() throws BadOperation
Method Detail |
public static void main(java.lang.String[] args)
args
- shall contain ORB-specific switches first, and
then either -xml xml_file
or -prop property_file
switch.deployFromPropFile(String)
,
deployFromXMLFile(String)
public void deployFromXMLFile(java.lang.String file) throws java.lang.Exception
file
- the name of the XML file to be parsed.java.lang.Exception
- a variety of exceptions if a parsing error occurs,
because of an invalid file format (check the XML content)public void deployFromPropFile(java.lang.String file) throws java.io.IOException
file
- the name of the property file to be parsed.java.io.IOException
- if the specified file could not be read.deploy(Properties)
public void deploy(java.util.Properties props)
public Name createAgent(java.lang.String region, Name agency, java.lang.String classname, java.lang.String codebase, Name name, java.lang.String place, org.omg.CfMAF.AgentProfile profile, java.io.Serializable agent_data, java.lang.Object[] arguments) throws BadOperation
region
- region nameagency
- name wrapper for agency MAF nameclassname
- the agent main class name.codebase
- the codebase for loading the agent classes
(interpreted by the specified agent system).name
- the name of the new agent.place
- the name of place where the agent will be located.profile
- new agent profile. The agent type must be compatible
with the agent system type of the target agent system.agent_data
- serializable object that will be passed as an argument
to the afterBirth() agent method, unless the arguments parameter is not null.arguments
- array of arguments that will be passed as an argument
to the afterBirth() agent method. Arguments must be Strings or object wrappers
for Java primitive types. If this parameter is null, then the agent_data
parameter is considered instead.BadOperation
- agent creation failed.MobileObject.afterBirth(AgentSystem, AgentInfo, Object)
public Name createAgent(Location location, java.lang.String classname, java.lang.String codebase, Name name, java.lang.String place, org.omg.CfMAF.AgentProfile profile, java.io.Serializable agent_data, java.lang.Object argObj) throws BadOperation
location
- agent system location where the agent must me created.classname
- the agent main class name.codebase
- the codebase for loading the agent classes
(interpreted by the specified agent system).name
- the name of the new agent.place
- the name of place where the agent will be located.profile
- new agent profile. The agent type must be compatible
with the agent system type of the target agent system.agent_data
- serializable object that will be passed as an argument
to the afterBirth() agent method, unless the arguments parameter is not null.arguments
- array of arguments that will be passed as an argument
to the afterBirth() agent method. Arguments must be Strings or object wrappers
for Java primitive types. If this parameter is null, then the agent_data
parameter is considered instead.BadOperation
- agent creation failed.MobileObject.afterBirth(AgentSystem, AgentInfo, Object)
public void moveAgent(java.lang.String from_region, Name agent, java.lang.String to_region, Name to_agency, java.lang.String place) throws BadOperation
from_region
- the name of the region the agent is currently residing in.agent
- the name of the agent.to_region
- the destination region.to_agency
- the name of the destination agency in the given destination region.place
- the destination place.BadOperation
- agent move has failed.public void moveAgent(Location from_location, Name agent, Location to_location, java.lang.String place) throws BadOperation
from_location
- current agent location.agent
- the name of the agent.to_location
- the destination location.place
- the destination place.BadOperation
- agent move has failed.public void resumeAgent(java.lang.String region, Name agent) throws BadOperation
region
- the name of the region where the agent is residing.agent
- the name wrapper of the agent MAF name.BadOperation
- either the agent was already running, or its resumption failed.public void resumeAgent(Location location, Name agent) throws BadOperation
location
- agent location.agent
- the name wrapper of the agent MAF name.BadOperationeither
- the agent was already running, or its resumption failed.public void suspendAgent(java.lang.String region, Name agent) throws BadOperation
region
- the name of the region where the agent is residing.agent
- the name wrapper of the agent MAF name.BadOperation
- either the agent was already suspended, or it could not be suspended.public void suspendAgent(Location location, Name agent) throws BadOperation
location
- agent location.agent
- the name wrapper of the agent MAF name.BadOperation
- either the agent was already suspended, or it could not be suspended.public boolean isRunning(java.lang.String region, Name agent) throws BadOperation
region
- the name of the region where the agent is residing.agent
- wrapper of the agent MAF name.BadOperation
- could not get agent activity status.public boolean isRunning(Location location, Name agent) throws BadOperation
location
- agent location.agent
- the name wrapper of the agent MAF name.BadOperation
- could not get agent activity status.public void terminateAgent(java.lang.String region, Name agent) throws BadOperation
region
- the name of the region where the agent is residing.agent
- the name wrapper of the agent MAF name.BadOperation
- public void terminateAgent(Location location, Name agent) throws BadOperation
location
- agent location.agent
- the name wrapper of the agent MAF name.BadOperation
- public void terminateAgency(java.lang.String region, Name agency) throws BadOperation
region
- the name of the region where the agency belongs to.agency
- wrapper of the agency MAF name.BadOperation
- agency could not be terminated.public void terminateAgency(Location location) throws BadOperation
location
- agency location.BadOperation
- agency could not be terminatedpublic Location[] listAgentLocations(java.lang.String region, java.util.Properties properties) throws BadOperation
region
- target regionproperties
- agent properties to match; may be null if all agents are wanted.BadOperation
- could not get list of agent locationpublic Name[] listAgentNames(java.lang.String region, java.util.Properties properties) throws BadOperation
region
- target region.properties
- agent properties to match; may be null if all agents are wanted.BadOperation
- could not get agents list.public Name[] listAgentsIn(Location location) throws BadOperation
location
- target agent system locationBadOperation
- could not get agents list.public Name[] listAgentsIn(Location location, org.omg.CfMAF.AgentProfile profile) throws BadOperation
location
- target agent system locationprofile
- agent profile to match.BadOperation
- could not get agents listpublic Location[] listAgencies(java.lang.String region, java.util.Properties properties) throws BadOperation
region
- target region.properties
- properties that selected agencies must match;
may be null if all agencies are wanted.BadOperation
- could not get agencies listpublic Location findAgent(java.lang.String region, Name agent) throws BadOperation
region
- target region.agent
- name wrapper of agent MAF name.BadOperation
- the agent could not be found.public Location findAgency(java.lang.String region, Name agency) throws BadOperation
region
- target region.agent
- name wrapper of agent system MAF name.BadOperation
- the agency could not be found.public java.util.Properties getAgentProperties(java.lang.String region, Name name) throws BadOperation
region
- target region.name
- wrapper of agent MAF name.BadOperation
- agent properties could not be obtained.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |