|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--metaglue.AgentAgent | +--agentland.util.GoodAgent | +--agentland.resource.ManagedAgent
The resource manager allows agents to invisibly used our resource system (whatever it may be) without fuss. When an agent does a relies on call it gets back an EHA as normal, but the resource part of the agent keeps that object in a hashtable and replaced the agent stub with the new agents stub if the resources are swapped on the agent When an agent extends the resource agent, it can both use resources and provide them. In fact you must extend resource agent if you want to do either. Hopefully extending the research agent, and doing nothing else, but will suffice in most cases (with the possible addition of describing the agent in whatever language necessary). WARNING: reliesOn( occ ) and reliesOn( occ, des ) are now resource requests. However reliesOn( AgentID ) is NOT.
Inner classes inherited from class metaglue.AgentAgent |
AgentAgent.Attribute |
Field Summary | |
protected ResourceManager |
rm
This is the ResourceManager which gives us all our resources. |
protected Society |
society
Our society, to ask questions of and stuff. |
Fields inherited from class agentland.util.GoodAgent |
alert, notifier |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Fields inherited from interface metaglue.Agent |
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING |
Constructor Summary | |
ManagedAgent()
Our constructor. |
Method Summary | |
boolean |
connect(AgentID start,
AgentID end)
Connect two agents together (in whatever sense makes sense.) |
protected void |
getAlert()
|
Need |
getNeed(String requestName)
This is a very simple implementation of getNeed -- it returns medium need if we have the request and 0 if we do not have it. |
protected boolean |
isAvailable(Agent a)
This method returns true if the agent stub given as a parameter can still be used (i.e. |
protected boolean |
isAvailable(String resBunchName)
Checks if all resources in the resource bunch with the given name are available. |
Agent |
reliesOn(String occ)
This most general reliesOn should grab resource. |
Agent |
reliesOn(String occ,
Object des)
This most general reliesOn should grab resource. |
void |
replace(Resource old_r,
Resource new_r)
A callback from the resource manager saying the resource has been replaced by a new resource in a given request. |
void |
replace(String requestName,
String resourceName,
Resource new_r)
Does yanking given the name of a resource and the request bunch that got the resource |
ResourceBunch |
request(Request req,
Context con)
The main request type. |
ResourceBunch |
request(String req)
This request assumes no context. |
ResourceBunch |
request(String request,
Context con)
A general request. |
Agent |
requestAgent(String occupation)
The real request agent. |
Agent |
requestAgent(String occupation,
String des)
Request any agent implementing a given Interface. |
Vector |
resources(Filter f)
Get all resources used that match the given filter. |
Vector |
resourcesByAgentID(Filter f)
Given a filter, look through the agentIDs of the resources for matches, instead of looking at the Resource objects themselves. |
void |
setNeed(String requestName,
float need)
Allows the agent to set its need for any resource it uses (or plans to use) |
void |
tiedTo(ResourceBunch rb)
This method is a shortcut for tiedTo -- it takes in a resource bunch as the argument. |
protected void |
yank(Resource r)
yank an individual resource. |
void |
yank(ResourceBunch rb)
A callback from the resource manager (or other) saying resource is dead. |
void |
yank(String requestName)
Does yanking given the name of the initial request that got us a resource bunch |
Methods inherited from class agentland.util.GoodAgent |
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, lookupClass, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface agentland.util.Good |
getHistory, getHistoryElement, resetHistory |
Methods inherited from interface metaglue.Agent |
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou |
Methods inherited from interface agentland.util.Spy |
tell |
Field Detail |
protected ResourceManager rm
protected Society society
Constructor Detail |
public ManagedAgent() throws RemoteException
Method Detail |
protected boolean isAvailable(String resBunchName)
protected boolean isAvailable(Agent a)
public ResourceBunch request(String req)
public ResourceBunch request(String request, Context con)
public ResourceBunch request(Request req, Context con)
public Agent requestAgent(String occupation, String des)
public Agent requestAgent(String occupation)
public void yank(String requestName) throws RemoteException
yank
in interface Managed
public void yank(ResourceBunch rb)
yank
in interface Managed
protected void yank(Resource r)
public void replace(String requestName, String resourceName, Resource new_r) throws RemoteException
replace
in interface Managed
public void replace(Resource old_r, Resource new_r)
replace
in interface Managed
public boolean connect(AgentID start, AgentID end) throws RemoteException
public Agent reliesOn(String occ)
reliesOn
in class AgentAgent
metaglue.AgentAgent
agentID
- agentID of agent to startSpreadError
- some reliance could not spreadAgentNotDefinedError
- some part of the agent was not
completely definedNativityError
- an error occurred during the construction of
agent.InvalidArgumentException
- (runtime) agentID is nullpublic Agent reliesOn(String occ, Object des)
reliesOn
in class AgentAgent
metaglue.AgentAgent
AgentAgent.reliesOn(String)
public void tiedTo(ResourceBunch rb) throws RemoteException
protected void getAlert()
getAlert
in class GoodAgent
public void setNeed(String requestName, float need) throws RemoteException
public Need getNeed(String requestName) throws RemoteException
getNeed
in interface Managed
requestName
- The name of the request -- for simple agent
this will be the occupation requestedpublic Vector resources(Filter f)
resources
in interface Managed
public Vector resourcesByAgentID(Filter f)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |