Community
Participate
Working Groups
Build Identifier: M20100909-0800 We like to have the ability to export and import of a CDO repository. Reproducible: Always
CDOServerExporter now produces the following xml: <?xml version="1.0" encoding="UTF-8"?> <repository name="repo1" uuid="repo1"> <models> <packageUnit type="NATIVE" time="1289888898109" data="<?xml version="1.0" encoding="UTF-8"?> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model1" nsURI="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" nsPrefix="model1"> <eAnnotations source="teneo.jpa"> <details key="value" value="@hbGenericGenerators({@GenericGenerator(name=&quot;system-uuid&quot;, strategy = &quot;org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOUUIDHexGenerator&quot;)})"/> </eAnnotations> <eClassifiers xsi:type="ecore:EClass" name="Address"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType ../../../2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="street" eType="ecore:EDataType ../../../2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="city" eType="ecore:EDataType ../../../2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Company" eSuperTypes="#//Address"> <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="#//Category" containment="true" resolveProxies="false"/> <eStructuralFeatures xsi:type="ecore:EReference" name="suppliers" upperBound="-1" eType="#//Supplier" containment="true" resolveProxies="false"/> <eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1" eType="#//Customer" containment="true" resolveProxies="false"/> <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="#//PurchaseOrder" containment="true" resolveProxies="false"/> <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" upperBound="-1" eType="#//SalesOrder" containment="true" resolveProxies="false"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Supplier" eSuperTypes="#//Address"> <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="#//PurchaseOrder" eOpposite="#//PurchaseOrder/supplier"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="preferred" eType="ecore:EDataType ../../../2002/Ecore#//EBoolean" defaultValueLiteral="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Customer" eSuperTypes="#//Address"> <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" upperBound="-1" eType="#//SalesOrder" eOpposite="#//SalesOrder/customer"/> <eStructuralFeatures xsi:type="ecore:EReference" name="orderByProduct" upperBound="-1" eType="#//ProductToOrder" containment="true" resolveProxies="false"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Order"> <eAnnotations source="teneo.jpa"> <details key="value" value="@Entity(name=&quot;BaseOrder&quot;)"/> </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="#//OrderDetail" containment="true" resolveProxies="false" eOpposite="#//OrderDetail/order"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="OrderDetail"> <eStructuralFeatures xsi:type="ecore:EReference" name="order" lowerBound="1" eType="#//Order" resolveProxies="false" eOpposite="#//Order/orderDetails"/> <eStructuralFeatures xsi:type="ecore:EReference" name="product" eType="#//Product1" eOpposite="#//Product1/orderDetails"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="price" eType="ecore:EDataType ../../../2002/Ecore#//EFloat"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="PurchaseOrder" eSuperTypes="#//Order"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="date" eType="ecore:EDataType ../../../2002/Ecore#//EDate"/> <eStructuralFeatures xsi:type="ecore:EReference" name="supplier" lowerBound="1" eType="#//Supplier" eOpposite="#//Supplier/purchaseOrders"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="SalesOrder" eSuperTypes="#//Order"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType ../../../2002/Ecore#//EInt"/> <eStructuralFeatures xsi:type="ecore:EReference" name="customer" lowerBound="1" eType="#//Customer" eOpposite="#//Customer/salesOrders"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Category"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType ../../../2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="#//Category" containment="true" resolveProxies="false"/> <eStructuralFeatures xsi:type="ecore:EReference" name="products" upperBound="-1" eType="#//Product1" containment="true" resolveProxies="false"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Product1"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType ../../../2002/Ecore#//EString"> <eAnnotations source="teneo.jpa"> <details key="value" value="@Id"/> </eAnnotations> </eStructuralFeatures> <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="#//OrderDetail" eOpposite="#//OrderDetail/product"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="vat" eType="#//VAT" defaultValueLiteral="vat15"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType ../../../2002/Ecore#//EString" transient="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="OrderAddress" eSuperTypes="#//Address #//Order #//OrderDetail"> <eAnnotations source="teneo.jpa"> <details key="value" value="@AssociationOverride(name=&quot;orderDetails&quot;, joinColumns=@JoinColumn(name=&quot;orderdetails_orderaddressid&quot;))"/> </eAnnotations> <eStructuralFeatures xsi:type="ecore:EAttribute" name="testAttribute" eType="ecore:EDataType ../../../2002/Ecore#//EBoolean"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="ProductToOrder" instanceClassName="java.util.Map$Entry"> <eStructuralFeatures xsi:type="ecore:EReference" name="key" eType="#//Product1"/> <eStructuralFeatures xsi:type="ecore:EReference" name="value" eType="#//SalesOrder"/> </eClassifiers> <eClassifiers xsi:type="ecore:EEnum" name="VAT"> <eLiterals name="vat0"/> <eLiterals name="vat7" value="7"/> <eLiterals name="vat15" value="15"/> </eClassifiers> </ecore:EPackage> "> <packageInfo uri="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" first="M467" count="93"/> </packageUnit> </models> <instances> <branch id="0" name="MAIN" time="1289888896563"> <revision id="L3" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="1" time="1289888898109"> <feature name="String" value="res1"/> <feature name="Object" value="L2"/> </revision> <revision id="L1" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="2" time="1289888898109"> <feature name="Object" value="L3"/> </revision> <revision id="L2" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#Customer" version="1" time="1289888898109"> <feature name="String" value="Eike"/> </revision> </branch> </instances> <commits> <commit time="1289888896563" user="CDO_SYSTEM" comment="<initialize root resource>"/> <commit time="1289888898109" previous="1289888896563"/> </commits> </repository>
New format: <?xml version="1.0" encoding="UTF-8"?> <repository name="repo1" uuid="repo1" created="1289906203130" committed="1289906204721"> <models> <packageUnit id="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" type="NATIVE" time="1289906204680" data="..."> <packageInfo uri="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" first="M467" count="93"/> </packageUnit> </models> <instances> <branch id="0" name="MAIN" time="1289906203130"> <revision id="L6" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#SalesOrder" version="1" time="1289906204721" resource="L4"> <feature name="id" type="Integer" value="4711"/> <feature name="customer" type="Object" value="L2"/> </revision> <revision id="L4" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="1" time="1289906204680" revised="1289906204720" resource="L1"> <feature name="name" type="String" value="res1"/> <feature name="contents" type="Object" value="L2"/> <feature name="contents" type="Object" value="L3"/> <feature name="contents" type="Object" value="L5"/> </revision> <revision id="L4" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="2" time="1289906204721" resource="L1"> <feature name="name" type="String" value="res1"/> <feature name="contents" type="Object" value="L2"/> <feature name="contents" type="Object" value="L3"/> <feature name="contents" type="Object" value="L5"/> <feature name="contents" type="Object" value="L6"/> </revision> <revision id="L5" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#Customer" version="1" time="1289906204680" resource="L4"> <feature name="name" type="String" value="Simon"/> </revision> <revision id="L2" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#Customer" version="1" time="1289906204680" revised="1289906204720" resource="L4"> <feature name="name" type="String" value="Eike"/> </revision> <revision id="L2" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#Customer" version="2" time="1289906204721" resource="L4"> <feature name="name" type="String" value="Eike"/> <feature name="salesOrders" type="Object" value="L6"/> </revision> <revision id="L3" class="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0#Customer" version="1" time="1289906204680" resource="L4"> <feature name="name" type="String" value="Jos"/> </revision> <revision id="L1" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="1" time="1289906203130" revised="1289906204679" resource="L1"/> <revision id="L1" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="2" time="1289906204680" resource="L1"> <feature name="contents" type="Object" value="L4"/> </revision> </branch> </instances> <commits> <commit time="1289906203130" user="CDO_SYSTEM" comment="<initialize root resource>"/> <commit time="1289906204680" previous="1289906203130"/> <commit time="1289906204721" previous="1289906204680"/> </commits> </repository>
LOB spport and DBStore support still missing, but it generally works: ByteArrayOutputStream baos = new ByteArrayOutputStream(); CDOServerExporter.XML exporter = new CDOServerExporter.XML(repo1); exporter.exportRepository(baos); System.out.println(baos.toString()); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); CDOServerImporter.XML importer = new CDOServerImporter.XML(repo2); importer.importRepository(bais);
New format including large objects: <?xml version="1.0" encoding="UTF-8"?> <repository name="repo1" uuid="repo1" root="L1" created="1289927423936" committed="1289927426167"> <models> <packageUnit id="http://www.eclipse.org/emf/CDO/Etypes/4.0.0" type="NATIVE" time="1289927426167" data="..."> <packageInfo uri="http://www.eclipse.org/emf/CDO/tests/model3/1.0.0" first="M467" count="62"/> <packageInfo uri="http://www.eclipse.org/emf/CDO/tests/subpackage/1.0.0" first="M529" count="4"/> </packageUnit> </models> <instances> <branch id="0" name="MAIN" time="1289927423936"> <revision id="L3" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="1" time="1289927426167" resource="L1"> <feature name="name" type="String" value="res1"/> <feature name="contents" type="Object" value="L2"/> </revision> <revision id="L1" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="1" time="1289927423936" revised="1289927426166" resource="L1"/> <revision id="L1" class="http://www.eclipse.org/emf/CDO/Eresource/2.0.0#CDOResource" version="2" time="1289927426167" resource="L1"> <feature name="contents" type="Object" value="L3"/> </revision> <revision id="L2" class="http://www.eclipse.org/emf/CDO/tests/model3/1.0.0#Image" version="1" time="1289927426167" resource="L3"> <feature name="width" type="Integer" value="320"/> <feature name="height" type="Integer" value="200"/> <feature name="data" type="Blob" value="0a596b8789ffbd6340081279755475e7a3c85674"/> </revision> </branch> </instances> <lobs> <blob id="0a596b8789ffbd6340081279755475e7a3c85674" size="373"><![CDATA[436f70797269676874202863292032303034202d20323031302045696b65205374657070657220284265726c696e2c204765726d616e792920616e64206f74686572732e0d0a416c6c207269676874732072657365727665642e20546869732070726f6772616d20616e6420746865206163636f6d70616e79696e67206d6174657269616c730d0a617265206d61646520617661696c61626c6520756e64657220746865207465726d73206f66207468652045636c69707365205075626c6963204c6963656e73652076312e300d0a7768696368206163636f6d70616e696573207468697320646973747269627574696f6e2c20616e6420697320617661696c61626c652061740d0a687474703a2f2f7777772e65636c697073652e6f72672f6c6567616c2f65706c2d7631302e68746d6c0d0a0d0a436f6e7472696275746f72733a0d0a20202045696b652053746570706572202d20696e697469616c2041504920616e6420696d706c656d656e746174696f6e]]></blob> </lobs> <commits> <commit time="1289927423936" user="CDO_SYSTEM" comment="<initialize root resource>"/> <commit time="1289927426167" previous="1289927423936"/> </commits> </repository>
Everything working except: - import of Lob data (Lob refs already work) - import of commit infos - update of system counters Can not commit, yet, because some offline tests are failing and it's late here...
Created attachment 183276 [details] Patch v1 - incomplete I must check whether the offline failures happen without these changes, too...
The offline failures were caused by wrong timing in the test logic. Fixed there. Committed patch v1 to HEAD. Going ahead...
Gosh, streaming huge data from a database into an XML file and vice versa is not easy...
Okay, I managed to import Blobs and Clobs from XML. I did not find out, yet, why the Exporter duplicates the line endings for Clobs... Committed to HEAD Going ahead...
Commit infos get properly imported, too. Committed to HEAD
Available in R20110608-1407