Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime.model.persistence
Class ContributionPersistenceComponent

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.runtime.model.persistence.ContributionPersistenceComponent
All Implemented Interfaces:
java.util.EventListener, Adaptable, Component, Extensible, ContributionPersistenceManager, org.osgi.framework.FrameworkListener

public class ContributionPersistenceComponent
extends DefaultComponent
implements ContributionPersistenceManager, org.osgi.framework.FrameworkListener

Author:
Bogdan Stefanescu

Field Summary
static java.lang.String STORAGE_XP
           
 
Constructor Summary
ContributionPersistenceComponent()
           
 
Method Summary
 void activate(ComponentContext context)
          Activates the component.
 Contribution addContribution(Contribution contrib)
          Persists a new contribution.
 void deactivate(ComponentContext context)
          Deactivates the component.
 void frameworkEvent(org.osgi.framework.FrameworkEvent event)
           
static java.lang.String getComponentName(java.lang.String contribName)
           
 Contribution getContribution(java.lang.String name)
          Gets a contribution given its name.
 java.util.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(java.lang.Object contribution, java.lang.String extensionPoint, ComponentInstance contributor)
           
 boolean removeContribution(Contribution contrib)
          Removes a persisted contribution given its name.
 void start()
          Starts the service.
 void stop()
          Stops the service.
 boolean uninstallContribution(Contribution contrib)
          Uninstalls a contribution given is name.
 void unregisterContribution(java.lang.Object contribution, java.lang.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
getAdapter, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORAGE_XP

public static final java.lang.String STORAGE_XP
See Also:
Constant Field Values
Constructor Detail

ContributionPersistenceComponent

public ContributionPersistenceComponent()
Method Detail

getComponentName

public static java.lang.String getComponentName(java.lang.String contribName)

activate

public void activate(ComponentContext context)
              throws java.lang.Exception
Description copied from interface: Component
Activates the component.

This method is called by the runtime when a component is activated.

Specified by:
activate in interface Component
Overrides:
activate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
java.lang.Exception - if an error occurs during activation

deactivate

public void deactivate(ComponentContext context)
                throws java.lang.Exception
Description copied from interface: Component
Deactivates the component.

This method is called by the runtime when a component is deactivated.

Specified by:
deactivate in interface Component
Overrides:
deactivate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
java.lang.Exception - if an error occurs during activation

registerContribution

public void registerContribution(java.lang.Object contribution,
                                 java.lang.String extensionPoint,
                                 ComponentInstance contributor)
                          throws java.lang.Exception
Overrides:
registerContribution in class DefaultComponent
Throws:
java.lang.Exception

unregisterContribution

public void unregisterContribution(java.lang.Object contribution,
                                   java.lang.String extensionPoint,
                                   ComponentInstance contributor)
                            throws java.lang.Exception
Overrides:
unregisterContribution in class DefaultComponent
Throws:
java.lang.Exception

getContributions

public java.util.List<Contribution> getContributions()
                                              throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Gets a list with all persisted contributions.

Specified by:
getContributions in interface ContributionPersistenceManager
Throws:
java.lang.Exception

getContribution

public Contribution getContribution(java.lang.String name)
                             throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Gets a contribution given its name.

Specified by:
getContribution in interface ContributionPersistenceManager
Throws:
java.lang.Exception

addContribution

public Contribution addContribution(Contribution contrib)
                             throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Persists a new contribution. The contribution will not be installed. You need to explicitly call ContributionPersistenceManager.installContribution(Contribution) to install the contribution.

Specified by:
addContribution in interface ContributionPersistenceManager
Throws:
java.lang.Exception

removeContribution

public boolean removeContribution(Contribution contrib)
                           throws java.lang.Exception
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 call #uninstallContribution(String) to uninstall it.

Specified by:
removeContribution in interface ContributionPersistenceManager
Returns:
true if the contribution was removed, false if the contribution was not found in persistence.
Throws:
java.lang.Exception

isInstalled

public boolean isInstalled(Contribution contrib)
                    throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Checks whether a contribution is currently installed.

Specified by:
isInstalled in interface ContributionPersistenceManager
Throws:
java.lang.Exception

installContribution

public boolean installContribution(Contribution contrib)
                            throws java.lang.Exception
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 interface ContributionPersistenceManager
Throws:
java.lang.Exception

uninstallContribution

public boolean uninstallContribution(Contribution contrib)
                              throws java.lang.Exception
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 interface ContributionPersistenceManager
Throws:
java.lang.Exception

updateContribution

public Contribution updateContribution(Contribution contribution)
                                throws java.lang.Exception
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 interface ContributionPersistenceManager
Throws:
java.lang.Exception

isPersisted

public boolean isPersisted(Contribution contrib)
                    throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Checks whether a contribution is currently persisted.

Specified by:
isPersisted in interface ContributionPersistenceManager
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Starts the service. This will install all persisted contributions that are marked as auto-install. See Contribution.isDisabled()

Specified by:
start in interface ContributionPersistenceManager
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: ContributionPersistenceManager
Stops the service. This will uninstall all installed contributions.

Specified by:
stop in interface ContributionPersistenceManager
Throws:
java.lang.Exception

frameworkEvent

public void frameworkEvent(org.osgi.framework.FrameworkEvent event)
Specified by:
frameworkEvent in interface org.osgi.framework.FrameworkListener

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.