Commit 06a7e2c3 authored by Erwan Bousse's avatar Erwan Bousse
Browse files

Versionning everything

parent cf54973e
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="lapin" nsURI="http://lapin" nsPrefix="lapin">
<eClassifiers xsi:type="ecore:EClass" name="Class0">
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass1_1" eType="#//Class1"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass4_4" eType="#//Class4"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class1">
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass2_2" eType="#//Class2"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class2">
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass3_3" eType="#//Class3"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEInt_5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEBoolean_8" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEInt_9_m" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEBoolean_12_m" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class3">
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass0_7" eType="#//Class0"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="refClass0_11_m" eType="#//Class0"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class4">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEInt_6" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attEInt_10_m" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
</ecore:EPackage>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.externalJavaSearch"/>
<classpathentry kind="output" path=""/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>External Plug-in Libraries</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#
#Mon Mar 03 19:11:35 CET 2014
searchablePlugins=org.eclipse.emf.importer,org.eclipse.emf.importer.ecore,org.eclipse.pde.ui
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SomeManipulations</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: SomeManipulations;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi;bundle-version="2.9.1",
org.eclipse.emf.common,
FancyEMFCloning;bundle-version="0.1.0",
SomeMetamodel;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
#
bin.includes = .,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="file/tmp/deepClone/submodel2.xmi#/0"/>
<x href="file/tmp/deepClone/submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="file/tmp/mutableClassesOnlyClone/submodel2.xmi#/0"/>
<x href="file/tmp/submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="file/tmp/submodel2.xmi#/0"/>
<x href="file/tmp/submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="submodel2.xmi#/0"/>
<x href="submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="submodel2.xmi#/0"/>
<x href="submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="submodel2.xmi#/0"/>
<x href="submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="submodel2.xmi#/0"/>
<x href="submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel">
<somemetamodel:A>
<c href="submodel2.xmi#/0"/>
<x href="submodel2.xmi#/1"/>
</somemetamodel:A>
<somemetamodel:B/>
</xmi:XMI>
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:somemetamodel="http://somemetamodel" xmlns:somemetamodelextension="http://somemetamodelextension/1.0">
<somemetamodel:C/>
<somemetamodelextension:X/>
</xmi:XMI>
#
pluginName = SomeMetamodel Model
providerName = www.example.org
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
-->
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated SomeMetamodel -->
<package
uri="http://somemetamodel"
class="somemetamodel.SomemetamodelPackage"/>
</extension>
</plugin>
package main;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import somemetamodel.A;
import somemetamodel.B;
import somemetamodel.C;
import somemetamodel.SomemetamodelFactory;
public class MainShowNoShare {
public static void main(String[] args) {
// Creating some objects from our metamodel
SomemetamodelFactory factory = SomemetamodelFactory.eINSTANCE;
A a1 = factory.createA();
B b1 = factory.createB();
A a2 = factory.createA();
B b2 = factory.createB();
C cShared = factory.createC();
// Preparing serialization
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
// Creating the resources (= models) set
ResourceSet resSet = new ResourceSetImpl();
// Creating a first model in the set
Resource model1 = resSet.createResource(URI.createURI("models/model1.xmi"));
model1.getContents().add(a1);
model1.getContents().add(b1);
model1.getContents().add(cShared);
// Creating a second model in the set
Resource model2 = resSet.createResource(URI.createURI("models/model2.xmi"));
model2.getContents().add(a2);
model2.getContents().add(b2);
model2.getContents().add(cShared); //TODO /!\ here C is removed from model1 and added to model2
// model2 = clone(model1)
// Saving the models into files
try {
model1.save(Collections.EMPTY_MAP);
model2.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package main;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import somemetamodel.A;
import somemetamodel.B;
import somemetamodel.C;
import somemetamodel.SomemetamodelFactory;
public class MainTestChangeResource {
public static void main(String[] args) {
// Creating some objects from our metamodel
SomemetamodelFactory factory = SomemetamodelFactory.eINSTANCE;
A a = factory.createA();
B b1 = factory.createB();
B b2 = factory.createB();
C c = factory.createC();
// Preparing serialization
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
// Creating the resource sets (= models)
ResourceSet model1 = new ResourceSetImpl();
ResourceSet model2 = new ResourceSetImpl();
// Creating the first model
Resource submodel1 = model1.createResource(URI.createURI("models/submodel1.xmi"));
submodel1.getContents().add(a);
submodel1.getContents().add(b1);
// Creating the second model
Resource submodel2 = model2.createResource(URI.createURI("models/submodel2.xmi"));
submodel2.getContents().add(b2);
submodel2.getContents().add(c);
a.setB(b1);
a.setB(b2);
a.setC(c);
}
}
package main;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import someMMMutClassOnly.SomeMMMutClassOnlyTags;
import somemetamodel.A;
import somemetamodel.B;
import somemetamodel.C;
import somemetamodel.SomemetamodelFactory;
import somemetamodelextension.SomemetamodelextensionFactory;
import somemetamodelextension.X;
import util.HeapDump;
import fancyemfcloning.cloner.Cloner;
import fancyemfcloning.cloner.impl.ClonerImpl;
import fancyemfcloning.emfextension.LooseCopier;
public class MainTestCloning {
public static void main(String[] args) {
// Preparing factories
SomemetamodelFactory factory = SomemetamodelFactory.eINSTANCE;
SomemetamodelextensionFactory factory2 = SomemetamodelextensionFactory.eINSTANCE;
// Creating some objects from our metamodel
A a = factory.createA();
B b = factory.createB();
C c = factory.createC();
X x = factory2.createX();
a.setC(c);
a.setX(x);
// Preparing serialization
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
// Creating the model
ResourceSet model = new ResourceSetImpl();
model.setPackageRegistry(new EPackageRegistryImpl());
// Creating submodels
Resource submodel1 = model.createResource(URI.createURI("file://home/ebousse/Dev/modelCloning/emf/SomeManipulations/models/submodel1.xmi"));
submodel1.getContents().add(a);
submodel1.getContents().add(b);
Resource submodel2 = model.createResource(URI.createURI("file://home/ebousse/Dev/modelCloning/emf/SomeManipulations/models/submodel2.xmi"));
submodel2.getContents().add(c);
submodel2.getContents().add(x);
// Deep cloning the model
/*
Cloner dc = new ClonerImpl(new SomeMMDeepTags(), new LooseCopier());
ResourceSet deepClone = dc.clone(model, "deepClone");
Cloner lightdc = new ClonerImpl(new SomeMMDeepTags(), new SomeMMDeepLightCopier());
ResourceSet lightDeepClone = lightdc.clone(model, "lightDeepClone");
*/
Cloner mc = new ClonerImpl(new SomeMMMutClassOnlyTags(), new LooseCopier());
@SuppressWarnings("unused")
ResourceSet mcClone = mc.clone(model, "mutableOnlyClone");
/*
Cloner lightmc = new ClonerImpl(new SomeMMMutClassOnlyTags(), new SomeMMMutClassOnlyLightCopier());
ResourceSet lightmcClone = lightmc.clone(model, "lightMutableOnlyClone");
try {
Thread.sleep(60000);
} catch (InterruptedException e1) {
// TODO Bloc catch généré automatiquement
e1.printStackTrace();
}*/
File outputDump = new File("/tmp/yay.bin");
if (outputDump.exists())
outputDump.delete();
HeapDump.dumpHeap(outputDump.getAbsolutePath(), true);
// MutClassesOnly cloning the model
//ResourceSet mutableClassesOnlyClone = new MutClassesOnlyCloner().clone(model, "mutableClassesOnlyClone");
/*
// WeakMutClassesOnly cloning the model
Set<Resource> metamodel = new HashSet<Resource>();
for (Object o : EPackage.Registry.INSTANCE.values()) {
EPackage p = (EPackage) o;
if (p.getNsURI() != "http://www.eclipse.org/emf/2002/Ecore")
metamodel.add(p.eResource());
}
//ResourceSet weakMutableClassesOnlyClone = new WeakMutClassesOnlyCloner(metamodel).clone(model, "mutableClassesOnlyClone");
*/
// Saving the models into files
try {
//mutableClassesOnlyClone.getResources().get(0).save(Collections.EMPTY_MAP);
//mutableClassesOnlyClone.getResources().get(1).save(Collections.EMPTY_MAP);
submodel1.save(Collections.EMPTY_MAP);
submodel2.save(Collections.EMPTY_MAP);
/*deepClone.getResources().get(0).save(Collections.EMPTY_MAP);
deepClone.getResources().get(1).save(Collections.EMPTY_MAP);
lightDeepClone.getResources().get(0).save(Collections.EMPTY_MAP);
lightDeepClone.getResources().get(1).save(Collections.EMPTY_MAP);
mcClone.getResources().get(0).save(Collections.EMPTY_MAP);
mcClone.getResources().get(1).save(Collections.EMPTY_MAP);
lightmcClone.getResources().get(0).save(Collections.EMPTY_MAP);
lightmcClone.getResources().get(1).save(Collections.EMPTY_MAP);*/
} catch (IOException e) {
// TODO Auto-generated catch block
System.err.println("An error occured during the saving:");
e.printStackTrace();
}
}
}
package main;
import somemetamodel.A;
import somemetamodel.B;
import somemetamodel.SomemetamodelFactory;
public class MainTestCompositions {
public static void main(String[] args) {
// Creating some objects from our metamodel
SomemetamodelFactory factory = SomemetamodelFactory.eINSTANCE;
A a1 = factory.createA();
A a2 = factory.createA();
B b = factory.createB();
a1.setB(b);
a2.setB(b);
System.out.println(a1);
}
}