zeus.agents
Class PersistentStore

java.lang.Object
  extended byzeus.agents.PersistentStore
Direct Known Subclasses:
FlatFile

public abstract class PersistentStore
extends java.lang.Object

This abstract class provides an interface to storage platforms so that messaging data (i.e. communication sessions among agents) may be stored for future playback and manipulation. It acts a bridge between a ZEUS database proxy (i.e. DbProxy) and and a persistent storage mechanism (e.g. a flat file or a database such as Oracle). Typically a ZEUS Visualiser agent talks to a DbProxy which in turn forwards the requests to subclasses of this abstract class. A class that extends this abstract class should provide implementations for following methods:

  public  abstract void createSession(String replyKey, String agent,
                  String sessionType, String sessionId, String accessKey);
  public abstract void deleteSession(String replyKey, String agent,
                                     String sessionType, String sessionId);
  public abstract void getAllSessions(String replyKey, String agent,
                                        String sessionType);
  public abstract void deleteSessionType(String replyKey, String agent,
                                         String sessionType);
  public abstract void openSession(String replyKey, String agent,
                    String sessionType, String sessionId, String accessKey);

  public abstract void saveRecord(String replyKey, String agent,
                                  String accessKey, String record);
  public  void closeSession(String replyKey,String agent,String accessKey);
  public abstract void nextRecord(String replyKey,String agent,String accessKey);
  public abstract void priorRecord(String replyKey,String agent,String accessKey);
  public abstract void beginSession(String replyKey,String agent,String accessKey);
  public abstract void endSession(String replyKey,String agent,String accessKey);
  public abstract void getAgents(String replyKey,String agent,String accessKey);
  public abstract void countRecords(String replyKey,String agent,String accessKey);

  

