jade.core.behaviours
Class OntologyServer

java.lang.Object
  extended by jade.core.behaviours.Behaviour
      extended by jade.core.behaviours.SimpleBehaviour
          extended by jade.core.behaviours.CyclicBehaviour
              extended by jade.core.behaviours.OntologyServer
All Implemented Interfaces:
java.io.Serializable

public class OntologyServer
extends CyclicBehaviour

Ready made behaviour that for each incoming message automatically invoke a corresponding method of the form
public void serveCcccPppp(Cccc c, ACLMessage msg) throws Exception
where c represents the key content-element referenced by the incoming message msg.
ContentElement-s representing SL0 operators action, done and result are automatically managed so that for instance if an incoming REQUEST message is received carrying a content of type
((action (actor ...) (Sell ...)))
a serving method with signature
public void serveSellRequest(Sell s, ACLMessage msg) throws Exception
will be searched.
Serving methods are responsible for sending back responses if any.

See Also:
Serialized Form

Field Summary
protected  Logger myLogger
           
 
Fields inherited from class jade.core.behaviours.Behaviour
myAgent
 
Constructor Summary
OntologyServer(Agent a, Ontology onto, int performative)
           
OntologyServer(Agent a, Ontology onto, int[] performatives)
           
OntologyServer(Agent a, Ontology onto, int[] performatives, java.lang.Object serverDelegate)
           
OntologyServer(Agent a, Ontology onto, int performative, java.lang.Object serverDelegate)
           
 
Method Summary
 void action()
          Runs the behaviour.
 void conversationFinished(java.lang.String convId)
           
protected  ContentElement extractKeyContentElement(ContentElement ce)
           
 ContentElement getReceivedContentElement()
          Allows subclasses to retrieve the actually received content element e.g.
protected  void handleNotUnderstood(ContentException ce, ACLMessage msg)
           
protected  void handleServingFailure(java.lang.Throwable t, ContentElement cel, ACLMessage msg)
           
protected  void handleUnsupported(ContentElement keyCel, ACLMessage msg)
           
 void ignoreConversation(java.lang.String convId)
           
 void onStart()
          This method is just an empty placeholders for subclasses.
 void setLanguage(Codec codec)
           
 void setMessageTemplate(MessageTemplate template)
           
 
Methods inherited from class jade.core.behaviours.CyclicBehaviour
done
 
Methods inherited from class jade.core.behaviours.SimpleBehaviour
reset
 
Methods inherited from class jade.core.behaviours.Behaviour
block, block, getBehaviourName, getDataStore, getParent, isRunnable, onEnd, restart, root, setAgent, setBehaviourName, setDataStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLogger

protected Logger myLogger
Constructor Detail

OntologyServer

public OntologyServer(Agent a,
                      Ontology onto,
                      int performative)

OntologyServer

public OntologyServer(Agent a,
                      Ontology onto,
                      int[] performatives)

OntologyServer

public OntologyServer(Agent a,
                      Ontology onto,
                      int performative,
                      java.lang.Object serverDelegate)

OntologyServer

public OntologyServer(Agent a,
                      Ontology onto,
                      int[] performatives,
                      java.lang.Object serverDelegate)
Method Detail

setLanguage

public void setLanguage(Codec codec)

setMessageTemplate

public void setMessageTemplate(MessageTemplate template)

onStart

public void onStart()
Description copied from class: Behaviour
This method is just an empty placeholders for subclasses. It is executed just once before starting behaviour execution. Therefore, it acts as a prolog to the task represented by this Behaviour.

Overrides:
onStart in class Behaviour

action

public final void action()
Description copied from class: Behaviour
Runs the behaviour. This abstract method must be implemented by Behavioursubclasses to perform ordinary behaviour duty. An agent schedules its behaviours calling their action() method; since all the behaviours belonging to the same agent are scheduled cooperatively, this method must not enter in an endless loop and should return as soon as possible to preserve agent responsiveness. To split a long and slow task into smaller section, recursive behaviour aggregation may be used.

Specified by:
action in class Behaviour
See Also:
CompositeBehaviour

getReceivedContentElement

public final ContentElement getReceivedContentElement()
Allows subclasses to retrieve the actually received content element e.g. Action, Done, Result

Returns:

extractKeyContentElement

protected ContentElement extractKeyContentElement(ContentElement ce)

handleUnsupported

protected void handleUnsupported(ContentElement keyCel,
                                 ACLMessage msg)

handleServingFailure

protected void handleServingFailure(java.lang.Throwable t,
                                    ContentElement cel,
                                    ACLMessage msg)

handleNotUnderstood

protected void handleNotUnderstood(ContentException ce,
                                   ACLMessage msg)

ignoreConversation

public void ignoreConversation(java.lang.String convId)

conversationFinished

public void conversationFinished(java.lang.String convId)


These are the official JADE API. For these API backward compatibility is guaranteed accross JADE versions