Class Migrator
- java.lang.Object
-
- org.eclipse.emf.edapt.migration.execution.Migrator
-
public class Migrator extends Object
Migrator to migrate a model from a previous to the current release.- Version:
- $Rev$
- Author:
- herrmama, $Author$
-
-
Constructor Summary
Constructors Constructor Description Migrator(org.eclipse.emf.common.util.URI historyURI, IClassLoader classLoader)
Constructor.Migrator(History history, IClassLoader classLoader)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Release
getLatestRelease()
Get the latest release.Metamodel
getMetamodel(Release release)
Returns the metamodel for a release.Set<String>
getNsURIs()
Get set of namespace URIs.IResourceSetProcessor
getPostLoadModelProcessor()
The post load model processor.Release
getRelease(int number)
Get the release with a certain number.Set<Release>
getRelease(Set<String> nsURIs)
Get the release of a model based on a set of namespace URIs.Set<Release>
getRelease(org.eclipse.emf.common.util.URI modelURI)
Get the release of a model based onURI
.Map<String,Set<Release>>
getReleaseMap()
Get the release map from NS-URI to releasesList<Release>
getReleases()
Get all releases.IResourceSetFactory
getResourceSetFactory()
Get the factory to createResourceSet
s for custom serialization.static void
main(String[] args)
Main method to perform migrations.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)
Migrate a model based on a set ofURI
s and load it afterwards.void
migrateAndSave(List<org.eclipse.emf.common.util.URI> modelURIs, Release sourceRelease, Release targetRelease, org.eclipse.core.runtime.IProgressMonitor monitor)
Migrate a model based on a set ofURI
.void
migrateAndSave(List<org.eclipse.emf.common.util.URI> modelURIs, Release sourceRelease, Release targetRelease, org.eclipse.core.runtime.IProgressMonitor monitor, Map<String,Object> options)
Migrate a model based on a set ofURI
.void
setLevel(ValidationLevel level)
Set the validation level.void
setPostLoadModelProcessor(IResourceSetProcessor postLoadProcessor)
The given processor will be called after the outdated model was loaded.void
setResourceSetFactory(IResourceSetFactory resourceSetFactory)
Set the factory to createResourceSet
s for custom serialization.
-
-
-
Constructor Detail
-
Migrator
public Migrator(org.eclipse.emf.common.util.URI historyURI, IClassLoader classLoader) throws MigrationException
Constructor.- Throws:
MigrationException
-
Migrator
public Migrator(History history, IClassLoader classLoader)
Constructor.
-
-
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 ofURI
.- Parameters:
modelURIs
-sourceRelease
- Release to which the model conformstargetRelease
- 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 ofURI
.- Parameters:
modelURIs
-sourceRelease
- Release to which the model conformstargetRelease
- Release to which the model should be migrated (use null for the newest release)monitor
- Progress monitoroptions
- 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 ofURI
s and load it afterwards.- Parameters:
modelURIs
- The set ofURI
sourceRelease
- Release to which the model conformstargetRelease
- 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 onURI
.
-
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.
-
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 createResourceSet
s for custom serialization.
-
getResourceSetFactory
public IResourceSetFactory getResourceSetFactory()
Get the factory to createResourceSet
s 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
-
-