agentland.resource
Class Resource

java.lang.Object
  |
  +--agentland.resource.Resource

public class Resource
extends Object
implements Cloneable, Serializable

A Resource is a description of some kind of functionality that can be allocated, etc. It is not the stuff itself, AGENTS are the stuff itself, if there is any stuff. Things like wires can't be messed with, so a Resource description suffices.

See Also:
Serialized Form

Constructor Summary
Resource(Request req, String occupation)
           
Resource(Request req, String occupation, AgentID agt)
           
Resource(Request req, String name, String occupation, AgentID agt)
           
Resource(Resource r)
           
Resource(String name, String occupation, String agentID, boolean abst)
          This constructor is used by the MESS side of Krzysztof's resource manager
 
Method Summary
 Object clone()
           
 boolean equals(Object o)
           
 Context getContext()
          Get the value of context.
 String getContext(String prop_name)
          Get a specific property of this resource.
 boolean getFilled()
          Get the value of filled.
 String getName()
          Get the value of name.
 String getOccupation()
          Get the value of occupation.
 ResourceProperties getProperties()
          Get associated properties of a given Resource.
 Request getRequest()
          Get the value of request.
 Object getThing()
          Get the value of thing.
 int hashCode()
          so resources can be put in hashtables by the relevant equals() fields.
 boolean isAbstract()
          true if no agent has to be running for the resource to be available.
 void setAbstract(boolean v)
          true if no agent has to be running for the resource to be available.
 void setContext(Context v)
          Set the value of context.
 void setFilled(boolean v)
          Set the value of filled.
 void setName(String v)
          Set the value of name.
 void setOccupation(String v)
          Set the value of occupation.
 void setProperties(ResourceProperties v)
          Set the value of properties.
 void setRequest(Request v)
          Set the value of request.
 void setThing(Object v)
          Set the value of thing.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Resource

public Resource(Request req,
                String occupation)

Resource

public Resource(Request req,
                String occupation,
                AgentID agt)
Parameters:
agt - the Thing in question (retrievable with getThing()

Resource

public Resource(Request req,
                String name,
                String occupation,
                AgentID agt)
Parameters:
req - the originating request
agt - the Thing in question (retrievable with getThing()

Resource

public Resource(String name,
                String occupation,
                String agentID,
                boolean abst)
This constructor is used by the MESS side of Krzysztof's resource manager
Parameters:
name - Name of the service (distinct from the occupation)
occupation - Occupation
agentID - string version of agentID of the agent that will provide the service
abst - boolean to indicate if the service is abstract (i.e. does not require any agent to startup) or not

Resource

public Resource(Resource r)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

isAbstract

public boolean isAbstract()
true if no agent has to be running for the resource to be available. e.g. for some hardware descriptions and other non-agent resources

setAbstract

public void setAbstract(boolean v)
true if no agent has to be running for the resource to be available. e.g. for some hardware descriptions and other non-agent resources

getProperties

public ResourceProperties getProperties()
Get associated properties of a given Resource. e.g. the port for a given modem resource
Returns:
Value of properties.

setProperties

public void setProperties(ResourceProperties v)
Set the value of properties.
Parameters:
v - Value to assign to properties.

getFilled

public boolean getFilled()
Get the value of filled.
Returns:
Value of filled.

setFilled

public void setFilled(boolean v)
Set the value of filled.
Parameters:
v - Value to assign to filled.

getName

public String getName()
Get the value of name.
Returns:
Value of name.

setName

public void setName(String v)
Set the value of name.
Parameters:
v - Value to assign to name.

getOccupation

public String getOccupation()
Get the value of occupation.
Returns:
Value of occupation.

setOccupation

public void setOccupation(String v)
Set the value of occupation.
Parameters:
v - Value to assign to occupation.

getThing

public Object getThing()
Get the value of thing.
Returns:
Value of thing.

setThing

public void setThing(Object v)
Set the value of thing.
Parameters:
v - Value to assign to thing.

getContext

public Context getContext()
Get the value of context.
Returns:
Value of context.

getContext

public String getContext(String prop_name)
Get a specific property of this resource.

setContext

public void setContext(Context v)
Set the value of context. Passing null to this resets the context to an empty context (not a null variable!)
Parameters:
v - Value to assign to context.

getRequest

public Request getRequest()
Get the value of request.
Returns:
Value of request.

setRequest

public void setRequest(Request v)
Set the value of request.
Parameters:
v - Value to assign to request.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
so resources can be put in hashtables by the relevant equals() fields.
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object