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

# Enum Class Phase

java.lang.Object
java.lang.Enum<Phase>
org.eclipse.emf.cdo.server.db.evolution.phased.Phase

All Implemented Interfaces:
  `Serializable`, `Comparable<Phase>`, `java.lang.constant.Constable`

public enum Phase extends Enum<Phase>
Phases in the model evolution process.

Each phase is associated with a specific `trigger` that causes its execution. Furthermore, each phase defines the possible transitions to subsequent phases via the `transitionTo()` method.

The phases are executed in the following order:

1. `ChangeDetection`
2. `RepositoryExport`
3. `SchemaMigration`
4. `StoreProcessing`
5. `RepositoryProcessing`

Since:
  4.14
Author:
  Eike Stepper
No Implement
  This package is currently considered provisional.
No Extend
  This package is currently considered provisional.
No Reference
  This package is currently considered provisional.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`Phase.Handler`
A handler for a specific phase in the model evolution process.
`static enum`
`Phase.Transition`
The possible transitions between phases.

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`ChangeDetection`
The change detection phase identifies model changes between the stored models and the currently registered EPackages.
`RepositoryExport`
The repository export phase exports the current repository data to the `evolution folder` before any schema migration takes place.
`RepositoryProcessing`
The repository processing phase processes the repository after the schema migration has taken place.
`SchemaMigration`
The schema migration phase migrates the database schema to match the currently registered EPackages.
`StoreProcessing`
The store processing phase processes the DB store after the schema migration has taken place.

## Method Summary

Modifier and Type
Method
Description
`void`
`done(Context context)`
Called after executing a phase handler.
`protected abstract Phase.Transition`
`getTransitionTo(Phase nextPhase)`
`void`
`init(Context context)`
Called before executing a phase handler.
`boolean`
`initial()`
Returns true if this is the initial phase in the model evolution process.
`Phase`
`next()`
Returns the next phase in the model evolution process, or `null` if this is the terminal phase.
`static Phase`
`parse(String str)`
Parses the given string into a Phase.
`Phase.Transition`
`transitionTo(Phase nextPhase)`
Returns the `transition` to the given `nextPhase`, or `null` if no such transition exists.
`IModelEvolutionSupport.Trigger`
`trigger()`
Returns the `trigger` that causes the execution of this phase.
`static Phase`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static Phase[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### ChangeDetection

public static final Phase ChangeDetection
The change detection phase identifies model changes between the stored models and the currently registered EPackages.

This phase is triggered by the `activating store` event.

From this phase, transitions are possible to:

- `RepositoryExport` via the `next trigger` transition
- `SchemaMigration` via the `same trigger` transition

The change detection phase is always the initial phase in the model evolution process. It is also the only phase that can be cancelled, for example, if no model changes are detected.

### RepositoryExport

public static final Phase RepositoryExport
The repository export phase exports the current repository data to the `evolution folder` before any schema migration takes place.

This phase is triggered by the `activated repository` event. At this point in time, the repository is fully configured and active. The repository's package registry is filled with the old models.

From this phase, a transition is possible to:

- `SchemaMigration` via the `repository restart` transition

The repository export phase, if applicable, is always the second phase in the model evolution process. It is only executed if model changes were detected during the `change detection` phase and a `phase handler` was registered for this phase.

### SchemaMigration

public static final Phase SchemaMigration
The schema migration phase migrates the database schema to match the currently registered EPackages. It also performs any necessary data migrations, such as updating the `cdo_feature` columns when feature IDs have changed or updating enum literal values when enum literals have changed.

This phase is triggered by the `activating store` event.

From this phase, transitions are possible to:

- `StoreProcessing` via the `store restart` transition
- `RepositoryProcessing` via the `store restart` transition

The schema migration phase is always executed (i.e., a `phase handler` must be registered for it) when model changes were detected during the `change detection` phase.

### StoreProcessing

public static final Phase StoreProcessing
The store processing phase processes the DB store after the schema migration has taken place. This phase is typically used to perform any necessary adjustments to the stored data to ensure consistency with the new schema.

This phase is triggered by the `activating store` event. At this point in time, the DB store is fully configured, but not yet active. The repository's package registry is filled with the new models. The store's mapping registry has been updated to match the new models.

From this phase, a transition is possible to:

- `RepositoryProcessing` via the `next trigger` transition

The store processing phase is only executed if a `phase handler` was registered for it.

### RepositoryProcessing

public static final Phase RepositoryProcessing
The repository processing phase processes the repository after the schema migration has taken place. This phase is typically used to perform any necessary adjustments to the repository data.

This phase is triggered by the `activated repository` event. At this point in time, the repository is fully configured and active. The repository's package registry is filled with the new models.

This is the terminal phase in the model evolution process. It is only executed if a `phase handler` was registered for it.

## Method Details

### values

public static Phase[] values()
Returns an array containing the constants of this enum class, in the order they are declared.

Returns:
  an array containing the constants of this enum class, in the order they are declared

### valueOf

public static Phase valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum class has no constant with the specified name
  `NullPointerException` - if the argument is null

### initial

public boolean initial()
Returns true if this is the initial phase in the model evolution process. The initial phase is always `ChangeDetection`.

### next

public Phase next()
Returns the next phase in the model evolution process, or `null` if this is the terminal phase. The terminal phase is always `RepositoryProcessing`.

### trigger

public IModelEvolutionSupport.Trigger trigger()
Returns the `trigger` that causes the execution of this phase.

### transitionTo

public Phase.Transition transitionTo(Phase nextPhase)
Returns the `transition` to the given `nextPhase`, or `null` if no such transition exists.

### getTransitionTo

protected abstract Phase.Transition getTransitionTo(Phase nextPhase)

### init

public void init(Context context)
Called before executing a phase handler.

### done

public void done(Context context)
Called after executing a phase handler.

### parse

public static Phase parse(String str)
Parses the given string into a Phase.