|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jade.domain.FIPAService | +--jade.domain.AMSService
This class provides a set of static methods to communicate with
a AMS Service that complies with FIPA specifications.
Notice that JADE calls automatically the register and deregister methods
with the default AMS respectively before calling Agent.setup()
method and just
after Agent.takeDown()
method returns; so there is no need for a normal
programmer to call them.
However, under certain circumstances, a programmer might need to call its
methods. To give some examples: when an agent wishes to register with the
AMS of a remote agent platform, or when an agent wishes to modify its
description by adding a private address to the set of its addresses, ...
It includes methods to register, deregister, modify and search with an AMS.
Each of this method has version with all the needed parameters, or with a
subset of them where, those parameters that can be omitted have been
defaulted to the default AMS of the platform, the AID of the sending agent,
the default Search Constraints.
Notice that all these methods blocks every activity of the agent until the
action (i.e. register/deregister/modify/search) has been successfully
executed or a jade.domain.FIPAException exception has been thrown
(e.g. because a FAILURE message has been received by the AMS).
In some cases, instead, it is more convenient to execute this task in a
non-blocking way. The method getNonBlockingBehaviour() returns a
non-blocking behaviour of type RequestFIPAServiceBehaviour that can be
added to the queue of the agent behaviours, as usual, by using
Agent.addBehaviour()
.
Constructor Summary | |
AMSService()
Default constructor. |
Method Summary | |
static void |
deregister(Agent a)
A default AMSAgentDescription is used for this agent, where only AID and state are set. |
static void |
deregister(Agent a,
AID AMSName)
A default AMSAgentDescription is used for this agent, where only AID and state are set (state is set to ACTIVE). |
static void |
deregister(Agent a,
AID AMSName,
AMSAgentDescription amsd)
Deregister a AMSAgentDescription from a AMS agent. |
static void |
deregister(Agent a,
AMSAgentDescription amsd)
The AID of the AMS is defaulted to the AMS of this platform. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
AID amsName,
java.lang.String actionName)
the default SearchContraints are used. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
AID amsName,
java.lang.String actionName,
AMSAgentDescription amsd)
the default AMS is used. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
AID AMSName,
java.lang.String actionName,
AMSAgentDescription amsd,
SearchConstraints constraints)
In some cases it is more convenient to execute this tasks in a non-blocking way. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
java.lang.String actionName)
the default AMS is used. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
java.lang.String actionName,
AMSAgentDescription amsd)
the default AMS is used. |
static jade.domain.RequestFIPAServiceBehaviour |
getNonBlockingBehaviour(Agent a,
java.lang.String actionName,
AMSAgentDescription amsd,
SearchConstraints constraints)
the default AMS is used. |
static void |
modify(Agent a,
AID AMSName,
AMSAgentDescription amsd)
Modifies data contained within a AMS agent. |
static void |
modify(Agent a,
AMSAgentDescription amsd)
The AID of the AMS is defaulted to the AMS of this platform. |
static void |
register(Agent a,
AID AMSName,
AMSAgentDescription amsd)
Register a AMSAgentDescription with a AMS agent. |
static void |
register(Agent a,
AMSAgentDescription amsd)
registers a AMSAgentDescription with the default AMS |
static AMSAgentDescription[] |
search(Agent a,
AID AMSName,
AMSAgentDescription amsd)
searches with the passed AMS by using the default SearchConstraints. |
static AMSAgentDescription[] |
search(Agent a,
AID AMSName,
AMSAgentDescription amsd,
SearchConstraints constraints)
Searches for data contained within a AMS agent. |
static AMSAgentDescription[] |
search(Agent a,
AMSAgentDescription amsd)
searches with the default AMS and the default SearchConstraints. |
static AMSAgentDescription[] |
search(Agent a,
AMSAgentDescription amsd,
SearchConstraints constraints)
searches with the default AMS |
Methods inherited from class jade.domain.FIPAService |
doFipaRequestClient, doFipaRequestClient |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AMSService()
Method Detail |
public static void register(Agent a, AID AMSName, AMSAgentDescription amsd) throws FIPAException
a
- is the Agent performing the registrationAMSName
- The AID of the AMS agent to register with.amsd
- A AMSAgentDescriptor
object containing all
data necessary to the registration. If the Agent name is empty, than
it is set according to the a
parameter. If the Agent state is
empty, than it is set to ACTIVE.
FIPAException
- A suitable exception can be thrown when
a refuse
or failure
messages are
received from the AMS to indicate some error condition or when
the method locally discovers that the amsdescription is not valid.public static void register(Agent a, AMSAgentDescription amsd) throws FIPAException
AMSAgentDescription
with the default AMS
FIPAException
register(Agent,AID,AMSAgentDescription)
public static void deregister(Agent a, AID AMSName, AMSAgentDescription amsd) throws FIPAException
AMSName
- The AID of the AMS agent to deregister from.amsd
- A AMSAgentDescription
object containing all
data necessary to the deregistration.
FIPAException
- A suitable exception can be thrown when
a refuse
or failure
messages are
received from the AMS to indicate some error condition or when
the method locally discovers that the amsdescription is not valid.public static void deregister(Agent a, AMSAgentDescription amsd) throws FIPAException
FIPAException
deregister(Agent a, AID AMSName, AMSAgentDescription amsd)
public static void deregister(Agent a, AID AMSName) throws FIPAException
FIPAException
deregister(Agent a, AID AMSName, AMSAgentDescription amsd)
public static void deregister(Agent a) throws FIPAException
FIPAException
deregister(Agent a, AID AMSName, AMSAgentDescription amsd)
public static void modify(Agent a, AID AMSName, AMSAgentDescription amsd) throws FIPAException
AMSName
- The GUID of the AMS agent holding the data
to be changed.amsd
- The new AMSAgentDescriptor
object
that should modify the existing one.
FIPAException
- A suitable exception can be thrown when
a refuse
or failure
messages are
received from the AMS to indicate some error condition or when
the method locally discovers that the amsdescription is not valid.public static void modify(Agent a, AMSAgentDescription amsd) throws FIPAException
FIPAException
modify(Agent a, AID AMSName, AMSAgentDescription amsd)
public static AMSAgentDescription[] search(Agent a, AID AMSName, AMSAgentDescription amsd, SearchConstraints constraints) throws FIPAException
a
- is the Agent performing the searchAMSName
- The GUID of the AMS agent to start search from.amsd
- A AMSAgentDescriptor
object containing
data to search for; this parameter is used as a template to match
data against.constraints
- of the search
AMSAgentDescription
containing all found
items matching the given
descriptor, subject to given search constraints for search depth
and result size.
FIPAException
- A suitable exception can be thrown when
a refuse
or failure
messages are
received from the AMS to indicate some error condition.public static AMSAgentDescription[] search(Agent a, AMSAgentDescription amsd, SearchConstraints constraints) throws FIPAException
FIPAException
search(Agent,AID,AMSAgentDescription,SearchConstraints)
public static AMSAgentDescription[] search(Agent a, AMSAgentDescription amsd) throws FIPAException
FIPAException
search(Agent,AID,AMSAgentDescription,SearchConstraints)
public static AMSAgentDescription[] search(Agent a, AID AMSName, AMSAgentDescription amsd) throws FIPAException
FIPAException
search(Agent,AID,AMSAgentDescription,SearchConstraints)
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, AID AMSName, java.lang.String actionName, AMSAgentDescription amsd, SearchConstraints constraints) throws FIPAException
Agent.addBehaviour()
.
Several ways are available to get the result of this behaviour and the programmer can select one according to his preferred programming style:
a
- is the agent performing the taskAMSName
- is the AID that should perform the requested actionactionName
- is the name of the action (one of the constants defined
in FIPAManagementOntology: REGISTER / DEREGISTER / MODIFY / SEARCH).amsd
- is the agent descriptionconstraints
- are the search constraints (can be null if this is
not a search operation)
FIPAException
- A suitable exception can be thrown
to indicate some error condition
locally discovered (e.g.the amsdescription is not valid.)FIPAManagementOntology
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, java.lang.String actionName, AMSAgentDescription amsd, SearchConstraints constraints) throws FIPAException
FIPAException
getNonBlockingBehaviour(Agent a, AID AMSName, String actionName, AMSAgentDescription amsd, SearchConstraints constraints)
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, java.lang.String actionName) throws FIPAException
FIPAException
getNonBlockingBehaviour(Agent a, AID AMSName, String actionName, AMSAgentDescription amsd, SearchConstraints constraints)
,
search(Agent,AID,AMSAgentDescription)
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, AID amsName, java.lang.String actionName) throws FIPAException
FIPAException
getNonBlockingBehaviour(Agent a, AID AMSName, String actionName, AMSAgentDescription amsd, SearchConstraints constraints)
,
search(Agent,AID,AMSAgentDescription)
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, java.lang.String actionName, AMSAgentDescription amsd) throws FIPAException
FIPAException
getNonBlockingBehaviour(Agent a, AID AMSName, String actionName, AMSAgentDescription amsd, SearchConstraints constraints)
,
search(Agent,AID,AMSAgentDescription)
public static jade.domain.RequestFIPAServiceBehaviour getNonBlockingBehaviour(Agent a, AID amsName, java.lang.String actionName, AMSAgentDescription amsd) throws FIPAException
FIPAException
getNonBlockingBehaviour(Agent a, AID AMSName, String actionName, AMSAgentDescription amsd, SearchConstraints constraints)
,
search(Agent,AID,AMSAgentDescription)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |