Class DefaultSchemaMigrator

java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.emf.cdo.server.db.evolution.phased.BasicPhaseHandler
org.eclipse.emf.cdo.server.db.evolution.phased.DefaultSchemaMigrator
All Implemented Interfaces:
Phase.Handler, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.event.INotifier.INotifier2, org.eclipse.net4j.util.lifecycle.IDeactivateable, org.eclipse.net4j.util.lifecycle.ILifecycle, org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation

public class DefaultSchemaMigrator extends BasicPhaseHandler
Evolves the models with the given mapping strategy, context, and store accessor.

This method performs the following steps:

  1. It delegates the model evolution to the mapping strategy, which is responsible for updating the database schema, migrating the existing data, and changing the container feature IDs in case of shifted features.
  2. It updates the system tables, including the cdo_package_units table, cdo_package_infos table, and cdo_external_refs table.
  3. It commits the transaction.
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/interfaces inherited from class org.eclipse.net4j.util.event.Notifier

    org.eclipse.net4j.util.event.Notifier.Cancelation

    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
    The factory type of the default schema migrator.

    Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

    USE_LABEL

    Fields inherited from interface org.eclipse.emf.cdo.server.db.evolution.phased.Phase.Handler

    PRODUCT_GROUP
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a schema migrator.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    Commits the model evolution changes to the database.
    void
    execute(Context context)
    Evolves the models with the current mapping strategy.
    boolean
    Returns whether to delete obsolete meta ID mappings from the cdo_external_refs table.
    protected void
    migrateSchema(Context context, IDBStoreAccessor accessor, ISchemaMigration schemaMigration)
    Delegates the schema migration to the mapping strategy.
    void
    setDeleteObsoleteMetaIDs(boolean deleteObsoleteMetaIDs)
    Sets whether to delete obsolete meta ID mappings from the cdo_external_refs table.
    protected void
    Updates the system tables with the changed models.

    Methods inherited from class org.eclipse.emf.cdo.server.db.evolution.phased.BasicPhaseHandler

    doBeforeActivate, getPhase, setPhase

    Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

    activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString

    Methods inherited from class org.eclipse.net4j.util.event.Notifier

    addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

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

    addListener, getListeners, hasListeners, removeListener
  • Field Details

    • FACTORY_TYPE

      public static final String FACTORY_TYPE
      The factory type of the default schema migrator.
      See Also:
  • Constructor Details

    • DefaultSchemaMigrator

      public DefaultSchemaMigrator()
      Creates a schema migrator.
  • Method Details

    • isDeleteObsoleteMetaIDs

      public boolean isDeleteObsoleteMetaIDs()
      Returns whether to delete obsolete meta ID mappings from the cdo_external_refs table.
    • setDeleteObsoleteMetaIDs

      public void setDeleteObsoleteMetaIDs(boolean deleteObsoleteMetaIDs)
      Sets whether to delete obsolete meta ID mappings from the cdo_external_refs table.
    • execute

      public void execute(Context context) throws Exception
      Evolves the models with the current mapping strategy.
      Throws:
      Exception
    • migrateSchema

      protected void migrateSchema(Context context, IDBStoreAccessor accessor, ISchemaMigration schemaMigration) throws SQLException
      Delegates the schema migration to the mapping strategy.
      Throws:
      SQLException
    • updateSystemTables

      protected void updateSystemTables(Context context, IDBStoreAccessor accessor) throws SQLException
      Updates the system tables with the changed models.
      Throws:
      SQLException
    • commitChanges

      protected boolean commitChanges(Context context, IDBStoreAccessor accessor) throws SQLException
      Commits the model evolution changes to the database.
      Throws:
      SQLException