Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-04-15 05:21:56 +0000
committerEike Stepper2010-04-15 05:21:56 +0000
commitf748ad6f9497b249b660ce3eabdd4e5631f80280 (patch)
tree4d2a616086f357bdeddfce11e9627ed554b7610d
parent796d7a29cd9d7c58713092d080c2cdc751b57fc4 (diff)
downloadcdo-f748ad6f9497b249b660ce3eabdd4e5631f80280.tar.gz
cdo-f748ad6f9497b249b660ce3eabdd4e5631f80280.tar.xz
cdo-f748ad6f9497b249b660ce3eabdd4e5631f80280.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/CloneRepository.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/RepositorySynchronizer.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/SynchronizableRepository.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java10
6 files changed, 39 insertions, 36 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 71adee5a90..9e01bddfd9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -217,14 +217,18 @@ public class Repository extends Container<Object> implements InternalRepository
checkArg(type, "type"); //$NON-NLS-1$
if (this.type != type)
{
- Type oldType = this.type;
- this.type = type;
- fireEvent(new RepositoryTypeChangedEvent(this, oldType, type));
+ changingType(this.type, type);
+ }
+ }
- if (sessionManager != null)
- {
- sessionManager.sendRepositoryTypeNotification(oldType, type);
- }
+ protected void changingType(Type oldType, Type newType)
+ {
+ type = newType;
+ fireEvent(new RepositoryTypeChangedEvent(this, oldType, newType));
+
+ if (sessionManager != null)
+ {
+ sessionManager.sendRepositoryTypeNotification(oldType, newType);
}
}
@@ -238,14 +242,18 @@ public class Repository extends Container<Object> implements InternalRepository
checkArg(state, "state"); //$NON-NLS-1$
if (this.state != state)
{
- State oldState = this.state;
- this.state = state;
- fireEvent(new RepositoryStateChangedEvent(this, oldState, state));
+ changingState(this.state, state);
+ }
+ }
- if (sessionManager != null)
- {
- sessionManager.sendRepositoryStateNotification(oldState, state);
- }
+ protected void changingState(State oldState, State newState)
+ {
+ this.state = newState;
+ fireEvent(new RepositoryStateChangedEvent(this, oldState, newState));
+
+ if (sessionManager != null)
+ {
+ sessionManager.sendRepositoryStateNotification(oldState, newState);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/CloneRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java
index a1c109638e..4b3f8ef272 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/CloneRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/clone/OfflineClone.java
@@ -13,9 +13,9 @@ package org.eclipse.emf.cdo.internal.server.clone;
/**
* @author Eike Stepper
*/
-public class CloneRepository extends SynchronizableRepository
+public class OfflineClone extends SynchronizableRepository
{
- public CloneRepository()
+ public OfflineClone()
{
setState(State.OFFLINE);
}
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/clone/RepositorySynchronizer.java
index ebfeac0819..8a7e2eb7e8 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/clone/RepositorySynchronizer.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.internal.server.clone;
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchCreatedEvent;
@@ -165,11 +166,11 @@ public class RepositorySynchronizer extends QueueRunner
OM.LOG.info("Disconnected from master.");
if (localRepository.getRootResourceID() == null)
{
- localRepository.setState(CloneRepository.State.INITIAL);
+ localRepository.setState(CDOCommonRepository.State.INITIAL);
}
else
{
- localRepository.setState(CloneRepository.State.OFFLINE);
+ localRepository.setState(CDOCommonRepository.State.OFFLINE);
}
remoteSession.getBranchManager().removeListener(remoteSessionListener);
@@ -330,11 +331,11 @@ public class RepositorySynchronizer extends QueueRunner
private void setRootResourceID()
{
- if (localRepository.getState() == CloneRepository.State.INITIAL)
+ if (localRepository.getState() == CDOCommonRepository.State.INITIAL)
{
CDOID rootResourceID = remoteSession.getRepositoryInfo().getRootResourceID();
localRepository.setRootResourceID(rootResourceID);
- localRepository.setState(CloneRepository.State.OFFLINE);
+ localRepository.setState(CDOCommonRepository.State.OFFLINE);
}
}
@@ -367,12 +368,12 @@ public class RepositorySynchronizer extends QueueRunner
TRACER.trace("Synchronizing with master..."); //$NON-NLS-1$
}
- localRepository.setState(CloneRepository.State.SYNCING);
+ localRepository.setState(CDOCommonRepository.State.SYNCING);
CDOSessionProtocol sessionProtocol = remoteSession.getSessionProtocol();
sessionProtocol.replicateRepository(localRepository);
- localRepository.setState(CloneRepository.State.ONLINE);
+ localRepository.setState(CDOCommonRepository.State.ONLINE);
OM.LOG.info("Synchronized with master.");
}
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/clone/SynchronizableRepository.java
index 9e25c86077..f5f68d6a0b 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/clone/SynchronizableRepository.java
@@ -64,7 +64,7 @@ import java.util.Set;
*
* @author Eike Stepper
*/
-public class SynchronizableRepository extends Repository.Default implements CDOReplicationContext
+public abstract class SynchronizableRepository extends Repository.Default implements CDOReplicationContext
{
private static final String PROP_LAST_REPLICATED_BRANCH_ID = "org.eclipse.emf.cdo.server.clone.lastReplicatedBranchID"; //$NON-NLS-1$
@@ -86,12 +86,6 @@ public class SynchronizableRepository extends Repository.Default implements CDOR
{
}
- @Override
- public Type getType()
- {
- return Type.CLONE;
- }
-
public RepositorySynchronizer getSynchronizer()
{
return synchronizer;
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 132defde5a..59a5520efe 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
@@ -14,7 +14,7 @@ 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.CloneRepository;
+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.server.embedded.CDOSessionConfiguration;
@@ -85,7 +85,7 @@ public final class CDOServerUtil
public static IRepository createCloneRepository(String name, IStore store, Map<String, String> props,
RepositorySynchronizer synchronizer)
{
- CloneRepository repository = new CloneRepository();
+ OfflineClone repository = new OfflineClone();
repository.setName(name);
repository.setStore((InternalStore)store);
repository.setProperties(props);
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 e73d33e717..4d57f0acb1 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,7 +19,7 @@ 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.CloneRepository;
+import org.eclipse.emf.cdo.internal.server.clone.OfflineClone;
import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
import org.eclipse.emf.cdo.server.IMEMStore;
import org.eclipse.emf.cdo.server.IRepository;
@@ -370,7 +370,7 @@ public class OfflineTest extends AbstractCDOTest
public void testDisconnectAndCommit() throws Exception
{
- CloneRepository clone = (CloneRepository)getRepository();
+ OfflineClone clone = (OfflineClone)getRepository();
waitForOnline(clone);
getOfflineConfig().stopMasterTransport();
@@ -391,7 +391,7 @@ public class OfflineTest extends AbstractCDOTest
public void testDisconnectAndCommitAndMerge() throws Exception
{
- CloneRepository clone = (CloneRepository)getRepository();
+ OfflineClone clone = (OfflineClone)getRepository();
waitForOnline(clone);
CDOSession session = openSession();
@@ -416,7 +416,7 @@ public class OfflineTest extends AbstractCDOTest
public void testDisconnectAndCommitAndMergeWithNewPackages() throws Exception
{
- CloneRepository clone = (CloneRepository)getRepository();
+ OfflineClone clone = (OfflineClone)getRepository();
waitForOnline(clone);
getOfflineConfig().stopMasterTransport();
@@ -443,7 +443,7 @@ public class OfflineTest extends AbstractCDOTest
public void testSqueezedCommitInfos_Initial() throws Exception
{
- CloneRepository clone = (CloneRepository)getRepository();
+ OfflineClone clone = (OfflineClone)getRepository();
waitForOnline(clone);
getOfflineConfig().stopMasterTransport();

Back to the top