org.datanucleus
Class OMFContext

java.lang.Object
  extended by org.datanucleus.OMFContext

public class OMFContext
extends java.lang.Object

Represents the context of an ObjectManagerFactory, holding state information and components that it needs to perform its task.


Field Summary
protected  Level2Cache cache
          Level 2 Cache, caching across ObjectManagers.
static int CONTEXT_ENHANCE
          Enhancement context.
static int CONTEXT_PERSISTENCE
          Persistence context.
protected static Localiser LOCALISER
          Localisation of messages.
 
Constructor Summary
OMFContext(PersistenceConfiguration persistenceConfig)
          Constructor for the context.
OMFContext(PersistenceConfiguration persistenceConfig, int context)
          Constructor for the context.
 
Method Summary
 void addObjectManagerListener(ExecutionContext.LifecycleListener listener)
          Register a new Listener for ObjectManager's events
 void close()
          Clear out resources
 java.lang.String getApi()
          Accessor for the API name.
 ApiAdapter getApiAdapter()
          Accessor for the ApiAdapter
 java.util.Calendar getCalendarForDateTimezone()
          Accessor for the Calendar to be used in handling all timezone issues with the datastore.
 ClassLoaderResolver getClassLoaderResolver(java.lang.ClassLoader primaryLoader)
          Accessor for a ClassLoaderResolver to use in resolving classes.
 int getContext()
           
 java.lang.Class getDatastoreIdentityClass()
          Accessor for the class to use for datastore identity.
 IdentityTranslator getIdentityTranslator()
          Accessor for the current identity translator to use (if any).
 ImplementationCreator getImplementationCreator()
          Accessor for the implementation creator for this context.
 ManagementManager getJMXManager()
          Accessor for the JMX manager (if required).
 javax.transaction.TransactionManager getJtaTransactionManager()
          Accessor for the JTA transaction manager (if using JTA).
 Level2Cache getLevel2Cache()
          Accessor for the DataStore (level 2) Cache
 MetaDataManager getMetaDataManager()
          Accessor for the Meta-Data Manager.
 ExecutionContext.LifecycleListener[] getObjectManagerListeners()
          Object the array of registered ObjectManagerListener's
 PersistenceConfiguration getPersistenceConfiguration()
          Accessor for the persistence configuration.
 PluginManager getPluginManager()
          Accessor for the Plugin Manager
 QueryManager getQueryManager()
          Accessor to the QueryManager
 StoreManager getStoreManager()
          Accessor for the StoreManager
 TransactionManager getTransactionManager()
          Accessor for the transaction manager.
 TypeManager getTypeManager()
          Accessor for the Type Manager
 boolean hasLevel2Cache()
          Return whether there is an L2 cache.
 boolean isJcaMode()
          Accessor for the JCA mode.
 void removeObjectManagerListener(ExecutionContext.LifecycleListener listener)
          Unregister a Listener from ObjectManager's events
 void setApi(java.lang.String name)
          Configure the API to be used
 void setJcaMode(boolean jca)
          Mutator for whether we are in JCA mode.
 void setStoreManager(StoreManager storeMgr)
          Mutator for the store manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation of messages.


CONTEXT_PERSISTENCE

public static final int CONTEXT_PERSISTENCE
Persistence context.

See Also:
Constant Field Values

CONTEXT_ENHANCE

public static final int CONTEXT_ENHANCE
Enhancement context.

See Also:
Constant Field Values

cache

protected Level2Cache cache
Level 2 Cache, caching across ObjectManagers.

Constructor Detail

OMFContext

public OMFContext(PersistenceConfiguration persistenceConfig)
Constructor for the context.

Parameters:
persistenceConfig - The persistence configuration

OMFContext

public OMFContext(PersistenceConfiguration persistenceConfig,
                  int context)
Constructor for the context. Any persistence properties affecting the plugin manager, api adapter, and type manager should have been set by this point.

Parameters:
persistenceConfig - The persistence configuration
context - The context that this is used in (persistence, enhancement)
Method Detail

