com.vinculumtech.platform.root
Class PersistenceSession

java.lang.Object
  extended bycom.vinculumtech.platform.root.PersistenceSession
Direct Known Subclasses:
HibernatePersistenceSession, InMemoryPersistenceSession, JDOPersistenceSession

public abstract class PersistenceSession
extends java.lang.Object

Each persistence engine has an associated PersistenceSession implementation, which manages the engine-specific state and behavior required to perform persistence operations.

The InMemoryPersistenceSession is the default implementation used by CarrierWave for simple object persistence and querying functinality.

Version:
$Id: //depot/carrierwave/src/server/com/vinculumtech/platform/root/PersistenceSession.java#18 $
See Also:
PersistenceRoot

Field Summary
static java.lang.String REFERENCEABLE_NAME_FIELD
           
 
Constructor Summary
protected PersistenceSession()
          Should be made public by sub-class.
 
Method Summary
abstract  void beginSession(boolean readOnly)
          Initialize the session for the current Thread.
abstract  void commitSession()
          Perform any necessary cleanup before the session is completed.
abstract  java.lang.Object createInstanceOf(java.lang.Class type)
          Create a new persistant instance of the given type.
abstract  void deleteInstance(java.lang.Object object)
          Delete an object.
abstract  java.util.List findAllInstancesOf(java.lang.Class type, boolean excludeSubclasses)
          Return a List of all objects of the given type.
If no object is found, an empty List is returned.
 java.util.List findAllInstancesOf(PersistenceCollectionFinder finder)
          Return all objects that match the criteria specified by the given PersistenceCollectionFinder.
If no object is found, an empty List is returned.
abstract  java.lang.Object findInstanceOf(java.lang.Class type, java.lang.Object objectId)
          Return the existing object of the specified type with the given id.
If no object is found, null is returned.
abstract  java.lang.Object findInstanceOf(java.lang.Class type, java.lang.String referenceableName)
          Return the existing object of the specified type with the given referenceableName.

Referenceable names are names that are more durable than the persistence tool object id, and are suitable for explicit referencing by remote applications.
 java.lang.Object findInstanceOf(PersistenceObjectFinder finder)
          Find the single object instance that matches the criteria specified by the given PersistenceObjectFinder.
If no object is found, null is returned.
 java.lang.Object getIdentityOf(java.lang.Object object)
           
static java.lang.String getReferenceableNameField()
           
 java.lang.String getReferenceableNameOf(java.lang.Object object)
           
abstract  void rollbackSession()
          Rollback the current session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENCEABLE_NAME_FIELD

public static final java.lang.String REFERENCEABLE_NAME_FIELD
See Also:
Constant Field Values
Constructor Detail

PersistenceSession

protected PersistenceSession()
Should be made public by sub-class.

Method Detail

getReferenceableNameField

public static java.lang.String getReferenceableNameField()

beginSession

public abstract void beginSession(boolean readOnly)
Initialize the session for the current Thread.

Parameters:
readOnly - Specifies whether this session will make modifications to domain objects or not

rollbackSession

public abstract void rollbackSession()
Rollback the current session.


commitSession

public abstract void commitSession()
Perform any necessary cleanup before the session is completed.


findInstanceOf

public abstract java.lang.Object findInstanceOf(java.lang.Class type,
                                                java.lang.Object objectId)
Return the existing object of the specified type with the given id.
If no object is found, null is returned.

Parameters:
type -
objectId -
Returns:

findInstanceOf

public abstract java.lang.Object findInstanceOf(java.lang.Class type,
                                                java.lang.String referenceableName)
Return the existing object of the specified type with the given referenceableName.

Referenceable names are names that are more durable than the persistence tool object id, and are suitable for explicit referencing by remote applications. That is, it is not proper to require a client application to remember an object by its object id, that value should be opaque, but the client should be provided an URL like reference to its target object.

This method should use the value of REFERENCEABLE_NAME_FIELD when searching for the applicable object. Or it should use a custom naming scheme.

Parameters:
type -
referenceableName -
Returns:

findInstanceOf

public java.lang.Object findInstanceOf(PersistenceObjectFinder finder)
Find the single object instance that matches the criteria specified by the given PersistenceObjectFinder.
If no object is found, null is returned.

Parameters:
finder -
Returns:

findAllInstancesOf

public abstract java.util.List findAllInstancesOf(java.lang.Class type,
                                                  boolean excludeSubclasses)
Return a List of all objects of the given type.
If no object is found, an empty List is returned.

Parameters:
type -
Returns:

findAllInstancesOf

public java.util.List findAllInstancesOf(PersistenceCollectionFinder finder)
Return all objects that match the criteria specified by the given PersistenceCollectionFinder.
If no object is found, an empty List is returned.

Parameters:
finder -
Returns:

createInstanceOf

public abstract java.lang.Object createInstanceOf(java.lang.Class type)
Create a new persistant instance of the given type.

Parameters:
type -
Returns:

deleteInstance

public abstract void deleteInstance(java.lang.Object object)
Delete an object.

Parameters:
object -

getIdentityOf

public java.lang.Object getIdentityOf(java.lang.Object object)

getReferenceableNameOf

public java.lang.String getReferenceableNameOf(java.lang.Object object)


Copyright (C) 2002 Vinculum Technologies, Inc. All Rights Reserved.