Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] another problems: my datas are modified by Teneo
[Teneo] another problems: my datas are modified by Teneo [message #89396] Thu, 12 July 2007 15:11 Go to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------050800070506060004000300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi again,

I'm sorry to have another question but I have a second problem with Teneo.

I use Teneo to store EPackage contained in .ecore files.
My problem is that when I want to get an EPackage from Teneo, this
package has been modified.
When I export it into another .ecore file I see that the "eType" and the
"instanceClassName" attributes of the "eClassifiers" elements have been
deleted...

Can you explain me why and how to avoid it ?

Thanks for your help,

Guillaume


PS : I joined my in ecore file (deb.ecore), my out ecore file
(resulting_deb.ecore) and the class which make them (addget.java).

--------------050800070506060004000300
Content-Type: text/xml;
name="deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" eType="#/1/Databin" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" eType="#/1/Bloc" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eType="#/1/Databin" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" eType="#/1/Field" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_name" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" eType="#/1/Script" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" eType="#/1/File" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------050800070506060004000300
Content-Type: text/xml;
name="resulting_deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resulting_deb.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
</ecore:EPackage>
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" containment="true" eOpposite="#/3/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" containment="true" eOpposite="#/3/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" containment="true" eOpposite="#/3/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eOpposite="#/3/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" containment="true" eOpposite="#/3/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eOpposite="#/3/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" containment="true" eOpposite="#/3/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eOpposite="#/3/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="#/3/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="#/3/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="#/3/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="#/3/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="#/3/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eOpposite="#/3/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" containment="true" eOpposite="#/3/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eOpposite="#/3/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eOpposite="#/3/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" containment="true" eOpposite="#/3/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eOpposite="#/3/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
</ecore:EPackage>
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" containment="true" eOpposite="#/5/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" containment="true" eOpposite="#/5/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" containment="true" eOpposite="#/5/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eOpposite="#/5/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" containment="true" eOpposite="#/5/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eOpposite="#/5/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" containment="true" eOpposite="#/5/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eOpposite="#/5/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="#/5/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="#/5/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="#/5/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="#/5/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="#/5/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eOpposite="#/5/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" containment="true" eOpposite="#/5/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eOpposite="#/5/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eOpposite="#/5/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" containment="true" eOpposite="#/5/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eOpposite="#/5/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------050800070506060004000300
Content-Type: text/x-java;
name="addget.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="addget.java"

package test;

import java.io.IOException;
import java.util.Collections;
import java.util.Properties;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
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.EcoreResourceFactoryImpl;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;
import org.hibernate.event.InitializeCollectionEventListener;

public class addget {


// work folder
public static String loc = "/home/doux/temp/";

// work resourceSet
private static ResourceSet resTeneo;
private static ResourceSet resourceSet;

// name of the database
private static String dbname = "test";

// the datastore
private static HbDataStore hbds;

// the name of the datastore
private static String hbName = "MySF";

public static void main(String[] args){
resTeneo = new ResourceSetImpl();
resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
new EcoreResourceFactoryImpl());
resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
new EcoreResourceFactoryImpl());
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, "doux");
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, "provisoiredoux");
props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE_LITERAL.getName());
// create the HbDataStore
hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
// set the relational database to use and other properties
hbds.setHibernateProperties(props);
EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
// configure EPackage used in this datastore
hbds.setEPackages(tpack);

hbds.initialize();

final EMFInitializeCollectionEventListener eventListener = new EMFInitializeCollectionEventListener();
((HbSessionDataStore)hbds).getConfiguration().getEventListen ers().setInitializeCollectionEventListeners
(new InitializeCollectionEventListener[] { eventListener });

try {
//loading a meta-model from an ecore file
String uri = loc+"deb.ecore";
Resource res = resourceSet.createResource(URI.createFileURI(uri));
res.load(null);

//making it persistent with Teneo
String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName;
Resource resourceT = resTeneo.createResource(URI.createURI(uristr));
resourceT.getContents().addAll(res.getContents());
resourceT.save(null);

//retrieve this package from Teneo
String uristr2 = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
Resource resout = resTeneo.createResource(URI.createURI(uristr));
resout.load(null);

//Serialization of this resource into an ecore file
String uri_res = loc+"resulting_deb.ecore";
Resource result = resourceSet.createResource(URI.createFileURI(uri_res));
result.getContents().addAll(resout.getContents());
result.save(null);


} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

--------------050800070506060004000300--
Re: [Teneo] another problems: my datas are modified by Teneo [message #89412 is a reply to message #89396] Thu, 12 July 2007 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------010809090604000405000103
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Sorry I have post a bad output file...

This is the good one...

Guillaume


doux guillaume wrote:
> Hi again,
>
> I'm sorry to have another question but I have a second problem with Teneo.
>
> I use Teneo to store EPackage contained in .ecore files.
> My problem is that when I want to get an EPackage from Teneo, this
> package has been modified.
> When I export it into another .ecore file I see that the "eType" and the
> "instanceClassName" attributes of the "eClassifiers" elements have been
> deleted...
>
> Can you explain me why and how to avoid it ?
>
> Thanks for your help,
>
> Guillaume
>
>
> PS : I joined my in ecore file (deb.ecore), my out ecore file
> (resulting_deb.ecore) and the class which make them (addget.java).
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI 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">
> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
> <eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
> <eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
> <eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
> </ecore:EPackage>
> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
> <eClassifiers xsi:type="ecore:EClass" name="Deb">
> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
> lowerBound="1" eType="#/1/Databin" containment="true" eOpposite="#/1/Databin/debpm"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
> lowerBound="1" eType="#/1/Archcontrol" containment="true" eOpposite="#/1/Archcontrol/debc"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eType="#/1/Archdata" containment="true" eOpposite="#/1/Archdata/debd"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Databin">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> upperBound="-1" eType="#/1/Bloc" containment="true" eOpposite="#/1/Bloc/meta"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
> <eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
> lowerBound="1" eType="#/1/Databin" eOpposite="#/1/Databin/blocs"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
> upperBound="-1" eType="#/1/Field" containment="true" eOpposite="#/1/Field/blocs"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Version" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="package_name" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
> upperBound="-1" eType="#/1/Script" containment="true" eOpposite="#/1/Script/archscript"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script">
> <eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
> lowerBound="1" eType="#/1/Archcontrol" eOpposite="#/1/Archcontrol/scripts"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
> upperBound="-1" eType="#/1/File" containment="true" eOpposite="#/1/File/data"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="File">
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eType="#/1/Archdata" eOpposite="#/1/Archdata/fil"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> </ecore:EPackage>
> </xmi:XMI>
>
>
> ------------------------------------------------------------ ------------
>
> package test;
>
> import java.io.IOException;
> import java.util.Collections;
> import java.util.Properties;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EcorePackage;
> 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.EcoreResourceFactoryImpl;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
> import org.hibernate.Query;
> import org.hibernate.Session;
> import org.hibernate.SessionFactory;
> import org.hibernate.Transaction;
> import org.hibernate.cfg.Environment;
> import org.hibernate.event.InitializeCollectionEventListener;
>
> public class addget {
>
>
> // work folder
> public static String loc = "/home/doux/temp/";
>
> // work resourceSet
> private static ResourceSet resTeneo;
> private static ResourceSet resourceSet;
>
> // name of the database
> private static String dbname = "test";
>
> // the datastore
> private static HbDataStore hbds;
>
> // the name of the datastore
> private static String hbName = "MySF";
>
> public static void main(String[] args){
> resTeneo = new ResourceSetImpl();
> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
> new EcoreResourceFactoryImpl());
> resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
> new EcoreResourceFactoryImpl());
> final Properties props = new Properties();
> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
> props.setProperty(Environment.USER, "doux");
> props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
> props.setProperty(Environment.PASS, "provisoiredoux");
> props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE_LITERAL.getName());
> // create the HbDataStore
> hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
> // set the relational database to use and other properties
> hbds.setHibernateProperties(props);
> EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
> // configure EPackage used in this datastore
> hbds.setEPackages(tpack);
>
> hbds.initialize();
>
> final EMFInitializeCollectionEventListener eventListener = new EMFInitializeCollectionEventListener();
> ((HbSessionDataStore)hbds).getConfiguration().getEventListen ers().setInitializeCollectionEventListeners
> (new InitializeCollectionEventListener[] { eventListener });
>
> try {
> //loading a meta-model from an ecore file
> String uri = loc+"deb.ecore";
> Resource res = resourceSet.createResource(URI.createFileURI(uri));
> res.load(null);
>
> //making it persistent with Teneo
> String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName;
> Resource resourceT = resTeneo.createResource(URI.createURI(uristr));
> resourceT.getContents().addAll(res.getContents());
> resourceT.save(null);
>
> //retrieve this package from Teneo
> String uristr2 = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
> Resource resout = resTeneo.createResource(URI.createURI(uristr));
> resout.load(null);
>
> //Serialization of this resource into an ecore file
> String uri_res = loc+"resulting_deb.ecore";
> Resource result = resourceSet.createResource(URI.createFileURI(uri_res));
> result.getContents().addAll(resout.getContents());
> result.save(null);
>
>
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> }


