public class PersistenceNucleusContextImpl extends AbstractNucleusContext implements Serializable, PersistenceNucleusContext
apiAdapter, classLoaderResolverClassName, classLoaderResolverMap, config, metaDataManager, pluginManager, STARTUP_PROPERTIES, typeManager
Constructor and Description |
---|
PersistenceNucleusContextImpl(String apiName,
Map startupProps)
Constructor for the context.
|
PersistenceNucleusContextImpl(String apiName,
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 |
applyDefaultProperties(Configuration conf)
Method called when initialising the Configuration to load up defaults for the properties appropriate for this NucleusContext.
|
void |
close()
Clear out resources for the supported services.
|
FetchGroup |
createInternalFetchGroup(Class cls,
String name)
Method to create a new internal fetch group for the class+name.
|
AutoStartMechanism |
getAutoStartMechanism() |
BeanValidationHandler |
getBeanValidationHandler(ExecutionContext ec)
Method to return a handler for bean validation (JSR303).
|
CDIHandler |
getCDIHandler()
Accessor for the handler for CDI (JSR346) if in an environment that provides one.
|
String |
getCurrentUser(ExecutionContext ec)
Accessor for the current user for the supplied ExecutionContext.
|
ExecutionContext |
getExecutionContext(Object owner,
Map<String,Object> options)
Method to return an ExecutionContext for use in persistence.
|
ExecutionContext.LifecycleListener[] |
getExecutionContextListeners()
Object the array of registered ExecutionContext listeners.
|
ExecutionContextPool |
getExecutionContextPool() |
FetchGroupManager |
getFetchGroupManager()
Convenience accessor for the FetchGroupManager.
|
Set<FetchGroup> |
getFetchGroupsWithName(String name)
Accessor for the fetch groups for the specified name.
|
IdentityManager |
getIdentityManager()
Accessor for a manager for identities.
|
ImplementationCreator |
getImplementationCreator() |
FetchGroup |
getInternalFetchGroup(Class cls,
String name,
boolean createIfNotPresent)
Accessor for an internal fetch group for the specified class.
|
ManagementManager |
getJMXManager()
Accessor for the JMX manager (if required).
|
JTASyncRegistry |
getJtaSyncRegistry()
Accessor for the JTA Synchronization registry, when using JTA.
|
TransactionManager |
getJtaTransactionManager()
Accessor for the JTA transaction manager, when using JTA.
|
Level2Cache |
getLevel2Cache() |
String |
getMultiTenancyId(ExecutionContext ec,
AbstractClassMetaData cmd)
Accessor for the tenant id for the supplied class and ExecutionContext.
|
ObjectProviderFactory |
getObjectProviderFactory() |
ResourcedTransactionManager |
getResourcedTransactionManager() |
FactoryStatistics |
getStatistics() |
StoreManager |
getStoreManager() |
boolean |
hasLevel2Cache() |
void |
initialise()
Method to initialise the context for use.
|
protected void |
initialiseAutoStart(ClassLoaderResolver clr)
Method to initialise the auto-start mechanism, loading up the classes
from its store into memory so that we start from what is required to be loaded.
|
protected void |
initialiseNamedQueries(ClassLoaderResolver clr)
Method to compile all registered named queries (when the user has initialised using a persistence-unit).
|
protected void |
initialiseSchema(String generateModeStr,
boolean generateScripts)
Method to handle generation (create, drop, drop+create) of a schema at initialisation.
|
boolean |
isClassCacheable(AbstractClassMetaData cmd)
Convenience method to return if objects of this type are cached for this NucleusContext.
|
boolean |
isClassMultiTenant(AbstractClassMetaData cmd)
Accessor for whether the supplied class is multi-tenant (i.e with a tenancy id column).
|
boolean |
isClassWithIdentityCacheable(Object id)
Convenience method to return if the supplied id is of an object that is cacheable in the L2 cache.
|
boolean |
isFederated()
Return whether we are managing a federated context (i.e a primary StoreManager, with some secondary StoreManager(s)).
|
boolean |
isJcaMode()
Accessor for the JCA mode.
|
protected void |
logConfigurationDetails()
Convenience method so that extending implementations can log their own configuration.
|
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.
|
boolean |
supportsORMMetaData() |
getApiAdapter, getApiName, getClassLoaderResolver, getConfiguration, getMetaDataManager, getPluginManager, getTypeManager, logConfiguration
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getApiAdapter, getApiName, getClassLoaderResolver, getConfiguration, getMetaDataManager, getPluginManager, getTypeManager
public PersistenceNucleusContextImpl(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 PersistenceNucleusContextImpl(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 void applyDefaultProperties(Configuration conf)
NucleusContext
applyDefaultProperties
in interface NucleusContext
applyDefaultProperties
in class AbstractNucleusContext
conf
- The configurationpublic void initialise()
NucleusContext
initialise
in interface NucleusContext
initialise
in class AbstractNucleusContext
public void close()
NucleusContext
close
in interface NucleusContext
close
in class AbstractNucleusContext
protected void initialiseAutoStart(ClassLoaderResolver clr) throws DatastoreInitialisationException
clr
- The ClassLoaderResolverDatastoreInitialisationException
- if an error occursprotected void logConfigurationDetails()
AbstractNucleusContext
logConfigurationDetails
in class AbstractNucleusContext
public boolean isFederated()
PersistenceNucleusContext
isFederated
in interface PersistenceNucleusContext
public AutoStartMechanism getAutoStartMechanism()
getAutoStartMechanism
in interface PersistenceNucleusContext
protected void initialiseNamedQueries(ClassLoaderResolver clr)
clr
- ClassLoader resolverprotected void initialiseSchema(String generateModeStr, boolean generateScripts)
generateModeStr
- Generate "mode"generateScripts
- Whether to generatepublic ExecutionContextPool getExecutionContextPool()
getExecutionContextPool
in interface PersistenceNucleusContext
public ObjectProviderFactory getObjectProviderFactory()
getObjectProviderFactory
in interface PersistenceNucleusContext
public ExecutionContext getExecutionContext(Object owner, Map<String,Object> options)
PersistenceNucleusContext
getExecutionContext
in interface PersistenceNucleusContext
owner
- The owner object for the context. PersistenceManager/EntityManager typically.options
- Any options affecting startuppublic IdentityManager getIdentityManager()
PersistenceNucleusContext
getIdentityManager
in interface PersistenceNucleusContext
public boolean statisticsEnabled()
PersistenceNucleusContext
statisticsEnabled
in interface PersistenceNucleusContext
public ManagementManager getJMXManager()
PersistenceNucleusContext
getJMXManager
in interface PersistenceNucleusContext
public FactoryStatistics getStatistics()
getStatistics
in interface PersistenceNucleusContext
public ImplementationCreator getImplementationCreator()
getImplementationCreator
in interface PersistenceNucleusContext
public ResourcedTransactionManager getResourcedTransactionManager()
getResourcedTransactionManager
in interface PersistenceNucleusContext
public TransactionManager getJtaTransactionManager()
PersistenceNucleusContext
getJtaTransactionManager
in interface PersistenceNucleusContext
public JTASyncRegistry getJtaSyncRegistry()
PersistenceNucleusContext
getJtaSyncRegistry
in interface PersistenceNucleusContext
public StoreManager getStoreManager()
getStoreManager
in interface StoreNucleusContext
public boolean supportsORMMetaData()
supportsORMMetaData
in interface NucleusContext
supportsORMMetaData
in class AbstractNucleusContext
public BeanValidationHandler getBeanValidationHandler(ExecutionContext ec)
PersistenceNucleusContext
getBeanValidationHandler
in interface PersistenceNucleusContext
ec
- The ExecutionContext that the handler is for.public CDIHandler getCDIHandler()
PersistenceNucleusContext
getCDIHandler
in interface PersistenceNucleusContext
public boolean hasLevel2Cache()
hasLevel2Cache
in interface PersistenceNucleusContext
public Level2Cache getLevel2Cache()
getLevel2Cache
in interface PersistenceNucleusContext
public ExecutionContext.LifecycleListener[] getExecutionContextListeners()
PersistenceNucleusContext
getExecutionContextListeners
in interface PersistenceNucleusContext
ExecutionContext.LifecycleListener
public void addExecutionContextListener(ExecutionContext.LifecycleListener listener)
PersistenceNucleusContext
addExecutionContextListener
in interface PersistenceNucleusContext
listener
- the listener to registerpublic void removeExecutionContextListener(ExecutionContext.LifecycleListener listener)
PersistenceNucleusContext
removeExecutionContextListener
in interface PersistenceNucleusContext
listener
- the listener to unregisterpublic void setJcaMode(boolean jca)
PersistenceNucleusContext
setJcaMode
in interface PersistenceNucleusContext
jca
- true if using JCA connectorpublic boolean isJcaMode()
PersistenceNucleusContext
isJcaMode
in interface PersistenceNucleusContext
public FetchGroupManager getFetchGroupManager()
PersistenceNucleusContext
getFetchGroupManager
in interface PersistenceNucleusContext
public void addInternalFetchGroup(FetchGroup grp)
PersistenceNucleusContext
addInternalFetchGroup
in interface PersistenceNucleusContext
grp
- The grouppublic void removeInternalFetchGroup(FetchGroup grp)
PersistenceNucleusContext
removeInternalFetchGroup
in interface PersistenceNucleusContext
grp
- The grouppublic FetchGroup createInternalFetchGroup(Class cls, String name)
PersistenceNucleusContext
createInternalFetchGroup
in interface PersistenceNucleusContext
cls
- Class that it applies toname
- Name of grouppublic FetchGroup getInternalFetchGroup(Class cls, String name, boolean createIfNotPresent)
PersistenceNucleusContext
getInternalFetchGroup
in interface PersistenceNucleusContext
cls
- The classname
- Name of the groupcreateIfNotPresent
- Whether to create the fetch group if not presentpublic Set<FetchGroup> getFetchGroupsWithName(String name)
PersistenceNucleusContext
getFetchGroupsWithName
in interface PersistenceNucleusContext
name
- Name of the grouppublic boolean isClassWithIdentityCacheable(Object id)
PersistenceNucleusContext
isClassWithIdentityCacheable
in interface PersistenceNucleusContext
id
- The identitypublic boolean isClassCacheable(AbstractClassMetaData cmd)
PersistenceNucleusContext
isClassCacheable
in interface PersistenceNucleusContext
cmd
- MetaData for the classpublic boolean isClassMultiTenant(AbstractClassMetaData cmd)
PersistenceNucleusContext
isClassMultiTenant
in interface PersistenceNucleusContext
cmd
- The classpublic String getMultiTenancyId(ExecutionContext ec, AbstractClassMetaData cmd)
PersistenceNucleusContext
getMultiTenancyId
in interface PersistenceNucleusContext
ec
- ExecutionContextcmd
- The classpublic String getCurrentUser(ExecutionContext ec)
PersistenceNucleusContext
getCurrentUser
in interface PersistenceNucleusContext
ec
- ExecutionContextCopyright © 2019. All rights reserved.