Package org.eclipse.emf.cdo.server.db.evolution

# Interface IModelEvolutionSupport

All Superinterfaces:
  `org.eclipse.net4j.util.lifecycle.IDeactivateable`, `org.eclipse.net4j.util.lifecycle.ILifecycle`, `org.eclipse.net4j.util.event.INotifier`

All Known Implementing Classes:
  `PhasedModelEvolutionSupport`

public interface IModelEvolutionSupport extends org.eclipse.net4j.util.lifecycle.ILifecycle
DB store support for model evolution.

Model evolution support is responsible for evolving the models stored in a DB store to match the currently registered EPackages.

Model evolution support implementations are registered via `factories` contributing to the `org.eclipse.emf.cdo.server.db.evolution.supports` `product group`. Here is an example contribution in plugin.xml:

     <extension point="org.eclipse.net4j.util.factories">
        <annotationFactory
           productGroup="org.eclipse.emf.cdo.server.db.evolution.supports"
           type="phased"
           productClass="org.eclipse.emf.cdo.server.db.evolution.phased.PhasedModelEvolutionSupport"/>
     </extension>

If model evolution support is desired, an instance must be created and set on the DB store via `setModelEvolutionSupport()` before the store is activated by the `IRepository`. If the store is configured via the `CDOServerApplication` and the `cdo-server.xml` configuration file, this can be achieved by specifying the `modelEvolutionSupport` element as follows:

     <store type="db">
       ...
       <modelEvolutionSupport type="phased" rootFolder="@state/evolution" mode="migrate">
         <
         <changeDetector/>
         <repositoryExporter type="default" binary="false"/>
         <schemaMigrator/>
         <storeProcessor type="my-sql-processor" myExtraArg="data"/>
         <repositoryProcessor type="my-eobject-handler" myExtraArg="data"/> -->
         <listener type="log"/>
         <listener type="my-extra-checks"/>
       </modelEvolutionSupport>
       ...
     </store>

The optional `mode` attribute can be used to specify whether model evolution should be performed automatically (`migrate`), only prevented with an exception (`prevent`), or skipped entirely (`disabled`) when model changes are detected.

The optional `listener` elements specify additional model evolution listeners to be notified during model evolution. They can be used to implement logging, custom checks, or additional evolution steps.

Note that model evolution happens very late during the activation of a DB store, but very early during the activation of the `IRepository`. Therefore, phase handlers must not rely on any services of the repository. In particular, they must not access the repository's `package registry` because it is not yet available!

Since:
  4.14
Author:
  Eike Stepper
See Also:
  - `PhasedModelEvolutionSupport`

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`IModelEvolutionSupport.Trigger`
The triggers for model evolution.

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

`org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

`org.eclipse.net4j.util.event.INotifier.INotifier2`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PRODUCT_GROUP`
The product group for model evolution support implementations.

## Method Summary

Modifier and Type
Method
Description
`IDBStore`
`getStore()`
Returns the DB store this model evolution support is associated with.
`void`
`setStore(IDBStore store)`
Sets the DB store this model evolution support is associated with.
`void`
`trigger(IModelEvolutionSupport.Trigger trigger)`
Evolves the models stored in the given DB store to match the currently registered `EPackages`.

### Methods inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

`activate, deactivate, getLifecycleState, isActive`

### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

`addListener, getListeners, hasListeners, removeListener`

## Field Details

### PRODUCT_GROUP

static final String PRODUCT_GROUP
The product group for model evolution support implementations.

See Also:
  - Constant Field Values

## Method Details

### getStore

IDBStore getStore()
Returns the DB store this model evolution support is associated with.

### setStore

void setStore(IDBStore store)
Sets the DB store this model evolution support is associated with.

No Reference
  This method is not intended to be called by clients.

### trigger

void trigger(IModelEvolutionSupport.Trigger trigger) throws Exception
Evolves the models stored in the given DB store to match the currently registered `EPackages`.

Throws:
  `Exception`