--------------010809090604000405000103
Content-Type: text/xml;
name="resulting_deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resulting_deb.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------010809090604000405000103--
Re: [Teneo] another problems: my datas are modified by Teneo [message #89429 is a reply to message #89412] Thu, 12 July 2007 15:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
It is probably this:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html

This is solved in cvs.

See the first post in this thread (see hyperlink) for a workaround.

gr. martin

doux guillaume wrote:
> Sorry I have post a bad output file...
>
> This is the good one...
>
> Guillaume
>
>
> doux guillaume wrote:
>> Hi again,
>>
>> I'm sorry to have another question but I have a second problem with
>> Teneo.
>>
>> I use Teneo to store EPackage contained in .ecore files.
>> My problem is that when I want to get an EPackage from Teneo, this
>> package has been modified.
>> When I export it into another .ecore file I see that the "eType" and
>> the "instanceClassName" attributes of the "eClassifiers" elements have
>> been deleted...
>>
>> Can you explain me why and how to avoid it ?
>>
>> Thanks for your help,
>>
>> Guillaume
>>
>>
>> PS : I joined my in ecore file (deb.ecore), my out ecore file
>> (resulting_deb.ecore) and the class which make them (addget.java).
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xmi:XMI 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">
>> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type"
>> nsPrefix="ptyp">
>> <eClassifiers xsi:type="ecore:EDataType" name="Boolean"
>> instanceClassName="boolean"/>
>> <eClassifiers xsi:type="ecore:EDataType" name="Integer"
>> instanceClassName="int"/>
>> <eClassifiers xsi:type="ecore:EDataType" name="String"
>> instanceClassName="java.lang.String"/>
>> </ecore:EPackage>
>> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package"
>> nsPrefix="deb">
>> <eClassifiers xsi:type="ecore:EClass" name="Deb">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata"
>> ordered="false"
>> lowerBound="1" eType="#/1/Databin" containment="true"
>> eOpposite="#/1/Databin/debpm"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="control"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archcontrol" containment="true"
>> eOpposite="#/1/Archcontrol/debc"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="data"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archdata" containment="true"
>> eOpposite="#/1/Archdata/debd"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Databin">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs"
>> ordered="false"
>> upperBound="-1" eType="#/1/Bloc" containment="true"
>> eOpposite="#/1/Bloc/meta"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="meta"
>> ordered="false"
>> lowerBound="1" eType="#/1/Databin"
>> eOpposite="#/1/Databin/blocs"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="field"
>> ordered="false"
>> upperBound="-1" eType="#/1/Field" containment="true"
>> eOpposite="#/1/Field/blocs"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs"
>> ordered="false"
>> lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="package_name"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debc"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts"
>> ordered="false"
>> upperBound="-1" eType="#/1/Script" containment="true"
>> eOpposite="#/1/Script/archscript"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Script">
>> <eStructuralFeatures xsi:type="ecore:EReference"
>> name="archscript" ordered="false"
>> lowerBound="1" eType="#/1/Archcontrol"
>> eOpposite="#/1/Archcontrol/scripts"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute"
>> name="script_name" ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debd"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="fil"
>> ordered="false"
>> upperBound="-1" eType="#/1/File" containment="true"
>> eOpposite="#/1/File/data"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="File">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="data"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archdata"
>> eOpposite="#/1/Archdata/fil"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> </ecore:EPackage>
>> </xmi:XMI>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package test;
>>
>> import java.io.IOException;
>> import java.util.Collections;
>> import java.util.Properties;
>>
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EPackage;
>> import org.eclipse.emf.ecore.EcorePackage;
>> 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.EcoreResourceFactoryImpl;
>> import org.eclipse.emf.teneo.PersistenceOptions;
>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>> import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>> import org.hibernate.Query;
>> import org.hibernate.Session;
>> import org.hibernate.SessionFactory;
>> import org.hibernate.Transaction;
>> import org.hibernate.cfg.Environment;
>> import org.hibernate.event.InitializeCollectionEventListener;
>>
>> public class addget {
>>
>>
>> // work folder
>> public static String loc = "/home/doux/temp/";
>>
>> // work resourceSet private static ResourceSet resTeneo;
>> private static ResourceSet resourceSet;
>>
>> // name of the database
>> private static String dbname = "test";
>>
>> // the datastore
>> private static HbDataStore hbds;
>>
>> // the name of the datastore
>> private static String hbName = "MySF";
>>
>> public static void main(String[] args){
>> resTeneo = new ResourceSetImpl();
>>
>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> resourceSet = new ResourceSetImpl();
>>
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> final Properties props = new Properties();
>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>> props.setProperty(Environment.USER, "doux");
>> props.setProperty(Environment.URL,
>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>> props.setProperty(Environment.PASS, "provisoiredoux");
>> props.setProperty(Environment.DIALECT,
>> org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>> // create the HbDataStore
>> hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
>> // set the relational database to use and other properties
>> hbds.setHibernateProperties(props);
>> EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
>> // configure EPackage used in this datastore
>> hbds.setEPackages(tpack);
>>
>> hbds.initialize();
>>
>> final EMFInitializeCollectionEventListener eventListener = new
>> EMFInitializeCollectionEventListener();
>>
>> ((HbSessionDataStore)hbds).getConfiguration().getEventListen ers().setInitializeCollectionEventListeners
>>
>> (new InitializeCollectionEventListener[] {
>> eventListener });
>>
>> try {
>> //loading a meta-model from an ecore file
>> String uri = loc+"deb.ecore";
>> Resource res =
>> resourceSet.createResource(URI.createFileURI(uri));
>> res.load(null);
>>
>> //making it persistent with Teneo
>> String uristr = "hibernate://?" +
>> HibernateResource.DS_NAME_PARAM + "=" + hbName;
>> Resource resourceT =
>> resTeneo.createResource(URI.createURI(uristr));
>> resourceT.getContents().addAll(res.getContents());
>> resourceT.save(null);
>> //retrieve this package from Teneo
>> String uristr2 = "hibernate://?" +
>> HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
>> Resource resout =
>> resTeneo.createResource(URI.createURI(uristr));
>> resout.load(null);
>> //Serialization of this resource into an ecore file
>> String uri_res = loc+"resulting_deb.ecore";
>> Resource result =
>> resourceSet.createResource(URI.createFileURI(uri_res));
>> result.getContents().addAll(resout.getContents());
>> result.save(null);
>> } catch (IOException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> }
>>
>> }
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI 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">
> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
> <eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
> <eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
> <eClassifiers xsi:type="ecore:EDataType" name="String"/>
> </ecore:EPackage>
> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
> <eClassifiers xsi:type="ecore:EClass" name="Deb">
> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Databin/debpm"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Archcontrol/debc"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Archdata/debd"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Databin">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/metadata"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Bloc/meta"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
> <eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
> lowerBound="1" eOpposite="#/1/Databin/blocs"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Field/blocs"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> lowerBound="1" eOpposite="#/1/Bloc/field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Version">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_name">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/control"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Script/archscript"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script">
> <eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
> lowerBound="1" eOpposite="#/1/Archcontrol/scripts"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/data"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/File/data"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="File">
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eOpposite="#/1/Archdata/fil"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> </ecore:EPackage>
> </xmi:XMI>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #89444 is a reply to message #89429] Thu, 12 July 2007 15:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

Yes, it was this, and now I have find a solution with your link.


Thanks a lot !


Guillaume


Martin Taal wrote:
> It is probably this:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>
> This is solved in cvs.
>
> See the first post in this thread (see hyperlink) for a workaround.
>
> gr. martin
>
> doux guillaume wrote:
>> Sorry I have post a bad output file...
>>
>> This is the good one...
>>
>> Guillaume
>>
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> I'm sorry to have another question but I have a second problem with
>>> Teneo.
>>>
>>> I use Teneo to store EPackage contained in .ecore files.
>>> My problem is that when I want to get an EPackage from Teneo, this
>>> package has been modified.
>>> When I export it into another .ecore file I see that the "eType" and
>>> the "instanceClassName" attributes of the "eClassifiers" elements
>>> have been deleted...
>>>
>>> Can you explain me why and how to avoid it ?
>>>
>>> Thanks for your help,
>>>
>>> Guillaume
>>>
>>>
Re: [Teneo] another problems: my datas are modified by Teneo [message #89863 is a reply to message #89444] Mon, 16 July 2007 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have updated my Teneo plugin this morning with the new version 0.8 and
I have a new problem, my package are modified again.
If I serialize them to ecore files, I see that they differs from the
originals.
The eSuperType attribute from my eClassifiers elements are replaced by
an <eGenericSuperTypes eClassifier="eClassifier="#/1/mysupertype"/> element.

What can I do to solve this ?

Thanks.

doux guillaume.



doux guillaume wrote:
> Hi,
>
> Yes, it was this, and now I have find a solution with your link.
>
>
> Thanks a lot !
>
>
> Guillaume
>
>
> Martin Taal wrote:
>> It is probably this:
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>
>>
>> This is solved in cvs.
>>
>> See the first post in this thread (see hyperlink) for a workaround.
>>
>> gr. martin
>>
>> doux guillaume wrote:
>>> Sorry I have post a bad output file...
>>>
>>> This is the good one...
>>>
>>> Guillaume
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi again,
>>>>
>>>> I'm sorry to have another question but I have a second problem with
>>>> Teneo.
>>>>
>>>> I use Teneo to store EPackage contained in .ecore files.
>>>> My problem is that when I want to get an EPackage from Teneo, this
>>>> package has been modified.
>>>> When I export it into another .ecore file I see that the "eType" and
>>>> the "instanceClassName" attributes of the "eClassifiers" elements
>>>> have been deleted...
>>>>
>>>> Can you explain me why and how to avoid it ?
>>>>
>>>> Thanks for your help,
>>>>
>>>> Guillaume
>>>>
>>>>
Re: [Teneo] another problems: my datas are modified by Teneo [message #89877 is a reply to message #89863] Mon, 16 July 2007 13:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ed,
Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3 ecore (with generic types)?

gr. Martin

doux guillaume wrote:
> Hi,
>
> I have updated my Teneo plugin this morning with the new version 0.8 and
> I have a new problem, my package are modified again.
> If I serialize them to ecore files, I see that they differs from the
> originals.
> The eSuperType attribute from my eClassifiers elements are replaced by
> an <eGenericSuperTypes eClassifier="eClassifier="#/1/mysupertype"/>
> element.
>
> What can I do to solve this ?
>
> Thanks.
>
> doux guillaume.
>
>
>
> doux guillaume wrote:
>> Hi,
>>
>> Yes, it was this, and now I have find a solution with your link.
>>
>>
>> Thanks a lot !
>>
>>
>> Guillaume
>>
>>
>> Martin Taal wrote:
>>> It is probably this:
>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>
>>>
>>> This is solved in cvs.
>>>
>>> See the first post in this thread (see hyperlink) for a workaround.
>>>
>>> gr. martin
>>>
>>> doux guillaume wrote:
>>>> Sorry I have post a bad output file...
>>>>
>>>> This is the good one...
>>>>
>>>> Guillaume
>>>>
>>>>
>>>> doux guillaume wrote:
>>>>> Hi again,
>>>>>
>>>>> I'm sorry to have another question but I have a second problem with
>>>>> Teneo.
>>>>>
>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>> My problem is that when I want to get an EPackage from Teneo, this
>>>>> package has been modified.
>>>>> When I export it into another .ecore file I see that the "eType"
>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>> elements have been deleted...
>>>>>
>>>>> Can you explain me why and how to avoid it ?
>>>>>
>>>>> Thanks for your help,
>>>>>
>>>>> Guillaume
>>>>>
>>>>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #89894 is a reply to message #89877] Mon, 16 July 2007 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010005040109000002070109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Martin,

If things are working properly, then as long as you don't do anything
specific that requires generics, the eSuperTypes reference would be
serialized the old way. More specifically, you'll only get
eGenericSuperTypes if the following returns true:

public boolean isSet()
{
for (EGenericType eGenericType : this)
{
if (eGenericType.getETypeParameter() != null ||
!eGenericType.getETypeArguments().isEmpty())
{
return true;
}
}
return false;
}

A super type being based on a type parameter is actually a constraint
violation, but the case that one of the super types has a type argument
is valid and in that case, we must serialize the generic types because
we'd lose the information about the type arguments if we serialized them
as just eSuperTypes.

The logic for whether to serialize instanceClassName verses
instanceTypeName is similarly gated by the use of type arguments in the
string (and of course ETypedElement.eType verses eGenericType is
similarly affected while EOperation.eExceptions verses
eGenericExceptions work just like EClass.eSuperTypes verses
eGenericSuperTypes).


Martin Taal wrote:
> Ed,
> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
> ecore (with generic types)?
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi,
>>
>> I have updated my Teneo plugin this morning with the new version 0.8
>> and I have a new problem, my package are modified again.
>> If I serialize them to ecore files, I see that they differs from the
>> originals.
>> The eSuperType attribute from my eClassifiers elements are replaced
>> by an <eGenericSuperTypes
>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>
>> What can I do to solve this ?
>>
>> Thanks.
>>
>> doux guillaume.
>>
>>
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> Yes, it was this, and now I have find a solution with your link.
>>>
>>>
>>> Thanks a lot !
>>>
>>>
>>> Guillaume
>>>
>>>
>>> Martin Taal wrote:
>>>> It is probably this:
>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>
>>>>
>>>> This is solved in cvs.
>>>>
>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>
>>>> gr. martin
>>>>
>>>> doux guillaume wrote:
>>>>> Sorry I have post a bad output file...
>>>>>
>>>>> This is the good one...
>>>>>
>>>>> Guillaume
>>>>>
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Hi again,
>>>>>>
>>>>>> I'm sorry to have another question but I have a second problem
>>>>>> with Teneo.
>>>>>>
>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>> this package has been modified.
>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>> elements have been deleted...
>>>>>>
>>>>>> Can you explain me why and how to avoid it ?
>>>>>>
>>>>>> Thanks for your help,
>>>>>>
>>>>>> Guillaume
>>>>>>
>>>>>>
>
>


--------------010005040109000002070109
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin,<br>
<br>
If things are working properly, then as long as you don't do anything
specific that requires generics, the eSuperTypes reference would be
serialized the old way.&nbsp; More specifically, you'll only get
eGenericSuperTypes if the following returns true:<br>
<br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public boolean isSet()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (EGenericType eGenericType : this)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (eGenericType.getETypeParameter() != null ||
!eGenericType.getETypeArguments().isEmpty())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<br>
A super type being based on a type parameter is actually a constraint
violation, but the case that one of the super types has a type argument
is valid and in that case, we must serialize the generic types because
we'd lose the information about the type arguments if we serialized
them as just eSuperTypes.<br>
<br>
The logic for whether to serialize instanceClassName verses
instanceTypeName is similarly gated by the use of type arguments in the
string (and of course ETypedElement.eType verses eGenericType is
similarly affected while EOperation.eExceptions verses
eGenericExceptions work just like EClass.eSuperTypes verses
eGenericSuperTypes).<br>
<br>
<br>
Martin Taal wrote:
<blockquote cite="mid:f7fs99$b1m$1@build.eclipse.org" type="cite">Ed,
<br>
Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
ecore (with generic types)?
<br>
<br>
gr. Martin
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
I have updated my Teneo plugin this morning with the new version 0.8
and I have a new problem, my package are modified again.
<br>
If I serialize them to ecore files, I see that they differs from the
originals.
<br>
The eSuperType attribute from my eClassifiers elements are replaced by
an &lt;eGenericSuperTypes
eClassifier="eClassifier="#/1/mysupertype"/&gt; element.
<br>
<br>
What can I do to solve this ?
<br>
<br>
Thanks.
<br>
<br>
doux guillaume.
<br>
<br>
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
Yes, it was this, and now I have find a solution with your link.
<br>
<br>
<br>
Thanks a lot !
<br>
<br>
<br>
Guillaume
<br>
<br>
<br>
Martin Taal wrote:
<br>
<blockquote type="cite">It is probably this:
<br>
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html"> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html</a>
<br>
<br>
This is solved in cvs.
<br>
<br>
See the first post in this thread (see hyperlink) for a workaround.
<br>
<br>
gr. martin
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Sorry I have post a bad output file...
<br>
<br>
This is the good one...
<br>
<br>
Guillaume
<br>
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi again,
<br>
<br>
I'm sorry to have another question but I have a second problem with
Teneo.
<br>
<br>
I use Teneo to store EPackage contained in .ecore files.
<br>
My problem is that when I want to get an EPackage from Teneo, this
package has been modified.
<br>
When I export it into another .ecore file I see that the "eType" and
the "instanceClassName" attributes of the "eClassifiers" elements have
been deleted...
<br>
<br>
Can you explain me why and how to avoid it ?
<br>
<br>
Thanks for your help,
<br>
<br>
Guillaume
<br>
<br>
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------010005040109000002070109--
Re: [Teneo] another problems: my datas are modified by Teneo [message #89922 is a reply to message #89894] Mon, 16 July 2007 20:49 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Guillaume,
I must say that (even after the description of Ed) I am in the dark why it happens and if it is even
a problem. Can you make a (small) testcase which illustrates the issue?

gr. Martin

Ed Merks wrote:
> Martin,
>
> If things are working properly, then as long as you don't do anything
> specific that requires generics, the eSuperTypes reference would be
> serialized the old way. More specifically, you'll only get
> eGenericSuperTypes if the following returns true:
>
> public boolean isSet()
> {
> for (EGenericType eGenericType : this)
> {
> if (eGenericType.getETypeParameter() != null ||
> !eGenericType.getETypeArguments().isEmpty())
> {
> return true;
> }
> }
> return false;
> }
>
> A super type being based on a type parameter is actually a constraint
> violation, but the case that one of the super types has a type argument
> is valid and in that case, we must serialize the generic types because
> we'd lose the information about the type arguments if we serialized them
> as just eSuperTypes.
>
> The logic for whether to serialize instanceClassName verses
> instanceTypeName is similarly gated by the use of type arguments in the
> string (and of course ETypedElement.eType verses eGenericType is
> similarly affected while EOperation.eExceptions verses
> eGenericExceptions work just like EClass.eSuperTypes verses
> eGenericSuperTypes).
>
>
> Martin Taal wrote:
>> Ed,
>> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
>> ecore (with generic types)?
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> I have updated my Teneo plugin this morning with the new version 0.8
>>> and I have a new problem, my package are modified again.
>>> If I serialize them to ecore files, I see that they differs from the
>>> originals.
>>> The eSuperType attribute from my eClassifiers elements are replaced
>>> by an <eGenericSuperTypes
>>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>>
>>> What can I do to solve this ?
>>>
>>> Thanks.
>>>
>>> doux guillaume.
>>>
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> Yes, it was this, and now I have find a solution with your link.
>>>>
>>>>
>>>> Thanks a lot !
>>>>
>>>>
>>>> Guillaume
>>>>
>>>>
>>>> Martin Taal wrote:
>>>>> It is probably this:
>>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>>
>>>>>
>>>>> This is solved in cvs.
>>>>>
>>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>>
>>>>> gr. martin
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Sorry I have post a bad output file...
>>>>>>
>>>>>> This is the good one...
>>>>>>
>>>>>> Guillaume
>>>>>>
>>>>>>
>>>>>> doux guillaume wrote:
>>>>>>> Hi again,
>>>>>>>
>>>>>>> I'm sorry to have another question but I have a second problem
>>>>>>> with Teneo.
>>>>>>>
>>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>>> this package has been modified.
>>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>>> elements have been deleted...
>>>>>>>
>>>>>>> Can you explain me why and how to avoid it ?
>>>>>>>
>>>>>>> Thanks for your help,
>>>>>>>
>>>>>>> Guillaume
>>>>>>>
>>>>>>>
>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #89937 is a reply to message #89922] Tue, 17 July 2007 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------030401010605000908040700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

My problem is that I must use meta-model persisted with Teneo to load
model conforming to the previous meta-model.
In the code that I joined to this mail I persist a model with Teneo,
retrieve it and then try to deserialized a model with it.
This code throw me an Exception when the XML parser try to find "val"
which is the first inherited attribute of my model.

I join the java program, the meta-model and the model.

Thanks,

guillaume doux


Martin Taal wrote:
> Guillaume,
> I must say that (even after the description of Ed) I am in the dark why
> it happens and if it is even a problem. Can you make a (small) testcase
> which illustrates the issue?
>
> gr. Martin
>
> Ed Merks wrote:
>> Martin,
>>
>> If things are working properly, then as long as you don't do anything
>> specific that requires generics, the eSuperTypes reference would be
>> serialized the old way. More specifically, you'll only get
>> eGenericSuperTypes if the following returns true:
>>
>> public boolean isSet()
>> {
>> for (EGenericType eGenericType : this)
>> {
>> if (eGenericType.getETypeParameter() != null ||
>> !eGenericType.getETypeArguments().isEmpty())
>> {
>> return true;
>> }
>> }
>> return false;
>> }
>>
>> A super type being based on a type parameter is actually a constraint
>> violation, but the case that one of the super types has a type
>> argument is valid and in that case, we must serialize the generic
>> types because we'd lose the information about the type arguments if we
>> serialized them as just eSuperTypes.
>>
>> The logic for whether to serialize instanceClassName verses
>> instanceTypeName is similarly gated by the use of type arguments in
>> the string (and of course ETypedElement.eType verses eGenericType is
>> similarly affected while EOperation.eExceptions verses
>> eGenericExceptions work just like EClass.eSuperTypes verses
>> eGenericSuperTypes).
>>
>>
>> Martin Taal wrote:
>>> Ed,
>>> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
>>> ecore (with generic types)?
>>>
>>> gr. Martin
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> I have updated my Teneo plugin this morning with the new version 0.8
>>>> and I have a new problem, my package are modified again.
>>>> If I serialize them to ecore files, I see that they differs from the
>>>> originals.
>>>> The eSuperType attribute from my eClassifiers elements are replaced
>>>> by an <eGenericSuperTypes
>>>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>>>
>>>> What can I do to solve this ?
>>>>
>>>> Thanks.
>>>>
>>>> doux guillaume.
>>>>
>>>>
>>>>
>>>> doux guillaume wrote:
>>>>> Hi,
>>>>>
>>>>> Yes, it was this, and now I have find a solution with your link.
>>>>>
>>>>>
>>>>> Thanks a lot !
>>>>>
>>>>>
>>>>> Guillaume
>>>>>
>>>>>
>>>>> Martin Taal wrote:
>>>>>> It is probably this:
>>>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>>>
>>>>>>
>>>>>> This is solved in cvs.
>>>>>>
>>>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>>>
>>>>>> gr. martin
>>>>>>
>>>>>> doux guillaume wrote:
>>>>>>> Sorry I have post a bad output file...
>>>>>>>
>>>>>>> This is the good one...
>>>>>>>
>>>>>>> Guillaume
>>>>>>>
>>>>>>>
>>>>>>> doux guillaume wrote:
>>>>>>>> Hi again,
>>>>>>>>
>>>>>>>> I'm sorry to have another question but I have a second problem
>>>>>>>> with Teneo.
>>>>>>>>
>>>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>>>> this package has been modified.
>>>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>>>> elements have been deleted...
>>>>>>>>
>>>>>>>> Can you explain me why and how to avoid it ?
>>>>>>>>
>>>>>>>> Thanks for your help,
>>>>>>>>
>>>>>>>> Guillaume
>>>>>>>>
>>>>>>>>
>>>
>>>
>>
>
>


--------------030401010605000908040700
Content-Type: text/xml;
name="deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" eType="#/1/Databin" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" eType="#/1/Bloc" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eType="#/1/Databin" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" eType="#/1/Field" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_name" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" eType="#/1/Script" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" eType="#/1/File" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------030401010605000908040700
Content-Type: text/xml;
name="deb_res_thunderbird.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb_res_thunderbird.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<deb:Deb xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:deb="my.model.of.debian.package" name="thunderbird.deb">
<metadata>
<blocs>
<field xsi:type="deb:Script_descriptions" val="Nom du trigger" type="Script_descriptions"/>
<field xsi:type="deb:package_descriptions" val="Descriptionnompaquet" type="package_descriptions"/>
<field xsi:type="deb:Version" val="0.10.1 0.1.0.rh7.test" type="version"/>
<field xsi:type="deb:Dependancy" val="dependance" type="Dependancy"/>
<field xsi:type="deb:package_name" val="thunderbird" type="name"/>
</blocs>
</metadata>
<control>
<scripts script_name="Nom du trigger" code="un script du paquet"/>
</control>
<data name="data.tar.gz">
<fil filename="libgtkembedmoz.so" location="/usr/lib/thunderbird"/>
<fil filename="bloaturls.txt" location="/usr/lib/thunderbird"/>
<fil filename="libgtkxtbin.so" location="/usr/lib/thunderbird"/>
<fil filename="libplds4.so" location="/usr/lib/thunderbird"/>
<fil filename="libbjsj.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-config" location="/usr/lib/thunderbird"/>
<fil filename="libplc4.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-bin" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-rebuild-database" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird" location="/usr/lib/thunderbird"/>
<fil filename="libnss3.so" location="/usr/lib/thunderbird"/>
<fil filename="elf-dynstr-gc" location="/usr/lib/thunderbird"/>
<fil filename="libnspr4.so" location="/usr/lib/thunderbird"/>
<fil filename="ligkgfx.so" location="/usr/lib/thunderbird"/>
<fil filename="ligtksuperwin.so" location="/usr/lib/thunderbird"/>
<fil filename="libmozjs.so" location="/usr/lib/thunderbird"/>
</data>
</deb:Deb>

--------------030401010605000908040700
Content-Type: text/x-java;
name="addget.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="addget.java"

package test;

import java.io.IOException;
import java.util.Collections;
import java.util.Properties;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
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.EcoreResourceFactoryImpl;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;
import org.hibernate.event.InitializeCollectionEventListener;

public class addget {


// work folder
public static String loc = "/home/doux/temp/";

// work resourceSet
private static ResourceSet resTeneo;
private static ResourceSet resourceSet;

// name of the database
private static String dbname = "test";
private static String usr = "root";
private static String pass = "root"

// the datastore
private static HbDataStore hbds;

// the name of the datastore
private static String hbName = "MySF";

public static void main(String[] args){
resTeneo = new ResourceSetImpl();
resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
new EcoreResourceFactoryImpl());
resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
new EcoreResourceFactoryImpl());
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, usr);
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, pass);
props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE.getLiteral());
// create the HbDataStore
hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
// set the relational database to use and other properties
hbds.setHibernateProperties(props);

EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
// configure EPackage used in this datastore
hbds.setEPackages(tpack);

hbds.initialize();

try {
//loading a meta-model from an ecore file
String uri = loc+"deb.ecore";
Resource res = resourceSet.createResource(URI.createFileURI(uri));
res.load(null);

//making it persistent with Teneo
String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName;
Resource resourceT = resTeneo.createResource(URI.createURI(uristr));
resourceT.getContents().addAll(res.getContents());
resourceT.save(null);

//retrieve this package from Teneo
String uristr2 = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
Resource resout = resTeneo.createResource(URI.createURI(uristr));
resout.load(null);

// //Serialization of this resource into an ecore file to see the difference
// String uri_res = loc+"resulting_deb.ecore";
// Resource result = resourceSet.createResource(URI.createFileURI(uri_res));
// result.getContents().addAll(resout.getContents());
// result.save(null);

// Then I will try to deserialize a model conforms to the model previously retrived
// registering meta model packages
for(int i = 0; i<resout.getContents().size(); ++i){
resTeneo.getPackageRegistry().put(((EPackage)(resout.getCont ents().get(i))).getNsURI(),
((EPackage)(resout.getContents().get(i))));
}


String uristr3 = loc+"deb_res_thunderbird.ecore";
Resource M = resTeneo.createResource(URI.createFileURI(uristr3));
M.load(null);


} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

--------------030401010605000908040700--
Re: [Teneo] another problems: my datas are modified by Teneo [message #90316 is a reply to message #89937] Wed, 18 July 2007 09:32 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have solved my problem by using in injector to load my model instead
of use the "resource.load(null)" way. So the difference between the in
and out metamodel is transparent.

Thanks.


guillaume doux.
Re: [Teneo] another problems: my datas are modified by Teneo [message #608724 is a reply to message #89396] Thu, 12 July 2007 15:15 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------010809090604000405000103
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Sorry I have post a bad output file...

This is the good one...

Guillaume


doux guillaume wrote:
> Hi again,
>
> I'm sorry to have another question but I have a second problem with Teneo.
>
> I use Teneo to store EPackage contained in .ecore files.
> My problem is that when I want to get an EPackage from Teneo, this
> package has been modified.
> When I export it into another .ecore file I see that the "eType" and the
> "instanceClassName" attributes of the "eClassifiers" elements have been
> deleted...
>
> Can you explain me why and how to avoid it ?
>
> Thanks for your help,
>
> Guillaume
>
>
> PS : I joined my in ecore file (deb.ecore), my out ecore file
> (resulting_deb.ecore) and the class which make them (addget.java).
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI 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">
> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
> <eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
> <eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
> <eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
> </ecore:EPackage>
> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
> <eClassifiers xsi:type="ecore:EClass" name="Deb">
> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
> lowerBound="1" eType="#/1/Databin" containment="true" eOpposite="#/1/Databin/debpm"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
> lowerBound="1" eType="#/1/Archcontrol" containment="true" eOpposite="#/1/Archcontrol/debc"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eType="#/1/Archdata" containment="true" eOpposite="#/1/Archdata/debd"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Databin">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> upperBound="-1" eType="#/1/Bloc" containment="true" eOpposite="#/1/Bloc/meta"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
> <eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
> lowerBound="1" eType="#/1/Databin" eOpposite="#/1/Databin/blocs"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
> upperBound="-1" eType="#/1/Field" containment="true" eOpposite="#/1/Field/blocs"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Version" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="package_name" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
> upperBound="-1" eType="#/1/Script" containment="true" eOpposite="#/1/Script/archscript"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script">
> <eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
> lowerBound="1" eType="#/1/Archcontrol" eOpposite="#/1/Archcontrol/scripts"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
> upperBound="-1" eType="#/1/File" containment="true" eOpposite="#/1/File/data"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="File">
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eType="#/1/Archdata" eOpposite="#/1/Archdata/fil"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
> unique="false" lowerBound="1" eType="#/0/String"/>
> </eClassifiers>
> </ecore:EPackage>
> </xmi:XMI>
>
>
> ------------------------------------------------------------ ------------
>
> package test;
>
> import java.io.IOException;
> import java.util.Collections;
> import java.util.Properties;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EcorePackage;
> 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.EcoreResourceFactoryImpl;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
> import org.hibernate.Query;
> import org.hibernate.Session;
> import org.hibernate.SessionFactory;
> import org.hibernate.Transaction;
> import org.hibernate.cfg.Environment;
> import org.hibernate.event.InitializeCollectionEventListener;
>
> public class addget {
>
>
> // work folder
> public static String loc = "/home/doux/temp/";
>
> // work resourceSet
> private static ResourceSet resTeneo;
> private static ResourceSet resourceSet;
>
> // name of the database
> private static String dbname = "test";
>
> // the datastore
> private static HbDataStore hbds;
>
> // the name of the datastore
> private static String hbName = "MySF";
>
> public static void main(String[] args){
> resTeneo = new ResourceSetImpl();
> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
> new EcoreResourceFactoryImpl());
> resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
> new EcoreResourceFactoryImpl());
> final Properties props = new Properties();
> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
> props.setProperty(Environment.USER, "doux");
> props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
> props.setProperty(Environment.PASS, "provisoiredoux");
> props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE_LITERAL.getName());
> // create the HbDataStore
> hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
> // set the relational database to use and other properties
> hbds.setHibernateProperties(props);
> EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
> // configure EPackage used in this datastore
> hbds.setEPackages(tpack);
>
> hbds.initialize();
>
> final EMFInitializeCollectionEventListener eventListener = new EMFInitializeCollectionEventListener();
> ((HbSessionDataStore)hbds).getConfiguration().getEventListen ers().setInitializeCollectionEventListeners
> (new InitializeCollectionEventListener[] { eventListener });
>
> try {
> //loading a meta-model from an ecore file
> String uri = loc+"deb.ecore";
> Resource res = resourceSet.createResource(URI.createFileURI(uri));
> res.load(null);
>
> //making it persistent with Teneo
> String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName;
> Resource resourceT = resTeneo.createResource(URI.createURI(uristr));
> resourceT.getContents().addAll(res.getContents());
> resourceT.save(null);
>
> //retrieve this package from Teneo
> String uristr2 = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
> Resource resout = resTeneo.createResource(URI.createURI(uristr));
> resout.load(null);
>
> //Serialization of this resource into an ecore file
> String uri_res = loc+"resulting_deb.ecore";
> Resource result = resourceSet.createResource(URI.createFileURI(uri_res));
> result.getContents().addAll(resout.getContents());
> result.save(null);
>
>
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> }


--------------010809090604000405000103
Content-Type: text/xml;
name="resulting_deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resulting_deb.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------010809090604000405000103--
Re: [Teneo] another problems: my datas are modified by Teneo [message #608725 is a reply to message #89412] Thu, 12 July 2007 15:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
It is probably this:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html

This is solved in cvs.

See the first post in this thread (see hyperlink) for a workaround.

gr. martin

doux guillaume wrote:
> Sorry I have post a bad output file...
>
> This is the good one...
>
> Guillaume
>
>
> doux guillaume wrote:
>> Hi again,
>>
>> I'm sorry to have another question but I have a second problem with
>> Teneo.
>>
>> I use Teneo to store EPackage contained in .ecore files.
>> My problem is that when I want to get an EPackage from Teneo, this
>> package has been modified.
>> When I export it into another .ecore file I see that the "eType" and
>> the "instanceClassName" attributes of the "eClassifiers" elements have
>> been deleted...
>>
>> Can you explain me why and how to avoid it ?
>>
>> Thanks for your help,
>>
>> Guillaume
>>
>>
>> PS : I joined my in ecore file (deb.ecore), my out ecore file
>> (resulting_deb.ecore) and the class which make them (addget.java).
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xmi:XMI 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">
>> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type"
>> nsPrefix="ptyp">
>> <eClassifiers xsi:type="ecore:EDataType" name="Boolean"
>> instanceClassName="boolean"/>
>> <eClassifiers xsi:type="ecore:EDataType" name="Integer"
>> instanceClassName="int"/>
>> <eClassifiers xsi:type="ecore:EDataType" name="String"
>> instanceClassName="java.lang.String"/>
>> </ecore:EPackage>
>> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package"
>> nsPrefix="deb">
>> <eClassifiers xsi:type="ecore:EClass" name="Deb">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata"
>> ordered="false"
>> lowerBound="1" eType="#/1/Databin" containment="true"
>> eOpposite="#/1/Databin/debpm"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="control"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archcontrol" containment="true"
>> eOpposite="#/1/Archcontrol/debc"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="data"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archdata" containment="true"
>> eOpposite="#/1/Archdata/debd"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Databin">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs"
>> ordered="false"
>> upperBound="-1" eType="#/1/Bloc" containment="true"
>> eOpposite="#/1/Bloc/meta"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="meta"
>> ordered="false"
>> lowerBound="1" eType="#/1/Databin"
>> eOpposite="#/1/Databin/blocs"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="field"
>> ordered="false"
>> upperBound="-1" eType="#/1/Field" containment="true"
>> eOpposite="#/1/Field/blocs"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs"
>> ordered="false"
>> lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="package_name"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debc"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts"
>> ordered="false"
>> upperBound="-1" eType="#/1/Script" containment="true"
>> eOpposite="#/1/Script/archscript"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Script">
>> <eStructuralFeatures xsi:type="ecore:EReference"
>> name="archscript" ordered="false"
>> lowerBound="1" eType="#/1/Archcontrol"
>> eOpposite="#/1/Archcontrol/scripts"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute"
>> name="script_name" ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="debd"
>> ordered="false"
>> lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="fil"
>> ordered="false"
>> upperBound="-1" eType="#/1/File" containment="true"
>> eOpposite="#/1/File/data"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="File">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="data"
>> ordered="false"
>> lowerBound="1" eType="#/1/Archdata"
>> eOpposite="#/1/Archdata/fil"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location"
>> ordered="false"
>> unique="false" lowerBound="1" eType="#/0/String"/>
>> </eClassifiers>
>> </ecore:EPackage>
>> </xmi:XMI>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package test;
>>
>> import java.io.IOException;
>> import java.util.Collections;
>> import java.util.Properties;
>>
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EPackage;
>> import org.eclipse.emf.ecore.EcorePackage;
>> 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.EcoreResourceFactoryImpl;
>> import org.eclipse.emf.teneo.PersistenceOptions;
>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>> import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>> import org.hibernate.Query;
>> import org.hibernate.Session;
>> import org.hibernate.SessionFactory;
>> import org.hibernate.Transaction;
>> import org.hibernate.cfg.Environment;
>> import org.hibernate.event.InitializeCollectionEventListener;
>>
>> public class addget {
>>
>>
>> // work folder
>> public static String loc = "/home/doux/temp/";
>>
>> // work resourceSet private static ResourceSet resTeneo;
>> private static ResourceSet resourceSet;
>>
>> // name of the database
>> private static String dbname = "test";
>>
>> // the datastore
>> private static HbDataStore hbds;
>>
>> // the name of the datastore
>> private static String hbName = "MySF";
>>
>> public static void main(String[] args){
>> resTeneo = new ResourceSetImpl();
>>
>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> resourceSet = new ResourceSetImpl();
>>
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> final Properties props = new Properties();
>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>> props.setProperty(Environment.USER, "doux");
>> props.setProperty(Environment.URL,
>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>> props.setProperty(Environment.PASS, "provisoiredoux");
>> props.setProperty(Environment.DIALECT,
>> org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>> // create the HbDataStore
>> hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
>> // set the relational database to use and other properties
>> hbds.setHibernateProperties(props);
>> EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
>> // configure EPackage used in this datastore
>> hbds.setEPackages(tpack);
>>
>> hbds.initialize();
>>
>> final EMFInitializeCollectionEventListener eventListener = new
>> EMFInitializeCollectionEventListener();
>>
>> ((HbSessionDataStore)hbds).getConfiguration().getEventListen ers().setInitializeCollectionEventListeners
>>
>> (new InitializeCollectionEventListener[] {
>> eventListener });
>>
>> try {
>> //loading a meta-model from an ecore file
>> String uri = loc+"deb.ecore";
>> Resource res =
>> resourceSet.createResource(URI.createFileURI(uri));
>> res.load(null);
>>
>> //making it persistent with Teneo
>> String uristr = "hibernate://?" +
>> HibernateResource.DS_NAME_PARAM + "=" + hbName;
>> Resource resourceT =
>> resTeneo.createResource(URI.createURI(uristr));
>> resourceT.getContents().addAll(res.getContents());
>> resourceT.save(null);
>> //retrieve this package from Teneo
>> String uristr2 = "hibernate://?" +
>> HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
>> Resource resout =
>> resTeneo.createResource(URI.createURI(uristr));
>> resout.load(null);
>> //Serialization of this resource into an ecore file
>> String uri_res = loc+"resulting_deb.ecore";
>> Resource result =
>> resourceSet.createResource(URI.createFileURI(uri_res));
>> result.getContents().addAll(resout.getContents());
>> result.save(null);
>> } catch (IOException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> }
>>
>> }
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI 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">
> <ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
> <eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
> <eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
> <eClassifiers xsi:type="ecore:EDataType" name="String"/>
> </ecore:EPackage>
> <ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
> <eClassifiers xsi:type="ecore:EClass" name="Deb">
> <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Databin/debpm"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Archcontrol/debc"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" containment="true" eOpposite="#/1/Archdata/debd"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Databin">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/metadata"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Bloc/meta"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Bloc">
> <eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
> lowerBound="1" eOpposite="#/1/Databin/blocs"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Field/blocs"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
> lowerBound="1" eOpposite="#/1/Bloc/field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Version">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_name">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
> <eGenericSuperTypes eClassifier="#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/control"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/Script/archscript"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Script">
> <eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
> lowerBound="1" eOpposite="#/1/Archcontrol/scripts"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Archdata">
> <eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
> lowerBound="1" eOpposite="#/1/Deb/data"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
> upperBound="-1" containment="true" eOpposite="#/1/File/data"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="File">
> <eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
> lowerBound="1" eOpposite="#/1/Archdata/fil"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
> unique="false" lowerBound="1"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
> unique="false" lowerBound="1"/>
> </eClassifiers>
> </ecore:EPackage>
> </xmi:XMI>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #608726 is a reply to message #89429] Thu, 12 July 2007 15:44 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

Yes, it was this, and now I have find a solution with your link.


Thanks a lot !


Guillaume


Martin Taal wrote:
> It is probably this:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>
> This is solved in cvs.
>
> See the first post in this thread (see hyperlink) for a workaround.
>
> gr. martin
>
> doux guillaume wrote:
>> Sorry I have post a bad output file...
>>
>> This is the good one...
>>
>> Guillaume
>>
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> I'm sorry to have another question but I have a second problem with
>>> Teneo.
>>>
>>> I use Teneo to store EPackage contained in .ecore files.
>>> My problem is that when I want to get an EPackage from Teneo, this
>>> package has been modified.
>>> When I export it into another .ecore file I see that the "eType" and
>>> the "instanceClassName" attributes of the "eClassifiers" elements
>>> have been deleted...
>>>
>>> Can you explain me why and how to avoid it ?
>>>
>>> Thanks for your help,
>>>
>>> Guillaume
>>>
>>>
Re: [Teneo] another problems: my datas are modified by Teneo [message #608752 is a reply to message #89444] Mon, 16 July 2007 12:12 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have updated my Teneo plugin this morning with the new version 0.8 and
I have a new problem, my package are modified again.
If I serialize them to ecore files, I see that they differs from the
originals.
The eSuperType attribute from my eClassifiers elements are replaced by
an <eGenericSuperTypes eClassifier="eClassifier="#/1/mysupertype"/> element.

What can I do to solve this ?

Thanks.

doux guillaume.



doux guillaume wrote:
> Hi,
>
> Yes, it was this, and now I have find a solution with your link.
>
>
> Thanks a lot !
>
>
> Guillaume
>
>
> Martin Taal wrote:
>> It is probably this:
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>
>>
>> This is solved in cvs.
>>
>> See the first post in this thread (see hyperlink) for a workaround.
>>
>> gr. martin
>>
>> doux guillaume wrote:
>>> Sorry I have post a bad output file...
>>>
>>> This is the good one...
>>>
>>> Guillaume
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi again,
>>>>
>>>> I'm sorry to have another question but I have a second problem with
>>>> Teneo.
>>>>
>>>> I use Teneo to store EPackage contained in .ecore files.
>>>> My problem is that when I want to get an EPackage from Teneo, this
>>>> package has been modified.
>>>> When I export it into another .ecore file I see that the "eType" and
>>>> the "instanceClassName" attributes of the "eClassifiers" elements
>>>> have been deleted...
>>>>
>>>> Can you explain me why and how to avoid it ?
>>>>
>>>> Thanks for your help,
>>>>
>>>> Guillaume
>>>>
>>>>
Re: [Teneo] another problems: my datas are modified by Teneo [message #608753 is a reply to message #89863] Mon, 16 July 2007 13:36 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ed,
Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3 ecore (with generic types)?

gr. Martin

doux guillaume wrote:
> Hi,
>
> I have updated my Teneo plugin this morning with the new version 0.8 and
> I have a new problem, my package are modified again.
> If I serialize them to ecore files, I see that they differs from the
> originals.
> The eSuperType attribute from my eClassifiers elements are replaced by
> an <eGenericSuperTypes eClassifier="eClassifier="#/1/mysupertype"/>
> element.
>
> What can I do to solve this ?
>
> Thanks.
>
> doux guillaume.
>
>
>
> doux guillaume wrote:
>> Hi,
>>
>> Yes, it was this, and now I have find a solution with your link.
>>
>>
>> Thanks a lot !
>>
>>
>> Guillaume
>>
>>
>> Martin Taal wrote:
>>> It is probably this:
>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>
>>>
>>> This is solved in cvs.
>>>
>>> See the first post in this thread (see hyperlink) for a workaround.
>>>
>>> gr. martin
>>>
>>> doux guillaume wrote:
>>>> Sorry I have post a bad output file...
>>>>
>>>> This is the good one...
>>>>
>>>> Guillaume
>>>>
>>>>
>>>> doux guillaume wrote:
>>>>> Hi again,
>>>>>
>>>>> I'm sorry to have another question but I have a second problem with
>>>>> Teneo.
>>>>>
>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>> My problem is that when I want to get an EPackage from Teneo, this
>>>>> package has been modified.
>>>>> When I export it into another .ecore file I see that the "eType"
>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>> elements have been deleted...
>>>>>
>>>>> Can you explain me why and how to avoid it ?
>>>>>
>>>>> Thanks for your help,
>>>>>
>>>>> Guillaume
>>>>>
>>>>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #608754 is a reply to message #89877] Mon, 16 July 2007 13:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010005040109000002070109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Martin,

If things are working properly, then as long as you don't do anything
specific that requires generics, the eSuperTypes reference would be
serialized the old way. More specifically, you'll only get
eGenericSuperTypes if the following returns true:

public boolean isSet()
{
for (EGenericType eGenericType : this)
{
if (eGenericType.getETypeParameter() != null ||
!eGenericType.getETypeArguments().isEmpty())
{
return true;
}
}
return false;
}

A super type being based on a type parameter is actually a constraint
violation, but the case that one of the super types has a type argument
is valid and in that case, we must serialize the generic types because
we'd lose the information about the type arguments if we serialized them
as just eSuperTypes.

The logic for whether to serialize instanceClassName verses
instanceTypeName is similarly gated by the use of type arguments in the
string (and of course ETypedElement.eType verses eGenericType is
similarly affected while EOperation.eExceptions verses
eGenericExceptions work just like EClass.eSuperTypes verses
eGenericSuperTypes).


Martin Taal wrote:
> Ed,
> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
> ecore (with generic types)?
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi,
>>
>> I have updated my Teneo plugin this morning with the new version 0.8
>> and I have a new problem, my package are modified again.
>> If I serialize them to ecore files, I see that they differs from the
>> originals.
>> The eSuperType attribute from my eClassifiers elements are replaced
>> by an <eGenericSuperTypes
>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>
>> What can I do to solve this ?
>>
>> Thanks.
>>
>> doux guillaume.
>>
>>
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> Yes, it was this, and now I have find a solution with your link.
>>>
>>>
>>> Thanks a lot !
>>>
>>>
>>> Guillaume
>>>
>>>
>>> Martin Taal wrote:
>>>> It is probably this:
>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>
>>>>
>>>> This is solved in cvs.
>>>>
>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>
>>>> gr. martin
>>>>
>>>> doux guillaume wrote:
>>>>> Sorry I have post a bad output file...
>>>>>
>>>>> This is the good one...
>>>>>
>>>>> Guillaume
>>>>>
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Hi again,
>>>>>>
>>>>>> I'm sorry to have another question but I have a second problem
>>>>>> with Teneo.
>>>>>>
>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>> this package has been modified.
>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>> elements have been deleted...
>>>>>>
>>>>>> Can you explain me why and how to avoid it ?
>>>>>>
>>>>>> Thanks for your help,
>>>>>>
>>>>>> Guillaume
>>>>>>
>>>>>>
>
>


--------------010005040109000002070109
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin,<br>
<br>
If things are working properly, then as long as you don't do anything
specific that requires generics, the eSuperTypes reference would be
serialized the old way.&nbsp; More specifically, you'll only get
eGenericSuperTypes if the following returns true:<br>
<br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public boolean isSet()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (EGenericType eGenericType : this)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (eGenericType.getETypeParameter() != null ||
!eGenericType.getETypeArguments().isEmpty())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<br>
A super type being based on a type parameter is actually a constraint
violation, but the case that one of the super types has a type argument
is valid and in that case, we must serialize the generic types because
we'd lose the information about the type arguments if we serialized
them as just eSuperTypes.<br>
<br>
The logic for whether to serialize instanceClassName verses
instanceTypeName is similarly gated by the use of type arguments in the
string (and of course ETypedElement.eType verses eGenericType is
similarly affected while EOperation.eExceptions verses
eGenericExceptions work just like EClass.eSuperTypes verses
eGenericSuperTypes).<br>
<br>
<br>
Martin Taal wrote:
<blockquote cite="mid:f7fs99$b1m$1@build.eclipse.org" type="cite">Ed,
<br>
Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
ecore (with generic types)?
<br>
<br>
gr. Martin
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
I have updated my Teneo plugin this morning with the new version 0.8
and I have a new problem, my package are modified again.
<br>
If I serialize them to ecore files, I see that they differs from the
originals.
<br>
The eSuperType attribute from my eClassifiers elements are replaced by
an &lt;eGenericSuperTypes
eClassifier="eClassifier="#/1/mysupertype"/&gt; element.
<br>
<br>
What can I do to solve this ?
<br>
<br>
Thanks.
<br>
<br>
doux guillaume.
<br>
<br>
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
Yes, it was this, and now I have find a solution with your link.
<br>
<br>
<br>
Thanks a lot !
<br>
<br>
<br>
Guillaume
<br>
<br>
<br>
Martin Taal wrote:
<br>
<blockquote type="cite">It is probably this:
<br>
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html"> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html</a>
<br>
<br>
This is solved in cvs.
<br>
<br>
See the first post in this thread (see hyperlink) for a workaround.
<br>
<br>
gr. martin
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Sorry I have post a bad output file...
<br>
<br>
This is the good one...
<br>
<br>
Guillaume
<br>
<br>
<br>
doux guillaume wrote:
<br>
<blockquote type="cite">Hi again,
<br>
<br>
I'm sorry to have another question but I have a second problem with
Teneo.
<br>
<br>
I use Teneo to store EPackage contained in .ecore files.
<br>
My problem is that when I want to get an EPackage from Teneo, this
package has been modified.
<br>
When I export it into another .ecore file I see that the "eType" and
the "instanceClassName" attributes of the "eClassifiers" elements have
been deleted...
<br>
<br>
Can you explain me why and how to avoid it ?
<br>
<br>
Thanks for your help,
<br>
<br>
Guillaume
<br>
<br>
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------010005040109000002070109--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Teneo] another problems: my datas are modified by Teneo [message #608756 is a reply to message #89894] Mon, 16 July 2007 20:49 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Guillaume,
I must say that (even after the description of Ed) I am in the dark why it happens and if it is even
a problem. Can you make a (small) testcase which illustrates the issue?

gr. Martin

Ed Merks wrote:
> Martin,
>
> If things are working properly, then as long as you don't do anything
> specific that requires generics, the eSuperTypes reference would be
> serialized the old way. More specifically, you'll only get
> eGenericSuperTypes if the following returns true:
>
> public boolean isSet()
> {
> for (EGenericType eGenericType : this)
> {
> if (eGenericType.getETypeParameter() != null ||
> !eGenericType.getETypeArguments().isEmpty())
> {
> return true;
> }
> }
> return false;
> }
>
> A super type being based on a type parameter is actually a constraint
> violation, but the case that one of the super types has a type argument
> is valid and in that case, we must serialize the generic types because
> we'd lose the information about the type arguments if we serialized them
> as just eSuperTypes.
>
> The logic for whether to serialize instanceClassName verses
> instanceTypeName is similarly gated by the use of type arguments in the
> string (and of course ETypedElement.eType verses eGenericType is
> similarly affected while EOperation.eExceptions verses
> eGenericExceptions work just like EClass.eSuperTypes verses
> eGenericSuperTypes).
>
>
> Martin Taal wrote:
>> Ed,
>> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
>> ecore (with generic types)?
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> I have updated my Teneo plugin this morning with the new version 0.8
>>> and I have a new problem, my package are modified again.
>>> If I serialize them to ecore files, I see that they differs from the
>>> originals.
>>> The eSuperType attribute from my eClassifiers elements are replaced
>>> by an <eGenericSuperTypes
>>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>>
>>> What can I do to solve this ?
>>>
>>> Thanks.
>>>
>>> doux guillaume.
>>>
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> Yes, it was this, and now I have find a solution with your link.
>>>>
>>>>
>>>> Thanks a lot !
>>>>
>>>>
>>>> Guillaume
>>>>
>>>>
>>>> Martin Taal wrote:
>>>>> It is probably this:
>>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>>
>>>>>
>>>>> This is solved in cvs.
>>>>>
>>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>>
>>>>> gr. martin
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Sorry I have post a bad output file...
>>>>>>
>>>>>> This is the good one...
>>>>>>
>>>>>> Guillaume
>>>>>>
>>>>>>
>>>>>> doux guillaume wrote:
>>>>>>> Hi again,
>>>>>>>
>>>>>>> I'm sorry to have another question but I have a second problem
>>>>>>> with Teneo.
>>>>>>>
>>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>>> this package has been modified.
>>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>>> elements have been deleted...
>>>>>>>
>>>>>>> Can you explain me why and how to avoid it ?
>>>>>>>
>>>>>>> Thanks for your help,
>>>>>>>
>>>>>>> Guillaume
>>>>>>>
>>>>>>>
>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] another problems: my datas are modified by Teneo [message #608757 is a reply to message #89922] Tue, 17 July 2007 07:28 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------030401010605000908040700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

My problem is that I must use meta-model persisted with Teneo to load
model conforming to the previous meta-model.
In the code that I joined to this mail I persist a model with Teneo,
retrieve it and then try to deserialized a model with it.
This code throw me an Exception when the XML parser try to find "val"
which is the first inherited attribute of my model.

I join the java program, the meta-model and the model.

Thanks,

guillaume doux


Martin Taal wrote:
> Guillaume,
> I must say that (even after the description of Ed) I am in the dark why
> it happens and if it is even a problem. Can you make a (small) testcase
> which illustrates the issue?
>
> gr. Martin
>
> Ed Merks wrote:
>> Martin,
>>
>> If things are working properly, then as long as you don't do anything
>> specific that requires generics, the eSuperTypes reference would be
>> serialized the old way. More specifically, you'll only get
>> eGenericSuperTypes if the following returns true:
>>
>> public boolean isSet()
>> {
>> for (EGenericType eGenericType : this)
>> {
>> if (eGenericType.getETypeParameter() != null ||
>> !eGenericType.getETypeArguments().isEmpty())
>> {
>> return true;
>> }
>> }
>> return false;
>> }
>>
>> A super type being based on a type parameter is actually a constraint
>> violation, but the case that one of the super types has a type
>> argument is valid and in that case, we must serialize the generic
>> types because we'd lose the information about the type arguments if we
>> serialized them as just eSuperTypes.
>>
>> The logic for whether to serialize instanceClassName verses
>> instanceTypeName is similarly gated by the use of type arguments in
>> the string (and of course ETypedElement.eType verses eGenericType is
>> similarly affected while EOperation.eExceptions verses
>> eGenericExceptions work just like EClass.eSuperTypes verses
>> eGenericSuperTypes).
>>
>>
>> Martin Taal wrote:
>>> Ed,
>>> Is this maybe the difference between a pre-emf 2.3 ecore and a 2.3
>>> ecore (with generic types)?
>>>
>>> gr. Martin
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> I have updated my Teneo plugin this morning with the new version 0.8
>>>> and I have a new problem, my package are modified again.
>>>> If I serialize them to ecore files, I see that they differs from the
>>>> originals.
>>>> The eSuperType attribute from my eClassifiers elements are replaced
>>>> by an <eGenericSuperTypes
>>>> eClassifier="eClassifier="#/1/mysupertype"/> element.
>>>>
>>>> What can I do to solve this ?
>>>>
>>>> Thanks.
>>>>
>>>> doux guillaume.
>>>>
>>>>
>>>>
>>>> doux guillaume wrote:
>>>>> Hi,
>>>>>
>>>>> Yes, it was this, and now I have find a solution with your link.
>>>>>
>>>>>
>>>>> Thanks a lot !
>>>>>
>>>>>
>>>>> Guillaume
>>>>>
>>>>>
>>>>> Martin Taal wrote:
>>>>>> It is probably this:
>>>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg02748.html
>>>>>>
>>>>>>
>>>>>> This is solved in cvs.
>>>>>>
>>>>>> See the first post in this thread (see hyperlink) for a workaround.
>>>>>>
>>>>>> gr. martin
>>>>>>
>>>>>> doux guillaume wrote:
>>>>>>> Sorry I have post a bad output file...
>>>>>>>
>>>>>>> This is the good one...
>>>>>>>
>>>>>>> Guillaume
>>>>>>>
>>>>>>>
>>>>>>> doux guillaume wrote:
>>>>>>>> Hi again,
>>>>>>>>
>>>>>>>> I'm sorry to have another question but I have a second problem
>>>>>>>> with Teneo.
>>>>>>>>
>>>>>>>> I use Teneo to store EPackage contained in .ecore files.
>>>>>>>> My problem is that when I want to get an EPackage from Teneo,
>>>>>>>> this package has been modified.
>>>>>>>> When I export it into another .ecore file I see that the "eType"
>>>>>>>> and the "instanceClassName" attributes of the "eClassifiers"
>>>>>>>> elements have been deleted...
>>>>>>>>
>>>>>>>> Can you explain me why and how to avoid it ?
>>>>>>>>
>>>>>>>> Thanks for your help,
>>>>>>>>
>>>>>>>> Guillaume
>>>>>>>>
>>>>>>>>
>>>
>>>
>>
>
>


--------------030401010605000908040700
Content-Type: text/xml;
name="deb.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI 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">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false"
lowerBound="1" eType="#/1/Databin" containment="true" eOpposite="#/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" containment="true" eOpposite="#/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" containment="true" eOpposite="#/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
upperBound="-1" eType="#/1/Bloc" containment="true" eOpposite="#/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false"
lowerBound="1" eType="#/1/Databin" eOpposite="#/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false"
upperBound="-1" eType="#/1/Field" containment="true" eOpposite="#/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false"
lowerBound="1" eType="#/1/Bloc" eOpposite="#/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_name" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false"
upperBound="-1" eType="#/1/Script" containment="true" eOpposite="#/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false"
lowerBound="1" eType="#/1/Archcontrol" eOpposite="#/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false"
lowerBound="1" eType="#/1/Deb" eOpposite="#/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false"
upperBound="-1" eType="#/1/File" containment="true" eOpposite="#/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false"
lowerBound="1" eType="#/1/Archdata" eOpposite="#/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------030401010605000908040700
Content-Type: text/xml;
name="deb_res_thunderbird.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb_res_thunderbird.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<deb:Deb xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:deb="my.model.of.debian.package" name="thunderbird.deb">
<metadata>
<blocs>
<field xsi:type="deb:Script_descriptions" val="Nom du trigger" type="Script_descriptions"/>
<field xsi:type="deb:package_descriptions" val="Descriptionnompaquet" type="package_descriptions"/>
<field xsi:type="deb:Version" val="0.10.1 0.1.0.rh7.test" type="version"/>
<field xsi:type="deb:Dependancy" val="dependance" type="Dependancy"/>
<field xsi:type="deb:package_name" val="thunderbird" type="name"/>
</blocs>
</metadata>
<control>
<scripts script_name="Nom du trigger" code="un script du paquet"/>
</control>
<data name="data.tar.gz">
<fil filename="libgtkembedmoz.so" location="/usr/lib/thunderbird"/>
<fil filename="bloaturls.txt" location="/usr/lib/thunderbird"/>
<fil filename="libgtkxtbin.so" location="/usr/lib/thunderbird"/>
<fil filename="libplds4.so" location="/usr/lib/thunderbird"/>
<fil filename="libbjsj.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-config" location="/usr/lib/thunderbird"/>
<fil filename="libplc4.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-bin" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-rebuild-database" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird" location="/usr/lib/thunderbird"/>
<fil filename="libnss3.so" location="/usr/lib/thunderbird"/>
<fil filename="elf-dynstr-gc" location="/usr/lib/thunderbird"/>
<fil filename="libnspr4.so" location="/usr/lib/thunderbird"/>
<fil filename="ligkgfx.so" location="/usr/lib/thunderbird"/>
<fil filename="ligtksuperwin.so" location="/usr/lib/thunderbird"/>
<fil filename="libmozjs.so" location="/usr/lib/thunderbird"/>
</data>
</deb:Deb>

--------------030401010605000908040700
Content-Type: text/x-java;
name="addget.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="addget.java"

package test;

import java.io.IOException;
import java.util.Collections;
import java.util.Properties;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
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.EcoreResourceFactoryImpl;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;
import org.hibernate.event.InitializeCollectionEventListener;

public class addget {


// work folder
public static String loc = "/home/doux/temp/";

// work resourceSet
private static ResourceSet resTeneo;
private static ResourceSet resourceSet;

// name of the database
private static String dbname = "test";
private static String usr = "root";
private static String pass = "root"

// the datastore
private static HbDataStore hbds;

// the name of the datastore
private static String hbName = "MySF";

public static void main(String[] args){
resTeneo = new ResourceSetImpl();
resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
new EcoreResourceFactoryImpl());
resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "ecore",
new EcoreResourceFactoryImpl());
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, usr);
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, pass);
props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE.getLiteral());
// create the HbDataStore
hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
// set the relational database to use and other properties
hbds.setHibernateProperties(props);

EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
// configure EPackage used in this datastore
hbds.setEPackages(tpack);

hbds.initialize();

try {
//loading a meta-model from an ecore file
String uri = loc+"deb.ecore";
Resource res = resourceSet.createResource(URI.createFileURI(uri));
res.load(null);

//making it persistent with Teneo
String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName;
Resource resourceT = resTeneo.createResource(URI.createURI(uristr));
resourceT.getContents().addAll(res.getContents());
resourceT.save(null);

//retrieve this package from Teneo
String uristr2 = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=" + hbName+"&query1 =FROM EPackage";
Resource resout = resTeneo.createResource(URI.createURI(uristr));
resout.load(null);

// //Serialization of this resource into an ecore file to see the difference
// String uri_res = loc+"resulting_deb.ecore";
// Resource result = resourceSet.createResource(URI.createFileURI(uri_res));
// result.getContents().addAll(resout.getContents());
// result.save(null);

// Then I will try to deserialize a model conforms to the model previously retrived
// registering meta model packages
for(int i = 0; i<resout.getContents().size(); ++i){
resTeneo.getPackageRegistry().put(((EPackage)(resout.getCont ents().get(i))).getNsURI(),
((EPackage)(resout.getContents().get(i))));
}


String uristr3 = loc+"deb_res_thunderbird.ecore";
Resource M = resTeneo.createResource(URI.createFileURI(uristr3));
M.load(null);


} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

--------------030401010605000908040700--
Re: [Teneo] another problems: my datas are modified by Teneo [message #608782 is a reply to message #89937] Wed, 18 July 2007 09:32 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have solved my problem by using in injector to load my model instead
of use the "resource.load(null)" way. So the difference between the in
and out metamodel is transparent.

Thanks.


guillaume doux.
Previous Topic:[EMF Compare] Compares as Text compare
Next Topic:problem with initialzing jpoxDataStore(emf+teneo+derby)
Goto Forum:
  


Current Time: Fri Apr 19 07:55:18 GMT 2024

Powered by FUDForum. Page generated in 0.03540 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top