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 RuntimeContextctxprotected ContributionStoragestoragestatic StringSTORAGE_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 voidactivate(ComponentContext context)Activates the component.ContributionaddContribution(Contribution contrib)Persists a new contribution.voiddeactivate(ComponentContext context)Deactivates the component.static StringgetComponentName(String contribName)ContributiongetContribution(String name)Gets a contribution given its name.List<Contribution>getContributions()Gets a list with all persisted contributions.booleaninstallContribution(Contribution contrib)Installs the contribution given its name.booleanisInstalled(Contribution contrib)Checks whether a contribution is currently installed.booleanisPersisted(Contribution contrib)Checks whether a contribution is currently persisted.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)booleanremoveContribution(Contribution contrib)Removes a persisted contribution given its name.voidstart()Starts the service.voidstart(ComponentContext context)Start the component.voidstop()Stops the service.voidstop(ComponentContext context)Stop the component.booleanuninstallContribution(Contribution contrib)Uninstalls a contribution given is name.voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)ContributionupdateContribution(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:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
getContributions
public List<Contribution> getContributions()
Description copied from interface:ContributionPersistenceManagerGets a list with all persisted contributions.- Specified by:
getContributionsin interfaceContributionPersistenceManager
-
getContribution
public Contribution getContribution(String name)
Description copied from interface:ContributionPersistenceManagerGets a contribution given its name.- Specified by:
getContributionin interfaceContributionPersistenceManager
-
addContribution
public Contribution addContribution(Contribution contrib)
Description copied from interface:ContributionPersistenceManagerPersists a new contribution. The contribution will not be installed. You need to explicitly callContributionPersistenceManager.installContribution(Contribution)to install the contribution.- Specified by:
addContributionin interfaceContributionPersistenceManager
-
removeContribution
public boolean removeContribution(Contribution contrib)
Description copied from interface:ContributionPersistenceManagerRemoves 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:
removeContributionin 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:ContributionPersistenceManagerChecks whether a contribution is currently installed.- Specified by:
isInstalledin interfaceContributionPersistenceManager
-
installContribution
public boolean installContribution(Contribution contrib)
Description copied from interface:ContributionPersistenceManagerInstalls 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:
installContributionin interfaceContributionPersistenceManager
-
uninstallContribution
public boolean uninstallContribution(Contribution contrib)
Description copied from interface:ContributionPersistenceManagerUninstalls 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:
uninstallContributionin interfaceContributionPersistenceManager
-
updateContribution
public Contribution updateContribution(Contribution contribution)
Description copied from interface:ContributionPersistenceManagerUpdates 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:
updateContributionin interfaceContributionPersistenceManager
-
isPersisted
public boolean isPersisted(Contribution contrib)
Description copied from interface:ContributionPersistenceManagerChecks whether a contribution is currently persisted.- Specified by:
isPersistedin interfaceContributionPersistenceManager
-
start
public void start()
Description copied from interface:ContributionPersistenceManagerStarts the service. This will install all persisted contributions that are marked as auto-install. SeeContribution.isDisabled()- Specified by:
startin interfaceContributionPersistenceManager
-
stop
public void stop()
Description copied from interface:ContributionPersistenceManagerStops the service. This will uninstall all installed contributions.- Specified by:
stopin interfaceContributionPersistenceManager
-
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
public void stop(ComponentContext context)
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent
-
-