Package org.datanucleus
Class AbstractNucleusContext
- java.lang.Object
-
- org.datanucleus.AbstractNucleusContext
-
- All Implemented Interfaces:
NucleusContext
- Direct Known Subclasses:
EnhancementNucleusContextImpl
,PersistenceNucleusContextImpl
public abstract class AbstractNucleusContext extends Object implements NucleusContext
Base implementation of a NucleusContext, providing configuration, metadata management, type management, plugin management and ClassLoader services.
-
-
Field Summary
Fields Modifier and Type Field Description protected ApiAdapter
apiAdapter
API adapter used by the context.protected String
classLoaderResolverClassName
Name of the class providing the ClassLoaderResolver.protected Map<String,ClassLoaderResolver>
classLoaderResolverMap
Map of the ClassLoaderResolver, keyed by the clr class and the primaryLoader name.protected Configuration
config
Configuration for this context.protected ClassLoaderResolver
defaultCLR
Default ClassLoaderResolver, when no primaryLoader is specified.protected MetaDataManager
metaDataManager
MetaDataManager for handling the MetaData.protected PluginManager
pluginManager
Manager for plug-ins.static Set<String>
STARTUP_PROPERTIES
protected TypeManager
typeManager
Manager for java types.
-
Constructor Summary
Constructors Constructor Description AbstractNucleusContext(String apiName, Map startupProps, PluginManager pluginMgr)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.ApiAdapter
getApiAdapter()
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.Configuration
getConfiguration()
Accessor for the overall configuration for DataNucleus.MetaDataManager
getMetaDataManager()
Accessor for the manager for persistence metadata information.PluginManager
getPluginManager()
Accessor for the manager for DataNucleus plugins.TypeManager
getTypeManager()
Accessor for manager for java types.void
initialise()
Method to initialise the context for use.protected void
logConfiguration()
Method to log the configuration of this context.protected abstract void
logConfigurationDetails()
Convenience method so that extending implementations can log their own configuration.boolean
supportsORMMetaData()
-
-
-
Field Detail
-
config
protected final Configuration config
Configuration for this context.
-
pluginManager
protected final PluginManager pluginManager
Manager for plug-ins.
-
metaDataManager
protected MetaDataManager metaDataManager
MetaDataManager for handling the MetaData.
-
apiAdapter
protected final ApiAdapter apiAdapter
API adapter used by the context.
-
typeManager
protected TypeManager typeManager
Manager for java types.
-
classLoaderResolverClassName
protected final String classLoaderResolverClassName
Name of the class providing the ClassLoaderResolver.
-
classLoaderResolverMap
protected transient Map<String,ClassLoaderResolver> classLoaderResolverMap
Map of the ClassLoaderResolver, keyed by the clr class and the primaryLoader name.
-
defaultCLR
protected ClassLoaderResolver defaultCLR
Default ClassLoaderResolver, when no primaryLoader is specified.
-
-
Constructor Detail
-
AbstractNucleusContext
public AbstractNucleusContext(String apiName, Map startupProps, PluginManager pluginMgr)
-
-
Method Detail
-
applyDefaultProperties
public void applyDefaultProperties(Configuration conf)
Description copied from interface:NucleusContext
Method called when initialising the Configuration to load up defaults for the properties appropriate for this NucleusContext.- Specified by:
applyDefaultProperties
in interfaceNucleusContext
- Parameters:
conf
- The configuration
-
initialise
public void initialise()
Description copied from interface:NucleusContext
Method to initialise the context for use. If any services are considered essential for operation then they will be enabled here, otherwise left for lazy initialisation.- Specified by:
initialise
in interfaceNucleusContext
-
close
public void close()
Description copied from interface:NucleusContext
Clear out resources for the supported services.- Specified by:
close
in interfaceNucleusContext
-
getApiAdapter
public ApiAdapter getApiAdapter()
- Specified by:
getApiAdapter
in interfaceNucleusContext
-
getApiName
public String getApiName()
Description copied from interface:NucleusContext
Accessor for the name of the API (JDO, JPA, etc).- Specified by:
getApiName
in interfaceNucleusContext
- Returns:
- the api
-
getConfiguration
public Configuration getConfiguration()
Description copied from interface:NucleusContext
Accessor for the overall configuration for DataNucleus.- Specified by:
getConfiguration
in interfaceNucleusContext
- Returns:
- The Configuration
-
getPluginManager
public PluginManager getPluginManager()
Description copied from interface:NucleusContext
Accessor for the manager for DataNucleus plugins.- Specified by:
getPluginManager
in interfaceNucleusContext
- Returns:
- The PluginManager
-
getMetaDataManager
public MetaDataManager getMetaDataManager()
Description copied from interface:NucleusContext
Accessor for the manager for persistence metadata information.- Specified by:
getMetaDataManager
in interfaceNucleusContext
- Returns:
- The MetaDataManager
-
supportsORMMetaData
public boolean supportsORMMetaData()
- Specified by:
supportsORMMetaData
in interfaceNucleusContext
-
getTypeManager
public TypeManager getTypeManager()
Description copied from interface:NucleusContext
Accessor for manager for java types.- Specified by:
getTypeManager
in interfaceNucleusContext
- Returns:
- The TypeManager
-
getClassLoaderResolver
public ClassLoaderResolver getClassLoaderResolver(ClassLoader primaryLoader)
Description copied from interface:NucleusContext
Accessor for a ClassLoaderResolver to use in resolving classes. Caches the resolver for the specified primary loader, and hands it out if present.- Specified by:
getClassLoaderResolver
in interfaceNucleusContext
- Parameters:
primaryLoader
- Loader to use as the primary loader (or null)- Returns:
- The ClassLoader resolver
-
logConfiguration
protected void logConfiguration()
Method to log the configuration of this context.
-
logConfigurationDetails
protected abstract void logConfigurationDetails()
Convenience method so that extending implementations can log their own configuration.
-
-