SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.runtime
Class PersistenceManagerFactoryImpl

java.lang.Object
  |
  +--kodo.runtime.PersistenceManagerFactoryImpl
All Implemented Interfaces:
com.solarmetric.util.Closeable, KodoPersistenceManagerFactory, PersistenceManagerFactory, Serializable
Direct Known Subclasses:
AbstractStorePersistenceManagerFactory, ClientPersistenceManagerFactory, JDBCPersistenceManagerFactory

public abstract class PersistenceManagerFactoryImpl
extends Object
implements KodoPersistenceManagerFactory

Abstract implementation of the PersistenceManagerFactory that must be subclassed for a specific runtime.

See Also:
Serialized Form

Constructor Summary
protected PersistenceManagerFactoryImpl(JDOConfiguration config)
          Constructor.
 
Method Summary
 void addInstanceLifecycleListener(InstanceLifecycleListener listener, Class[] classes)
          JDO 2.0 Preview.
protected  void addInstanceLifecycleListeners(PersistenceManagerImpl pm)
          Add PMF-registered lifecycle listeners to the persistence manager.
 void close()
           
protected  void configurePersistenceManager(PersistenceManagerImpl pm)
          Configures the given PersistenceManager with the current factory option settings.
protected  PersistenceManagerImpl findPersistenceManager(String user, String pass, boolean managed)
          Find a pooled PersistenceManager, or return null if none.
protected  PersistenceManagerImpl findTransactionalPersistenceManager(String user, String pass)
          Find a managed runtime PersistenceManager associated with the current transaction, or returns null if none.
protected  void freeze()
          Freezes the configuration of this factory.
 JDOConfiguration getConfiguration()
          Return the configuration for this factory.
 String getConnectionDriverName()
           
 Object getConnectionFactory()
           
 Object getConnectionFactory2()
           
 String getConnectionFactory2Name()
           
 String getConnectionFactoryName()
           
 String getConnectionPassword()
           
 String getConnectionURL()
           
 String getConnectionUserName()
           
 boolean getIgnoreCache()
           
 boolean getMultithreaded()
           
 boolean getNontransactionalRead()
           
 boolean getNontransactionalWrite()
           
 boolean getOptimistic()
           
 PersistenceManager getPersistenceManager()
           
 KodoPersistenceManager getPersistenceManager(boolean managed, int connRetainMode)
          Return a persistence manager in the given transaction and connection retain mode.
 PersistenceManager getPersistenceManager(String user, String pass)
           
 KodoPersistenceManager getPersistenceManager(String user, String pass, boolean managed, int connRetainMode)
          Return a persistence manager in the given transaction and connection retain mode.
protected static PersistenceManagerFactoryImpl getPooledFactory(Properties props)
          Return the pooled factory matching the given configuration, or null if none.
 Properties getProperties()
          Subclasses should override this method to add a Platform property listing the runtime platform, such as: Kodo JDO JDBC Edition: Oracle Database
 boolean getRestoreValues()
           
 boolean getRetainValues()
           
 boolean isPersistenceManagerServerRunning()
          Return true if a persistence manager server is running.
 boolean joinPersistenceManagerServer()
          Join the thread running the persistence manager server for this factory.
protected  Collection loadPersistentClasses(ClassLoader pmLoader)
          Load the configured persistent classes list.
protected  void lock()
          Synchronizes on an internal lock.
protected  PersistenceManagerImpl newPersistenceManager(String user, String pass)
          Return a PersistenceManager configured with the proper settings.
protected abstract  StoreManager newStoreManager()
          Return a new StoreManager for this runtime.
protected  void pool()
          Add the factory to the pool.
protected  Object readResolve()
          Replaces the factory with this JVMs pooled version if it exists.
 void removeInstanceLifecycleListener(InstanceLifecycleListener listener)
          JDO 2.0 Preview.
 void setConnectionDriverName(String val)
           
 void setConnectionFactory(Object val)
           
 void setConnectionFactory2(Object val)
           
 void setConnectionFactory2Name(String val)
           
 void setConnectionFactoryName(String val)
           
 void setConnectionPassword(String val)
           
 void setConnectionURL(String val)
           
 void setConnectionUserName(String val)
           
 void setIgnoreCache(boolean val)
           
 void setMultithreaded(boolean val)
           
 void setNontransactionalRead(boolean val)
           
 void setNontransactionalWrite(boolean val)
           
 void setOptimistic(boolean val)
           
 void setRestoreValues(boolean val)
           
 void setRetainValues(boolean val)
           
protected  void setup()
          Setup transient state used by this factory based on the current configuration, which will subsequently be locked down.
 boolean startPersistenceManagerServer()
          Start the persistence manager server.
 boolean stopPersistenceManagerServer()
          Stop the persistence manager server.
 Collection supportedOptions()
           
protected  void unlock()
          Releases the internal lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceManagerFactoryImpl

protected PersistenceManagerFactoryImpl(JDOConfiguration config)
Constructor. Configuration must be provided on construction.
Method Detail

getPooledFactory

protected static PersistenceManagerFactoryImpl getPooledFactory(Properties props)
Return the pooled factory matching the given configuration, or null if none.

