Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-07-20 11:50:52 +0000
committerEike Stepper2011-07-20 11:50:52 +0000
commitaf719ba16912427971a462cf41f6245cde962ab6 (patch)
tree8ea61c606d79b36652b1fdbcc7299aeac7ea0b9b /plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf
parentad46e775fa0f070dcb43eaea4e8b260e3e9bf443 (diff)
downloadcdo-af719ba16912427971a462cf41f6245cde962ab6.tar.gz
cdo-af719ba16912427971a462cf41f6245cde962ab6.tar.xz
cdo-af719ba16912427971a462cf41f6245cde962ab6.zip
[352561] Support client assigned CDOIDs (UUIDs)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352561
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf')
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java10
3 files changed, 32 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
index 7ba8d31561..ec77a73c52 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
@@ -159,6 +159,8 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
private boolean ensuringReferentialIntegrity;
+ private IDGenerationLocation idGenerationLocation;
+
private InternalCDOSession session;
public RepositoryInfo(String name, OpenSessionResult result, InternalCDOSession session)
@@ -176,6 +178,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
supportingBranches = result.isRepositorySupportingBranches();
supportingEcore = result.isRepositorySupportingEcore();
ensuringReferentialIntegrity = result.isRepositoryEnsuringReferentialIntegrity();
+ idGenerationLocation = result.getRepositoryIDGenerationLocation();
this.session = session;
}
@@ -267,6 +270,11 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
return ensuringReferentialIntegrity;
}
+ public IDGenerationLocation getIDGenerationLocation()
+ {
+ return idGenerationLocation;
+ }
+
private RepositoryTimeResult refreshTime()
{
return session.getSessionProtocol().getRepositoryTime();
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java
index d66602bd3d..75279e6125 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java
@@ -55,19 +55,13 @@ public class CommitXATransactionPhase2Request extends CommitXATransactionRequest
protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
{
requestingTransactionInfo(out);
- requestingIdMapping(out);
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- return confirmingCheckError(in);
+ requestingIDMapping(out);
}
/**
- * Write ids that are needed. only If it needs to
+ * Write IDs that are needed. only If it needs to
*/
- protected void requestingIdMapping(CDODataOutput out) throws IOException
+ protected void requestingIDMapping(CDODataOutput out) throws IOException
{
InternalCDOXACommitContext context = getCommitContext();
Map<CDOIDTempObjectExternalImpl, InternalCDOTransaction> requestedIDs = context.getRequestedIDs();
@@ -77,13 +71,13 @@ public class CommitXATransactionPhase2Request extends CommitXATransactionRequest
{
PROTOCOL.format("Number of ids requested: {0}", size); //$NON-NLS-1$
}
-
+
for (Entry<CDOIDTempObjectExternalImpl, InternalCDOTransaction> entry : requestedIDs.entrySet())
{
CDOIDTempObjectExternalImpl tempID = entry.getKey();
URI oldURIExternal = URI.createURI(tempID.toURIFragment());
CDOID oldCDOID = CDOIDUtil.read(oldURIExternal.fragment());
-
+
InternalCDOXACommitContext commitContext = context.getTransactionManager().getCommitContext(entry.getValue());
if (commitContext == null)
{
@@ -91,7 +85,7 @@ public class CommitXATransactionPhase2Request extends CommitXATransactionRequest
Messages.getString("CommitTransactionPhase2Request.1"), entry //$NON-NLS-1$
.getValue()));
}
-
+
CDOID newID = commitContext.getResult().getIDMappings().get(oldCDOID);
if (newID == null)
{
@@ -99,17 +93,23 @@ public class CommitXATransactionPhase2Request extends CommitXATransactionRequest
Messages.getString("CommitTransactionPhase2Request.2"), oldCDOID //$NON-NLS-1$
.toURIFragment()));
}
-
+
CDOID newIDExternal = CDOURIUtil.convertExternalCDOID(oldURIExternal, newID);
if (PROTOCOL.isEnabled())
{
PROTOCOL.format("ID mapping: {0} --> {1}", tempID.toURIFragment(), newIDExternal.toURIFragment()); //$NON-NLS-1$
}
-
+
out.writeCDOID(tempID);
out.writeCDOID(newIDExternal);
-
+
context.getResult().addIDMapping(tempID, newIDExternal);
}
}
+
+ @Override
+ protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
+ {
+ return confirmingCheckError(in);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java
index eb6f74b4b3..601496df3f 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.cdo.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
@@ -175,9 +176,16 @@ public class OpenSessionRequest extends CDOClientRequestWithMonitoring<OpenSessi
TRACER.format("Read repositoryEnsuringReferentialIntegrity: {0}", repositoryEnsuringReferentialIntegrity); //$NON-NLS-1$
}
+ IDGenerationLocation repositoryIDGenerationLocation = in.readEnum(IDGenerationLocation.class);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read repositoryIDGenerationLocation: {0}", repositoryIDGenerationLocation); //$NON-NLS-1$
+ }
+
result = new OpenSessionResult(sessionID, userID, repositoryUUID, repositoryType, repositoryState, storeType,
objectIDTypes, repositoryCreationTime, lastUpdateTime, rootResourceID, repositorySupportingAudits,
- repositorySupportingBranches, repositorySupportingEcore, repositoryEnsuringReferentialIntegrity);
+ repositorySupportingBranches, repositorySupportingEcore, repositoryEnsuringReferentialIntegrity,
+ repositoryIDGenerationLocation);
CDOPackageUnit[] packageUnits = in.readCDOPackageUnits(null);
for (int i = 0; i < packageUnits.length; i++)

Back to the top