public class NucleusContext extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NucleusContext.ContextType |
Modifier and Type | Field and Description |
---|---|
protected static Localiser |
LOCALISER
Localisation of messages.
|
static Random |
random
Random number generator, for use when needing unique names.
|
static Set<String> |
STARTUP_PROPERTIES |
Constructor and Description |
---|
NucleusContext(String apiName,
Map startupProps)
Constructor for the context.
|
NucleusContext(String apiName,
Map startupProps,
PluginManager pluginMgr)
Constructor for the context.
|
NucleusContext(String apiName,
NucleusContext.ContextType type,
Map startupProps)
Constructor for the context.
|
NucleusContext(String apiName,
NucleusContext.ContextType type,
Map startupProps,
PluginManager pluginMgr)
Constructor for the context.
|
Modifier and Type | Method and Description |
---|---|
void |
addExecutionContextListener(ExecutionContext.LifecycleListener listener)
Register a new Listener for ExecutionContext events.
|
void |
addInternalFetchGroup(FetchGroup grp)
Method to add a dynamic FetchGroup for use by this OMF.
|
void |
close()
Clear out resources
|
FetchGroup |
createInternalFetchGroup(Class cls,
String name)
Method to create a new internal fetch group for the class+name.
|
static StoreManager |
createStoreManagerForProperties(Map<String,Object> props,
Map<String,Object> datastoreProps,
ClassLoaderResolver clr,
NucleusContext nucCtx)
Method to create a StoreManager based on the specified properties passed in.
|
ApiAdapter |
getApiAdapter()
Accessor for the ApiAdapter
|
String |
getApiName()
Accessor for the name of the API (JDO, JPA, etc).
|
ClassLoaderResolver |
getClassLoaderResolver(ClassLoader primaryLoader)
Accessor for a ClassLoaderResolver to use in resolving classes.
|
Class |
getDatastoreIdentityClass()
Accessor for the class to use for datastore identity.
|
ExecutionContext.LifecycleListener[] |
getExecutionContextListeners()
Object the array of registered ExecutionContext listeners.
|
FetchGroupManager |
getFetchGroupManager()
Convenience accessor for the FetchGroupManager.
|
Set<FetchGroup> |
getFetchGroupsWithName(String name)
Accessor for the fetch groups for the specified name.
|
IdentityKeyTranslator |
getIdentityKeyTranslator()
Accessor for the current identity key translator to use (if any).
|
IdentityStringTranslator |
getIdentityStringTranslator()
Accessor for the current identity string translator to use (if any).
|
ImplementationCreator |
getImplementationCreator()
Accessor for the implementation creator for this context.
|
FetchGroup |
getInternalFetchGroup(Class cls,
String name)
Accessor for an internal fetch group for the specified class.
|
ManagementManager |
getJMXManager()
Accessor for the JMX manager (if required).
|
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.
|
PersistenceConfiguration |
getPersistenceConfiguration()
Accessor for the persistence configuration.
|
PluginManager |
getPluginManager()
Accessor for the Plugin Manager
|
FactoryStatistics |
getStatistics() |
StoreManager |
getStoreManager()
Accessor for the StoreManager
|
static String |
getTransactionIsolationForStoreManager(StoreManager storeMgr,
String transactionIsolation)
Method to return the transaction isolation level that will be used for the provided StoreManager
bearing in mind the specified level the user requested.
|
TransactionManager |
getTransactionManager()
Accessor for the transaction manager.
|
NucleusContext.ContextType |
getType()
Accessor for the type of this context (persistence, enhancer etc).
|
TypeManager |
getTypeManager()
Accessor for the Type Manager
|
CallbackHandler |
getValidationHandler(ExecutionContext ec)
Method to return a handler for validation (JSR303).
|
boolean |
hasLevel2Cache()
Return whether there is an L2 cache.
|
void |
initialise()
Method to initialise the context for use.
|
boolean |
isClassCacheable(AbstractClassMetaData cmd)
Convenience method to return if objects of this type are cached for this NucleusContext.
|
boolean |
isJcaMode()
Accessor for the JCA mode.
|
boolean |
isStoreManagerInitialised() |
protected void |
logConfiguration()
Method to log the configuration of this context.
|
void |
removeExecutionContextListener(ExecutionContext.LifecycleListener listener)
Unregister a Listener from ExecutionContext events.
|
void |
removeInternalFetchGroup(FetchGroup grp)
Method to remove a dynamic FetchGroup from use by this OMF.
|
void |
setJcaMode(boolean jca)
Mutator for whether we are in JCA mode.
|
boolean |
statisticsEnabled()
Accessor for whether statistics gathering is enabled.
|
protected static final Localiser LOCALISER
public static final Random random
public NucleusContext(String apiName, Map startupProps)
apiName
- Name of the API that we need a context for (JDO, JPA, etc)startupProps
- Any properties that could define behaviour of this context (plugin registry, class loading etc)public NucleusContext(String apiName, Map startupProps, PluginManager pluginMgr)
apiName
- Name of the API that we need a context for (JDO, JPA, etc)startupProps
- Any properties that could define behaviour of this context (plugin registry, class loading etc)pluginMgr
- Plugin Manager (or null if wanting it to be created)public NucleusContext(String apiName, NucleusContext.ContextType type, Map startupProps)
apiName
- Name of the API that we need a context for (JDO, JPA, etc)type
- The type of context required (persistence, enhancement)startupProps
- Any properties that could define behaviour of this context (plugin registry, class loading etc)public NucleusContext(String apiName, NucleusContext.ContextType type, Map startupProps, PluginManager pluginMgr)
apiName
- Name of the API that we need a context for (JDO, JPA, etc)type
- The type of context required (persistence, enhancement)startupProps
- Any properties that could define behaviour of this context (plugin registry, class loading etc)pluginMgr
- Plugin Manager (or null if wanting it to be created)public void initialise()
public static String getTransactionIsolationForStoreManager(StoreManager storeMgr, String transactionIsolation)
storeMgr
- The Store ManagertransactionIsolation
- Requested isolation levelTransactionIsolationNotSupportedException
- When no suitable level available given the requested levelpublic static StoreManager createStoreManagerForProperties(Map<String,Object> props, Map<String,Object> datastoreProps, ClassLoaderResolver clr, NucleusContext nucCtx)
props
- The overall persistence propertiesdatastoreProps
- Persistence properties to apply to the datastoreclr
- ClassLoader resolverNucleusUserException
- if impossible to create the StoreManager (not in CLASSPATH?, invalid definition?)public void close()
public NucleusContext.ContextType getType()
public ApiAdapter getApiAdapter()
public String getApiName()
public PersistenceConfiguration getPersistenceConfiguration()
public PluginManager getPluginManager()
public TypeManager getTypeManager()
protected void logConfiguration()
public Class getDatastoreIdentityClass()
public IdentityStringTranslator getIdentityStringTranslator()
public IdentityKeyTranslator getIdentityKeyTranslator()
public boolean statisticsEnabled()
public ManagementManager getJMXManager()
public FactoryStatistics getStatistics()
public ClassLoaderResolver getClassLoaderResolver(ClassLoader primaryLoader)
primaryLoader
- Loader to use as the primary loader (or null)public ImplementationCreator getImplementationCreator()
public MetaDataManager getMetaDataManager()
public TransactionManager getTransactionManager()
public TransactionManager getJtaTransactionManager()
public boolean isStoreManagerInitialised()
public StoreManager getStoreManager()
public CallbackHandler getValidationHandler(ExecutionContext ec)
ec
- The ExecutionContext that the handler is for.public boolean hasLevel2Cache()
public Level2Cache getLevel2Cache()
public ExecutionContext.LifecycleListener[] getExecutionContextListeners()
ExecutionContext.LifecycleListener
public void addExecutionContextListener(ExecutionContext.LifecycleListener listener)
listener
- the listener to registerpublic void removeExecutionContextListener(ExecutionContext.LifecycleListener listener)
listener
- the listener to unregisterpublic void setJcaMode(boolean jca)
jca
- true if using JCA connectorpublic boolean isJcaMode()
public FetchGroupManager getFetchGroupManager()
public void addInternalFetchGroup(FetchGroup grp)
grp
- The grouppublic void removeInternalFetchGroup(FetchGroup grp)
grp
- The grouppublic FetchGroup createInternalFetchGroup(Class cls, String name)
cls
- Class that it applies toname
- Name of grouppublic FetchGroup getInternalFetchGroup(Class cls, String name)
cls
- The classname
- Name of the groupNucleusUserException
- if the class is not persistablepublic Set<FetchGroup> getFetchGroupsWithName(String name)
name
- Name of the grouppublic boolean isClassCacheable(AbstractClassMetaData cmd)
Copyright © 2012. All Rights Reserved.