getConfiguration

public JDOConfiguration getConfiguration()
Return the configuration for this factory.
Specified by:
getConfiguration in interface KodoPersistenceManagerFactory

getPersistenceManager

public PersistenceManager getPersistenceManager()
Specified by:
getPersistenceManager in interface PersistenceManagerFactory

getPersistenceManager

public PersistenceManager getPersistenceManager(String user,
                                                String pass)
Specified by:
getPersistenceManager in interface PersistenceManagerFactory

getPersistenceManager

public KodoPersistenceManager getPersistenceManager(boolean managed,
                                                    int connRetainMode)
Description copied from interface: KodoPersistenceManagerFactory
Return a persistence manager in the given transaction and connection retain mode. The connection mode constants are defined in KodoPersistenceManager.
Specified by:
getPersistenceManager in interface KodoPersistenceManagerFactory

getPersistenceManager

public KodoPersistenceManager getPersistenceManager(String user,
                                                    String pass,
                                                    boolean managed,
                                                    int connRetainMode)
Description copied from interface: KodoPersistenceManagerFactory
Return a persistence manager in the given transaction and connection retain mode. The mode connection mode constants are defined in KodoPersistenceManager.
Specified by:
getPersistenceManager in interface KodoPersistenceManagerFactory

addInstanceLifecycleListeners

protected void addInstanceLifecycleListeners(PersistenceManagerImpl pm)
Add PMF-registered lifecycle listeners to the persistence manager.

loadPersistentClasses

protected Collection loadPersistentClasses(ClassLoader pmLoader)
Load the configured persistent classes list. Performed automatically whenever a persistence manager is created. This method is only guaranteed to return a non-empty collection the first time it is called for a given ClassLoader.

startPersistenceManagerServer

public boolean startPersistenceManagerServer()
Description copied from interface: KodoPersistenceManagerFactory
Start the persistence manager server. This typically happens automatically when a factory with a configured server is obtained.
Specified by:
startPersistenceManagerServer in interface KodoPersistenceManagerFactory
Following copied from interface: kodo.runtime.KodoPersistenceManagerFactory
Returns:
false if there is no server configured, true otherwise

joinPersistenceManagerServer

public boolean joinPersistenceManagerServer()
Description copied from interface: KodoPersistenceManagerFactory
Join the thread running the persistence manager server for this factory.
Specified by:
joinPersistenceManagerServer in interface KodoPersistenceManagerFactory
Following copied from interface: kodo.runtime.KodoPersistenceManagerFactory
Returns:
false if no server is running, true otherwise

stopPersistenceManagerServer

public boolean stopPersistenceManagerServer()
Description copied from interface: KodoPersistenceManagerFactory
Stop the persistence manager server.
Specified by:
stopPersistenceManagerServer in interface KodoPersistenceManagerFactory
Following copied from interface: kodo.runtime.KodoPersistenceManagerFactory
Returns:
false if the server was not running, true otherwise

isPersistenceManagerServerRunning

public boolean isPersistenceManagerServerRunning()
Description copied from interface: KodoPersistenceManagerFactory
Return true if a persistence manager server is running.
Specified by:
isPersistenceManagerServerRunning in interface KodoPersistenceManagerFactory

addInstanceLifecycleListener

public void addInstanceLifecycleListener(InstanceLifecycleListener listener,
                                         Class[] classes)
Description copied from interface: KodoPersistenceManagerFactory
JDO 2.0 Preview. Register a listener for lifecycle-related events on the specified classes. If the classes are null, all events will be propagated to the listener. The listener will be passed on to all new persistence managers.
Specified by:
addInstanceLifecycleListener in interface KodoPersistenceManagerFactory

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(InstanceLifecycleListener listener)
Description copied from interface: KodoPersistenceManagerFactory
JDO 2.0 Preview. Remove a listener for lifecycle-related events.
Specified by:
removeInstanceLifecycleListener in interface KodoPersistenceManagerFactory

close

public void close()
Specified by:
close in interface PersistenceManagerFactory

getProperties

public Properties getProperties()
Subclasses should override this method to add a Platform property listing the runtime platform, such as: Kodo JDO JDBC Edition: Oracle Database
Specified by:
getProperties in interface PersistenceManagerFactory

supportedOptions

public Collection supportedOptions()
Specified by:
supportedOptions in interface PersistenceManagerFactory

getConnectionUserName

public String getConnectionUserName()
Specified by:
getConnectionUserName in interface PersistenceManagerFactory

setConnectionUserName

public void setConnectionUserName(String val)
Specified by:
setConnectionUserName in interface PersistenceManagerFactory

getConnectionPassword

public String getConnectionPassword()

setConnectionPassword

public void setConnectionPassword(String val)
Specified by:
setConnectionPassword in interface PersistenceManagerFactory

getConnectionURL

public String getConnectionURL()
Specified by:
getConnectionURL in interface PersistenceManagerFactory

setConnectionURL

public void setConnectionURL(String val)
Specified by:
setConnectionURL in interface PersistenceManagerFactory

getConnectionDriverName

