summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-06-02 03:43:57 (EDT)
committerEike Stepper2008-06-02 03:43:57 (EDT)
commitf5511215d7cc09c81e78ef3f58f41f0d698829df (patch)
treeca0d7c0dec7027a548a86f6428ea47a7f3a083fd
parent6bd26133beec45d590260cb7655b978ca8b70a41 (diff)
downloadcdo-f5511215d7cc09c81e78ef3f58f41f0d698829df.zip
cdo-f5511215d7cc09c81e78ef3f58f41f0d698829df.tar.gz
cdo-f5511215d7cc09c81e78ef3f58f41f0d698829df.tar.bz2
[235042] Provide exchangeable protocol facade
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235042
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOFacade.java69
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java6
6 files changed, 89 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 9d0ec88..5ab0437 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -34,6 +34,7 @@ import org.eclipse.net4j.util.collection.MoveableList;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
/**
@@ -218,13 +219,15 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
@Override
protected InternalCDORevision loadRevision(CDOID id, int referenceChunk)
{
- return send(new LoadRevisionRequest(session.getChannel(), id, referenceChunk)).get(0);
+ return send(new LoadRevisionRequest(session.getChannel(), Collections.singleton(id), referenceChunk)).get(0);
}
@Override
protected InternalCDORevision loadRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
{
- return send(new LoadRevisionByTimeRequest(session.getChannel(), id, referenceChunk, timeStamp)).get(0);
+ return send(
+ new LoadRevisionByTimeRequest(session.getChannel(), Collections.singleton(id), referenceChunk, timeStamp)).get(
+ 0);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 06db4f7..28c3f25 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -33,6 +33,7 @@ import org.eclipse.emf.cdo.util.LegacySystemNotAvailableException;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol;
+import org.eclipse.emf.internal.cdo.protocol.CDOFacade;
import org.eclipse.emf.internal.cdo.protocol.LoadLibrariesRequest;
import org.eclipse.emf.internal.cdo.protocol.OpenSessionRequest;
import org.eclipse.emf.internal.cdo.protocol.OpenSessionResult;
@@ -95,6 +96,8 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
private int referenceChunkSize;
+ private CDOFacade facade;
+
private IFailOverStrategy failOverStrategy;
private IListener failOverStrategyListener = new IListener()
@@ -196,6 +199,16 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
this.referenceChunkSize = referenceChunkSize;
}
+ public CDOFacade getFacade()
+ {
+ return facade;
+ }
+
+ public void setFacade(CDOFacade facade)
+ {
+ this.facade = facade;
+ }
+
public IFailOverStrategy getFailOverStrategy()
{
return failOverStrategy == null ? IFailOverStrategy.NOOP : failOverStrategy;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOFacade.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOFacade.java
new file mode 100644
index 0000000..59e41fd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOFacade.java
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * 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.internal.cdo.protocol;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.internal.protocol.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.protocol.id.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+
+import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Provisional in preparation for 2.0.0
+ *
+ * @author Eike Stepper
+ */
+public interface CDOFacade
+{
+ public OpenSessionResult openSession(String repositoryName, boolean legacySupportEnabled,
+ RemoteInvalidationHandler remoteInvalidationHandler);
+
+ public int loadLibraries(Collection<String> libraryNames, File cacheFolder);
+
+ public boolean viewsChanged(int viewID, byte kind);
+
+ public CDOID resourceID(String path);
+
+ public String resourcePath(CDOID id);
+
+ public void loadPackage(CDOPackage cdoPackage);
+
+ public List<InternalCDORevision> loadRevision(Collection<CDOID> ids, int referenceChunk);
+
+ public List<InternalCDORevision> loadRevisionByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp);
+
+ public List<InternalCDORevision> loadRevisionByVersion();
+
+ public CDOID loadChunk(InternalCDORevision revision, CDOFeature feature, int accessIndex, int fromIndex, int toIndex);
+
+ public List<InternalCDORevision> verifyRevision(Collection<InternalCDORevision> revisions);
+
+ public CDOClassRef[] queryObjectTypes(List<CDOID> ids);
+
+ public CommitTransactionResult commitTransaction(CDOTransactionImpl transaction);
+
+ public void closeSession(CDOSession session);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface RemoteInvalidationHandler
+ {
+ public void handleRemoteInvalidation();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
index 95b45cd..8e79041 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java
@@ -22,7 +22,6 @@ import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection;
-import java.util.Collections;
/**
* @author Eike Stepper
@@ -39,11 +38,6 @@ public class LoadRevisionByTimeRequest extends LoadRevisionRequest
this.timeStamp = timeStamp;
}
- public LoadRevisionByTimeRequest(IChannel channel, CDOID id, int referenceChunk, long timeStamp)
- {
- this(channel, Collections.singleton(id), referenceChunk, timeStamp);
- }
-
@Override
protected short getSignalID()
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
index f6ac5f0..b33291d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java
@@ -21,6 +21,7 @@ import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.Collections;
/**
* @author Eike Stepper
@@ -33,7 +34,7 @@ public class LoadRevisionByVersionRequest extends LoadRevisionRequest
public LoadRevisionByVersionRequest(IChannel channel, CDOID id, int referenceChunk, int version)
{
- super(channel, id, referenceChunk);
+ super(channel, Collections.singleton(id), referenceChunk);
this.version = version;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
index b92a89c..4e5d938 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
@@ -32,7 +32,6 @@ import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
/**
@@ -53,11 +52,6 @@ public class LoadRevisionRequest extends CDOClientRequest<List<InternalCDORevisi
this.referenceChunk = referenceChunk;
}
- public LoadRevisionRequest(IChannel channel, CDOID id, int referenceChunk)
- {
- this(channel, Collections.singleton(id), referenceChunk);
- }
-
@Override
protected short getSignalID()
{