public interface ComponentManager
Modifier and Type | Interface and Description |
---|---|
static interface |
ComponentManager.Listener
Listener interface for component manager events
|
Modifier and Type | Method and Description |
---|---|
void |
addComponentListener(ComponentListener listener)
Adds a component listener.
|
void |
addListener(ComponentManager.Listener listener)
Add a listener to be notified on manager actions like start / stop components.
|
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.
|
Map<ComponentName,Set<Extension>> |
getMissingRegistrations()
Returns the missing registrations, linked to missing target extension points.
|
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.
|
Collection<ComponentName> |
getResolvedRegistrations()
Gets the resolved component names in the order they were resolved
|
<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
|
boolean |
hasChanged()
Tests whether components were deployed over the initial snapshot (i.e.
|
boolean |
hasComponentFromLocation(String sourceId)
Deprecated.
since 9.2
|
boolean |
hasSnapshot()
Check if a snapshot was done
|
boolean |
isRegistered(ComponentName name)
Checks whether or not a component with the given name was registered.
|
boolean |
isRunning()
Tests whether the components are running.
|
boolean |
isStandby()
Tests whether the components are in standby mode.
|
boolean |
isStarted()
Tests whether the components were already started.
|
boolean |
isStashEmpty()
Tests if the stash is empty
|
default boolean |
refresh()
Shortcut for refresh(false).
|
boolean |
refresh(boolean reset)
Refresh the registry using stashed registrations if any.
|
void |
register(RegistrationInfo ri)
Handles the registration of the given registration info.
|
void |
removeComponentListener(ComponentListener listener)
Removes a component listener.
|
void |
removeListener(ComponentManager.Listener listener)
Remove the component manager listener previously added by
addListener(Listener) . |
boolean |
reset()
Reset the registry to the last snapshot if any and stop the components (if they are currently started).
|
void |
restart(boolean reset)
Optionally reset the registry to the last snapshot and restart the components.
|
void |
resume()
Start standby components.
|
void |
setBlacklist(Set<String> blacklist) |
void |
shutdown()
Shuts down the component registry.
|
int |
size()
Gets the number of registered objects in this registry.
|
void |
snapshot()
Make a snapshot of the component registry.
|
void |
standby()
Stop all started components but don't deactivate them.
|
void |
standby(int timeout)
Same as
standby() but log a warning if the timeout is reached while stopping components |
boolean |
start()
Activate and start all resolved components.
|
boolean |
stop()
Stop and deactivate all resolved components.
|
void |
stop(int timeout)
Same as
stop() but log a warning if the timeout is reached while stopping components |
void |
unregister(ComponentName name)
Unregisters a component given its name.
|
void |
unregister(RegistrationInfo ri)
Handles the unregistration of the given registration info.
|
boolean |
unregisterByLocation(String sourceId)
Deprecated.
since 9.2
|
void |
unstash()
Apply the stash if not empty.
|
void addComponentListener(ComponentListener listener)
Does nothing if the given listener is already registered.
listener
- the component listener to addvoid removeComponentListener(ComponentListener listener)
Does nothing if the given listener is not registered.
listener
- the component listener to removevoid register(RegistrationInfo ri)
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.
ri
- the registration infovoid unregister(RegistrationInfo ri)
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.
ri
- the registration infovoid unregister(ComponentName name)
name
- the component name@Deprecated boolean unregisterByLocation(String sourceId)
sourceId
- the location from where the component was deployedfor more on this
@Deprecated boolean hasComponentFromLocation(String sourceId)
RegistrationInfo getRegistrationInfo(ComponentName name)
name
- the component nameComponentInstance getComponent(ComponentName name)
name
- the object nameboolean isRegistered(ComponentName name)
name
- the object nameCollection<RegistrationInfo> getRegistrations()
Map<ComponentName,Set<ComponentName>> getPendingRegistrations()
Map<ComponentName,Set<Extension>> getMissingRegistrations()
Collection<ComponentName> getActivatingRegistrations()
Collection<ComponentName> getResolvedRegistrations()
Collection<ComponentName> getStartFailureRegistrations()
int size()
void shutdown()
This unregisters all objects registered in this registry.
<T> T getService(Class<T> serviceClass)
If the component is not yet activated it will be prior to return the service.
T
- the service typeserviceClass
- the service classString[] getServices()
ComponentInstance getComponentProvidingService(Class<?> serviceClass)
serviceClass
- the service classSet<String> getBlacklist()
void setBlacklist(Set<String> blacklist)
boolean start()
boolean stop()
void stop(int timeout)
stop()
but log a warning if the timeout is reached while stopping componentsvoid standby()
If any components were previously started do nothing
void standby(int timeout)
standby()
but log a warning if the timeout is reached while stopping componentsvoid resume()
void snapshot()
void restart(boolean reset)
When restarting components all components will be stopped, deactivated and re-instantiated. It means that all references to components before a restart will become invalid after the restart.
If no snapshot was created then the components will be restarted without changing the registry.
If the reset
argument is true then the registry will be reverted to the last snapshot before
starting the components.
reset
- whether or not to revert to the last snapshotboolean reset()
start()
to start again the componentsboolean refresh(boolean reset)
reset
argument is true then the
registry will be reverted to the last snapshot before applying the stash.
If the stash is empty it does nothing and return true, otherwise it will:
reset
- whether or not to revert to the last snapshotdefault boolean refresh()
refresh(boolean)
boolean isStarted()
boolean isStandby()
When putting components in standby they are stopped but not deactivated. You start back the standby components by calling #resume
While in standby mode the component manager remains in running state.
boolean isRunning()
boolean hasChanged()
boolean hasSnapshot()
boolean isStashEmpty()
void unstash()
isRunning()
.
For compatibility reasons (to be able to emulate the old hot deploy mechanism or to speed up tests) this method will force a registry refresh in all 3 component manager states: stopped, standby, started.
Usually you should apply the stash by calling refresh()
which is similar to
stop(); [restoreSnapshot();] unstash(); start();
void addListener(ComponentManager.Listener listener)
void removeListener(ComponentManager.Listener listener)
addListener(Listener)
. If the listener were
not added then nothing is done.Copyright © 2018 Nuxeo. All rights reserved.