public String getConnectionDriverName()
Specified by:
getConnectionDriverName in interface PersistenceManagerFactory

setConnectionDriverName

public void setConnectionDriverName(String val)
Specified by:
setConnectionDriverName in interface PersistenceManagerFactory

getConnectionFactoryName

public String getConnectionFactoryName()
Specified by:
getConnectionFactoryName in interface PersistenceManagerFactory

setConnectionFactoryName

public void setConnectionFactoryName(String val)
Specified by:
setConnectionFactoryName in interface PersistenceManagerFactory

getConnectionFactory

public Object getConnectionFactory()
Specified by:
getConnectionFactory in interface PersistenceManagerFactory

setConnectionFactory

public void setConnectionFactory(Object val)
Specified by:
setConnectionFactory in interface PersistenceManagerFactory

getConnectionFactory2Name

public String getConnectionFactory2Name()
Specified by:
getConnectionFactory2Name in interface PersistenceManagerFactory

setConnectionFactory2Name

public void setConnectionFactory2Name(String val)
Specified by:
setConnectionFactory2Name in interface PersistenceManagerFactory

getConnectionFactory2

public Object getConnectionFactory2()
Specified by:
getConnectionFactory2 in interface PersistenceManagerFactory

setConnectionFactory2

public void setConnectionFactory2(Object val)
Specified by:
setConnectionFactory2 in interface PersistenceManagerFactory

getOptimistic

public boolean getOptimistic()
Specified by:
getOptimistic in interface PersistenceManagerFactory

setOptimistic

public void setOptimistic(boolean val)
Specified by:
setOptimistic in interface PersistenceManagerFactory

getRetainValues

public boolean getRetainValues()
Specified by:
getRetainValues in interface PersistenceManagerFactory

setRetainValues

public void setRetainValues(boolean val)
Specified by:
setRetainValues in interface PersistenceManagerFactory

getRestoreValues

public boolean getRestoreValues()
Specified by:
getRestoreValues in interface PersistenceManagerFactory

setRestoreValues

public void setRestoreValues(boolean val)
Specified by:
setRestoreValues in interface PersistenceManagerFactory

getNontransactionalRead

public boolean getNontransactionalRead()
Specified by:
getNontransactionalRead in interface PersistenceManagerFactory

setNontransactionalRead

public void setNontransactionalRead(boolean val)
Specified by:
setNontransactionalRead in interface PersistenceManagerFactory

getNontransactionalWrite

public boolean getNontransactionalWrite()
Specified by:
getNontransactionalWrite in interface PersistenceManagerFactory

setNontransactionalWrite

public void setNontransactionalWrite(boolean val)
Specified by:
setNontransactionalWrite in interface PersistenceManagerFactory

getIgnoreCache

public boolean getIgnoreCache()
Specified by:
getIgnoreCache in interface PersistenceManagerFactory

setIgnoreCache

public void setIgnoreCache(boolean val)
Specified by:
setIgnoreCache in interface PersistenceManagerFactory

getMultithreaded

public boolean getMultithreaded()
Specified by:
getMultithreaded in interface PersistenceManagerFactory

setMultithreaded

public void setMultithreaded(boolean val)
Specified by:
setMultithreaded in interface PersistenceManagerFactory

readResolve

protected Object readResolve()
                      throws ObjectStreamException
Replaces the factory with this JVMs pooled version if it exists. Also freezes the factory.

newStoreManager

protected abstract StoreManager newStoreManager()
Return a new StoreManager for this runtime. Note that the instance returned here may be wrapped before being passed to the newPersistenceManager(java.lang.String, java.lang.String) method.

findPersistenceManager

protected PersistenceManagerImpl findPersistenceManager(String user,
                                                        String pass,
                                                        boolean managed)
Find a pooled PersistenceManager, or return null if none. If using managed transactions, looks for a transactional persistence manager; otherwise returns null by default. This method will be called before newStoreManager() so that factory subclasses implementing pooling can return a matching manager before a new StoreManager is created.

newPersistenceManager

protected PersistenceManagerImpl newPersistenceManager(String user,
                                                       String pass)
Return a PersistenceManager configured with the proper settings. By default, this method constructs a new PersistenceManagerImpl of the class set for this factory.

setup

protected void setup()
Setup transient state used by this factory based on the current configuration, which will subsequently be locked down. This method will be called before the first PersistenceManager is requested, and will be re-called each time the factory is deserialized into a JVM that has no configuration for this data store. Subclasses must be sure to call super.setup() if they override this method.

findTransactionalPersistenceManager

protected PersistenceManagerImpl findTransactionalPersistenceManager(String user,
                                                                     String pass)
Find a managed runtime PersistenceManager associated with the current transaction, or returns null if none.

configurePersistenceManager

protected void configurePersistenceManager(PersistenceManagerImpl pm)
Configures the given PersistenceManager with the current factory option settings.

lock

protected void lock()
Synchronizes on an internal lock. Make sure to call unlock() in a finally clause of the same method.

unlock

protected void unlock()
Releases the internal lock.

pool

protected void pool()
Add the factory to the pool.

freeze

protected void freeze()
Freezes the configuration of this factory.

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.