diff options
5 files changed, 48 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java index 56850624f4..c5fb283593 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java @@ -13,6 +13,7 @@ */ package org.eclipse.emf.cdo.internal.server.mem; +import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation; import org.eclipse.emf.cdo.common.branch.CDOBranch; import org.eclipse.emf.cdo.common.branch.CDOBranchHandler; import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; @@ -75,6 +76,7 @@ import java.io.Writer; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -134,6 +136,40 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader, Du this(UNLIMITED); } + @Override + public CDOID createObjectID(String val) + { + if (getRepository().getIDGenerationLocation() == IDGenerationLocation.CLIENT) + { + byte[] decoded = CDOIDUtil.decodeUUID(val); + return CDOIDUtil.createUUID(decoded); + } + + return super.createObjectID(val); + } + + @Override + public boolean isLocal(CDOID id) + { + if (getRepository().getIDGenerationLocation() == IDGenerationLocation.CLIENT) + { + return false; + } + + return super.isLocal(id); + } + + @Override + public void ensureLastObjectID(CDOID id) + { + if (getRepository().getIDGenerationLocation() == IDGenerationLocation.CLIENT) + { + return; + } + + super.ensureLastObjectID(id); + } + public synchronized Map<String, String> getPersistentProperties(Set<String> names) { if (names == null || names.isEmpty()) @@ -966,7 +1002,12 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader, Du protected void doActivate() throws Exception { super.doActivate(); - creationTime = System.currentTimeMillis(); + creationTime = getRepository().getTimeStamp(); + + if (getRepository().getIDGenerationLocation() == IDGenerationLocation.CLIENT) + { + setObjectIDTypes(Collections.singleton(CDOID.ObjectType.UUID)); + } } @Override diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/IMEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/IMEMStore.java index aa972e8ca8..ef73bbdbd8 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/IMEMStore.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/IMEMStore.java @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider; import org.eclipse.emf.cdo.common.revision.CDORevision; import org.eclipse.emf.cdo.server.IStore; +import org.eclipse.emf.cdo.server.IStore.CanHandleClientAssignedIDs; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; @@ -27,7 +28,7 @@ import org.eclipse.emf.ecore.EClass; * @noimplement This interface is not intended to be implemented by clients. * @since 4.0 */ -public interface IMEMStore extends IStore, CDOAllRevisionsProvider +public interface IMEMStore extends IStore, CDOAllRevisionsProvider, CanHandleClientAssignedIDs { public static final int UNLIMITED = -1; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java index e6a2abecf6..2a367441ca 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java @@ -29,6 +29,7 @@ public class AllTests extends AllConfigs addScenario(parent, COMBINED, MEM, JVM, NATIVE); addScenario(parent, COMBINED, MEM_AUDITS, JVM, NATIVE); addScenario(parent, COMBINED, MEM_BRANCHES, JVM, NATIVE); + addScenario(parent, COMBINED, MEM_BRANCHES_UUIDS, JVM, NATIVE); addScenario(parent, COMBINED, MEM, JVM, LEGACY); addScenario(parent, COMBINED, MEM_AUDITS, JVM, LEGACY); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java index a7d6bb373b..d191576574 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_327604_Test.java @@ -166,6 +166,7 @@ public class Bugzilla_327604_Test extends AbstractCDOTest config.setRemote(remote); config.setBranchPath(branchPath); config.setTimeStamp(timeStamp); + config.setIDGenerationLocation(getRepository().getIDGenerationLocation()); InternalCDOWorkspace workspace = (InternalCDOWorkspace)config.checkout(); workspaces.add(workspace); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java index 1576b402f4..5a6aa2dcb6 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java @@ -34,6 +34,8 @@ public interface IConstants public static final RepositoryConfig MEM_BRANCHES = new MEMConfig(true, true, IDGenerationLocation.STORE); + public static final RepositoryConfig MEM_BRANCHES_UUIDS = new MEMConfig(true, true, IDGenerationLocation.CLIENT); + public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig(IDGenerationLocation.CLIENT); public static final SessionConfig EMBEDDED = SessionConfig.Embedded.INSTANCE; |