Package org.nuxeo.runtime.model.impl
Class ComponentRegistry
- java.lang.Object
-
- org.nuxeo.runtime.model.impl.ComponentRegistry
-
public class ComponentRegistry extends Object
This class is synchronized to safely update and access the different maps managed by the registry- Author:
- Bogdan Stefanescu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ComponentRegistry.MappedSet
-
Field Summary
Fields Modifier and Type Field Description protected Map<ComponentName,ComponentName>
aliases
Map of aliased name to canonical name.protected Map<ComponentName,RegistrationInfo>
components
All registered components including unresolved ones.protected Map<String,ComponentName>
deployedFiles
Map deployment source ids to component names This was previously managed by DefaultRuntimeContext - but is no more usable in the original form.protected ComponentRegistry.MappedSet
pendings
Map pending components to the set of unresolved components they are waiting for.protected ComponentRegistry.MappedSet
requirements
Maps a component name to a set of component names that are depending on that component.protected LinkedHashMap<ComponentName,RegistrationInfo>
resolved
The list of resolved components.
-
Constructor Summary
Constructors Constructor Description ComponentRegistry()
ComponentRegistry(ComponentRegistry reg)
-
Method Summary
-
-
-
Field Detail
-
components
protected Map<ComponentName,RegistrationInfo> components
All registered components including unresolved ones. You can check the state of a component for getting the unresolved ones.
-
resolved
protected LinkedHashMap<ComponentName,RegistrationInfo> resolved
The list of resolved components. We need to use a linked hash map preserve the resolve order. We don't use a simple list to optimize removal by name (used by unregister operations).- Since:
- 9.2
-
aliases
protected Map<ComponentName,ComponentName> aliases
Map of aliased name to canonical name.
-
requirements
protected ComponentRegistry.MappedSet requirements
Maps a component name to a set of component names that are depending on that component. Values are always unaliased.
-
pendings
protected ComponentRegistry.MappedSet pendings
Map pending components to the set of unresolved components they are waiting for. Key is always unaliased.
-
deployedFiles
protected Map<String,ComponentName> deployedFiles
Map deployment source ids to component names This was previously managed by DefaultRuntimeContext - but is no more usable in the original form. This map is only useful for unregister by location - which is used by some tests. Remove this if the unregister API will be removed.- Since:
- 9.2
-
-
Constructor Detail
-
ComponentRegistry
public ComponentRegistry()
-
ComponentRegistry
public ComponentRegistry(ComponentRegistry reg)
-
-
Method Detail
-
destroy
public void destroy()
-
isResolved
public final boolean isResolved(ComponentName name)
-
addComponent
public boolean addComponent(RegistrationInfo ri)
- Returns:
- true if the component was resolved, false if the component is pending
-
removeComponent
public RegistrationInfo removeComponent(ComponentName name)
-
getResolvedRegistrationInfo
public Collection<RegistrationInfo> getResolvedRegistrationInfo()
- Returns:
- an unmodifiable collection of resolved registration infos, sorted by
LinkedHashMap
- Since:
- 9.2
-
getResolvedNames
public Collection<ComponentName> getResolvedNames()
- Returns:
- an unmodifiable collection of resolved component names, sorted by
LinkedHashMap
- Since:
- 9.2
-
getMissingDependencies
public Set<ComponentName> getMissingDependencies(ComponentName name)
- Returns:
- an unmodifiable collection of missing dependencies
- Since:
- 9.2
-
getComponent
public RegistrationInfo getComponent(ComponentName name)
Get the registration info for the given component name or null if none was registered.- Since:
- 9.2
-
contains
public boolean contains(ComponentName name)
Check if the component is already registered against this registry
-
size
public int size()
Get the registered components count
-
getComponents
public Collection<RegistrationInfo> getComponents()
- Returns:
- an unmodifiable collection of registered components
-
getComponentsArray
public RegistrationInfo[] getComponentsArray()
Get a copy of the registered components as an array.
-
getPendingComponents
public Map<ComponentName,Set<ComponentName>> getPendingComponents()
- Returns:
- an unmodifiable map of pending components
-
unaliased
protected ComponentName unaliased(ComponentName name)
-
computePendings
protected final boolean computePendings(RegistrationInfo ri)
Fill the pending map with all unresolved dependencies of the given component. Returns false if no unresolved dependencies are found, otherwise returns true.
-
resolveComponent
protected void resolveComponent(RegistrationInfo ri)
-
unresolveComponent
protected void unresolveComponent(RegistrationInfo ri)
-
-