summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-23 13:17:43 (EST)
committerEike Stepper2008-01-23 13:17:43 (EST)
commit39d94a1c92215b59ef30e1ee38a30a9f5ecfd249 (patch)
tree50c7fc307ac217ec39321f4944669206de479b79
parent20b2ca154d0e6f181af588f0e2a560912997d677 (diff)
downloadcdo-39d94a1c92215b59ef30e1ee38a30a9f5ecfd249.zip
cdo-39d94a1c92215b59ef30e1ee38a30a9f5ecfd249.tar.gz
cdo-39d94a1c92215b59ef30e1ee38a30a9f5ecfd249.tar.bz2
[215688] Create save points
https://bugs.eclipse.org/bugs/show_bug.cgi?id=215688
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOReadIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreUtil.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java89
12 files changed, 112 insertions, 34 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index a62cd1a..80d441d 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -12,10 +12,10 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.Store;
-import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.protocol.model.CDOType;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IMappingStrategy;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
index c4497c7..614611d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo;
import org.eclipse.emf.cdo.server.IPackageManager;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IStoreWriter;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.net4j.util.transaction.ITransaction;
import org.eclipse.net4j.util.transaction.ITransactionalOperation;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java
index b76fc26..d670f69 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.server.IResourceManager;
import org.eclipse.emf.cdo.server.IStoreReader;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index 9f2a6e9..136f3b2 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -28,6 +28,7 @@ import org.eclipse.emf.cdo.server.IRevisionManager;
import org.eclipse.emf.cdo.server.IStoreChunkReader;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IStoreWriter;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
import org.eclipse.net4j.util.collection.MoveableList;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 6670e1a..e4bc5eb 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.SessionCreationException;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.server.IView.Type;
import org.eclipse.net4j.internal.util.container.Container;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOReadIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOReadIndication.java
index 410e355..dc7939c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOReadIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOReadIndication.java
@@ -10,9 +10,9 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.server.protocol;
-import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreReader;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.net4j.buffer.BufferInputStream;
import org.eclipse.net4j.buffer.BufferOutputStream;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index 0c1251a..998ff8a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.internal.protocol.revision.delta.CDORevisionDeltaImpl
import org.eclipse.emf.cdo.internal.server.PackageManager;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.RevisionManager;
-import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.internal.server.View;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
@@ -33,6 +32,7 @@ import org.eclipse.emf.cdo.protocol.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreWriter;
import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.internal.util.transaction.Transaction;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
index 6822725..c3f57f5 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.server;
-import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java
index 5d0f1b1..15e00fb 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java
@@ -8,10 +8,10 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.internal.server;
+package org.eclipse.emf.cdo.server;
-import org.eclipse.emf.cdo.server.IStore;
-import org.eclipse.emf.cdo.server.IStoreReader;
+import org.eclipse.emf.cdo.internal.server.MEMStore;
+import org.eclipse.emf.cdo.internal.server.NOOPStore;
/**
* @author Eike Stepper
diff --git a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
index 05c0051..3191fc3 100644
--- a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -13,15 +13,12 @@ package org.eclipse.net4j.tests;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.internal.util.container.ManagedContainer;
import org.eclipse.net4j.jvm.JVMUtil;
import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.internal.net4j.acceptor.Acceptor;
-import org.eclipse.internal.net4j.connector.Connector;
-
/**
* @author Eike Stepper
*/
@@ -67,7 +64,7 @@ public abstract class AbstractTransportTest extends AbstractOMTest
protected IManagedContainer createContainer()
{
- IManagedContainer container = new ManagedContainer();
+ IManagedContainer container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container);
if (useJVMTransport())
{
@@ -87,11 +84,11 @@ public abstract class AbstractTransportTest extends AbstractOMTest
{
if (useJVMTransport())
{
- acceptor = (Acceptor)JVMUtil.getAcceptor(container, "default");
+ acceptor = JVMUtil.getAcceptor(container, "default");
}
else
{
- acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ acceptor = TCPUtil.getAcceptor(container, null);
}
}
@@ -104,11 +101,11 @@ public abstract class AbstractTransportTest extends AbstractOMTest
{
if (useJVMTransport())
{
- connector = (Connector)JVMUtil.getConnector(container, "default");
+ connector = JVMUtil.getConnector(container, "default");
}
else
{
- connector = (Connector)TCPUtil.getConnector(container, HOST);
+ connector = TCPUtil.getConnector(container, HOST);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index 001e632..1947429 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -14,12 +14,10 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.server.ContainerRepositoryProvider;
-import org.eclipse.emf.cdo.internal.server.Repository;
-import org.eclipse.emf.cdo.internal.server.StoreUtil;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.tests.model1.Model1Package;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -46,7 +44,7 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
{
IManagedContainer container = super.createContainer();
CDOUtil.prepareContainer(container, false);
- CDOServerUtil.prepareContainer(container, new ContainerRepositoryProvider(container));
+ CDOServerUtil.prepareContainer(container);
CDOServerUtil.addRepository(container, createRepository());
return container;
}
@@ -56,22 +54,13 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
return StoreUtil.createMEMStore();
}
- protected Repository createRepository()
+ protected IRepository createRepository()
{
Map<String, String> props = new HashMap<String, String>();
- // props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true");
- // props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "20");
- // props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "20");
-
- IStore store = createStore();
-
- Repository repository = new Repository();
- repository.setName(REPOSITORY_NAME);
- repository.setProperties(props);
- repository.setStore(store);
-
- store.setRepository(repository);
- return repository;
+ props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true");
+ props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "10000");
+ props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "10000");
+ return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
}
protected IRepository getRepository()
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java
new file mode 100644
index 0000000..14876a0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOTransaction;
+import org.eclipse.emf.cdo.server.CDOServerUtil;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.StoreUtil;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.jvm.JVMUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class ImportXML
+{
+ private static final String REPOSITORY_NAME = "repo1";
+
+ public static void main(String[] args)
+ {
+ // Prepare the standalone infra structure (not needed when running inside Eclipse)
+ IManagedContainer container = ContainerUtil.createContainer(); // Create a wiring container
+ Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
+ JVMUtil.prepareContainer(container); // Prepare the JVM transport
+ CDOServerUtil.prepareContainer(container); // Prepare the CDO server
+ CDOUtil.prepareContainer(container, false); // Prepare the CDO client
+
+ // Start the transport and create a repository
+ JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
+ CDOServerUtil.addRepository(container, createRepository()); // Start a CDO respository
+
+ // Establish a communications connection and open a session with the repository
+ IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
+ CDOSession session = CDOUtil.openSession(connector, REPOSITORY_NAME, true);// Open a CDO session
+ CDOTransaction transaction = session.openTransaction();// Open a CDO transaction
+ Resource resource = transaction.createResource("/my/big/resource");// Create a new EMF resource
+
+ // Work normally with the EMF resource
+ for (int i = 0; i < 100; i++)
+ {
+ EObject inputModel = getInputModel(i);
+ resource.getContents().add(inputModel);
+ transaction.commit();
+ }
+
+ session.close();
+ }
+
+ private static IRepository createRepository()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true");
+ props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "10000");
+ props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "10000");
+ return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
+ }
+
+ private static IStore createStore()
+ {
+ // You might want to create an IDBStore here instead if memory is an issue!
+ return StoreUtil.createMEMStore();
+ }
+
+ private static EObject getInputModel(int i)
+ {
+ throw new UnsupportedOperationException("Load you model here");
+ }
+}