Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-04-15 06:21:36 +0000
committerEike Stepper2010-04-15 06:21:36 +0000
commit4b93f7ba31388a75a835d7bb098518043cb56f85 (patch)
tree74f28b8ddd5774831755dc625683d026a7288e86 /plugins
parent715b731ebf408bfc226a4cf1f29a2603007b35f1 (diff)
downloadcdo-4b93f7ba31388a75a835d7bb098518043cb56f85.tar.gz
cdo-4b93f7ba31388a75a835d7bb098518043cb56f85.tar.xz
cdo-4b93f7ba31388a75a835d7bb098518043cb56f85.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/FailoverParticipant.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/OfflineClone.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/ReplicatorCommitContext.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/ReplicatorCommitContext.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/RepositorySynchronizer.java)15
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/SynchronizableRepository.java)39
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositorySynchronizer.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISynchronizableRepository.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/FailoverParticipant.java)17
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepositorySynchronizer.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSynchronizableRepository.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java4
15 files changed, 243 insertions, 47 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
index 668101ca18..31b251a0f2 100644
--- a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
@@ -13,10 +13,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)";resoluti
org.eclipse.emf.cdo;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.internal.server;version="3.0.0";x-friends:="org.eclipse.emf.cdo.server.db,org.eclipse.emf.cdo.server.net4j,org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.server.bundle;version="3.0.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.clone;version="3.0.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.server.embedded;version="3.0.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.server.mem;version="3.0.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.server.messages;version="3.0.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.syncing;version="3.0.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.server;version="3.0.0",
org.eclipse.emf.cdo.server.embedded;version="3.0.0",
org.eclipse.emf.cdo.server.mem;version="3.0.0",
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/FailoverParticipant.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/FailoverParticipant.java
new file mode 100644
index 0000000000..04b443f7ef
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/FailoverParticipant.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * 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.internal.server.syncing;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
+import org.eclipse.emf.cdo.spi.server.InternalTransaction;
+
+/**
+ * @author Eike Stepper
+ */
+public class FailoverParticipant extends SynchronizableRepository
+{
+ public FailoverParticipant()
+ {
+ setState(State.OFFLINE);
+ }
+
+ @Override
+ public void setType(Type type)
+ {
+ checkArg(type == CDOCommonRepository.Type.MASTER || type == CDOCommonRepository.Type.BACKUP,
+ "Type must be MASTER or BACKUP");
+ super.setType(type);
+ }
+
+ @Override
+ public InternalCommitContext createCommitContext(InternalTransaction transaction)
+ {
+ if (getType() == CDOCommonRepository.Type.BACKUP)
+ {
+ if (transaction.getSession() != getReplicatorSession())
+ {
+ throw new IllegalStateException(
+ "Only the repository synchronizer is allowed to commit transactions to a backup repository");
+ }
+ }
+
+ return super.createCommitContext(transaction);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/OfflineClone.java
index 4b3f8ef272..57667bca3e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/OfflineClone.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.server.clone;
+package org.eclipse.emf.cdo.internal.server.syncing;
/**
* @author Eike Stepper
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/ReplicatorCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/ReplicatorCommitContext.java
index 61a279f7e7..9f10d90020 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/ReplicatorCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/ReplicatorCommitContext.java
@@ -1,4 +1,4 @@
-package org.eclipse.emf.cdo.internal.server.clone;
+package org.eclipse.emf.cdo.internal.server.syncing;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/RepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
index 8a7e2eb7e8..ece52abff2 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/RepositorySynchronizer.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.server.clone;
+package org.eclipse.emf.cdo.internal.server.syncing;
import org.eclipse.emf.cdo.common.CDOCommonRepository;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
@@ -18,11 +18,12 @@ import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.internal.common.revision.cache.noop.NOOPRevisionCache;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
-import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
+import org.eclipse.emf.cdo.spi.server.InternalSynchronizableRepository;
import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
import org.eclipse.net4j.util.concurrent.QueueRunner;
@@ -41,7 +42,7 @@ import java.util.concurrent.PriorityBlockingQueue;
* @author Eike Stepper
* @since 3.0
*/
-public class RepositorySynchronizer extends QueueRunner
+public class RepositorySynchronizer extends QueueRunner implements InternalRepositorySynchronizer
{
public static final int DEFAULT_RETRY_INTERVAL = 3;
@@ -59,7 +60,7 @@ public class RepositorySynchronizer extends QueueRunner
private Object connectLock = new Object();
- private SynchronizableRepository localRepository;
+ private InternalSynchronizableRepository localRepository;
private InternalCDOSession remoteSession;
@@ -83,12 +84,12 @@ public class RepositorySynchronizer extends QueueRunner
this.retryInterval = retryInterval;
}
- public SynchronizableRepository getLocalRepository()
+ public InternalSynchronizableRepository getLocalRepository()
{
return localRepository;
}
- public void setLocalRepository(SynchronizableRepository localRepository)
+ public void setLocalRepository(InternalSynchronizableRepository localRepository)
{
checkInactive();
this.localRepository = localRepository;
@@ -105,7 +106,7 @@ public class RepositorySynchronizer extends QueueRunner
this.remoteSessionConfigurationFactory = remoteSessionConfigurationFactory;
}
- public CDOSession getRemoteSession()
+ public InternalCDOSession getRemoteSession()
{
return remoteSession;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/SynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
index bbfc6bfdce..d17b3c1387 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/SynchronizableRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.server.clone;
+package org.eclipse.emf.cdo.internal.server.syncing;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -24,15 +24,16 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.TransactionCommitContext;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
-import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
+import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
import org.eclipse.emf.cdo.spi.server.InternalSession;
import org.eclipse.emf.cdo.spi.server.InternalStore;
+import org.eclipse.emf.cdo.spi.server.InternalSynchronizableRepository;
import org.eclipse.emf.cdo.spi.server.InternalTransaction;
import org.eclipse.net4j.util.collection.IndexedList;
@@ -42,7 +43,6 @@ import org.eclipse.net4j.util.transaction.TransactionException;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
import java.util.Arrays;
import java.util.Collections;
@@ -64,15 +64,15 @@ import java.util.Set;
*
* @author Eike Stepper
*/
-public abstract class SynchronizableRepository extends Repository.Default implements CDOReplicationContext
+public abstract class SynchronizableRepository extends Repository.Default implements InternalSynchronizableRepository
{
- private static final String PROP_LAST_REPLICATED_BRANCH_ID = "org.eclipse.emf.cdo.server.clone.lastReplicatedBranchID"; //$NON-NLS-1$
+ private static final String PROP_LAST_REPLICATED_BRANCH_ID = "org.eclipse.emf.cdo.server.lastReplicatedBranchID"; //$NON-NLS-1$
- private static final String PROP_LAST_REPLICATED_COMMIT_TIME = "org.eclipse.emf.cdo.server.clone.lastReplicatedCommitTime"; //$NON-NLS-1$
+ private static final String PROP_LAST_REPLICATED_COMMIT_TIME = "org.eclipse.emf.cdo.server.lastReplicatedCommitTime"; //$NON-NLS-1$
- private static final String PROP_GRACEFULLY_SHUT_DOWN = "org.eclipse.emf.cdo.server.clone.gracefullyShutDown"; //$NON-NLS-1$
+ private static final String PROP_GRACEFULLY_SHUT_DOWN = "org.eclipse.emf.cdo.server.gracefullyShutDown"; //$NON-NLS-1$
- private RepositorySynchronizer synchronizer;
+ private InternalRepositorySynchronizer synchronizer;
private InternalSession replicatorSession;
@@ -86,17 +86,22 @@ public abstract class SynchronizableRepository extends Repository.Default implem
{
}
- public RepositorySynchronizer getSynchronizer()
+ public InternalRepositorySynchronizer getSynchronizer()
{
return synchronizer;
}
- public void setSynchronizer(RepositorySynchronizer synchronizer)
+ public void setSynchronizer(InternalRepositorySynchronizer synchronizer)
{
checkInactive();
this.synchronizer = synchronizer;
}
+ public InternalSession getReplicatorSession()
+ {
+ return replicatorSession;
+ }
+
@Override
public Object[] getElements()
{
@@ -225,7 +230,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
Map<String, String> map = store.getPropertyValues(Collections.singleton(PROP_GRACEFULLY_SHUT_DOWN));
if (!map.containsKey(PROP_GRACEFULLY_SHUT_DOWN))
{
- throw new IllegalStateException("Clone store was not gracefully shut down");
+ throw new IllegalStateException("Local repository was not gracefully shut down");
}
Set<String> names = new HashSet<String>();
@@ -288,7 +293,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
/**
* @author Eike Stepper
*/
- private static final class CommitContextData implements CDOCommitData
+ protected static final class CommitContextData implements CDOCommitData
{
private InternalCommitContext commitContext;
@@ -382,7 +387,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
/**
* @author Eike Stepper
*/
- private final class WriteThroughCommitContext extends TransactionCommitContext
+ protected final class WriteThroughCommitContext extends TransactionCommitContext
{
public WriteThroughCommitContext(InternalTransaction transaction)
{
@@ -407,7 +412,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
CDOCommitData commitData = new CommitContextData(this);
// Delegate commit to the master
- CDOSessionProtocol sessionProtocol = ((InternalCDOSession)synchronizer.getRemoteSession()).getSessionProtocol();
+ CDOSessionProtocol sessionProtocol = (synchronizer.getRemoteSession()).getSessionProtocol();
CommitTransactionResult result = sessionProtocol.commitDelegation(branch, userID, comment, commitData, monitor);
// Stop if commit to master failed
@@ -423,12 +428,12 @@ public abstract class SynchronizableRepository extends Repository.Default implem
addIDMappings(result.getIDMappings());
applyIDMappings(new Monitor());
- // Commit to the clone
+ // Commit to the local repository
super.preWrite();
super.write(new Monitor());
super.commit(new Monitor());
- // Remember commit time in the clone
+ // Remember commit time in the local repository
setLastCommitTimeStamp(result.getTimeStamp());
}
@@ -476,7 +481,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
/**
* @author Eike Stepper
*/
- private final class BranchingCommitContext extends TransactionCommitContext
+ protected final class BranchingCommitContext extends TransactionCommitContext
{
private long timeStamp;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
index 59a5520efe..8e75db3e88 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
@@ -10,14 +10,18 @@
*/
package org.eclipse.emf.cdo.server;
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.SessionManager;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
-import org.eclipse.emf.cdo.internal.server.clone.OfflineClone;
-import org.eclipse.emf.cdo.internal.server.clone.RepositorySynchronizer;
import org.eclipse.emf.cdo.internal.server.embedded.EmbeddedClientSessionConfiguration;
+import org.eclipse.emf.cdo.internal.server.syncing.FailoverParticipant;
+import org.eclipse.emf.cdo.internal.server.syncing.OfflineClone;
+import org.eclipse.emf.cdo.internal.server.syncing.RepositorySynchronizer;
import org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration;
+import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
import org.eclipse.emf.cdo.spi.server.InternalStore;
import org.eclipse.emf.cdo.spi.server.RepositoryFactory;
@@ -71,26 +75,51 @@ public final class CDOServerUtil
public static IRepository createRepository(String name, IStore store, Map<String, String> props)
{
Repository repository = new Repository.Default();
- repository.setName(name);
- repository.setStore((InternalStore)store);
- repository.setProperties(props);
+ initRepository(repository, name, store, props);
return repository;
}
/**
- * TODO Add SPI for CloneSynchronizer
- *
* @since 3.0
*/
- public static IRepository createCloneRepository(String name, IStore store, Map<String, String> props,
- RepositorySynchronizer synchronizer)
+ public static IRepositorySynchronizer createRepositorySynchronizer(
+ CDOSessionConfigurationFactory remoteSessionConfigurationFactory)
+ {
+ RepositorySynchronizer synchronizer = new RepositorySynchronizer();
+ synchronizer.setRemoteSessionConfigurationFactory(remoteSessionConfigurationFactory);
+ return synchronizer;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static ISynchronizableRepository createOfflineClone(String name, IStore store, Map<String, String> props,
+ IRepositorySynchronizer synchronizer)
{
OfflineClone repository = new OfflineClone();
+ initRepository(repository, name, store, props);
+ repository.setSynchronizer((InternalRepositorySynchronizer)synchronizer);
+ return repository;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static ISynchronizableRepository createFailoverParticipant(String name, IStore store,
+ Map<String, String> props, IRepositorySynchronizer synchronizer, boolean master)
+ {
+ FailoverParticipant repository = new FailoverParticipant();
+ initRepository(repository, name, store, props);
+ repository.setSynchronizer((InternalRepositorySynchronizer)synchronizer);
+ repository.setType(master ? CDOCommonRepository.Type.MASTER : CDOCommonRepository.Type.BACKUP);
+ return repository;
+ }
+
+ private static void initRepository(Repository repository, String name, IStore store, Map<String, String> props)
+ {
repository.setName(name);
repository.setStore((InternalStore)store);
repository.setProperties(props);
- repository.setSynchronizer(synchronizer);
- return repository;
}
public static void addRepository(IManagedContainer container, IRepository repository)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositorySynchronizer.java
new file mode 100644
index 0000000000..b4dc43de8b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositorySynchronizer.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * 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.server;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface IRepositorySynchronizer extends ILifecycle
+{
+ public int getRetryInterval();
+
+ public void setRetryInterval(int retryInterval);
+
+ public ISynchronizableRepository getLocalRepository();
+
+ public CDOSessionConfigurationFactory getRemoteSessionConfigurationFactory();
+
+ public CDOSession getRemoteSession();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/FailoverParticipant.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISynchronizableRepository.java
index 8a29093e2f..e26ed917d4 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/FailoverParticipant.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISynchronizableRepository.java
@@ -8,15 +8,20 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.server.clone;
+package org.eclipse.emf.cdo.server;
+
/**
* @author Eike Stepper
+ * @since 3.0
*/
-public class FailoverParticipant extends SynchronizableRepository
+public interface ISynchronizableRepository
{
- public FailoverParticipant()
- {
- setState(State.OFFLINE);
- }
+ public IRepositorySynchronizer getSynchronizer();
+
+ public ISession getReplicatorSession();
+
+ public int getLastReplicatedBranchID();
+
+ public long getLastReplicatedCommitTime();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java
index f3793f60c4..4652b30497 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java
@@ -47,6 +47,10 @@ public interface InternalRepository extends IRepository, PackageLoader, BranchLo
{
public void setName(String name);
+ public void setType(Type type);
+
+ public void setState(State state);
+
public InternalStore getStore();
public void setStore(InternalStore store);
@@ -81,6 +85,8 @@ public interface InternalRepository extends IRepository, PackageLoader, BranchLo
public InternalCommitContext createCommitContext(InternalTransaction transaction);
+ public void setRootResourceID(CDOID rootResourceID);
+
/**
* Returns a commit time stamp that is guaranteed to be unique in the given branch. If <code>null</code> is passed the
* time stamp is expected to e used with a new branch, hence will be unique by definition.
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepositorySynchronizer.java
new file mode 100644
index 0000000000..3a45483704
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepositorySynchronizer.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.server;
+
+import org.eclipse.emf.cdo.server.IRepositorySynchronizer;
+import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+
+import org.eclipse.emf.spi.cdo.InternalCDOSession;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface InternalRepositorySynchronizer extends IRepositorySynchronizer
+{
+ public InternalSynchronizableRepository getLocalRepository();
+
+ public void setLocalRepository(InternalSynchronizableRepository localRepository);
+
+ public void setRemoteSessionConfigurationFactory(CDOSessionConfigurationFactory remoteSessionConfigurationFactory);
+
+ public InternalCDOSession getRemoteSession();
+
+ public boolean isSqueezeCommitInfos();
+
+ public void setSqueezeCommitInfos(boolean squeezeCommitInfos);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSynchronizableRepository.java
new file mode 100644
index 0000000000..77428cd269
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSynchronizableRepository.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.server;
+
+import org.eclipse.emf.cdo.server.ISynchronizableRepository;
+import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface InternalSynchronizableRepository extends ISynchronizableRepository, InternalRepository,
+ CDOReplicationContext
+{
+ public InternalRepositorySynchronizer getSynchronizer();
+
+ public void setSynchronizer(InternalRepositorySynchronizer synchronizer);
+
+ public InternalSession getReplicatorSession();
+
+ public boolean isSqueezeCommitInfos();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java
index 6156f84f06..be5e95b5fa 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java
@@ -37,6 +37,9 @@ public abstract class LongIDStoreAccessor extends StoreAccessor
super(store, transaction);
}
+ /**
+ * @since 3.0
+ */
@Override
protected void addIDMappings(InternalCommitContext commitContext, OMMonitor monitor)
{
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
index 4d57f0acb1..5ee6297256 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
@@ -19,8 +19,8 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.server.clone.OfflineClone;
import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
+import org.eclipse.emf.cdo.internal.server.syncing.OfflineClone;
import org.eclipse.emf.cdo.server.IMEMStore;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.session.CDOSession;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
index 7316d4da96..5c4518d045 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.tests.config.impl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
import org.eclipse.emf.cdo.internal.common.revision.cache.noop.NOOPRevisionCache;
-import org.eclipse.emf.cdo.internal.server.clone.RepositorySynchronizer;
+import org.eclipse.emf.cdo.internal.server.syncing.RepositorySynchronizer;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.server.CDOServerUtil;
@@ -275,7 +275,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
synchronizer.setSqueezeCommitInfos(getTestSqueezeCommitInfos());
IStore store = createStore(name);
- return (InternalRepository)CDOServerUtil.createCloneRepository(name, store, props, synchronizer);
+ return (InternalRepository)CDOServerUtil.createOfflineClone(name, store, props, synchronizer);
}
protected boolean getTestSqueezeCommitInfos()

Back to the top