@Generated(value="org.jomc.tools.SourceFileProcessor 1.5", comments="See http://www.jomc.org/jomc/1.5/jomc-tools-1.5") public class DefaultObjectManager extends Object implements ObjectManager
ObjectManager
implementation.
Modifier and Type | Field and Description |
---|---|
protected static String |
SINGLETON_SCOPE_IDENTIFIER
Constant for the
Singleton scope identifier. |
Constructor and Description |
---|
DefaultObjectManager()
Creates a new
DefaultObjectManager instance. |
Modifier and Type | Method and Description |
---|---|
static String |
getBootstrapClassLoaderClassName()
Gets the name of the platform's bootstrap class loader class.
|
static ClassLoader |
getClassLoader(Class<?> clazz)
Deprecated.
As of JOMC 1.1, please use method
getDefaultClassLoader(java.lang.Class) . This method will
be removed in version 2.0. |
static ClassLoader |
getClassLoader(ClassLoader classLoader)
Deprecated.
As of JOMC 1.1, please use method
getDefaultClassLoader(java.lang.ClassLoader) . This method
will be removed in version 2.0. |
ClassLoader |
getDefaultClassLoader(Class<?> clazz)
Gets the class loader of a given class.
|
ClassLoader |
getDefaultClassLoader(ClassLoader classLoader)
Gets the parent class loader of a given class loader recursively.
|
Invocation |
getDefaultInvocation()
Deprecated.
As of JOMC 1.2, replaced by method
getDefaultInvocation(org.jomc.model.Modules) . This method
will be removed in version 2.0. |
Invocation |
getDefaultInvocation(Modules model)
Gets a new default invocation implementation instance.
|
Invoker |
getDefaultInvoker()
Deprecated.
As of JOMC 1.2, replaced by method
getDefaultInvoker(org.jomc.model.Modules) . This method
will be removed in version 2.0. |
Invoker |
getDefaultInvoker(Modules model)
Gets a new default invoker implementation instance.
|
Listener |
getDefaultListener()
Deprecated.
As of JOMC 1.2, replaced by method
getDefaultListener(org.jomc.model.Modules) . This method
will be removed in version 2.0. |
Listener |
getDefaultListener(Modules model)
Gets a new default listener implementation instance.
|
Locator |
getDefaultLocator(Modules model,
URI location)
Gets a new default locator implementation instance for a given location URI.
|
Locator |
getDefaultLocator(URI location)
Deprecated.
As of JOMC 1.2, replaced by method
getDefaultLocator(org.jomc.model.Modules, java.net.URI) .
This method will be removed in version 2.0. |
static Level |
getDefaultLogLevel()
Gets the default log level events are logged at.
|
static String |
getDefaultModelIdentifier()
Gets the identifier of the model to search for modules by default.
|
Modules |
getDefaultModules()
Gets a new default modules instance.
|
Scope |
getDefaultScope(Modules model,
String identifier)
Gets a new default scope implementation instance for a given identifier.
|
Scope |
getDefaultScope(String identifier)
Deprecated.
As of JOMC 1.2, replaced by method
getDefaultScope(org.jomc.model.Modules,java.lang.String) .
This method will be removed in version 2.0. |
Object |
getDependency(Object object,
String dependencyName) |
Invocation |
getInvocation(ClassLoader classLoader,
Object object,
Instance instance,
Method method,
Object[] arguments)
Gets an invocation for a given class loader, object, instance, method and arguments.
|
Invocation |
getInvocation(Object object,
Instance instance,
Method method,
Object[] arguments)
Deprecated.
As of JOMC 1.1, please use method
getInvocation(java.lang.ClassLoader, java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[]) .
This method will be removed in version 2.0. |
Invoker |
getInvoker(ClassLoader classLoader)
Gets the invoker registered with a given class loader.
|
List<Listener> |
getListeners()
Gets the list of listeners registered with the class loader of the instance.
|
List<Listener> |
getListeners(ClassLoader classLoader)
Gets the list of listeners registered with a given class loader.
|
Locator |
getLocator(URI location,
ClassLoader classLoader)
Gets a locator to use with a given location URI registered with a given class loader.
|
Level |
getLogLevel()
Gets the log level of the instance.
|
String |
getMessage(Object object,
String messageName,
Locale locale,
Object... arguments) |
String |
getModelIdentifier()
Gets the identifier of the model to search for modules.
|
Modules |
getModules(ClassLoader classLoader)
Gets the modules registered with a given class loader.
|
<T> T |
getObject(Class<T> specification) |
<T> T |
getObject(Class<T> specification,
String implementationName) |
<T> T |
getObject(Class<T> specification,
URI location,
ClassLoader classLoader)
Gets an object for a given location URI.
|
Object |
getObject(Scope scope,
Instance instance,
ClassLoader classLoader)
Gets an object of a given instance from a given scope.
|
static ObjectManager |
getObjectManager(ClassLoader classLoader)
Default
ObjectManagerFactory.getObjectManager(ClassLoader) implementation. |
Object |
getProperty(Object object,
String propertyName) |
Modules |
getRuntimeModules(Modules modules,
Map<Object,Instance> objectMap)
Gets a new
Modules instance to register with a class loader. |
Scope |
getScope(String identifier,
ClassLoader classLoader)
Gets the scope implementation for a given scope identifier registered with a given class loader.
|
void |
initialize()
Initializes the instance.
|
static boolean |
isDefaultModelObjectClasspathResolutionEnabled()
Gets a flag indicating model object class path resolution is enabled by default.
|
static boolean |
isDefaultModelProcessingEnabled()
Gets a flag indicating model processing is enabled by default.
|
boolean |
isLoggable(Level level)
Checks if a message at a given level is provided to the listeners of the instance.
|
boolean |
isModelObjectClasspathResolutionEnabled()
Gets a flag indicating model object class path resolution is enabled.
|
boolean |
isModelProcessingEnabled()
Gets a flag indicating model processing is enabled.
|
void |
log(ClassLoader classLoader,
Level level,
String message,
Throwable throwable)
Notifies listeners registered with a given class loader.
|
void |
log(Level level,
String message,
Throwable throwable)
Notifies listeners registered with the class loader of the instance.
|
static void |
setBootstrapClassLoaderClassName(String value)
Sets the name of the platform's bootstrap class loader class.
|
static void |
setDefaultLogLevel(Level value)
Sets the default log level events are logged at.
|
static void |
setDefaultModelIdentifier(String value)
Sets the identifier of the model to search for modules by default.
|
static void |
setDefaultModelObjectClasspathResolutionEnabled(Boolean value)
Sets the flag indicating model object class path resolution is enabled by default.
|
static void |
setDefaultModelProcessingEnabled(Boolean value)
Sets the flag indicating model processing is enabled by default.
|
void |
setLogLevel(Level value)
Sets the log level of the instance.
|
void |
setModelIdentifier(String value)
Sets the identifier of the model to search for modules.
|
void |
setModelObjectClasspathResolutionEnabled(Boolean value)
Sets the flag indicating model object class path resolution is enabled.
|
void |
setModelProcessingEnabled(Boolean value)
Sets the flag indicating model processing is enabled.
|
protected static final String SINGLETON_SCOPE_IDENTIFIER
Singleton
scope identifier.@Generated(value="org.jomc.tools.SourceFileProcessor 1.5", comments="See http://www.jomc.org/jomc/1.5/jomc-tools-1.5") public DefaultObjectManager()
DefaultObjectManager
instance.public <T> T getObject(Class<T> specification)
getObject
in interface ObjectManager
public <T> T getObject(Class<T> specification, String implementationName)
getObject
in interface ObjectManager
public Object getDependency(Object object, String dependencyName)
getDependency
in interface ObjectManager
public Object getProperty(Object object, String propertyName)
getProperty
in interface ObjectManager
public String getMessage(Object object, String messageName, Locale locale, Object... arguments)
getMessage
in interface ObjectManager
public static ObjectManager getObjectManager(ClassLoader classLoader)
ObjectManagerFactory.getObjectManager(ClassLoader)
implementation.classLoader
- The class loader to use for getting the singleton instance; null
to use the platform's
bootstrap class loader.ObjectManager
singleton instance.ObjectManagerFactory.getObjectManager(ClassLoader)
public List<Listener> getListeners()
Calling this method is the same as calling
getListeners( getClassLoader( getClass() ) );
ObjectManagementException
- if getting the list of listeners fails.getListeners(java.lang.ClassLoader)
public List<Listener> getListeners(ClassLoader classLoader)
classLoader
- The class loader to get registered listeners of.classLoader
.NullPointerException
- if classLoader
is null
.ObjectManagementException
- if getting the list of listeners fails.getDefaultListener(org.jomc.model.Modules)
@Deprecated public Listener getDefaultListener()
getDefaultListener(org.jomc.model.Modules)
. This method
will be removed in version 2.0.getListeners()
,
getListeners(java.lang.ClassLoader)
public Listener getDefaultListener(Modules model)
model
- The model to get a new default listener implementation instance of.NullPointerException
- if model
is null
.ObjectManagementException
- if getting a new default listener implementation instance fails.getListeners()
,
getListeners(java.lang.ClassLoader)
public static Level getDefaultLogLevel()
The default log level is controlled by system property
org.jomc.ri.DefaultObjectManager.defaultLogLevel
holding the log level to log events at by default.
If that property is not set, the WARNING
default is returned.
getLogLevel()
,
Level.parse(java.lang.String)
public static void setDefaultLogLevel(Level value)
value
- The new default level events are logged at or null
.getDefaultLogLevel()
public final Level getLogLevel()
getDefaultLogLevel()
,
setLogLevel(java.util.logging.Level)
,
isLoggable(java.util.logging.Level)
public final void setLogLevel(Level value)
value
- The new log level of the instance or null
.getLogLevel()
,
isLoggable(java.util.logging.Level)
public boolean isLoggable(Level level)
level
- The level to test.true
, if messages at level
are provided to the listeners of the instance;
false
, if messages at level
are not provided to the listeners of the instance.NullPointerException
- if level
is null
.getLogLevel()
,
setLogLevel(java.util.logging.Level)
,
log(java.util.logging.Level, java.lang.String, java.lang.Throwable)
,
log(java.lang.ClassLoader, java.util.logging.Level, java.lang.String, java.lang.Throwable)
public void log(Level level, String message, Throwable throwable)
Calling this method is the same as calling
log( getClassLoader( getClass() ), level, message, throwable );
level
- The level of the event.message
- The message of the event or null
.throwable
- The throwable of the event or null
.NullPointerException
- if level
is null
.ObjectManagementException
- if notifying listeners fails.log(java.lang.ClassLoader, java.util.logging.Level, java.lang.String, java.lang.Throwable)
public void log(ClassLoader classLoader, Level level, String message, Throwable throwable)
classLoader
- The class loader to notify listeners of.level
- The level of the event.message
- The message of the event or null
.throwable
- The throwable of the event or null
.NullPointerException
- if classLoader
or level
is null
.ObjectManagementException
- if notifying listeners fails.public static String getDefaultModelIdentifier()
The identifier of the model to search for modules by default is controlled by system property
org.jomc.ri.DefaultObjectManager.defaultModelIdentifier
holding the identifier of the model to search for
modules by default. If that property is not set, the http://jomc.org/model
default is returned.
getModelIdentifier()
,
setDefaultModelIdentifier(java.lang.String)
,
ModelObject.MODEL_PUBLIC_ID
public static void setDefaultModelIdentifier(String value)
value
- The new identifier of the model to search for modules by default or null
.getDefaultModelIdentifier()
public final String getModelIdentifier()
getDefaultModelIdentifier()
,
setModelIdentifier(java.lang.String)
public final void setModelIdentifier(String value)
value
- The new identifier of the model to search for modules or null
.public static boolean isDefaultModelObjectClasspathResolutionEnabled()
The default model object class path resolution enabled flag is controlled by system property
org.jomc.ri.DefaultObjectManager.defaultModelObjectClasspathResolutionEnabled
holding a boolean
indicating model object class path resolution is enabled by default. If that property is not set, the
true
default is returned.
true
, if model object class path resolution is enabled by default; false
, if model object
class path resolution is disabled by default.isModelObjectClasspathResolutionEnabled()
,
setDefaultModelObjectClasspathResolutionEnabled(java.lang.Boolean)
public static void setDefaultModelObjectClasspathResolutionEnabled(Boolean value)
value
- The new value of the flag indicating model object class path resolution is enabled by default or
null
.isDefaultModelObjectClasspathResolutionEnabled()
public final boolean isModelObjectClasspathResolutionEnabled()
true
, if model object class path resolution is enabled; false
, if model object class path
resolution is disabled.isDefaultModelObjectClasspathResolutionEnabled()
,
setModelObjectClasspathResolutionEnabled(java.lang.Boolean)
public final void setModelObjectClasspathResolutionEnabled(Boolean value)
value
- The new value of the flag indicating model object class path resolution is enabled or null
.isModelObjectClasspathResolutionEnabled()
public static boolean isDefaultModelProcessingEnabled()
The default model processing enabled flag is controlled by system property
org.jomc.ri.DefaultObjectManager.defaultModelProcessingEnabled
holding a boolean indicating model
processing is enabled by default. If that property is not set, the true
default is returned.
true
, if model processing is enabled by default; false
, if model processing is disabled
by default.isModelProcessingEnabled()
,
setDefaultModelProcessingEnabled(java.lang.Boolean)
public static void setDefaultModelProcessingEnabled(Boolean value)
value
- The new value of the flag indicating model processing is enabled by default or null
.isDefaultModelProcessingEnabled()
public final boolean isModelProcessingEnabled()
true
, if model processing is enabled; false
, if model processing is disabled .isDefaultModelProcessingEnabled()
,
setModelProcessingEnabled(java.lang.Boolean)
public final void setModelProcessingEnabled(Boolean value)
value
- The new value of the flag indicating model processing is enabled or null
.isModelProcessingEnabled()
public static String getBootstrapClassLoaderClassName()
The name of the platform's bootstrap class loader class is controlled by system property
org.jomc.ri.DefaultObjectManager.bootstrapClassLoaderClassName
holding the name of the platform's
bootstrap class loader class. If that property is not set, the bootstrap class loader is assumed to be
represented by a null
parent class loader.
null
.getClassLoader(java.lang.ClassLoader)
public static void setBootstrapClassLoaderClassName(String value)
value
- The new name of the platform's bootstrap class loader class or null
.getBootstrapClassLoaderClassName()
public Modules getModules(ClassLoader classLoader)
classLoader
- The class loader to get the modules of.NullPointerException
- if classLoader
is null
.ObjectManagementException
- if getting the modules fails.getDefaultModules()
,
getModelIdentifier()
,
isModelObjectClasspathResolutionEnabled()
,
isModelProcessingEnabled()
,
getRuntimeModules(org.jomc.model.Modules, java.util.Map)
public Modules getDefaultModules()
ObjectManagementException
- if getting a new default modules instance fails.getModules(java.lang.ClassLoader)
public Modules getRuntimeModules(Modules modules, Map<Object,Instance> objectMap)
Modules
instance to register with a class loader.modules
- The modules prepared for registration with a class loader.objectMap
- The object map to associate with the given modules.NullPointerException
- if modules
or objectMap
is null
.getModules(java.lang.ClassLoader)
,
RuntimeModules
public ClassLoader getDefaultClassLoader(Class<?> clazz)
clazz
- The class whose class loader to get.clazz
.NullPointerException
- if clazz
is null
.public ClassLoader getDefaultClassLoader(ClassLoader classLoader)
This method recursively finds the parent class loader of the given class loader. Recursion stops at the
platform's bootstrap class loader. That class loader is detected when either the current class loader has no
parent (a call to the getParent()
method returns null
) or when the class name of the
current class loader's parent class loader is equal to the name returned by method
getBootstrapClassLoaderClassName()
. Configuration of the name of the platform's bootstrap class loader
class is needed when the platform's getParent()
method of the ClassLoader
class does not return
null
to indicate the bootstrap class loader but instead returns an instance of ClassLoader
.
classLoader
- The class loader whose parent class loader to return or null
to return a
ClassLoader
instance representing the platform's bootstrap class loader.classLoader
.NullPointerException
- if classLoader
is null
.getBootstrapClassLoaderClassName()
,
ClassLoader.getParent()
@Deprecated public static ClassLoader getClassLoader(Class<?> clazz)
getDefaultClassLoader(java.lang.Class)
. This method will
be removed in version 2.0.clazz
- The class whose class loader to return.clazz
.NullPointerException
- if clazz
is null
.@Deprecated public static ClassLoader getClassLoader(ClassLoader classLoader)
getDefaultClassLoader(java.lang.ClassLoader)
. This method
will be removed in version 2.0.This method recursively finds the parent class loader of the given class loader. Recursion stops at the
platform's bootstrap class loader. That class loader is detected when either the current class loader has no
parent (a call to the getParent()
method returns null
) or when the class name of the
current class loader's parent class loader is equal to the name returned by method
getBootstrapClassLoaderClassName()
. Configuration of the name of the platform's bootstrap class loader
class is needed when the platform's getParent()
method of the ClassLoader
class does not return
null
to indicate the bootstrap class loader but instead returns an instance of ClassLoader
.
classLoader
- The class loader whose parent class loader to return or null
to return a
ClassLoader
instance representing the platform's bootstrap class loader.classLoader
.NullPointerException
- if classLoader
is null
.getBootstrapClassLoaderClassName()
,
ClassLoader.getParent()
public Object getObject(Scope scope, Instance instance, ClassLoader classLoader)
scope
- The scope to get the object from or null
.instance
- The instance of the object to get.classLoader
- The class loader to use for creating the object.instance
from scope
or null
, if no such object is found.NullPointerException
- if instance
or classLoader
is null
.ObjectManagementException
- if getting an object fails.public <T> T getObject(Class<T> specification, URI location, ClassLoader classLoader)
T
- The type of the object.specification
- The specification class of the object to locate.location
- The location URI of the object to locate.classLoader
- The class loader to use for loading locator classes.location
or null
, if no such object is found.NullPointerException
- if specification
, location
or classLoader
is null
.ObjectManagementException
- if getting an object fails.public Scope getScope(String identifier, ClassLoader classLoader)
identifier
- The identifier of the scope to get an implementation of.classLoader
- The class loader to use for loading scope implementations.identifier
or null
, if no such scope
implementation is found.NullPointerException
- if classLoader
or identifier
is null
.ObjectManagementException
- if getting the scope implementation fails.getDefaultScope(org.jomc.model.Modules, java.lang.String)
@Deprecated public Scope getDefaultScope(String identifier)
getDefaultScope(org.jomc.model.Modules,java.lang.String)
.
This method will be removed in version 2.0.identifier
- The identifier to get a new default scope implementation instance for.identifier
or null
, if no such instance
is available.NullPointerException
- if identifier
is null
.getScope(java.lang.String, java.lang.ClassLoader)
public Scope getDefaultScope(Modules model, String identifier)
model
- The model to get a new default scope implementation instance of.identifier
- The identifier to get a new default scope implementation instance for.identifier
or null
, if no such instance
is available.NullPointerException
- if model
or identifier
is null
.ObjectManagementException
- if getting a new default scope implementation instance fails.getScope(java.lang.String, java.lang.ClassLoader)
public Locator getLocator(URI location, ClassLoader classLoader)
location
- The location URI to get a locator for.classLoader
- The class loader to use for loading locator implementations.location
or null
, if no such locator is
available.NullPointerException
- if classLoader
or location
is null
.ObjectManagementException
- if getting a locator fails.getDefaultLocator(org.jomc.model.Modules, java.net.URI)
@Deprecated public Locator getDefaultLocator(URI location)
getDefaultLocator(org.jomc.model.Modules, java.net.URI)
.
This method will be removed in version 2.0.location
- The location URI to get a new default locator implementation instance for.location
or null
, if no such instance
is available.NullPointerException
- if location
is null
.getLocator(java.net.URI, java.lang.ClassLoader)
public Locator getDefaultLocator(Modules model, URI location)
model
- The model to get a new default location implementation instance of.location
- The location URI to get a new default locator implementation instance for.location
or null
, if no such instance
is available.NullPointerException
- if model
or location
is null
.ObjectManagementException
- if getting a new default locator implementation instance fails.getLocator(java.net.URI, java.lang.ClassLoader)
public Invoker getInvoker(ClassLoader classLoader)
classLoader
- The class loader to use for loading invoker implementations.NullPointerException
- if classLoader
is null
.ObjectManagementException
- if getting the invoker fails.getDefaultInvoker(org.jomc.model.Modules)
@Deprecated public Invoker getDefaultInvoker()
getDefaultInvoker(org.jomc.model.Modules)
. This method
will be removed in version 2.0.getInvoker(java.lang.ClassLoader)
public Invoker getDefaultInvoker(Modules model)
model
- The model to get a new default invoker implementation instance of.NullPointerException
- if model
is null
.ObjectManagementException
- if getting a new default invoker implementation instance fails.getInvoker(java.lang.ClassLoader)
@Deprecated public Invocation getInvocation(Object object, Instance instance, Method method, Object[] arguments) throws InstantiationException
getInvocation(java.lang.ClassLoader, java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[])
.
This method will be removed in version 2.0.object
- The object to invoke.instance
- The instance of the object to invoke.method
- The method to invoke on object
.arguments
- The arguments of the invocation or null
.object
, instance
, method
and arguments
.NullPointerException
- if object
, instance
or method
is null
.InstantiationException
- if instantiating a new invocation fails.public Invocation getInvocation(ClassLoader classLoader, Object object, Instance instance, Method method, Object[] arguments)
classLoader
- The class loader of the invocation.object
- The object to invoke.instance
- The instance of the object to invoke.method
- The method to invoke on object
.arguments
- The arguments of the invocation or null
.classLoader
, object
, instance
, method
and
arguments
.NullPointerException
- if classLoader
object
, instance
or method
is
null
.ObjectManagementException
- if getting an invocation fails.getDefaultInvocation(org.jomc.model.Modules)
@Deprecated public Invocation getDefaultInvocation()
getDefaultInvocation(org.jomc.model.Modules)
. This method
will be removed in version 2.0.getInvocation(java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[])
public Invocation getDefaultInvocation(Modules model)
model
- The model to get a new default invocation implementation instance of.NullPointerException
- if model
is null
.ObjectManagementException
- if getting a new default invocation implementation instance fails.getInvocation(java.lang.ClassLoader, java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[])
public void initialize()
This method is called once on first usage of a new instance.
ObjectManagementException
- if initialization fails.Copyright © 2005-2013 The JOMC Project. All Rights Reserved.