jason.infra.centralised
Class CentralisedAgArch

Package class diagram package CentralisedAgArch
java.lang.Object
  extended by jason.architecture.AgArch
      extended by jason.infra.centralised.CentralisedAgArch
All Implemented Interfaces:
AgArchInfraTier, java.lang.Runnable

public class CentralisedAgArch
extends AgArch
implements java.lang.Runnable

This class provides an agent architecture when using Centralised infrastructure to run the MAS inside Jason.

Execution sequence:


Field Summary
protected  CentralisedEnvironment infraEnv
           
protected  java.util.logging.Logger logger
           
 
Constructor Summary
CentralisedAgArch()
           
 
Method Summary
 void act(ActionExec action, java.util.List<ActionExec> feedback)
          called by the TS to ask the execution of an action in the environment
 void actionExecuted(ActionExec action)
          called the the environment when the action was executed
static void addMsgListener(MsgListener l)
           
 void broadcast(Message m)
          Broadcasts a Jason message
 boolean canSleep()
          Returns true if the agent can enter in sleep mode.
 void checkMail()
          Reads the agent's mailbox and adds messages into the agent's circumstance
 void createArchs(java.util.List<java.lang.String> agArchClasses, Agent ag, RunCentralisedMAS masRunner)
          init the agent architecture based on another agent
 void createArchs(java.util.List<java.lang.String> agArchClasses, java.lang.String agClass, ClassParameters bbPars, java.lang.String asSrc, Settings stts, RunCentralisedMAS masRunner)
          Creates the user agent architecture, default architecture is jason.architecture.AgArch.
 java.lang.String getAgName()
          Gets the agent's name
 CentralisedExecutionControl getControlInfraTier()
           
 CentralisedEnvironment getEnvInfraTier()
           
 java.util.logging.Logger getLogger()
           
 RuntimeServicesInfraTier getRuntimeServices()
          Gets an object with infrastructure runtime services
 AgArch getUserAgArch()
           
 void informCycleFinished(boolean breakpoint, int cycle)
          Informs the infrastructure tier controller that the agent has finished its reasoning cycle (used in sync mode).
 boolean isRunning()
          Checks whether the agent is running
 java.util.List<Literal> perceive()
          Gets the agent's perception as a list of Literals.
 void receiveMsg(Message m)
           
 void receiveSyncSignal()
          inform this agent that it can continue, if it is in sync mode and waiting a signal
static void removeMsgListener(MsgListener l)
           
 void run()
           
 void sendMsg(Message m)
          Sends a Jason message
 void setAgName(java.lang.String name)
           
 void setControlInfraTier(CentralisedExecutionControl pControl)
           
 void setEnvInfraTier(CentralisedEnvironment env)
           
 void setLogger()
           
 void setThread(java.lang.Thread t)
           
 void sleep()
          Puts the agent in sleep.
 void stopAg()
           
 void wake()
          Removes the agent from the "sleep" mode
 
Methods inherited from class jason.architecture.AgArch
createCustomArchs, getAgArchClassesChain, getArchInfraTier, getCycleNumber, getFirstAgArch, getNextAgArch, getTS, incCycleNumber, init, initAg, insertAgArch, reasoningCycleStarting, setCycleNumber, setTS, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infraEnv

protected CentralisedEnvironment infraEnv

logger

protected java.util.logging.Logger logger
Constructor Detail

CentralisedAgArch

public CentralisedAgArch()
Method Detail

addMsgListener

public static void addMsgListener(MsgListener l)

removeMsgListener

public static void removeMsgListener(MsgListener l)

createArchs

public void createArchs(java.util.List<java.lang.String> agArchClasses,
                        java.lang.String agClass,
                        ClassParameters bbPars,
                        java.lang.String asSrc,
                        Settings stts,
                        RunCentralisedMAS masRunner)
                 throws JasonException
Creates the user agent architecture, default architecture is jason.architecture.AgArch. The arch will create the agent that creates the TS.

Throws:
JasonException

createArchs