getContext

public int getContext()

close

public void close()
Clear out resources


getDatastoreIdentityClass

public java.lang.Class getDatastoreIdentityClass()
Accessor for the class to use for datastore identity.

Returns:
Class for datastore-identity

getIdentityTranslator

public IdentityTranslator getIdentityTranslator()
Accessor for the current identity translator to use (if any).

Returns:
Identity translator instance (or null if persistence property not set)

getJMXManager

public ManagementManager getJMXManager()
Accessor for the JMX manager (if required). If the user has set the persistence property "datanucleus.managedRuntime" to true then this will return a JMX manager.

Returns:
The JMX manager

getClassLoaderResolver

public ClassLoaderResolver getClassLoaderResolver(java.lang.ClassLoader primaryLoader)
Accessor for a ClassLoaderResolver to use in resolving classes.

Parameters:
primaryLoader - Loader to use as the primary loader.
Returns:
The ClassLoader resolver

getImplementationCreator

public ImplementationCreator getImplementationCreator()
Accessor for the implementation creator for this context.

Returns:
The implementation creator

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the Meta-Data Manager.

Returns:
Returns the MetaDataManager.

getPersistenceConfiguration

public PersistenceConfiguration getPersistenceConfiguration()
Accessor for the persistence configuration.

Returns:
Returns the persistence configuration.

getPluginManager

public PluginManager getPluginManager()
Accessor for the Plugin Manager

Returns:
the PluginManager

getTypeManager

public TypeManager getTypeManager()
Accessor for the Type Manager

Returns:
the TypeManager

getTransactionManager

public TransactionManager getTransactionManager()
Accessor for the transaction manager.

Returns:
The transaction manager.

getJtaTransactionManager

public javax.transaction.TransactionManager getJtaTransactionManager()
Accessor for the JTA transaction manager (if using JTA).

Returns:
the JTA Transaction Manager

getStoreManager

public StoreManager getStoreManager()
Accessor for the StoreManager

Returns:
the StoreManager

setStoreManager

public void setStoreManager(StoreManager storeMgr)
Mutator for the store manager. Can only be set once.

Parameters:
storeMgr - The store manager

getApiAdapter

public ApiAdapter getApiAdapter()
Accessor for the ApiAdapter

Returns:
the ApiAdapter

getApi

public java.lang.String getApi()
Accessor for the API name.

Returns:
the api

setApi

public void setApi(java.lang.String name)
Configure the API to be used

Parameters:
name - the API name

hasLevel2Cache

public boolean hasLevel2Cache()
Return whether there is an L2 cache.

Returns:
Whether the L2 cache is enabled

getLevel2Cache

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

Returns:
The datastore cache

getObjectManagerListeners

public ExecutionContext.LifecycleListener[] getObjectManagerListeners()
Object the array of registered ObjectManagerListener's

Returns:
array of ExecutionContext.LifecycleListener

addObjectManagerListener

public void addObjectManagerListener(ExecutionContext.LifecycleListener listener)
Register a new Listener for ObjectManager's events

Parameters:
listener - the listener to register

removeObjectManagerListener

public void removeObjectManagerListener(ExecutionContext.LifecycleListener listener)
Unregister a Listener from ObjectManager's events

Parameters:
listener - the listener to unregister

getQueryManager

public QueryManager getQueryManager()
Accessor to the QueryManager

Returns:
the QueryManager

setJcaMode

public void setJcaMode(boolean jca)
Mutator for whether we are in JCA mode.

Parameters:
jca - true if using JCA connector

isJcaMode

public boolean isJcaMode()
Accessor for the JCA mode.

Returns:
true if using JCA connector.

getCalendarForDateTimezone

public java.util.Calendar getCalendarForDateTimezone()
Accessor for the Calendar to be used in handling all timezone issues with the datastore. Utilises the "serverTimeZoneID" in providing this Calendar used in time/date conversions.

Returns:
The calendar to use for dateTimezone issues.


Copyright © 2011. All Rights Reserved.