Class Migrator


  • public class Migrator
    extends Object
    Migrator to migrate a model from a previous to the current release.
    Version:
    $Rev$
    Author:
    herrmama, $Author$
    • Method Detail

      • migrateAndSave

        public void migrateAndSave​(List<org.eclipse.emf.common.util.URI> modelURIs,
                                   Release sourceRelease,
                                   Release targetRelease,
                                   org.eclipse.core.runtime.IProgressMonitor monitor)
                            throws MigrationException
        Migrate a model based on a set of URI.
        Parameters:
        modelURIs -
        sourceRelease - Release to which the model conforms
        targetRelease - Release to which the model should be migrated (use null for the newest release)
        monitor - Progress monitor
        Throws:
        MigrationException
      • migrateAndSave

        public void migrateAndSave​(List<org.eclipse.emf.common.util.URI> modelURIs,
                                   Release sourceRelease,
                                   Release targetRelease,
                                   org.eclipse.core.runtime.IProgressMonitor monitor,
                                   Map<String,​Object> options)
                            throws MigrationException
        Migrate a model based on a set of URI.
        Parameters:
        modelURIs -
        sourceRelease - Release to which the model conforms
        targetRelease - Release to which the model should be migrated (use null for the newest release)
        monitor - Progress monitor
        options - Options to pass to the ResourceSet when saving
        Throws:
        MigrationException
        Since:
        1.1
      • migrateAndLoad

        public org.eclipse.emf.ecore.resource.ResourceSet migrateAndLoad​(List<org.eclipse.emf.common.util.URI> modelURIs,
                                                                         Release sourceRelease,
                                                                         Release targetRelease,
                                                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                                                  throws MigrationException
        Migrate a model based on a set of URIs and load it afterwards.
        Parameters:
        modelURIs - The set of URI
        sourceRelease - Release to which the model conforms
        targetRelease - Release to which the model should be migrated (use null for the newest release)
        monitor - Progress monitor
        Returns:
        The model in a ResourceSet
        Throws:
        MigrationException
      • getLatestRelease

        public Release getLatestRelease()
        Get the latest release.
      • getRelease

        public Set<Release> getRelease​(org.eclipse.emf.common.util.URI modelURI)
        Get the release of a model based on URI.
      • getRelease

        public Set<Release> getRelease​(Set<String> nsURIs)
        Get the release of a model based on a set of namespace URIs.
        Since:
        1.2
      • getReleaseMap

        public Map<String,​Set<Release>> getReleaseMap()
        Get the release map from NS-URI to releases
      • getRelease

        public Release getRelease​(int number)
        Get the release with a certain number.
      • getReleases

        public List<Release> getReleases()
        Get all releases.
      • getNsURIs

        public Set<String> getNsURIs()
        Get set of namespace URIs.
      • getMetamodel

        public Metamodel getMetamodel​(Release release)
        Returns the metamodel for a release.
      • setLevel

        public void setLevel​(ValidationLevel level)
        Set the validation level.
      • main

        public static void main​(String[] args)
        Main method to perform migrations.
      • setResourceSetFactory

        public void setResourceSetFactory​(IResourceSetFactory resourceSetFactory)
        Set the factory to create ResourceSets for custom serialization.
      • getResourceSetFactory

        public IResourceSetFactory getResourceSetFactory()
        Get the factory to create ResourceSets for custom serialization.
      • setPostLoadModelProcessor

        public void setPostLoadModelProcessor​(IResourceSetProcessor postLoadProcessor)
        The given processor will be called after the outdated model was loaded. It will be called before Edapt translates the dynamic EMF model into its internal representation required for the migration. Hence this processor may be used to modify the to be migrated model before the actual migrations starts.
        Since:
        1.3
      • getPostLoadModelProcessor

        public IResourceSetProcessor getPostLoadModelProcessor()
        The post load model processor.
        Since:
        1.3