Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.runtime.model.impl
Class ComponentManagerImpl

java.lang.Object
  extended by org.nuxeo.runtime.model.impl.ComponentManagerImpl
All Implemented Interfaces:
ComponentManager

public class ComponentManagerImpl
extends Object
implements ComponentManager

Author:
Bogdan Stefanescu, Florent Guillaume

Constructor Summary
ComponentManagerImpl(RuntimeService runtime)
           
 
Method Summary
 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.
<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.
 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentManagerImpl

public ComponentManagerImpl(RuntimeService runtime)
Method Detail

getRegistrations

public Collection<RegistrationInfo> getRegistrations()
Description copied from interface: ComponentManager
Gets the registered components.

Specified by:
getRegistrations in interface ComponentManager
Returns:
a read-only collection of components

getPendingRegistrations

public Map<ComponentName,Set<ComponentName>> getPendingRegistrations()
Description copied from interface: ComponentManager
Gets the pending registrations and their dependencies.

Specified by:
getPendingRegistrations in interface ComponentManager
Returns:
the pending registrations

getNeededRegistrations

public Collection<ComponentName> getNeededRegistrations()

getPendingExtensions

public Collection<Extension> getPendingExtensions(ComponentName name)

getRegistrationInfo

public RegistrationInfo getRegistrationInfo(ComponentName name)
Description copied from interface: ComponentManager
Gets the component if there is one having the given name.

Specified by:
getRegistrationInfo in interface ComponentManager
Parameters:
name - the component name
Returns:
the component if any was registered with that name, null otherwise

isRegistered

public boolean isRegistered(ComponentName name)
Description copied from interface: ComponentManager
Checks whether or not a component with the given name was registered.

Specified by:
isRegistered in interface ComponentManager
Parameters:
name - the object name
Returns:
true if an object with the given name was registered, false otherwise

size

public int size()
Description copied from interface: ComponentManager
Gets the number of registered objects in this registry.

Specified by:
size in interface ComponentManager
Returns:
the number of registered objects

getComponent

public ComponentInstance getComponent(ComponentName name)
Description copied from interface: ComponentManager
Gets object instance managed by the named component.

Specified by:
getComponent in interface ComponentManager
Parameters:
name - the object name
Returns:
the object instance if any. may be null

shutdown

public void shutdown()
Description copied from interface: ComponentManager
Shuts down the component registry.

This unregisters all objects registered in this registry.

Specified by:
shutdown in interface ComponentManager

getBlacklist

public Set<String> getBlacklist()
Specified by:
getBlacklist in interface ComponentManager

setBlacklist

public void setBlacklist(Set<String> blacklist)
Specified by:
setBlacklist in interface ComponentManager

register

public void register(RegistrationInfo regInfo)
Description copied from interface: ComponentManager
Handles the registration of the given registration info.

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.

Specified by:
register in interface ComponentManager
Parameters:
regInfo - the registration info

unregister

public void unregister(RegistrationInfo regInfo)
Description copied from interface: ComponentManager
Handles the unregistration of the given registration info.

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.

Specified by:
unregister in interface ComponentManager
Parameters:
regInfo - the registration info

unregister

public void unregister(ComponentName name)
Description copied from interface: ComponentManager
Unregisters a component given its name.

Specified by:
unregister in interface ComponentManager
Parameters:
name - the component name

addComponentListener

public void addComponentListener(ComponentListener listener)
Description copied from interface: ComponentManager
Adds a component listener.

Does nothing if the given listener is already registered.

Specified by:
addComponentListener in interface ComponentManager
Parameters:
listener - the component listener to add

removeComponentListener

public void removeComponentListener(ComponentListener listener)
Description copied from interface: ComponentManager
Removes a component listener.

Does nothing if the given listener is not registered.

Specified by:
removeComponentListener in interface ComponentManager
Parameters:
listener - the component listener to remove

getComponentProvidingService

public ComponentInstance getComponentProvidingService(Class<?> serviceClass)
Description copied from interface: ComponentManager
Gets the component that provides the given service.

Specified by:
getComponentProvidingService in interface ComponentManager
Parameters:
serviceClass - the service class
Returns:
the component or null if none

getService

public <T> T getService(Class<T> serviceClass)
Description copied from interface: ComponentManager
Gets the service of type serviceClass if such a service was declared by a resolved runtime component.

If the component is not yet activated it will be prior to return the service.

Specified by:
getService in interface ComponentManager
Type Parameters:
T - the service type
Parameters:
serviceClass - the service class
Returns:
the service object

getActivatingRegistrations

public Collection<ComponentName> getActivatingRegistrations()
Description copied from interface: ComponentManager
Gets the pending extensions by component.

Specified by:
getActivatingRegistrations in interface ComponentManager
Returns:
the pending extensions

registerExtension

public void registerExtension(Extension extension)
                       throws Exception
Throws:
Exception

unregisterExtension

public void unregisterExtension(Extension extension)
                         throws Exception
Throws:
Exception

loadContributions

public static void loadContributions(RegistrationInfoImpl ri,
                                     Extension xt)

registerServices

public void registerServices(RegistrationInfoImpl ri)

unregisterServices

public void unregisterServices(RegistrationInfoImpl ri)

getServices

public String[] getServices()
Description copied from interface: ComponentManager
Get the list of all registered service names An empty array is returned if no registered services are found.

Specified by:
getServices in interface ComponentManager
Returns:
an array of registered service.

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.