- 
- All Superinterfaces:
- NucleusContext
 - All Known Implementing Classes:
- PersistenceNucleusContextImpl
 
 public interface PersistenceNucleusContext extends NucleusContext Context for use in the persistence process. Adds on many extra services to the basic+store contexts, for transactions, executionContext, identity handling, StateManagers, autostart, L2 cache etc.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddExecutionContextListener(ExecutionContext.LifecycleListener listener)Register a new Listener for ExecutionContext events.voidaddInternalFetchGroup(FetchGroup grp)Method to add a dynamic FetchGroup for use by this OMF.FetchGroupcreateInternalFetchGroup(Class cls, String name)Method to create a new internal fetch group for the class+name.AutoStartMechanismgetAutoStartMechanism()BeanValidationHandlergetBeanValidationHandler(ExecutionContext ec)Method to return a handler for bean validation (JSR303).CDIHandlergetCDIHandler()Accessor for the handler for CDI (JSR346) if in an environment that provides one.StringgetCurrentUser(ExecutionContext ec)Accessor for the current user for the supplied ExecutionContext.ExecutionContextgetExecutionContext(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.ExecutionContextPoolgetExecutionContextPool()FetchGroupManagergetFetchGroupManager()Convenience accessor for the FetchGroupManager.Set<FetchGroup>getFetchGroupsWithName(String name)Accessor for the fetch groups for the specified name.IdentityManagergetIdentityManager()Accessor for a manager for identities.ImplementationCreatorgetImplementationCreator()FetchGroupgetInternalFetchGroup(Class cls, String name, boolean createIfNotPresent)Accessor for an internal fetch group for the specified class.ManagementManagergetJMXManager()Accessor for the JMX manager (if required).JTASyncRegistrygetJtaSyncRegistry()Accessor for the JTA Synchronization registry, when using JTA.javax.transaction.TransactionManagergetJtaTransactionManager()Accessor for the JTA transaction manager, when using JTA.Level2CachegetLevel2Cache()ResourcedTransactionManagergetResourcedTransactionManager()StateManagerFactorygetStateManagerFactory()FactoryStatisticsgetStatistics()StoreManagergetStoreManager()StringgetTenantId(ExecutionContext ec)Accessor for the tenant id for the ExecutionContext.String[]getTenantReadIds(ExecutionContext ec)Accessor for the ids of the tenants that should be included in any read operations.booleanhasLevel2Cache()booleanisClassCacheable(AbstractClassMetaData cmd)Convenience method to return if objects of this type are cached for this NucleusContext.booleanisClassWithIdentityCacheable(Object id)Convenience method to return if the supplied id is of an object that is cacheable in the L2 cache.booleanisFederated()Return whether we are managing a federated context (i.e a primary StoreManager, with some secondary StoreManager(s)).booleanisJcaMode()Accessor for the JCA mode.voidremoveExecutionContextListener(ExecutionContext.LifecycleListener listener)Unregister a Listener from ExecutionContext events.voidremoveInternalFetchGroup(FetchGroup grp)Method to remove a dynamic FetchGroup from use by this OMF.voidsetJcaMode(boolean jca)Mutator for whether we are in JCA mode.booleanstatisticsEnabled()Accessor for whether statistics gathering is enabled.- 
Methods inherited from interface org.datanucleus.NucleusContextapplyDefaultProperties, close, getApiAdapter, getApiName, getClassLoaderResolver, getConfiguration, getMetaDataManager, getPluginManager, getTypeManager, initialise, supportsORMMetaData
 
- 
 
- 
- 
- 
Method Detail- 
getStoreManagerStoreManager getStoreManager() 
 - 
getAutoStartMechanismAutoStartMechanism getAutoStartMechanism() 
 - 
getStateManagerFactoryStateManagerFactory getStateManagerFactory() 
 - 
getExecutionContextPoolExecutionContextPool getExecutionContextPool() 
 - 
getExecutionContextExecutionContext getExecutionContext(Object owner, Map<String,Object> options) Method to return an ExecutionContext for use in persistence.- Parameters:
- owner- The owner object for the context. PersistenceManager/EntityManager typically.
- options- Any options affecting startup
- Returns:
- The ExecutionContext
 
 - 
getIdentityManagerIdentityManager getIdentityManager() Accessor for a manager for identities.- Returns:
- The identity manager to use
 
 - 
statisticsEnabledboolean statisticsEnabled() Accessor for whether statistics gathering is enabled.- Returns:
- Whether the user has enabled statistics or JMX management is enabled
 
 - 
getJMXManagerManagementManager getJMXManager() Accessor for the JMX manager (if required). Does nothing if the property "datanucleus.jmxType" is unset.- Returns:
- The JMX manager
 
 - 
getStatisticsFactoryStatistics getStatistics() 
 - 
getImplementationCreatorImplementationCreator getImplementationCreator() 
 - 
getResourcedTransactionManagerResourcedTransactionManager getResourcedTransactionManager() 
 - 
getJtaTransactionManagerjavax.transaction.TransactionManager getJtaTransactionManager() Accessor for the JTA transaction manager, when using JTA.- Returns:
- the JTA Transaction Manager
 
 - 
getJtaSyncRegistryJTASyncRegistry getJtaSyncRegistry() Accessor for the JTA Synchronization registry, when using JTA.- Returns:
- The JTASyncRegistry (or null if not using JTA)
 
 - 
getBeanValidationHandlerBeanValidationHandler getBeanValidationHandler(ExecutionContext ec) Method to return a handler for bean validation (JSR303).- Parameters:
- ec- The ExecutionContext that the handler is for.
- Returns:
- The bean validation handler (or null if not supported on this PMF/EMF, or no validator present)
 
 - 
getCDIHandlerCDIHandler getCDIHandler() Accessor for the handler for CDI (JSR346) if in an environment that provides one.- Returns:
- The CDI Handler
 
 - 
hasLevel2Cacheboolean hasLevel2Cache() 
 - 
getLevel2CacheLevel2Cache getLevel2Cache() 
 - 
getExecutionContextListenersExecutionContext.LifecycleListener[] getExecutionContextListeners() Object the array of registered ExecutionContext listeners.- Returns:
- array of ExecutionContext.LifecycleListener
 
 - 
addExecutionContextListenervoid addExecutionContextListener(ExecutionContext.LifecycleListener listener) Register a new Listener for ExecutionContext events.- Parameters:
- listener- the listener to register
 
 - 
removeExecutionContextListenervoid removeExecutionContextListener(ExecutionContext.LifecycleListener listener) Unregister a Listener from ExecutionContext events.- Parameters:
- listener- the listener to unregister
 
 - 
setJcaModevoid setJcaMode(boolean jca) Mutator for whether we are in JCA mode.- Parameters:
- jca- true if using JCA connector
 
 - 
isJcaModeboolean isJcaMode() Accessor for the JCA mode.- Returns:
- true if using JCA connector.
 
 - 
getFetchGroupManagerFetchGroupManager getFetchGroupManager() Convenience accessor for the FetchGroupManager. Creates it if not yet existing.- Returns:
- The FetchGroupManager
 
 - 
addInternalFetchGroupvoid addInternalFetchGroup(FetchGroup grp) Method to add a dynamic FetchGroup for use by this OMF.- Parameters:
- grp- The group
 
 - 
removeInternalFetchGroupvoid removeInternalFetchGroup(FetchGroup grp) Method to remove a dynamic FetchGroup from use by this OMF.- Parameters:
- grp- The group
 
 - 
createInternalFetchGroupFetchGroup createInternalFetchGroup(Class cls, 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
 
 - 
getInternalFetchGroupFetchGroup getInternalFetchGroup(Class cls, String name, boolean createIfNotPresent) Accessor for an internal fetch group for the specified class.- Parameters:
- cls- The class
- name- Name of the group
- createIfNotPresent- Whether to create the fetch group if not present
- Returns:
- The FetchGroup
- Throws:
- NucleusUserException- if the class is not persistable
 
 - 
getFetchGroupsWithNameSet<FetchGroup> getFetchGroupsWithName(String name) Accessor for the fetch groups for the specified name.- Parameters:
- name- Name of the group
- Returns:
- The FetchGroup
 
 - 
isClassWithIdentityCacheableboolean isClassWithIdentityCacheable(Object id) Convenience method to return if the supplied id is of an object that is cacheable in the L2 cache.- Parameters:
- id- The identity
- Returns:
- Whether the object it refers to is considered cacheable
 
 - 
isClassCacheableboolean isClassCacheable(AbstractClassMetaData cmd) Convenience method to return if objects of this type are cached for this NucleusContext. Uses the "cacheable" flag of the class, and the cache-mode to determine whether to cache- Parameters:
- cmd- MetaData for the class
- Returns:
- Whether it is cacheable
 
 - 
isFederatedboolean isFederated() Return whether we are managing a federated context (i.e a primary StoreManager, with some secondary StoreManager(s)).- Returns:
- Whether this is federated
 
 - 
getTenantIdString getTenantId(ExecutionContext ec) Accessor for the tenant id for the ExecutionContext. Returns the MultiTenancyProvider id (if specified) or relays to the ExecutionContext "tenantId" property (or global tenantId if that is not defined).- Parameters:
- ec- ExecutionContext
- Returns:
- The tenant id for this context.
 
 - 
getTenantReadIdsString[] getTenantReadIds(ExecutionContext ec) Accessor for the ids of the tenants that should be included in any read operations. Defaults to just the current tenant id unless specified.- Parameters:
- ec- ExecutionContext
- Returns:
- The tenant id(s) for use when reading
 
 - 
getCurrentUserString getCurrentUser(ExecutionContext ec) Accessor for the current user for the supplied ExecutionContext.- Parameters:
- ec- ExecutionContext
- Returns:
- The current user for this context.
 
 
- 
 
-