com.vinculumtech.platform.root
Class PersistenceRoot

java.lang.Object
  extended bycom.vinculumtech.platform.root.PersistenceRoot

public final class PersistenceRoot
extends java.lang.Object

PersistenceRoot is responsible for life cycle management of all persistent objects, and is the sole interface to the persistence engine.

A PersistenceSession must be created and destroyed for each Thread at the server boundaries.

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

Field Summary
static java.lang.String PERSISTENCE_SESSION_PROPERTY
          The property name specifying the PersistenceSession implementation to use.
 
Method Summary
static void beginSession(boolean readOnly)
          Create a PersistenceSession for the current Thread.
static void commitSession()
          Destroy the PersistenceSession for the current Thread.
static java.lang.Object createInstanceOf(java.lang.Class type)
          Create a new object of the specified type.
static void deleteInstance(java.lang.Object object)
          Delete a persisted object.
static java.util.List findAllInstancesOf(java.lang.Class type, boolean excludeSubclasses)
          Return the a List of all objects of the given type
static java.util.List findAllInstancesOf(PersistenceCollectionFinder finder)
          Return a List of all objects meeting the criteria specified by the given CollectionFinder.
static java.lang.Object findInstanceOf(java.lang.Class type)
          Return the existing object of the specified type.
static java.lang.Object findInstanceOf(java.lang.Class type, java.lang.Object objectId)
          Return the existing object of the specified type with the given id.
static java.lang.Object findInstanceOf(java.lang.Class type, java.lang.String referenceableName)
          Return the existing object of the specified type with the given name.
static java.lang.Object findInstanceOf(PersistenceObjectFinder finder)
          Find the existing object using the query represented by the specified ObjectFinder.
static java.lang.Object getIdentityOf(java.lang.Object object)
           
protected static PersistenceSession getPersistenceSession()
          Get the PersistenceSession for the current Thread.
static java.lang.String getReferenceableNameOf(java.lang.Object object)
           
static boolean isInSession()
          Test whether this thread has an available PersistenceSession.
static void rollbackSession()
          Destroy the PersistenceSession for the current Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSISTENCE_SESSION_PROPERTY

public static final java.lang.String PERSISTENCE_SESSION_PROPERTY
The property name specifying the PersistenceSession implementation to use.

See Also:
Constant Field Values
Method Detail

beginSession

public static final void beginSession(boolean readOnly)
Create a PersistenceSession for the current Thread. This must be done before any other persistence methods are invoked.

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

rollbackSession

public static final void rollbackSession()
Destroy the PersistenceSession for the current Thread. Each call into the server must destroy it's session before returning.


commitSession

public static final void commitSession()
Destroy the PersistenceSession for the current Thread. Each call into the server must destroy it's session before returning.


isInSession

public static final boolean isInSession()
Test whether this thread has an available PersistenceSession.


getPersistenceSession

protected static final PersistenceSession getPersistenceSession()
Get the PersistenceSession for the current Thread.

Throws:
java.lang.IllegalStateException - if no PersistenceSession is active for the current thread

findInstanceOf

public static final java.lang.Object findInstanceOf(java.lang.Class type)
Return the existing object of the specified type. Note this method returns the first found instance of the given type (subclasses excluded).

Use this method with Singleton type instances.


findInstanceOf

public static final java.lang.Object findInstanceOf(java.lang.Class type,
                                                    java.lang.Object objectId)
Return the existing object of the specified type with the given id.


findInstanceOf

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


findInstanceOf

public static final java.lang.Object findInstanceOf(PersistenceObjectFinder finder)
Find the existing object using the query represented by the specified ObjectFinder.


findAllInstancesOf

public static final java.util.List findAllInstancesOf(java.lang.Class type,
                                                      boolean excludeSubclasses)
Return the a List of all objects of the given type


findAllInstancesOf

public static final java.util.List findAllInstancesOf(PersistenceCollectionFinder finder)
Return a List of all objects meeting the criteria specified by the given CollectionFinder.


createInstanceOf

public static final java.lang.Object createInstanceOf(java.lang.Class type)
                                               throws PersistenceException
Create a new object of the specified type.

Throws:
PersistenceException

deleteInstance

public static final void deleteInstance(java.lang.Object object)
                                 throws PersistenceException
Delete a persisted object.

Throws:
PersistenceException

getIdentityOf

public static final java.lang.Object getIdentityOf(java.lang.Object object)
                                            throws PersistenceException
Throws:
PersistenceException

getReferenceableNameOf

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


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