public class ComponentManagerImpl extends Object implements ComponentManager
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
blacklist |
protected Map<ComponentName,Set<Extension>> |
pendingExtensions |
protected ComponentRegistry |
reg |
Constructor and Description |
---|
ComponentManagerImpl(RuntimeService runtime) |
Modifier and Type | Method and Description |
---|---|
void |
addComponentListener(ComponentListener listener)
Adds a component listener.
|
Collection<ComponentName> |
getActivatingRegistrations()
Gets the pending extensions by component.
|
Set<String> |
getBlacklist() |
ComponentInstance |
getComponent(ComponentName name)
Gets object instance managed by the named component.
|
ComponentInstance |
getComponentProvidingService(Class<?> serviceClass)
Gets the component that provides the given service.
|
Collection<ComponentName> |
getNeededRegistrations() |
Collection<Extension> |
getPendingExtensions(ComponentName name) |
Map<ComponentName,Set<ComponentName>> |
getPendingRegistrations()
Gets the pending registrations and their dependencies.
|
RegistrationInfo |
getRegistrationInfo(ComponentName name)
Gets the component if there is one having the given name.
|
Collection<RegistrationInfo> |
getRegistrations()
Gets the registered components.
|
protected Collection<ComponentName> |
getRegistrations(int state) |
<T> T |
getService(Class<T> serviceClass)
Gets the service of type serviceClass if such a service was declared by a resolved runtime component.
|
String[] |
getServices()
Get the list of all registered service names An empty array is returned if no registered services are found.
|
Collection<ComponentName> |
getStartFailureRegistrations()
Gets the components that fail on applicationStarted notification
|
protected static void |
handleError(String message,
Exception e) |
boolean |
isRegistered(ComponentName name)
Checks whether or not a component with the given name was registered.
|
static void |
loadContributions(RegistrationInfoImpl ri,
Extension xt) |
void |
register(RegistrationInfo regInfo)
Handles the registration of the given registration info.
|
void |
registerExtension(Extension extension) |
void |
registerServices(RegistrationInfoImpl ri) |
void |
removeComponentListener(ComponentListener listener)
Removes a component listener.
|
void |
setBlacklist(Set<String> blacklist) |
void |
shutdown()
Shuts down the component registry.
|
int |
size()
Gets the number of registered objects in this registry.
|
void |
unregister(ComponentName name)
Unregisters a component given its name.
|
void |
unregister(RegistrationInfo regInfo)
Handles the unregistration of the given registration info.
|
void |
unregisterExtension(Extension extension) |
void |
unregisterServices(RegistrationInfoImpl ri) |
protected final Map<ComponentName,Set<Extension>> pendingExtensions
protected ComponentRegistry reg
public ComponentManagerImpl(RuntimeService runtime)
public Collection<RegistrationInfo> getRegistrations()
ComponentManager
getRegistrations
in interface ComponentManager
public Map<ComponentName,Set<ComponentName>> getPendingRegistrations()
ComponentManager
getPendingRegistrations
in interface ComponentManager
public Collection<ComponentName> getNeededRegistrations()
public Collection<Extension> getPendingExtensions(ComponentName name)
public RegistrationInfo getRegistrationInfo(ComponentName name)
ComponentManager
getRegistrationInfo
in interface ComponentManager
name
- the component namepublic boolean isRegistered(ComponentName name)
ComponentManager
isRegistered
in interface ComponentManager
name
- the object namepublic int size()
ComponentManager
size
in interface ComponentManager
public ComponentInstance getComponent(ComponentName name)
ComponentManager
getComponent
in interface ComponentManager
name
- the object namepublic void shutdown()
ComponentManager
This unregisters all objects registered in this registry.
shutdown
in interface ComponentManager
public Set<String> getBlacklist()
getBlacklist
in interface ComponentManager
public void setBlacklist(Set<String> blacklist)
setBlacklist
in interface ComponentManager
public void register(RegistrationInfo regInfo)
ComponentManager
This is called by the main registry when all dependencies of this registration info were solved and the object can be registered.
If true is returned, the object will be added to the main registry under the name given in RegistrationInfo.
register
in interface ComponentManager
regInfo
- the registration infopublic void unregister(RegistrationInfo regInfo)
ComponentManager
This is called by the main registry when the object is unregistered.
If true is returned, the object will be removed from the main registry.
unregister
in interface ComponentManager
regInfo
- the registration infopublic void unregister(ComponentName name)
ComponentManager
unregister
in interface ComponentManager
name
- the component namepublic void addComponentListener(ComponentListener listener)
ComponentManager
Does nothing if the given listener is already registered.
addComponentListener
in interface ComponentManager
listener
- the component listener to addpublic void removeComponentListener(ComponentListener listener)
ComponentManager
Does nothing if the given listener is not registered.
removeComponentListener
in interface ComponentManager
listener
- the component listener to removepublic ComponentInstance getComponentProvidingService(Class<?> serviceClass)
ComponentManager
getComponentProvidingService
in interface ComponentManager
serviceClass
- the service classpublic <T> T getService(Class<T> serviceClass)
ComponentManager
If the component is not yet activated it will be prior to return the service.
getService
in interface ComponentManager
T
- the service typeserviceClass
- the service classpublic Collection<ComponentName> getActivatingRegistrations()
ComponentManager
getActivatingRegistrations
in interface ComponentManager
public Collection<ComponentName> getStartFailureRegistrations()
ComponentManager
getStartFailureRegistrations
in interface ComponentManager
protected Collection<ComponentName> getRegistrations(int state)
public void registerExtension(Extension extension)
public void unregisterExtension(Extension extension)
public static void loadContributions(RegistrationInfoImpl ri, Extension xt)
public void registerServices(RegistrationInfoImpl ri)
public void unregisterServices(RegistrationInfoImpl ri)
public String[] getServices()
ComponentManager
getServices
in interface ComponentManager
protected static void handleError(String message, Exception e)
Copyright © 2016 Nuxeo SA. All rights reserved.