public abstract class BaseInitiator extends AchieveREInitiator
| Modifier and Type | Field and Description |
|---|---|
protected ConversationList |
conversations |
protected Logger |
myLogger |
protected OutcomeManager |
outcome |
ALL_REQUESTS_KEY, ALL_RESPONSES_KEY, ALL_RESULT_NOTIFICATIONS_KEY, CHECK_AGAIN, HANDLE_AGREE, HANDLE_ALL_RESPONSES, HANDLE_ALL_RESULT_NOTIFICATIONS, HANDLE_INFORM, HANDLE_REFUSE, REPLY_KEY, REQUEST_KEYcurrentName, lastStates| Constructor and Description |
|---|
BaseInitiator() |
BaseInitiator(OutcomeManager om) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkLanguage(java.lang.String languageName) |
protected void |
checkOntology(Ontology onto) |
protected java.lang.String |
createConvId(java.util.Vector msgs)
Create a new conversation identifier to begin a new
interaction.
|
protected abstract ACLMessage |
createInitiation()
Concrete subclasses are expected to implement this method to create the initiation message.
|
java.lang.String |
getErrorMsg()
Shortcut method for getOutcome().getErrorMsg()
|
int |
getExitCode()
Shortcut method for getOutcome().getExitCode()
|
OutcomeManager |
getOutcome() |
protected java.lang.String |
getTargetDescription()
Concrete subclasses can redefine this method to provide a human readable description of the
target agent of this behaviour.
|
void |
handleAllResultNotifications(java.util.Vector notifications)
This method is called when all the result notification messages
have been
collected.
|
void |
handleFailure(ACLMessage failure)
This method is called every time a
failure
message is received, which is not out-of-sequence according
to the protocol rules. |
void |
handleNotUnderstood(ACLMessage notUnderstood)
This method is called every time a
not-understood
message is received, which is not out-of-sequence according
to the protocol rules. |
protected void |
handleOutOfSequence(ACLMessage msg)
This method is called every time a
message is received, which is out-of-sequence according
to the protocol rules.
|
void |
handleRefuse(ACLMessage refuse)
This method is called every time a
refuse
message is received, which is not out-of-sequence according
to the protocol rules. |
void |
handleTimeout() |
int |
onEnd()
Override the onEnd() method to return the exit value of the
last executed state.
|
void |
onStart()
Override the onStart() method to initialize the vectors that
will keep all the replies in the data store.
|
java.util.Vector |
prepareRequests(ACLMessage msg)
This method must return the vector of ACLMessage objects to be
sent.
|
void |
registerHandleFailure(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_FAILURE state. |
void |
registerHandleNotUnderstood(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_NOT_UNDERSTOOD state. |
void |
registerHandleOutOfSequence(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_OUT_OF_SEQ state. |
void |
reset()
reset this behaviour by putting a null ACLMessage as message
to be sent
|
void |
reset(ACLMessage msg)
reset this behaviour
|
void |
setActiveConversations(ConversationList conversations) |
void |
setDataStore(DataStore ds)
Override the setDataStore() method to propagate this
setting to all children.
|
getSession, handleAgree, handleAllResponses, handleInform, registerHandleAgree, registerHandleAllResponses, registerHandleAllResultNotifications, registerHandleInform, registerHandleRefuse, registerPrepareRequests, reinitcheckTermination, deregisterDefaultTransition, deregisterState, deregisterTransition, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, hasDefaultTransition, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, resetStates, scheduleFirst, scheduleNext, stringifyTransitionTableaction, done, resetChildren, setAgentblock, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, restart, root, setBehaviourNameprotected OutcomeManager outcome
protected ConversationList conversations
protected Logger myLogger
public BaseInitiator()
public BaseInitiator(OutcomeManager om)
public void setActiveConversations(ConversationList conversations)
protected void checkLanguage(java.lang.String languageName)
protected void checkOntology(Ontology onto)
public OutcomeManager getOutcome()
public int getExitCode()
public java.lang.String getErrorMsg()
protected abstract ACLMessage createInitiation()
protected java.lang.String getTargetDescription()
public java.util.Vector prepareRequests(ACLMessage msg)
AchieveREInitiatorprepareRequests in class AchieveREInitiatormsg - the ACLMessage object passed in the constructorreply-with is ignored and a different value is assigned
automatically by this class for each receiver.public void handleRefuse(ACLMessage refuse)
AchieveREInitiatorrefuse
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event.handleRefuse in class AchieveREInitiatorrefuse - the received refuse messagepublic void handleNotUnderstood(ACLMessage notUnderstood)
not-understood
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event.notUnderstood - the received not-understood messagepublic void handleFailure(ACLMessage failure)
failure
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event.failure - the received failure messagepublic void handleAllResultNotifications(java.util.Vector notifications)
AchieveREInitiatorinform,
failure received messages, which are not
not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event
by analysing all the messages in just one call.handleAllResultNotifications in class AchieveREInitiatorpublic void handleTimeout()
public int onEnd()
FSMBehaviouronEnd in class FSMBehaviourprotected void handleOutOfSequence(ACLMessage msg)
msg - the received messagepublic void registerHandleNotUnderstood(Behaviour b)
Behaviour
in the HANDLE_NOT_UNDERSTOOD state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the not-understood ACLMessage object received
from the datastore at the REPLY_KEY
key.b - the Behaviour that will handle this statepublic void registerHandleFailure(Behaviour b)
Behaviour
in the HANDLE_FAILURE state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the failure ACLMessage object received
from the datastore at the REPLY_KEY
key.b - the Behaviour that will handle this statepublic void registerHandleOutOfSequence(Behaviour b)
Behaviour
in the HANDLE_OUT_OF_SEQ state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the out of sequence ACLMessage object received
from the datastore at the REPLY_KEY
key.b - the Behaviour that will handle this statepublic void reset()
reset in class FSMBehaviourpublic void reset(ACLMessage msg)
msg - is the ACLMessage to be sentpublic void onStart()
public void setDataStore(DataStore ds)
setDataStore in class Behaviourds - the DataStore that this Behaviour
will use as its private data storeprotected java.lang.String createConvId(java.util.Vector msgs)
msgs - A vector of ACL messages. If the first one has a
non-empty :conversation-id slot, its value is
used, else a new conversation identifier is generated.