|
|||||||||
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 |
Fields inherited from interface metaglue.Agent |
ALIVE,
DIED,
NO_METAGLUE,
NOT_RUNNING,
STARTING |
Constructor Summary | |
ManagedAgent()
|
Method Summary | |
boolean |
connect(AgentID start,
AgentID end)
Connect two agents together (in whatever sense makes sense.) |
protected void |
getAlert()
|
float |
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. |
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. |
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 |
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 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,
toString,
toStub |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected ResourceManager rm
protected Society society
Constructor Detail |
public ManagedAgent() throws RemoteException
Method Detail |
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
public void yank(ResourceBunch rb)
public void yank(Resource r)
public void replace(Resource old_r, Resource new_r)
public boolean connect(AgentID start, AgentID end) throws RemoteException
public Agent reliesOn(String occ)
agentID
- agentID of agent to startpublic Agent reliesOn(String occ, Object des)
AgentAgent.reliesOn(String)
protected void getAlert()
public void setNeed(String requestName, float need) throws RemoteException
public float getNeed(String requestName) throws RemoteException
requestName
- The name of the request -- for simple agent
sthis will be the occupation requestedpublic Vector resources(Filter f)
public Vector resourcesByAgentID(Filter f)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |