Bug 330235 - Add Backup/Restore Functionality
Summary: Add Backup/Restore Functionality
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: Power to the People
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2010-11-15 07:29 EST by Ronald Krijgsheld CLA
Modified: 2011-06-23 03:40 EDT (History)
2 users (show)

See Also:


Attachments
Patch v1 - incomplete (121.87 KB, patch)
2010-11-17 00:58 EST, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald Krijgsheld CLA 2010-11-15 07:29:48 EST
Build Identifier: M20100909-0800

We like to have the ability to export and import of a CDO repository.

Reproducible: Always
Comment 1 Eike Stepper CLA 2010-11-16 01:29:19 EST
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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;ecore:EPackage xmi:version=&quot;2.0&quot;&#13;&#10;    xmlns:xmi=&quot;http://www.omg.org/XMI&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&#13;&#10;    xmlns:ecore=&quot;http://www.eclipse.org/emf/2002/Ecore&quot; name=&quot;model1&quot;&#13;&#10;    nsURI=&quot;http://www.eclipse.org/emf/CDO/tests/model1/1.0.0&quot; nsPrefix=&quot;model1&quot;&gt;&#13;&#10;  &lt;eAnnotations source=&quot;teneo.jpa&quot;&gt;&#13;&#10;    &lt;details key=&quot;value&quot; value=&quot;@hbGenericGenerators({@GenericGenerator(name=&amp;quot;system-uuid&amp;quot;, strategy = &amp;quot;org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOUUIDHexGenerator&amp;quot;)})&quot;/&gt;&#13;&#10;  &lt;/eAnnotations&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Address&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;name&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;street&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;city&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Company&quot; eSuperTypes=&quot;#//Address&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;categories&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//Category&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;suppliers&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//Supplier&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;customers&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//Customer&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;purchaseOrders&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//PurchaseOrder&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;salesOrders&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//SalesOrder&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Supplier&quot; eSuperTypes=&quot;#//Address&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;purchaseOrders&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//PurchaseOrder&quot; eOpposite=&quot;#//PurchaseOrder/supplier&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;preferred&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EBoolean&quot;&#13;&#10;        defaultValueLiteral=&quot;true&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Customer&quot; eSuperTypes=&quot;#//Address&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;salesOrders&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//SalesOrder&quot; eOpposite=&quot;#//SalesOrder/customer&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;orderByProduct&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//ProductToOrder&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Order&quot;&gt;&#13;&#10;    &lt;eAnnotations source=&quot;teneo.jpa&quot;&gt;&#13;&#10;      &lt;details key=&quot;value&quot; value=&quot;@Entity(name=&amp;quot;BaseOrder&amp;quot;)&quot;/&gt;&#13;&#10;    &lt;/eAnnotations&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;orderDetails&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//OrderDetail&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot; eOpposite=&quot;#//OrderDetail/order&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;OrderDetail&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;order&quot; lowerBound=&quot;1&quot; eType=&quot;#//Order&quot;&#13;&#10;        resolveProxies=&quot;false&quot; eOpposite=&quot;#//Order/orderDetails&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;product&quot; eType=&quot;#//Product1&quot;&#13;&#10;        eOpposite=&quot;#//Product1/orderDetails&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;price&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EFloat&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;PurchaseOrder&quot; eSuperTypes=&quot;#//Order&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;date&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EDate&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;supplier&quot; lowerBound=&quot;1&quot;&#13;&#10;        eType=&quot;#//Supplier&quot; eOpposite=&quot;#//Supplier/purchaseOrders&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;SalesOrder&quot; eSuperTypes=&quot;#//Order&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;id&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EInt&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;customer&quot; lowerBound=&quot;1&quot;&#13;&#10;        eType=&quot;#//Customer&quot; eOpposite=&quot;#//Customer/salesOrders&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Category&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;name&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;categories&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//Category&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;products&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//Product1&quot; containment=&quot;true&quot; resolveProxies=&quot;false&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;Product1&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;name&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;&gt;&#13;&#10;      &lt;eAnnotations source=&quot;teneo.jpa&quot;&gt;&#13;&#10;        &lt;details key=&quot;value&quot; value=&quot;@Id&quot;/&gt;&#13;&#10;      &lt;/eAnnotations&gt;&#13;&#10;    &lt;/eStructuralFeatures&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;orderDetails&quot; upperBound=&quot;-1&quot;&#13;&#10;        eType=&quot;#//OrderDetail&quot; eOpposite=&quot;#//OrderDetail/product&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;vat&quot; eType=&quot;#//VAT&quot; defaultValueLiteral=&quot;vat15&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;description&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EString&quot;&#13;&#10;        transient=&quot;true&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;OrderAddress&quot; eSuperTypes=&quot;#//Address #//Order #//OrderDetail&quot;&gt;&#13;&#10;    &lt;eAnnotations source=&quot;teneo.jpa&quot;&gt;&#13;&#10;      &lt;details key=&quot;value&quot; value=&quot;@AssociationOverride(name=&amp;quot;orderDetails&amp;quot;, joinColumns=@JoinColumn(name=&amp;quot;orderdetails_orderaddressid&amp;quot;))&quot;/&gt;&#13;&#10;    &lt;/eAnnotations&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EAttribute&quot; name=&quot;testAttribute&quot; eType=&quot;ecore:EDataType ../../../2002/Ecore#//EBoolean&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EClass&quot; name=&quot;ProductToOrder&quot; instanceClassName=&quot;java.util.Map$Entry&quot;&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;key&quot; eType=&quot;#//Product1&quot;/&gt;&#13;&#10;    &lt;eStructuralFeatures xsi:type=&quot;ecore:EReference&quot; name=&quot;value&quot; eType=&quot;#//SalesOrder&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;  &lt;eClassifiers xsi:type=&quot;ecore:EEnum&quot; name=&quot;VAT&quot;&gt;&#13;&#10;    &lt;eLiterals name=&quot;vat0&quot;/&gt;&#13;&#10;    &lt;eLiterals name=&quot;vat7&quot; value=&quot;7&quot;/&gt;&#13;&#10;    &lt;eLiterals name=&quot;vat15&quot; value=&quot;15&quot;/&gt;&#13;&#10;  &lt;/eClassifiers&gt;&#13;&#10;&lt;/ecore:EPackage&gt;&#13;&#10;">
      <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="&lt;initialize root resource&gt;"/>
    <commit time="1289888898109" previous="1289888896563"/>
  </commits>
</repository>
Comment 2 Eike Stepper CLA 2010-11-16 06:17:45 EST
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="&lt;initialize root resource&gt;"/>
    <commit time="1289906204680" previous="1289906203130"/>
    <commit time="1289906204721" previous="1289906204680"/>
  </commits>
</repository>
Comment 3 Eike Stepper CLA 2010-11-16 06:38:25 EST
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);
Comment 4 Eike Stepper CLA 2010-11-16 12:22:28 EST
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="&lt;initialize root resource&gt;"/>
    <commit time="1289927426167" previous="1289927423936"/>
  </commits>
</repository>
Comment 5 Eike Stepper CLA 2010-11-16 15:01:59 EST
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...
Comment 6 Eike Stepper CLA 2010-11-17 00:58:32 EST
Created attachment 183276 [details]
Patch v1 - incomplete

I must check whether the  offline failures happen without these changes, too...
Comment 7 Eike Stepper CLA 2010-11-17 01:17:06 EST
The offline failures were caused by wrong timing in the test logic. Fixed there.

Committed patch v1 to HEAD.

Going ahead...
Comment 8 Eike Stepper CLA 2010-11-17 05:26:22 EST
Gosh, streaming huge data from a database into an XML file and vice versa is not easy...
Comment 9 Eike Stepper CLA 2010-11-17 06:06:37 EST
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...
Comment 10 Eike Stepper CLA 2010-11-17 13:02:03 EST
Commit infos get properly imported, too.

Committed to HEAD
Comment 11 Eike Stepper CLA 2011-06-23 03:40:16 EDT
Available in R20110608-1407