|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--drm.agentbase.Base
|
+--drm.core.Node
This class extends Base to become a DRM node.
A node is a member of the DRM (distributed resource machine) collective,
a collective which has the goal of serving distributed applications.
The agents living in a Node are given
the chance to observe the DRM.
The agents can cast the IBase object set through setBase into
the type IDRM, and they can access information about the DRM through it.
All communication is implemented via the standard Base messaging interface, the low level protocol is not extended.
IDRM,
IAgent.setBase(IBase), Serialized Form| Inner classes inherited from class drm.agentbase.Base |
Base.Firewall |
| Fields inherited from class drm.agentbase.Base |
AGENT, boxes, cfg, GET_JAR, group, GROUP_MISMATCH, ISALIVE, MESSAGE, name, NOT_OK, OK, PROTOCOL_VERSION, RELEASE_VERSION, SENDING_DIR |
| Constructor Summary | |
Node(java.util.Properties cfg)
Calls super constructor. |
|
| Method Summary | |
void |
addNodes(java.util.Properties cfg)
Adds the peers defined in cfg to the default peer list
of the collective. |
void |
close()
Calls super implementation and after that closes the collective. |
void |
collectiveUpdated(ContributionBox peer)
Stores the peer, and performs new commands. |
IRequest |
fireMessage(Address recipient,
java.lang.String type,
java.lang.Object content)
The observer must provide this method to allow requesting information. |
java.util.Set |
getCommands()
The controller has to return the new commands it intends to execute in the collective. |
java.lang.Object |
getContribution()
The contributor has to return its contribution to the common repository when asked through this method. |
ContributionBox |
getContribution(java.lang.String nodeName)
Returns the contribution that belongs to the given node name. |
java.util.List |
getContributions()
Returns all known contributions in the DRM collective. |
Base.Firewall |
getFirewall()
This method should return the firewall that is given to the agents. |
ContributionBox |
getNewestContribution()
Returns the most up-to-date contribution. |
Address[] |
getPeerAddresses()
Returns always null. |
java.lang.String |
getType()
Returns "Node". |
boolean |
handleMessage(Message m,
java.lang.Object object)
Handles message type "collectiveUpdate-"+getJob(). |
void |
invokeCommand(NodeCommand command)
Invokes the command on the DRM. |
void |
invokeCommandLocally(NodeCommand command)
Invokes the command only on this local node. |
IRequest |
launch(java.lang.String method,
IAgent agent,
java.lang.Object par)
Adds implementation of launch method "RANDOM". |
void |
onArrival(Address from,
Address to)
Connects to the DRM collective. |
java.lang.String |
toString()
|
| Methods inherited from class drm.agentbase.Base |
addListener, destroyAgent, dispatchAgent, fireMessage, getBaseName, getJob, getName, getNames, getProperty, getUniqueName, goOffline, goOnline, isOnline, onDestruction, removeListener, run, setBase, version, wipeClean |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface drm.core.Contributor |
getName |
| Constructor Detail |
public Node(java.util.Properties cfg)
"node" gives the address of
another living node in the form host:port.spy is "true" (case sensitive) then when
exchanging information with other nodes this will not publis its
own descriptor. Thus this will be an observer of the collective but not
a contributor. The default is false. | Method Detail |
public IRequest launch(java.lang.String method,
IAgent agent,
java.lang.Object par)
launch in class Basemethod - If "RANDOM", runs the above algorithm otherwise propagates
call to superclass.par - ignoredgetInfo method there knows two
kinds of queries: "type" which returns the type as desribed above in String
format and "address" which returns the address of the launched agent
(type Address) if status is DONE, otherwise null.public ContributionBox getContribution(java.lang.String nodeName)
IDRMgetContribution in interface IDRMpublic ContributionBox getNewestContribution()
IDRMgetNewestContribution in interface IDRMpublic java.util.List getContributions()
IDRMContributionBox, and the
type of the contribution field is NodeContribution.
Returned list might be empty, but it's never null.getContributions in interface IDRMdrm.core.IDRMCollective.getContributions()public void close()
close in class Basepublic Base.Firewall getFirewall()
BasegetFirewall in class Base
public boolean handleMessage(Message m,
java.lang.Object object)
"collectiveUpdate-"+getJob(). In fact
only forwards it to the collective.handleMessage in class Basedrm.agentbase.IAgentm - The message to handle.object - The object that is wrapped in the message. If null
then there is no binary content or it is not a serialized object
(in which case it can be read using Message.getBinary()).Message.setReply(Object),
IBase.fireMessage(Message)public java.lang.String getType()
getType in class Base
public void onArrival(Address from,
Address to)
onArrival in class Basedrm.agentbase.IAgentfrom - The address of the base from which the agent was sent.
If the agent has never been on any base it is null.to - The address of the local base at the time of the arrival.
It is not guaranteed to remain valid trough the lifetime of the
agent. If the agent has never been on a base it is null.IAgent.setBase(IBase)public void collectiveUpdated(ContributionBox peer)
collectiveUpdated in interface Observerpublic Address[] getPeerAddresses()
addPeerAddress instead, thus through a side effect.
- Specified by:
getPeerAddresses in interface Observer
- See Also:
Collective.addPeerAddress(Address)
public IRequest fireMessage(Address recipient,
java.lang.String type,
java.lang.Object content)
ObserverfireMessage in interface Observerpublic java.lang.Object getContribution()
ContributorgetContribution in interface Contributorpublic java.util.Set getCommands()
ControllergetCommands in interface Controllerpublic void addNodes(java.util.Properties cfg)
cfg to the default peer list
of the collective.
Initializes peers from the properties starting with "base" or "node".
The format of the property value should be host[:port].
If no port is given then the one defined in cfg is used, or 10101 as
default.public void invokeCommand(NodeCommand command)
public void invokeCommandLocally(NodeCommand command)
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||