goodsjpi
Class PersistenceFactory

java.lang.Object
  extended bygoodsjpi.PersistenceFactory
Direct Known Subclasses:
GoodsFactory

public abstract class PersistenceFactory
extends java.lang.Object

Class which defines the interface to a persistent store


Field Summary
protected static java.util.Properties persistenceMap
          Mapping from class and interface types to persistent implementations of them this contains lines like persistence.root=my.root.object.type persistence.java.util.Set=goodsjpi.PersistentHashSet persistence.java.util.List=goodsjpi.PersistentArrayList
protected  java.lang.Object root
          Root object of the object store
 
Constructor Summary
protected PersistenceFactory()
          Create the new persistence factory
 
Method Summary
static PersistenceFactory get()
          Get the instance of the persistence factory
static java.lang.Object get(java.lang.Class required)
          Get an object instance which is compatible with the required class and is also persistent
static java.lang.Object get(java.lang.Class required, java.lang.Class[] types, java.lang.Object[] params)
          Get an object instance which is compatible with the required class and is also persistent
protected static java.lang.Class getImplClass(java.lang.Class required)
          Get the implementation type for the requested type
protected abstract  java.lang.Object getImplementation(java.lang.Class required)
          Handle on the datastore specific getImplementation method
protected abstract  java.lang.Object getImplementation(java.lang.Class required, java.lang.Class[] types, java.lang.Object[] params)
          Handle on the datastore specific getImplementation method
static java.lang.Object getRoot()
          Get the root object of the data store
protected abstract  java.lang.Object getRootImpl()
          Handle on the datastore specific implementation of the getRoot method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected java.lang.Object root
Root object of the object store


persistenceMap

protected static java.util.Properties persistenceMap
Mapping from class and interface types to persistent implementations of them this contains lines like persistence.root=my.root.object.type persistence.java.util.Set=goodsjpi.PersistentHashSet persistence.java.util.List=goodsjpi.PersistentArrayList

Constructor Detail

PersistenceFactory

protected PersistenceFactory()
Create the new persistence factory

Method Detail

get

public static final PersistenceFactory get()
Get the instance of the persistence factory


get

public static final java.lang.Object get(java.lang.Class required)
Get an object instance which is compatible with the required class and is also persistent

Parameters:
required - the required class or interface type

get

public static final java.lang.Object get(java.lang.Class required,
                                         java.lang.Class[] types,
                                         java.lang.Object[] params)
Get an object instance which is compatible with the required class and is also persistent

Parameters:
required - the required class or interface type
types - array of types for the constructor
params - array of parameters for the constructor

getImplClass

protected static java.lang.Class getImplClass(java.lang.Class required)
Get the implementation type for the requested type

Parameters:
required - a class or interface type for which a persistent implementation is required
Returns:
the class type implementing persistence for the required type

getImplementation

protected abstract java.lang.Object getImplementation(java.lang.Class required)
Handle on the datastore specific getImplementation method

Parameters:
required - class for which a persistent object is required

getImplementation

protected abstract java.lang.Object getImplementation(java.lang.Class required,
                                                      java.lang.Class[] types,
                                                      java.lang.Object[] params)
Handle on the datastore specific getImplementation method

Parameters:
required - class for which a persistent object is required
types - array of types for the constuctor arguments
params - array of parameters for the constructor

getRoot

public static java.lang.Object getRoot()
                                throws java.io.IOException
Get the root object of the data store

Returns:
an object of type mapped by the entry persistence.root in the config file
Throws:
java.io.IOException

getRootImpl

protected abstract java.lang.Object getRootImpl()
                                         throws java.io.IOException
Handle on the datastore specific implementation of the getRoot method

Returns:
an object of type mapped by the entry persistence.root in the config file
Throws:
java.io.IOException