Class ContributionPersistenceComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.model.persistence.ContributionPersistenceComponent
- All Implemented Interfaces:
Adaptable
,Component
,Extensible
,ContributionPersistenceManager
,TimestampedService
public class ContributionPersistenceComponent
extends DefaultComponent
implements ContributionPersistenceManager
- Author:
- Bogdan Stefanescu
-
Field Summary
Modifier and TypeFieldDescriptionprotected RuntimeContext
protected ContributionStorage
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ComponentContext context) Activates the component.addContribution
(Contribution contrib) Persists a new contribution.void
deactivate
(ComponentContext context) Deactivates the component.static String
getComponentName
(String contribName) getContribution
(String name) Gets a contribution given its name.Gets a list with all persisted contributions.boolean
installContribution
(Contribution contrib) Installs the contribution given its name.boolean
isInstalled
(Contribution contrib) Checks whether a contribution is currently installed.boolean
isPersisted
(Contribution contrib) Checks whether a contribution is currently persisted.void
registerContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) boolean
removeContribution
(Contribution contrib) Removes a persisted contribution given its name.void
start()
Starts the service.void
start
(ComponentContext context) Start the component.void
stop()
Stops the service.void
stop
(ComponentContext context) Stop the component.boolean
uninstallContribution
(Contribution contrib) Uninstalls a contribution given is name.void
unregisterContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) updateContribution
(Contribution contribution) Updates in the storage the given contribution modifications.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
STORAGE_XP
- See Also:
-
storage
-
ctx
-
-
Constructor Details
-
ContributionPersistenceComponent
public ContributionPersistenceComponent()
-
-
Method Details
-
getComponentName
-
activate
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
getContributions
Description copied from interface:ContributionPersistenceManager
Gets a list with all persisted contributions.- Specified by:
getContributions
in interfaceContributionPersistenceManager
-
getContribution
Description copied from interface:ContributionPersistenceManager
Gets a contribution given its name.- Specified by:
getContribution
in interfaceContributionPersistenceManager
-
addContribution
Description copied from interface:ContributionPersistenceManager
Persists a new contribution. The contribution will not be installed. You need to explicitly callContributionPersistenceManager.installContribution(Contribution)
to install the contribution.- Specified by:
addContribution
in interfaceContributionPersistenceManager
-
removeContribution
Description copied from interface:ContributionPersistenceManager
Removes a persisted contribution given its name. The contribution will not be uninstalled before being removed. You need to explicitly callContributionPersistenceManager.uninstallContribution(Contribution)
to uninstall it.- Specified by:
removeContribution
in interfaceContributionPersistenceManager
- Returns:
- true if the contribution was removed, false if the contribution was not found in persistence.
-
isInstalled
Description copied from interface:ContributionPersistenceManager
Checks whether a contribution is currently installed.- Specified by:
isInstalled
in interfaceContributionPersistenceManager
-
installContribution
Description copied from interface:ContributionPersistenceManager
Installs the contribution given its name. Return true if contribution install succeeds, false if the contribution is already installed.To be able to install a contribution you need to persist it first.
- Specified by:
installContribution
in interfaceContributionPersistenceManager
-
uninstallContribution
Description copied from interface:ContributionPersistenceManager
Uninstalls a contribution given is name. If not already installed return false otherwise return true. The contribution persisted state is not modified by this operation.- Specified by:
uninstallContribution
in interfaceContributionPersistenceManager
-
updateContribution
Description copied from interface:ContributionPersistenceManager
Updates in the storage the given contribution modifications.A contribution cannot be renamed. The only permitted modifications are changing the description and the auto start status.
Return back the contribution object.
- Specified by:
updateContribution
in interfaceContributionPersistenceManager
-
isPersisted
Description copied from interface:ContributionPersistenceManager
Checks whether a contribution is currently persisted.- Specified by:
isPersisted
in interfaceContributionPersistenceManager
-
start
public void start()Description copied from interface:ContributionPersistenceManager
Starts the service. This will install all persisted contributions that are marked as auto-install. SeeContribution.isDisabled()
- Specified by:
start
in interfaceContributionPersistenceManager
-
stop
public void stop()Description copied from interface:ContributionPersistenceManager
Stops the service. This will uninstall all installed contributions.- Specified by:
stop
in interfaceContributionPersistenceManager
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-