The methods have all or some of the following arguments:
String replyKey Recipient's (i.e.the ZEUS Visualiser agent) conversation key.
String agent The name of the ZEUS Visualiser agent who wants the communication sessions saved for future playback.
String sessionType The type of information being saved for future playback (i.e. the tool within which the communication session is taken place. Tools can be one of the following: Society Viewer, Report Viewer, Statistics Viewer, Remote Viewer and Control Tool Viewer.
String sessionId A unique identifier (typically the name of the persistent storage i.e. flat file or database) representing a communication session.
String accessKey A handle representing an agent and session id used by subclasses of this abstract class to access the persistent storage.
Each implemented method should return a Zeus Performative object ( using proxy.sendMsg(msg) where msg is a Performative object ) by specifying whether the operation failed or succeeds. If the operation succeeds then instantiate a Performative class with "inform" or "failure" if it failed. Instantiating a Performative class should follow this format:
Performative msg = new Performative("failure");
msg.setReceiver(agent);
msg.setInReplyTo(replyKey);
msg.setContent("reason for failure or success");
proxy.sendMsg(msg);


Field Summary
private  OrderedHashtable knownAgents
           
protected  DbProxy proxy
           
private  boolean verifyAccess
           
 
Constructor Summary
PersistentStore()
           
 
Method Summary
abstract  void beginSession(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Go to the beginning of a session identified by accessKey.
abstract  void closeSession(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Close a session identified by accessKey.
abstract  void countRecords(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Returns the number of records in a session identified by accessKey.
abstract  void createSession(java.lang.String replyKey, java.lang.String agent, java.lang.String sessionType, java.lang.String sessionId, java.lang.String accessKey)
          Its purpose is to create a new session (i.e. a flat file or database table).
abstract  void deleteSession(java.lang.String replyKey, java.lang.String agent, java.lang.String sessionType, java.lang.String sessionId)
          Given a session type, delete the session type with the name sessionId.
abstract  void deleteSessionType(java.lang.String replyKey, java.lang.String agent, java.lang.String sessionType)
          Delete a session type with its associated sessions (i.e. tables).
abstract  void endSession(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Go to the end of a session identified by accessKey.
abstract  void getAgents(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Returns all known agents associated with a given session identified by accessKey.
abstract  void getAllSessions(java.lang.String replyKey, java.lang.String agent, java.lang.String sessionType)
          Given a session type, list all sessions (tables) associated with that type.
protected  boolean isAccessible()
           
abstract  void nextRecord(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Returns the next record in a session identified by accessKey.
abstract  void openSession(java.lang.String replyKey, java.lang.String agent, java.lang.String sessionType, java.lang.String sessionId, java.lang.String accessKey)
          Given a session type, open the session with name sessionId.
abstract  void priorRecord(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey)
          Returns the previous record in a session identified by accessKey.
abstract  void saveRecord(java.lang.String replyKey, java.lang.String agent, java.lang.String accessKey, java.lang.String record)
          Save the record in a session identified by accessKey.
 void setAccess(boolean access)
          Sets access level.
 void setProxy(DbProxy proxy)
          Sets the proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxy

protected DbProxy proxy

verifyAccess

private boolean verifyAccess

knownAgents

private OrderedHashtable knownAgents
Constructor Detail

PersistentStore

public PersistentStore()
Method Detail

setProxy

public void setProxy(DbProxy proxy)
Sets the proxy.


setAccess

public void setAccess(boolean access)
Sets access level.


createSession

public abstract void createSession(java.lang.String replyKey,
                                   java.lang.String agent,
                                   java.lang.String sessionType,
                                   java.lang.String sessionId,
                                   java.lang.String accessKey)
Its purpose is to create a new session (i.e. a flat file or database table). Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.
If the session exists open it for appending and return done.
If the session doesn't exit create it for writing and return done.
If aforementioned operations fails return failure.


deleteSession

public abstract void deleteSession(java.lang.String replyKey,
                                   java.lang.String agent,
                                   java.lang.String sessionType,
                                   java.lang.String sessionId)
Given a session type, delete the session type with the name sessionId. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


getAllSessions

public abstract void getAllSessions(java.lang.String replyKey,
                                    java.lang.String agent,
                                    java.lang.String sessionType)
Given a session type, list all sessions (tables) associated with that type. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


deleteSessionType

public abstract void deleteSessionType(java.lang.String replyKey,
                                       java.lang.String agent,
                                       java.lang.String sessionType)
Delete a session type with its associated sessions (i.e. tables). Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


openSession

public abstract void openSession(java.lang.String replyKey,
                                 java.lang.String agent,
                                 java.lang.String sessionType,
                                 java.lang.String sessionId,
                                 java.lang.String accessKey)
Given a session type, open the session with name sessionId. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


saveRecord

public abstract void saveRecord(java.lang.String replyKey,
                                java.lang.String agent,
                                java.lang.String accessKey,
                                java.lang.String record)
Save the record in a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


closeSession

public abstract void closeSession(java.lang.String replyKey,
                                  java.lang.String agent,
                                  java.lang.String accessKey)
Close a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


nextRecord

public abstract void nextRecord(java.lang.String replyKey,
                                java.lang.String agent,
                                java.lang.String accessKey)
Returns the next record in a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


priorRecord

public abstract void priorRecord(java.lang.String replyKey,
                                 java.lang.String agent,
                                 java.lang.String accessKey)
Returns the previous record in a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


beginSession

public abstract void beginSession(java.lang.String replyKey,
                                  java.lang.String agent,
                                  java.lang.String accessKey)
Go to the beginning of a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


endSession

public abstract void endSession(java.lang.String replyKey,
                                java.lang.String agent,
                                java.lang.String accessKey)
Go to the end of a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


getAgents

public abstract void getAgents(java.lang.String replyKey,
                               java.lang.String agent,
                               java.lang.String accessKey)
Returns all known agents associated with a given session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


countRecords

public abstract void countRecords(java.lang.String replyKey,
                                  java.lang.String agent,
                                  java.lang.String accessKey)
Returns the number of records in a session identified by accessKey. Returns done as the content of a Performative object if the operation succeeds else return reasons for failure to the specified agent with the replyKey as agent's conversation key.


isAccessible

protected boolean isAccessible()


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.