org.eclipse.emf.edapt.history.reconstruction.EcoreForwardReconstructor$EcoreReconstructorSwitch 124 [message #1716428] |
Thu, 03 December 2015 16:40 |
Garcia de Mirasierra Perez Messages: 15 Registered: August 2015 |
Junior Member |
|
|
Hello,
I am doing Eclipse Rich Client. I have define *-product.
I have a problem with Edapt. When I execute as Launch an Eckipse application my code is Ok.
But if I do a export eclipse Producto I have de next problem
org.eclipse.emf.edapt.history.reconstruction.EcoreForwardReconstructor$EcoreReconstructorSwitch line 124
My code is:
package es.giss.diccionarios.edapt;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.edapt.declaration.BaseLibrary;
import org.eclipse.emf.edapt.declaration.Library;
import org.eclipse.emf.edapt.declaration.LibraryExtractor;
import org.eclipse.emf.edapt.declaration.OperationRegistry;
import org.eclipse.emf.edapt.history.History;
import org.eclipse.emf.edapt.history.HistoryPackage;
import org.eclipse.emf.edapt.history.Release;
import org.eclipse.emf.edapt.migration.Metamodel;
import org.eclipse.emf.edapt.migration.MigrationException;
import org.eclipse.emf.edapt.migration.PrintStreamProgressMonitor;
import org.eclipse.emf.edapt.migration.execution.ClassLoaderFacade;
import org.eclipse.emf.edapt.migration.execution.Migrator;
import org.eclipse.emf.edapt.migration.execution.ValidationLevel;
public class PruenaJuanjo {
static ResourceSet resourceSetFactory = new ResourceSetImpl();
public static void main(String[] args) throws IOException {
// Registrar todas las extensiones
Registry.INSTANCE.getExtensionToFactoryMap().put("*",
new XMIResourceFactoryImpl());
// Registrar extension concreta
// Registry.INSTANCE.getExtensionToFactoryMap().put("history",
// new XMIResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
// como leer el fichero xmi
resourceSet.getPackageRegistry().put(HistoryPackage.eNS_URI,
HistoryPackage.eINSTANCE);
Resource resourceHistory = resourceSet.getResource(
URI.createFileURI("E:/PruebaEdapt/EjemploJuanjo/Pais.history"),
true);
History history = (History) resourceHistory.getContents().get(0);
// System.out.println(history);
final Migrator migrator = new Migrator(history, new ClassLoaderFacade(
Thread.currentThread().getContextClassLoader()));
java.util.Set<String> uris = migrator.getNsURIs();
List<String> uriList = new ArrayList<String>();
uriList.addAll(uris);
migrator.setLevel(ValidationLevel.CHANGE);
for (Release release : history.getReleases()) {
if (release.getDate() != null) {
Metamodel metamodel = migrator.getMetamodel(release);
String URIecore = metamodel.getEPackages().get(0).getNsURI();
EPackage ePackage = metamodel.getEPackages().get(0);
// Linea superimportante: donde se rgistra
resourceSet.getPackageRegistry().put(URIecore, ePackage);
System.out.println("URI:" + URIecore);
System.out.println("Package:" + ePackage);
}
}
Resource oldInstance = null;
// InputStream inputStream = new FileInputStream(
// "E:/PruebaEdapt/EjemploJuanjo/My.pais");
try {
oldInstance = resourceSet.getResource(
URI.createFileURI("E:/PruebaEdapt/EjemploJuanjo/My.pais"),
true);
} catch (Exception e) {
e.printStackTrace();
}
List<URI> olsInstanceURIs = new ArrayList();
olsInstanceURIs.add(oldInstance.getURI());
//
LibraryExtractor libex = new LibraryExtractor();
Library lib = libex.extractLibrary(BaseLibrary.class);
OperationRegistry.getInstance()
.registerLibrary(lib.getImplementation());
int releaseVersion = history.getReleases().size();
//
try {
migrator.migrateAndSave(olsInstanceURIs, history.getFirstRelease(),
history.getReleases().get(releaseVersion - 2),
new PrintStreamProgressMonitor(System.out));
} catch (MigrationException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
|
|
Re: org.eclipse.emf.edapt.history.reconstruction.EcoreForwardReconstructor$EcoreReconstructorSwitch [message #1716464 is a reply to message #1716428] |
Fri, 04 December 2015 07:48 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
what does "problem" exactly mean? Have you made sure your product
contains all bundles, which are in your run config? Have you made sure
all non-code artefacts are included in the build?
Best regards
Jonas
Am 03.12.2015 um 17:40 schrieb Garcia de Mirasierra Perez:
> Hello,
>
> I am doing Eclipse Rich Client. I have define *-product.
>
> I have a problem with Edapt. When I execute as Launch an Eckipse
> application my code is Ok.
>
> But if I do a export eclipse Producto I have de next problem
> org.eclipse.emf.edapt.history.reconstruction.EcoreForwardReconstructor$EcoreReconstructorSwitch
> line 124
>
> My code is:
>
> package es.giss.diccionarios.edapt;
>
> import java.io.IOException;
> import java.util.ArrayList;
> import java.util.List;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> import org.eclipse.emf.edapt.declaration.BaseLibrary;
> import org.eclipse.emf.edapt.declaration.Library;
> import org.eclipse.emf.edapt.declaration.LibraryExtractor;
> import org.eclipse.emf.edapt.declaration.OperationRegistry;
> import org.eclipse.emf.edapt.history.History;
> import org.eclipse.emf.edapt.history.HistoryPackage;
> import org.eclipse.emf.edapt.history.Release;
> import org.eclipse.emf.edapt.migration.Metamodel;
> import org.eclipse.emf.edapt.migration.MigrationException;
> import org.eclipse.emf.edapt.migration.PrintStreamProgressMonitor;
> import org.eclipse.emf.edapt.migration.execution.ClassLoaderFacade;
> import org.eclipse.emf.edapt.migration.execution.Migrator;
> import org.eclipse.emf.edapt.migration.execution.ValidationLevel;
>
> public class PruenaJuanjo {
> static ResourceSet resourceSetFactory = new ResourceSetImpl();
>
> public static void main(String[] args) throws IOException {
>
> // Registrar todas las extensiones
> Registry.INSTANCE.getExtensionToFactoryMap().put("*",
> new XMIResourceFactoryImpl());
>
> // Registrar extension concreta
> // Registry.INSTANCE.getExtensionToFactoryMap().put("history",
> // new XMIResourceFactoryImpl());
>
> ResourceSet resourceSet = new ResourceSetImpl();
> // como leer el fichero xmi
> resourceSet.getPackageRegistry().put(HistoryPackage.eNS_URI,
> HistoryPackage.eINSTANCE);
>
> Resource resourceHistory = resourceSet.getResource(
>
> URI.createFileURI("E:/PruebaEdapt/EjemploJuanjo/Pais.history"),
> true);
>
> History history = (History) resourceHistory.getContents().get(0);
> // System.out.println(history);
> final Migrator migrator = new Migrator(history, new
> ClassLoaderFacade(
> Thread.currentThread().getContextClassLoader()));
> java.util.Set<String> uris = migrator.getNsURIs();
>
> List<String> uriList = new ArrayList<String>();
> uriList.addAll(uris);
>
> migrator.setLevel(ValidationLevel.CHANGE);
> for (Release release : history.getReleases()) {
> if (release.getDate() != null) {
> Metamodel metamodel = migrator.getMetamodel(release);
> String URIecore =
> metamodel.getEPackages().get(0).getNsURI();
> EPackage ePackage = metamodel.getEPackages().get(0);
> // Linea superimportante: donde se rgistra
> resourceSet.getPackageRegistry().put(URIecore, ePackage);
> System.out.println("URI:" + URIecore);
> System.out.println("Package:" + ePackage);
> }
> }
>
> Resource oldInstance = null;
> // InputStream inputStream = new FileInputStream(
> // "E:/PruebaEdapt/EjemploJuanjo/My.pais");
> try {
> oldInstance = resourceSet.getResource(
>
> URI.createFileURI("E:/PruebaEdapt/EjemploJuanjo/My.pais"),
> true);
> } catch (Exception e) {
> e.printStackTrace();
> }
> List<URI> olsInstanceURIs = new ArrayList();
> olsInstanceURIs.add(oldInstance.getURI());
> //
> LibraryExtractor libex = new LibraryExtractor();
> Library lib = libex.extractLibrary(BaseLibrary.class);
>
> OperationRegistry.getInstance()
> .registerLibrary(lib.getImplementation());
> int releaseVersion = history.getReleases().size();
> //
> try {
> migrator.migrateAndSave(olsInstanceURIs,
> history.getFirstRelease(),
> history.getReleases().get(releaseVersion - 2),
> new PrintStreamProgressMonitor(System.out));
> } catch (MigrationException e) {
> e.printStackTrace();
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> }
> }
>
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Powered by
FUDForum. Page generated in 0.03646 seconds