Nuxeo Enterprise Platform 5.1

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

Field Summary
protected  Map<ComponentName,Set<Extension>> pendingExtensions
           
 
Constructor Summary
ComponentManagerImpl(RuntimeService runtime)
           
 
Method Summary
 void _register(RegistrationInfoImpl ri)
           
 void _unregister(RegistrationInfoImpl ri)
           
 void addComponentListener(ComponentListener listener)
          Adds a component listener.
protected  void addDependency(ComponentName name, RegistrationInfoImpl dependent)
           
protected  boolean computeBlockingDependencies(RegistrationInfoImpl ri)
           
 ComponentInstance getComponent(ComponentName name)
          Gets object instance managed by the named component.
 Collection<ComponentName> getNeededRegistrations()
           
 Collection<Extension> getPendingExtensions(ComponentName name)
           
 Collection<ComponentName> getPendingRegistrations()
          Gets the list of pending registrations.
 RegistrationInfo getRegistrationInfo(ComponentName name)
          Gets the component if there is one having the given name.
 Collection<RegistrationInfo> getRegistrations()
          Gets the registrated 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()
           
 boolean isRegistered(ComponentName name)
          Checks whether or not a component with the given name was registered.
 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.
protected  Set<RegistrationInfoImpl> removeDependencies(ComponentName name)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pendingExtensions

protected final Map<ComponentName,Set<Extension>> pendingExtensions
Constructor Detail

ComponentManagerImpl

public ComponentManagerImpl(RuntimeService runtime)
Method Detail

getRegistrations

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

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

getPendingRegistrations

public Collection<ComponentName> getPendingRegistrations()
Description copied from interface: ComponentManager
Gets the list of pending registrations.

Specified by:
getPendingRegistrations in interface ComponentManager
Returns:
the pending registrations or an empty collection if none

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 fo 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

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

_register

public final void _register(RegistrationInfoImpl ri)

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 u nregistered.

If true is returned, the object will be removed fom the main registry.

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

_unregister

public final void _unregister(RegistrationInfoImpl ri)

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

computeBlockingDependencies

protected boolean computeBlockingDependencies(RegistrationInfoImpl ri)

addDependency

protected void addDependency(ComponentName name,
                             RegistrationInfoImpl dependent)

removeDependencies

protected Set<RegistrationInfoImpl> removeDependencies(ComponentName name)

registerExtension

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

unregisterExtension

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

loadContributions

public void loadContributions(RegistrationInfoImpl ri,
                              Extension xt)

registerServices

public void registerServices(RegistrationInfoImpl ri)

unregisterServices

public void unregisterServices(RegistrationInfoImpl ri)

getServices

public String[] getServices()

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

Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.