drm.agentbase
Class Base.Firewall
java.lang.Object
|
+--drm.agentbase.Base.Firewall
- All Implemented Interfaces:
- IBase
- Enclosing class:
- Base
- protected class Base.Firewall
- extends java.lang.Object
- implements IBase
This is an implementation of IBase hiding
the public functions which are not part of IBase.
This is the class that serves as a firewall between the base and the
agents.
Field Summary |
protected IBase |
b
|
Method Summary |
void |
close()
|
void |
destroyAgent(java.lang.String name)
Destroys an agent with all necessary clean up. |
IRequest |
dispatchAgent(java.lang.String name,
Address dest)
Dispatches an agent with all necessary clean up. |
IRequest |
fireMessage(Message m)
Fires the given message. |
java.util.Set |
getNames()
Gets the names of all agents on this base. |
java.lang.String |
getProperty(java.lang.String p)
Retuns a base property. |
boolean |
isOnline()
Returns the online status of the base. |
IRequest |
launch(java.lang.String method,
IAgent a,
java.lang.Object par)
Launches an agent to a specified destination. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
b
protected IBase b
Base.Firewall
protected Base.Firewall()
close
public void close()
getProperty
public final java.lang.String getProperty(java.lang.String p)
- Description copied from interface:
IBase
- Retuns a base property. Properties are mostly set and documented
at construction time of implementor classes
(see also the constructors of the extending classes).
The following properties must be defined in every case:
drm.baseName
The name of the base.
- Specified by:
getProperty
in interface IBase
- Following copied from interface:
drm.agentbase.IBase
- Parameters:
prop
- Name of the property.- Returns:
- As in java.util.Properties.
- See Also:
Base.Base(java.util.Properties)
getNames
public final java.util.Set getNames()
- Description copied from interface:
IBase
- Gets the names of all agents on this base. Returns a newly
allocated Set of Strings. This is the only solution that is
guaranteed to be thread safe.
- Specified by:
getNames
in interface IBase
destroyAgent
public final void destroyAgent(java.lang.String name)
- Description copied from interface:
IBase
- Destroys an agent with all necessary clean up. The method
IAgent.onDestruction()
will
be called before removing the agent from the base. The agent has to
stop all its threads (java offers no possibility at the moment
(version 1.4) to stop threads). The agent will be cut off of the
outside world, even if it fails to stop its threads.
- Specified by:
destroyAgent
in interface IBase
- Following copied from interface:
drm.agentbase.IBase
- Parameters:
name
- Name of the agent.
dispatchAgent
public final IRequest dispatchAgent(java.lang.String name,
Address dest)
- Description copied from interface:
IBase
- Dispatches an agent with all necessary clean up. The succesful
operation means sending the agent to the address, then destroying
the local copy. Permission to send an agent implies destroying it
so it is not possible that sending is succesful but destruction is
not.
If succesful then the local agent is destroyed after sending by
calling
destroyAgent
.
The operation is assynchronous.
- Specified by:
dispatchAgent
in interface IBase
- Following copied from interface:
drm.agentbase.IBase
- Parameters:
name
- Name of the agent.destination
- Where to send the agent.- Returns:
- Returns a request so that the user can check the status
of the operation.
- See Also:
IBase.destroyAgent(String)
launch
public final IRequest launch(java.lang.String method,
IAgent a,
java.lang.Object par)
- Description copied from interface:
IBase
- Launches an agent to a specified destination.
It is assumed that the agent to be launched is not in the base.
The operation is assynchronous.
- Specified by:
launch
in interface IBase
- Following copied from interface:
drm.agentbase.IBase
- Parameters:
method
- The algorithm used for launching the agent.
At least "DIRECT" has to be implemented. Other algorithms have to
be documented in the implementing class.agent
- Agent to launch.parameter
- An arbitrary parameter (list) of the selected
launching algorithm. In the case of "DIRECT" the address of the
recipient base of type Address.
If null then the local base is the destination.- Returns:
- Returns a request so that the user can check the status
of the operation.
- Throws:
java.lang.IllegalArgumentException
- if the arguments are not of the
right type or inconsistent.
fireMessage
public final IRequest fireMessage(Message m)
- Description copied from interface:
IBase
- Fires the given message. The recipient can be local or global.
From the sender address only the name is used the rest is filled
in by the base and the recipient base. The message is sent by a
separate thread in case of a remote destination.
- Specified by:
fireMessage
in interface IBase
- Following copied from interface:
drm.agentbase.IBase
- Returns:
- Returns a request so that the user can check the status
of the operation. The method call
IRequest.getInfo("reply")
returns the reply object to
the message (after it arrives of course). - See Also:
IRequest.getInfo(String)
isOnline
public final boolean isOnline()
- Description copied from interface:
IBase
- Returns the online status of the base. If the base is not online,
communication with the outside world is not possible.
- Specified by:
isOnline
in interface IBase