public void createArchs(java.util.List<java.lang.String> agArchClasses,
                        Agent ag,
                        RunCentralisedMAS masRunner)
                 throws JasonException
init the agent architecture based on another agent

Throws:
JasonException

stopAg

public void stopAg()

setLogger

public void setLogger()

getLogger

public java.util.logging.Logger getLogger()

setAgName

public void setAgName(java.lang.String name)

getAgName

public java.lang.String getAgName()
Description copied from class: AgArch
Gets the agent's name

Specified by:
getAgName in interface AgArchInfraTier
Overrides:
getAgName in class AgArch

getUserAgArch

public AgArch getUserAgArch()

setEnvInfraTier

public void setEnvInfraTier(CentralisedEnvironment env)

getEnvInfraTier

public CentralisedEnvironment getEnvInfraTier()

setControlInfraTier

public void setControlInfraTier(CentralisedExecutionControl pControl)

getControlInfraTier

public CentralisedExecutionControl getControlInfraTier()

setThread

public void setThread(java.lang.Thread t)

isRunning

public boolean isRunning()
Description copied from class: AgArch
Checks whether the agent is running

Specified by:
isRunning in interface AgArchInfraTier
Overrides:
isRunning in class AgArch

run

public void run()
Specified by:
run in interface java.lang.Runnable

sleep

public void sleep()
Description copied from class: AgArch
Puts the agent in sleep.

Specified by:
sleep in interface AgArchInfraTier
Overrides:
sleep in class AgArch

wake

public void wake()
Description copied from interface: AgArchInfraTier
Removes the agent from the "sleep" mode

Specified by:
wake in interface AgArchInfraTier
Overrides:
wake in class AgArch

perceive

public java.util.List<Literal> perceive()
Description copied from class: AgArch
Gets the agent's perception as a list of Literals. The returned list will be modified by Jason.

Specified by:
perceive in interface AgArchInfraTier
Overrides:
perceive in class AgArch

sendMsg

public void sendMsg(Message m)
             throws ReceiverNotFoundException
Description copied from class: AgArch
Sends a Jason message

Specified by:
sendMsg in interface AgArchInfraTier
Overrides:
sendMsg in class AgArch
Throws:
ReceiverNotFoundException

receiveMsg

public void receiveMsg(Message m)

broadcast

public void broadcast(Message m)
               throws java.lang.Exception
Description copied from class: AgArch
Broadcasts a Jason message

Specified by:
broadcast in interface AgArchInfraTier
Overrides:
broadcast in class AgArch
Throws:
java.lang.Exception

checkMail

public void checkMail()
Description copied from class: AgArch
Reads the agent's mailbox and adds messages into the agent's circumstance

Specified by:
checkMail in interface AgArchInfraTier
Overrides:
checkMail in class AgArch

act

public void act(ActionExec action,
                java.util.List<ActionExec> feedback)
called by the TS to ask the execution of an action in the environment

Specified by:
act in interface AgArchInfraTier
Overrides:
act in class AgArch

actionExecuted

public void actionExecuted(ActionExec action)
called the the environment when the action was executed


canSleep

public boolean canSleep()
Description copied from class: AgArch
Returns true if the agent can enter in sleep mode.

Specified by:
canSleep in interface AgArchInfraTier
Overrides:
canSleep in class AgArch

receiveSyncSignal

public void receiveSyncSignal()
inform this agent that it can continue, if it is in sync mode and waiting a signal


informCycleFinished

public void informCycleFinished(boolean breakpoint,
                                int cycle)
Informs the infrastructure tier controller that the agent has finished its reasoning cycle (used in sync mode).

breakpoint is true in case the agent selected one plan with the "breakpoint" annotation.


getRuntimeServices

public RuntimeServicesInfraTier getRuntimeServices()
Description copied from interface: AgArchInfraTier
Gets an object with infrastructure runtime services

Specified by:
getRuntimeServices in interface AgArchInfraTier
Overrides:
getRuntimeServices in class AgArch