org.datanucleus
Class ObjectManagerFactoryImpl

java.lang.Object
  extended by org.datanucleus.PersistenceConfiguration
      extended by org.datanucleus.ObjectManagerFactoryImpl
Direct Known Subclasses:
AbstractPersistenceManagerFactory

public class ObjectManagerFactoryImpl
extends PersistenceConfiguration

ObjectManagerFactory responsible for creation of ObjectManagers for persistence of objects to datastores. Will typically be either extended or utilised by PersistenceManagerFactory (JDO) or EntityManagerFactory (JPA).


Field Summary
protected  Level2Cache cache
          Level 2 Cache, caching across ObjectManagers.
protected  OMFContext omfContext
          The context that this ObjectManagerFactory uses.
 
Fields inherited from class org.datanucleus.PersistenceConfiguration
configurable, LOCALISER
 
Constructor Summary
ObjectManagerFactoryImpl()
          Constructor.
 
Method Summary
protected  void addInternalFetchGroup(FetchGroup grp)
          Method to add a dynamic FetchGroup for use by this OMF.
protected  void assertIsOpen()
          Asserts that the factory is open.
 void close()
          Close the ObjectManagerFactory.
 FetchGroup createInternalFetchGroup(java.lang.Class cls, java.lang.String name)
          Method to create a new internal fetch group for the class+name.
protected  FetchGroupManager getFetchGroupManager()
          Convenience accessor for the FetchGroupManager.
 java.util.Set getFetchGroupsWithName(java.lang.String name)
          Accessor for the fetch groups for the specified name.
 FetchGroup getInternalFetchGroup(java.lang.Class cls, java.lang.String name)
          Accessor for an internal fetch group for the specified class.
 Level2Cache getLevel2Cache()
          Accessor for the DataStore (level 2) Cache
 OMFContext getOMFContext()
          Gets the context for this ObjectManagerFactory
 PersistenceConfiguration getPersistenceConfiguration()
          Accessor for the PersistenceConfiguration.
 StoreManager getStoreManager()
          Convenience accessor for the StoreManager.
static java.lang.String getVendorName()
          Utility to get the vendor of DataNucleus.
static java.lang.String getVersionNumber()
          Utility to get the version of DataNucleus.
protected  void initialiseLevel2Cache()
          Method to initialise the L2 cache.
protected  void initialiseOMFContext()
          Method to initialise the OMFContext.
protected  void initialiseStoreManager(ClassLoaderResolver clr)
          Method to initialise the StoreManager used by this factory.
 boolean isClosed()
          Utility to return whether the factory is closed or not.
protected  void logConfiguration()
          Method to log the configuration of this factory.
protected  void removeInternalFetchGroup(FetchGroup grp)
          Method to remove a dynamic FetchGroup from use by this OMF.
 
Methods inherited from class org.datanucleus.PersistenceConfiguration
assertConfigurable, equals, getBooleanObjectProperty, getBooleanProperty, getCalendarForDateTimezone, getIntProperty, getLongProperty, getOptions, getPrimaryClassLoader, getProperty, getStringProperty, getSupportedOptions, hasProperty, isJcaMode, setDefaultProperties, setJCAMode, setOptions, setPrimaryClassLoader, setPropertiesFile, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

omfContext

protected OMFContext omfContext
The context that this ObjectManagerFactory uses.


cache

protected Level2Cache cache
Level 2 Cache, caching across ObjectManagers.

Constructor Detail

ObjectManagerFactoryImpl

public ObjectManagerFactoryImpl()
Constructor.

Method Detail

assertIsOpen

protected void assertIsOpen()
Asserts that the factory is open.

Throws:
NucleusUserException - if it is already closed

logConfiguration

protected void logConfiguration()
Method to log the configuration of this factory.


initialiseOMFContext

protected void initialiseOMFContext()
Method to initialise the OMFContext. This should be performed after setting any persistence properties that affect the content of the OMFContext (e.g PluginRegistry, ClassLoaderResolver, etc).


initialiseStoreManager

protected void initialiseStoreManager(ClassLoaderResolver clr)
Method to initialise the StoreManager used by this factory.

Parameters:
clr - ClassLoaderResolver to use for class loading issues

getStoreManager

public StoreManager getStoreManager()
Convenience accessor for the StoreManager. This is for public access to DataNucleus APIs. TODO Rework this when there is a FederationManager.

Returns:
The StoreManager

initialiseLevel2Cache

protected void initialiseLevel2Cache()
Method to initialise the L2 cache.


close

public void close()
Close the ObjectManagerFactory. Cleans out all objects in the Level2 cache and closes the context, marking the factory as closed.


isClosed

public boolean isClosed()
Utility to return whether the factory is closed or not.

Returns:
Whether it is closed.

getOMFContext

public OMFContext getOMFContext()
Gets the context for this ObjectManagerFactory

Returns:
Returns the context.

getPersistenceConfiguration

public PersistenceConfiguration getPersistenceConfiguration()
Accessor for the PersistenceConfiguration.

Returns:
Returns the persistence config.

getLevel2Cache

public Level2Cache getLevel2Cache()
Accessor for the DataStore (level 2) Cache

Returns:
The datastore cache
Since:
1.1

getVersionNumber

public static java.lang.String getVersionNumber()
Utility to get the version of DataNucleus.

Returns:
Version number for DataNucleus.

getVendorName

public static java.lang.String getVendorName()
Utility to get the vendor of DataNucleus.

Returns:
Vendor name for DataNucleus.

getFetchGroupManager

protected FetchGroupManager getFetchGroupManager()
Convenience accessor for the FetchGroupManager. Creates it if not yet existing.

Returns:
The FetchGroupManager

addInternalFetchGroup

protected void addInternalFetchGroup(FetchGroup grp)
Method to add a dynamic FetchGroup for use by this OMF.

Parameters:
grp - The group

removeInternalFetchGroup

protected void removeInternalFetchGroup(FetchGroup grp)
Method to remove a dynamic FetchGroup from use by this OMF.

Parameters:
grp - The group

createInternalFetchGroup

public FetchGroup createInternalFetchGroup(java.lang.Class cls,
                                           java.lang.String name)
Method to create a new internal fetch group for the class+name.

Parameters:
cls - Class that it applies to
name - Name of group
Returns:
The group

getInternalFetchGroup

public FetchGroup getInternalFetchGroup(java.lang.Class cls,
                                        java.lang.String name)
Accessor for an internal fetch group for the specified class.

Parameters:
cls - The class
name - Name of the group
Returns:
The FetchGroup
Throws:
NucleusUserException - if the class is not persistable

getFetchGroupsWithName

public java.util.Set getFetchGroupsWithName(java.lang.String name)
Accessor for the fetch groups for the specified name.

Parameters:
name - Name of the group
Returns:
The FetchGroup


Copyright © 2009. All Rights Reserved.