jason.infra.centralised
Class CentralisedAgArch

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

public class CentralisedAgArch
extends java.lang.Object
implements java.lang.Runnable, AgArchInfraTier

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
           
protected  AgArch userAgArch
          The user implementation of the architecture
 
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 in a specific infrastructure
 boolean canSleep()
          Returns true whether the agent can sleep according to the arch
 void checkMail()
          Reads the agent's mailbox and adds messages into the agent's circumstance
 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).
 void initAg(java.lang.String agArchClass, 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.
 boolean isRunning()
          Checks whether the agent is running (alive)
 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 in a specific infrastructure
 void setAgName(java.lang.String name)
           
 void setControlInfraTier(CentralisedExecutionControl pControl)
           
 void setEnvInfraTier(CentralisedEnvironment env)
           
 void setLogger()
           
protected  void setThread(java.lang.Thread t)
           
 void setUserAgArch(AgArch arch)
           
 void sleep()
          Put the agent in "sleep" mode
 void stopAg()
          Stops the agent
 void wake()
          Removes the agent from the "sleep" mode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infraEnv

protected CentralisedEnvironment infraEnv

userAgArch

protected AgArch userAgArch
The user implementation of the architecture


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)

initAg

public void initAg(java.lang.String agArchClass,
                   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

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 interface: AgArchInfraTier
Gets the agent's name

Specified by:
getAgName in interface AgArchInfraTier

setUserAgArch

public void setUserAgArch(AgArch arch)

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

protected void setThread(java.lang.Thread t)

stopAg

public void stopAg()
Description copied from interface: AgArchInfraTier
Stops the agent

Specified by:
stopAg in interface AgArchInfraTier

isRunning

public boolean isRunning()
Description copied from interface: AgArchInfraTier
Checks whether the agent is running (alive)

Specified by:
isRunning in interface AgArchInfraTier

run

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

sleep

public void sleep()
Description copied from interface: AgArchInfraTier
Put the agent in "sleep" mode

Specified by:
sleep in interface AgArchInfraTier

wake

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

Specified by:
wake in interface AgArchInfraTier

perceive

public java.util.List<Literal> perceive()
Description copied from interface: AgArchInfraTier
Gets the agent's perception as a list of Literals

Specified by:
perceive in interface AgArchInfraTier

sendMsg

public void sendMsg(Message m)
             throws ReceiverNotFoundException
Description copied from interface: AgArchInfraTier
Sends a Jason message in a specific infrastructure

Specified by:
sendMsg in interface AgArchInfraTier
Throws:
ReceiverNotFoundException

receiveMsg

public void receiveMsg(Message m)

broadcast

public void broadcast(Message m)
               throws java.lang.Exception
Description copied from interface: AgArchInfraTier
Broadcasts a Jason message in a specific infrastructure

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

checkMail

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

Specified by:
checkMail in interface AgArchInfraTier

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

actionExecuted

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


canSleep

public boolean canSleep()
Description copied from interface: AgArchInfraTier
Returns true whether the agent can sleep according to the arch

Specified by:
canSleep in interface AgArchInfraTier

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