ADK CVS

tryllian.are.persistence.spi
Interface AgentPersistencePlugin


public interface AgentPersistencePlugin

Objects that implement the AgentPersistencePlugin are created by the PersistencePlugin and manage the persisting of the agent data.


Method Summary
 void checkpoint(AgentSerializer serializer, Transaction action)
          Checkpoint an agent.
 void clear(Transaction action)
          Removes all agents from persistence.
 boolean contains(java.lang.String agentID, Transaction action)
          Check whether the agent with the specified ID is present.
 java.util.Set getCheckpointed(Transaction action)
          Returns a Set of Strings containing the Agent IDs of all checkpointed agents.
 java.lang.String getPersistencyFlag(java.lang.String agentID, Transaction action)
          Retrieves the persistency flag for the specified agent, or null if the agent is not in the database.
 java.util.Set getRestorable(Transaction action)
          Returns a Set of Strings containing the Agent IDs of all agents that should be woken up.
 boolean isDeparting(java.lang.String agentID, Transaction action)
          Returns true if the agent is departing.
 void remove(java.lang.String agentID, Transaction action)
          Remove the agent with the specified ID
 void removeMoving(java.lang.String agentID, Transaction action)
          Remove the agent with the specified ID, but only if isDeparting returns true.
 void restore(java.lang.String agentID, AgentBuilder builder, Transaction action)
          Restores the specified agent.
 void setDeparting(java.lang.String agentID, boolean enabled, Transaction action)
          Set the 'Moving' flag of the specified agent.
 void setPersistencyFlag(java.lang.String agentID, java.lang.String flag, Transaction action)
          Set the persistency flag for the specified agent.
 void suspend(AgentSerializer serializer, long seconds, Transaction action)
          Suspend an agent for the specified amount of seconds.
 void upgrade(AgentSerializer serializer, ARLSerializer newARL, Transaction action)
          Upgrade one agent to a new ARL.
 void upgrade(java.lang.String arlID, ARLSerializer newARL, Transaction action)
          Upgrade all agents with the specified arlID to a new ARL in the current habitat.
 

Method Detail

checkpoint

public void checkpoint(AgentSerializer serializer,
                       Transaction action)
                throws PersistenceException
Checkpoint an agent.

Throws:
PersistenceException

suspend

public void suspend(AgentSerializer serializer,
                    long seconds,
                    Transaction action)
             throws PersistenceException
Suspend an agent for the specified amount of seconds.

Throws:
PersistenceException

upgrade

public void upgrade(AgentSerializer serializer,
                    ARLSerializer newARL,
                    Transaction action)
             throws PersistenceException
Upgrade one agent to a new ARL.

Throws:
PersistenceException

upgrade

public void upgrade(java.lang.String arlID,
                    ARLSerializer newARL,
                    Transaction action)
             throws PersistenceException
Upgrade all agents with the specified arlID to a new ARL in the current habitat.

Throws:
PersistenceException

contains

public boolean contains(java.lang.String agentID,
                        Transaction action)
                 throws PersistenceException
Check whether the agent with the specified ID is present.

Throws:
PersistenceException

getPersistencyFlag

public java.lang.String getPersistencyFlag(java.lang.String agentID,
                                           Transaction action)
                                    throws PersistenceException
Retrieves the persistency flag for the specified agent, or null if the agent is not in the database.

Throws:
PersistenceException

setPersistencyFlag

public void setPersistencyFlag(java.lang.String agentID,
                               java.lang.String flag,
                               Transaction action)
                        throws PersistenceException
Set the persistency flag for the specified agent.

Throws:
PersistenceException

remove

public void remove(java.lang.String agentID,
                   Transaction action)
            throws PersistenceException
Remove the agent with the specified ID

Throws:
PersistenceException

removeMoving

public void removeMoving(java.lang.String agentID,
                         Transaction action)
                  throws PersistenceException
Remove the agent with the specified ID, but only if isDeparting returns true.

Throws:
PersistenceException

setDeparting

public void setDeparting(java.lang.String agentID,
                         boolean enabled,
                         Transaction action)
                  throws PersistenceException
Set the 'Moving' flag of the specified agent.

Parameters:
enabled - set to true if the agent should be moving, false otherwise.
Throws:
PersistenceException

isDeparting

public boolean isDeparting(java.lang.String agentID,
                           Transaction action)
                    throws PersistenceException
Returns true if the agent is departing.

Throws:
PersistenceException

restore

public void restore(java.lang.String agentID,
                    AgentBuilder builder,
                    Transaction action)
             throws PersistenceException
Restores the specified agent. When finished, the agent can be removed.

Parameters:
agentID - the agent to restore
builder - AgentBuilder to create the agent with
Throws:
PersistenceException

getRestorable

public java.util.Set getRestorable(Transaction action)
                            throws PersistenceException
Returns a Set of Strings containing the Agent IDs of all agents that should be woken up.

Throws:
PersistenceException

getCheckpointed

public java.util.Set getCheckpointed(Transaction action)
                              throws PersistenceException
Returns a Set of Strings containing the Agent IDs of all checkpointed agents.

Throws:
PersistenceException

clear

public void clear(Transaction action)
           throws PersistenceException
Removes all agents from persistence.

Throws:
PersistenceException

Copyright 2005, Tryllian Solutions B.V.