cartago
Class CartagoSession

java.lang.Object
  extended by cartago.CartagoSession
All Implemented Interfaces:
ICartagoCallback, ICartagoSession

public class CartagoSession
extends java.lang.Object
implements ICartagoSession, ICartagoCallback

Class to manage a working session of an agent inside a workspace

Author:
aricci

Method Summary
 long doAction(ArtifactId aid, Op op, IAlignmentTest test, long timeout)
          Executing an action, i.e. an operation over an artifact
 long doAction(Op op, IAlignmentTest test, long timeout)
          Executing an action, i.e. an operation over an artifact in the current workspace.
 long doAction(java.lang.String artName, Op op, IAlignmentTest test, long timeout)
          Executing an action, i.e. an operation over an artifact in the current workspace.
 long doAction(WorkspaceId wspId, Op op, IAlignmentTest test, long timeout)
          Executing an action, i.e. an operation over an artifact In this case, the target artifact is not specified.
 long doAction(WorkspaceId wspId, java.lang.String artName, Op op, IAlignmentTest test, long timeout)
          Executing an action, i.e. an operation over an artifact In this case, the name of the artifact and the workspace are specified.
 CartagoEvent fetchNextPercept()
          Fetch a new percept.
 WorkspaceId getCurrentWorkspace()
          Get the current workspace identifier.
 void notifyCartagoEvent(CartagoEvent ev)
          Notify a CArtAgO event occurred inside a workspace.
 void setCurrentWorkspace(WorkspaceId wspId)
          Internal action to change the current workspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doAction

public long doAction(ArtifactId aid,
                     Op op,
                     IAlignmentTest test,
                     long timeout)
              throws CartagoException
Description copied from interface: ICartagoSession
Executing an action, i.e. an operation over an artifact

Specified by:
doAction in interface ICartagoSession
Parameters:
aid - target artifact
op - target operation
test - alignment test
timeout - timeout
Returns:
unique action identifier
Throws:
CartagoException

doAction

public long doAction(WorkspaceId wspId,
                     java.lang.String artName,
                     Op op,
                     IAlignmentTest test,
                     long timeout)
              throws CartagoException
Description copied from interface: ICartagoSession
Executing an action, i.e. an operation over an artifact In this case, the name of the artifact and the workspace are specified.

Specified by:
doAction in interface ICartagoSession
Parameters:
wspId - workspace identifier
artName - target artifact
op - target operation
test - alignment test
timeout - timeout
Returns:
unique action identifier
Throws:
CartagoException

doAction

public long doAction(WorkspaceId wspId,
                     Op op,
                     IAlignmentTest test,
                     long timeout)
              throws CartagoException
Description copied from interface: ICartagoSession
Executing an action, i.e. an operation over an artifact In this case, the target artifact is not specified.

Specified by:
doAction in interface ICartagoSession
Parameters:
wspId - workspace identifier
op - target operation
test - alignment test
timeout - timeout
Returns:
unique action identifier
Throws:
CartagoException

doAction

public long doAction(java.lang.String artName,
                     Op op,
                     IAlignmentTest test,
                     long timeout)
              throws CartagoException
Description copied from interface: ICartagoSession
Executing an action, i.e. an operation over an artifact in the current workspace.

Specified by:
doAction in interface ICartagoSession
Parameters:
artName - target artifact
op - target operation
test - alignment test
timeout - timeout
Returns:
unique action identifier
Throws:
CartagoException

doAction

public long doAction(Op op,
                     IAlignmentTest test,
                     long timeout)
              throws CartagoException
Description copied from interface: ICartagoSession
Executing an action, i.e. an operation over an artifact in the current workspace.

Specified by:
doAction in interface ICartagoSession
Parameters:
op - target operation
test - alignment test
timeout - timeout
Returns:
unique action identifier
Throws:
CartagoException

getCurrentWorkspace

public WorkspaceId getCurrentWorkspace()
Description copied from interface: ICartagoSession
Get the current workspace identifier.

Specified by:
getCurrentWorkspace in interface ICartagoSession
Returns:
workspace identifier.

setCurrentWorkspace

public void setCurrentWorkspace(WorkspaceId wspId)
                         throws CartagoException
Description copied from interface: ICartagoSession
Internal action to change the current workspace.

Specified by:
setCurrentWorkspace in interface ICartagoSession
Parameters:
wspId - workspace identifier.
Throws:
CartagoException

fetchNextPercept

public CartagoEvent fetchNextPercept()
Fetch a new percept. To be called in the sense stage of the agent execution cycle.

Specified by:
fetchNextPercept in interface ICartagoSession
Returns:
null if no percepts are available.

notifyCartagoEvent

public void notifyCartagoEvent(CartagoEvent ev)
Description copied from interface: ICartagoCallback
Notify a CArtAgO event occurred inside a workspace.

Specified by:
notifyCartagoEvent in interface ICartagoCallback
Parameters:
ev - the event


>DEIS - University of Bologna