|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.jomc.ri.DefaultObjectManager
@Generated(value="org.jomc.tools.JavaSources",
comments="See http://jomc.sourceforge.net/jomc/1.0-alpha-5/jomc-tools")
public class DefaultObjectManagerObject management and configuration reference implementation.
Specifications
org.jomc.ObjectManager 1.0 Singleton
| Field Summary | |
|---|---|
private List<LogRecord> |
bootstrapLogRecords
Bootstrap LogRecords. |
private Listener |
bootstrapObjectManagementListener
Bootstrap ObjectManagementListener. |
private Boolean |
classpathAware
Flag indicating classpath awareness. |
private DefaultModelManager.Listener |
defaultModelManagerListener
DefaultModelManager.Listener of the instance. |
private boolean |
initialized
Flag indicating that initialization has been performed. |
private List<Listener> |
listeners
Listeners of the instance. |
private Map<String,Locator> |
locators
Locators of the instance. |
private ModelManager |
modelManager
The model manager of the instance. |
private Modules |
modules
The modules of the instance. |
private static URL[] |
NO_URLS
Empty URL array. |
private Map<String,Scope> |
scopes
Scopes of the instance. |
private static ObjectManager |
singleton
Singleton instance. |
protected static String |
SINGLETON_SCOPE_IDENTIFIER
Constant for the Singleton scope identifier. |
| Constructor Summary | |
|---|---|
DefaultObjectManager()
Creates a new DefaultObjectManager instance. |
|
| Method Summary | |
|---|---|
private StringBuilder |
appendImplementationInfo(Implementation i,
StringBuilder b)
|
private StringBuilder |
appendSpecificationInfo(Specification s,
StringBuilder b)
|
private Object |
createProxy(Specification specification,
Instance instance,
Object object)
Creates a proxy for a given object. |
private String |
getArtifactNameMessage()
|
private String |
getCannotProxySpecificationClassMessage(String specification,
String instance)
|
ClassLoader |
getClassLoader(Class clazz)
Gets the class loader of a given class. |
Locator |
getDefaultLocator(URI location)
Gets the default locator implementation for a given location URI. |
private String |
getDefaultLocatorInfoMessage(String scheme)
|
Scope |
getDefaultScope(String modelScope)
Gets the default scope implementation for a given model scope. |
private String |
getDefaultScopeInfoMessage(String modelScope,
Map objects)
|
Object |
getDependency(Object object,
String dependencyName)
|
private String |
getDependencyCycleMessage(String implementation)
|
private String |
getImplementationInfoMessage(Long startMillis)
|
List<Listener> |
getListeners()
Gets the list of registered listeners. |
Locator |
getLocator(URI location)
Gets a locator to use with a given location URI. |
String |
getMessage(Object object,
String messageName,
Locale locale,
Object arguments)
|
private String |
getMessage(String key,
Object arguments)
|
private String |
getMissingClassLoaderMessage()
|
private String |
getMissingDependencyMessage(String dependency,
String implementation)
|
private String |
getMissingImplementationMessage(String implementationName,
String specification)
|
private String |
getMissingImplementationsMessage(String specification)
|
private String |
getMissingInstanceMessage(String implementation,
String implementationName)
|
private String |
getMissingLocatorMessage(URI location)
|
private String |
getMissingMessageMessage(String message,
String implementation)
|
private String |
getMissingObjectInstanceMessage(Object object)
|
private String |
getMissingObjectMessage(String implementation,
String implementationName)
|
private String |
getMissingPropertyMessage(String property,
String implementation)
|
private String |
getMissingScopeMessage(String modelScope)
|
private String |
getMissingSpecificationMessage(String specification)
|
ModelManager |
getModelManager()
Gets the model manager backing the instance. |
Modules |
getModules()
Gets the modules of the instance. |
private String |
getModulesReport(Modules mods)
|
Object |
getObject(Class specification)
|
Object |
getObject(Class specification,
String implementationName)
|
Object |
getObject(Specification specification,
Instance instance)
Gets an object of a given instance. |
Object |
getObject(Specification specification,
URI location,
ClassLoader classLoader)
Gets an object for a given location URI. |
static ObjectManager |
getObjectManager()
Default ObjectManagerFactory.getObjectManager() implementation backed by static field. |
Object |
getProperty(Object object,
String propertyName)
|
private String |
getRegisteredListenerMessage(String listener)
|
Scope |
getScope(String modelScope)
Gets the scope implementation for a given model scope. |
private String |
getUnsupportedMultiplicityMessage(Multiplicity multiplicity)
|
void |
initialize()
Initializes the instance. |
boolean |
isClasspathAware()
Gets a flag indicating that classpath resolution is performed. |
protected void |
log(Level level,
String message,
Throwable throwable)
Notifies registered listeners. |
void |
setClasspathAware(boolean value)
Sets the flag indicating that classpath resolution should be performed. |
void |
setModules(Modules value)
Sets the modules of the instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String SINGLETON_SCOPE_IDENTIFIER
Singleton scope identifier.
private static final URL[] NO_URLS
URL array.
private static final ObjectManager singleton
private Modules modules
private ModelManager modelManager
private final Map<String,Scope> scopes
private final Map<String,Locator> locators
private List<Listener> listeners
private boolean initialized
private Boolean classpathAware
private final List<LogRecord> bootstrapLogRecords
LogRecords.
initialize()private final DefaultModelManager.Listener defaultModelManagerListener
DefaultModelManager.Listener of the instance.
private final Listener bootstrapObjectManagementListener
ObjectManagementListener.
| Constructor Detail |
|---|
@Generated(value="org.jomc.tools.JavaSources",
comments="See http://jomc.sourceforge.net/jomc/1.0-alpha-5/jomc-tools")
public DefaultObjectManager()
DefaultObjectManager instance.
| Method Detail |
|---|
public Object getObject(Class specification)
getObject in interface ObjectManager
public Object getObject(Class 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 ObjectManagerpublic static ObjectManager getObjectManager()
ObjectManagerFactory.getObjectManager() implementation backed by static field.
ObjectManager singleton instance.public boolean isClasspathAware()
Classpath resolution is performed by default. It can be disabled by setting the system property
org.jomc.ri.DefaultObjectManager.classpathAware to false.
true if the class loader of the instance is searched for resources; false if no
classpath resolution is performed.public void setClasspathAware(boolean value)
value - true if the class loader of the instance is searched for resources; false if no
classpath resolution is performed.public List<Listener> getListeners()
public Modules getModules()
public void setModules(Modules value)
value - The new modules of the instance.public ModelManager getModelManager()
public ClassLoader getClassLoader(Class clazz)
clazz - The class whose class loader to return.
clazz.
NullPointerException - if clazz is null.
public Object getObject(Specification specification,
Instance instance)
throws InstantiationException
specification - The specification specifying the object to return.instance - The instance of the object to get.
instance or null if nothing could be resolved.
NullPointerException - if specification or instance is null.
InstantiationException - if getting an object fails.
public Object getObject(Specification specification,
URI location,
ClassLoader classLoader)
throws InstantiationException,
ClassNotFoundException,
IOException
specification - The specification specifying the object to return.location - The location URI of the object to return.classLoader - The class loader of specification.
location or null if nothing could be resolved.
NullPointerException - if specification, location or classLoader is null.
InstantiationException - if instantiating a locator fails.
ClassNotFoundException - if the class of specification is not found.
IOException - if locating the object fails.
public Scope getScope(String modelScope)
throws InstantiationException
modelScope - The scope to get an implementation of.
modelScope or null if no implementation is available implementing
modelScope.
NullPointerException - if modelScope is null.
InstantiationException - if instantiating a scope fails.public Scope getDefaultScope(String modelScope)
modelScope - The scope to get the default implementation of.
modelScope or null if no default implementation is
available implementing modelScope.
NullPointerException - if modelScope is null.
public Locator getLocator(URI location)
throws InstantiationException
location - The location URI to get a locator for.
location or null if no locator is available.
NullPointerException - if location is null.
InstantiationException - if instantiating a locator fails.public Locator getDefaultLocator(URI location)
location - The location URI to get a default locator implementation for.
location or null if no default implementation is
available for location.
NullPointerException - if location is null.
public void initialize()
throws InstantiationException
This method is called once on first usage of a new instance.
InstantiationException - if initialization fails.
protected void log(Level level,
String message,
Throwable throwable)
level - The level of the event.message - The message of the event or null.throwable - The throwable of the event or null.
private Object createProxy(Specification specification,
Instance instance,
Object object)
throws InstantiationException
specification - The specification to create a proxy for.instance - The instance of object.object - The object to create a proxy for.
object.
InstantiationException - if creating a proxy fails.
private String getMessage(String key,
Object arguments)
private String getArtifactNameMessage()
private String getMissingSpecificationMessage(String specification)
private String getMissingImplementationsMessage(String specification)
private String getMissingImplementationMessage(String implementationName,
String specification)
private String getMissingObjectInstanceMessage(Object object)
private String getMissingDependencyMessage(String dependency,
String implementation)
private String getMissingPropertyMessage(String property,
String implementation)
private String getMissingMessageMessage(String message,
String implementation)
private String getMissingClassLoaderMessage()
private String getMissingInstanceMessage(String implementation,
String implementationName)
private String getMissingObjectMessage(String implementation,
String implementationName)
private String getDependencyCycleMessage(String implementation)
private String getImplementationInfoMessage(Long startMillis)
private String getDefaultScopeInfoMessage(String modelScope,
Map objects)
private String getMissingScopeMessage(String modelScope)
private String getRegisteredListenerMessage(String listener)
private String getUnsupportedMultiplicityMessage(Multiplicity multiplicity)
private String getCannotProxySpecificationClassMessage(String specification,
String instance)
private String getDefaultLocatorInfoMessage(String scheme)
private String getMissingLocatorMessage(URI location)
private String getModulesReport(Modules mods)
private StringBuilder appendSpecificationInfo(Specification s,
StringBuilder b)
private StringBuilder appendImplementationInfo(Implementation i,
StringBuilder b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||