RbDe rbde-349 (20120127151154)

edu.mssm.crover.scentral
Interface PersistenceScheme

All Known Subinterfaces:
DS_PersistenceScheme
All Known Implementing Classes:
DS_PersistenceScheme_JDBC_Impl, PersistenceScheme_JDBC_Impl

public interface PersistenceScheme

Interface to support plugable persistence schemes. Three types of persistence schemes are available.

  1. The first provides no persistence, this defaults to obtaining newly initialized objects each time the getX method is invoked.
  2. The second method uses serialization in files to save the state of each object.
  3. The third method uses JDBC to save each object in a JDBC compliant DBMS.

Author:
Fabien Campagne, Karel Konvicka

Field Summary
static int CUSTOMIZED_DIAGRAM_KIND
          Customized diagram kind.
static String LATEST_DIAGRAM_CLASS_NAME
          The current CustomizedDiagram implementation.
static int OWNER_REFERENCE_ID
          Owner reference id for use in the dropLibraryObjectReference(int, int, UserRecord) to drop owner reference.
static int USER_SESSION_KIND
          User session kind.
 
Method Summary
 int createCustomizedDiagram(UserRecord ur, String name, CustomizedDiagram cd, String description)
          Creates customized diagriam in persistent storage.
 void dropLibraryObjectReference(int objectId, int referenceObjectId, UserRecord record)
          Drops a reference in the database to this object identified by objectId.
 CustomizedDiagram getCustomizedDiagram(UserRecord ur, int diagram_id)
          Get a CustomizedDiagram from the persistent storage.
 LibraryObjectInfo getLibraryObjectInfo(int kind, int libraryObjectId, UserRecord record)
          Get a LibraryObjectInfo for a given object kind with the given object ID.
 Collection getLibraryObjectsInfo(int kind, UserRecord record)
          Get a collection of LibraryObjectInfos.
 UserSession getUserSession(UserRecord record)
          Retrieve a session instance.
 void initialize()
          Initializes the persistence scheme.
 void saveUserSession(UserSession session)
          Save a session instance.
 void updateCustomizedDiagram(UserRecord ur, int diagram_id, CustomizedDiagram cd, String description)
          Updates customized diagriam in persistent storage.
 void userLogsIn(UserRecord record, Date loginTime)
          Signal the storage that the user has logged in.
 

Field Detail

OWNER_REFERENCE_ID

static final int OWNER_REFERENCE_ID
Owner reference id for use in the dropLibraryObjectReference(int, int, UserRecord) to drop owner reference.

See Also:
Constant Field Values

USER_SESSION_KIND

static final int USER_SESSION_KIND
User session kind.

See Also:
Constant Field Values

CUSTOMIZED_DIAGRAM_KIND

static final int CUSTOMIZED_DIAGRAM_KIND
Customized diagram kind.

See Also:
Constant Field Values

LATEST_DIAGRAM_CLASS_NAME

static final String LATEST_DIAGRAM_CLASS_NAME
The current CustomizedDiagram implementation. This variable has to be updated every time we upgrade to a new version of CustomizedDiagram.

Method Detail

getUserSession

UserSession getUserSession(UserRecord record)
Retrieve a session instance.

Parameters:
record - The user to get the session for
Returns:
the session object for the specified user

saveUserSession

void saveUserSession(UserSession session)
Save a session instance.

Parameters:
session - The session to save

dropLibraryObjectReference

void dropLibraryObjectReference(int objectId,
                                int referenceObjectId,
                                UserRecord record)
Drops a reference in the database to this object identified by objectId. The objectId referencing the object is referenceObjectId. When owner requests to drop an object, the owner is identified by reference_objectId = OWNER_REFERENCE_ID (=0), which could never occur for regular objects. Regular objects have id-s > 0. An object is dropped when all references to it are dropped including the owner reference.


getLibraryObjectInfo

LibraryObjectInfo getLibraryObjectInfo(int kind,
                                       int libraryObjectId,
                                       UserRecord record)
Get a LibraryObjectInfo for a given object kind with the given object ID.

Returns:
LibraryObjectInfo.

getLibraryObjectsInfo

Collection getLibraryObjectsInfo(int kind,
                                 UserRecord record)
Get a collection of LibraryObjectInfos.

Returns:
Collection of LibraryObjectInfos.

initialize

void initialize()
Initializes the persistence scheme.


userLogsIn

void userLogsIn(UserRecord record,
                Date loginTime)
Signal the storage that the user has logged in. Used for accounting.


getCustomizedDiagram

CustomizedDiagram getCustomizedDiagram(UserRecord ur,
                                       int diagram_id)
Get a CustomizedDiagram from the persistent storage.


createCustomizedDiagram

int createCustomizedDiagram(UserRecord ur,
                            String name,
                            CustomizedDiagram cd,
                            String description)
                            throws BadPersistentID
Creates customized diagriam in persistent storage.

Parameters:
ur - The requesting user's record.
name - name for this diagram.
cd - The customized diagram to be stored.
description - The customized diagram description to be stored.
Throws:
BadPersistentID - Thrown when the underlying persistence storage mechanism cannot handle such a persistent identifier (possible causes: invalid character, null or empty value, already allocated ID).

updateCustomizedDiagram

void updateCustomizedDiagram(UserRecord ur,
                             int diagram_id,
                             CustomizedDiagram cd,
                             String description)
                             throws BadPersistentID
Updates customized diagriam in persistent storage.

Parameters:
ur - The requesting user's record.
diagram_id - unique diagram identifier.
cd - The customized diagram to be stored.
description - The customized diagram description to be stored.
Throws:
BadPersistentID - Thrown when the underlying persistence storage mechanism cannot handle such a persistent identifier (possible causes: invalid character, null or empty value, ID does not exist).

RbDe rbde-349 (20120127151154)

Copyright © 2003-2012 Institute for Computational Biomedicine, All Rights Reserved.