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
Fields Modifier and Type Field Description protected RuntimeContext
ctx
protected ContributionStorage
storage
static String
STORAGE_XP
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description ContributionPersistenceComponent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.Contribution
addContribution(Contribution contrib)
Persists a new contribution.void
deactivate(ComponentContext context)
Deactivates the component.static String
getComponentName(String contribName)
Contribution
getContribution(String name)
Gets a contribution given its name.List<Contribution>
getContributions()
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)
Contribution
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
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
STORAGE_XP
public static final String STORAGE_XP
- See Also:
- Constant Field Values
-
storage
protected ContributionStorage storage
-
ctx
protected RuntimeContext ctx
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
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
public void deactivate(ComponentContext context)
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
public List<Contribution> getContributions()
Description copied from interface:ContributionPersistenceManager
Gets a list with all persisted contributions.- Specified by:
getContributions
in interfaceContributionPersistenceManager
-
getContribution
public Contribution getContribution(String name)
Description copied from interface:ContributionPersistenceManager
Gets a contribution given its name.- Specified by:
getContribution
in interfaceContributionPersistenceManager
-
addContribution
public Contribution addContribution(Contribution contrib)
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
public boolean removeContribution(Contribution contrib)
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
public boolean isInstalled(Contribution contrib)
Description copied from interface:ContributionPersistenceManager
Checks whether a contribution is currently installed.- Specified by:
isInstalled
in interfaceContributionPersistenceManager
-
installContribution
public boolean installContribution(Contribution contrib)
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
public boolean uninstallContribution(Contribution contrib)
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
public Contribution updateContribution(Contribution contribution)
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
public boolean isPersisted(Contribution contrib)
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
public void start(ComponentContext context)
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
public void stop(ComponentContext context)
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-
-