Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-02-20 19:24:10 +0000
committerEike Stepper2011-02-20 19:24:10 +0000
commit86c6fca2effab5a18af9eb07c1c5fc56a3868595 (patch)
treed19baa81ed093e5a3d508c9d4ae37e471e1a553d /plugins/org.eclipse.emf.cdo.server.mongodb
parent47e47653db35600fa437acf4484672ab3297c5e3 (diff)
downloadcdo-86c6fca2effab5a18af9eb07c1c5fc56a3868595.tar.gz
cdo-86c6fca2effab5a18af9eb07c1c5fc56a3868595.tar.xz
cdo-86c6fca2effab5a18af9eb07c1c5fc56a3868595.zip
[337152] [Mongo] Create a MongoDBStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337152
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.mongodb')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStoreAccessor.java4
2 files changed, 16 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
index 062b90b1d9..a153ae5e35 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClassInfo;
import org.eclipse.emf.cdo.common.model.CDOModelConstants;
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
@@ -307,9 +306,9 @@ public class Commits extends Coll
context.applyIDMappings(monitor.fork());
List<DBObject> docs = new ArrayList<DBObject>();
+ marshalRevisions(docs, context.getDetachedRevisions(), CDOChangeKind.DETACHED); // Must come first, bug 272861
marshalRevisions(docs, context.getNewObjects(), CDOChangeKind.NEW);
marshalRevisions(docs, context.getDirtyObjects(), CDOChangeKind.CHANGED);
- marshalRevisions(docs, context.getDetachedRevisions(), CDOChangeKind.DETACHED);
if (!docs.isEmpty())
{
@@ -367,15 +366,14 @@ public class Commits extends Coll
int featureID = revision.getContainingFeatureID();
doc.put(REVISIONS_FEATURE, featureID);
- if (resource && changeKind == CDOChangeKind.NEW)
+ if (resource && changeKind != CDOChangeKind.DETACHED)
{
String name = (String)revision.data().get(resourceNameFeature, 0);
IStoreAccessor accessor = StoreThreadLocal.getAccessor();
- CDOID duplicateID = accessor.readResourceID(containerID, name, revision);
- if (!CDOIDUtil.isNull(duplicateID))
+ CDOID existingID = accessor.readResourceID(containerID, name, revision);
+ if (existingID != null && !existingID.equals(revision.getID()))
{
- duplicateID = accessor.readResourceID(containerID, name, revision);
throw new IllegalStateException("Duplicate resource: name=" + name + ", folderID=" + containerID); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -578,7 +576,7 @@ public class Commits extends Coll
return CDOBranchPoint.UNSPECIFIED_DATE;
}
- public InternalCDORevision readRevision(final CDOID id, CDOBranchPoint branchPoint, int listChunk,
+ public InternalCDORevision readRevision(final CDOID id, final CDOBranchPoint branchPoint, int listChunk,
CDORevisionCacheAdder cache)
{
DBObject query = new BasicDBObject();
@@ -614,7 +612,15 @@ public class Commits extends Coll
InternalCDOBranchManager branchManager = store.getRepository().getBranchManager();
CDOBranchPoint revisionBranchPoint = branchManager.getBranch(revisionBranch).getPoint(revisionTime);
- return unmarshallRevision(doc, embedded, id, revisionBranchPoint);
+ InternalCDORevision revision = unmarshallRevision(doc, embedded, id, revisionBranchPoint);
+
+ // long revised = revision.getRevised();
+ // if (revised != CDOBranchPoint.UNSPECIFIED_DATE && revised < branchPoint.getTimeStamp())
+ // {
+ // return null;
+ // }
+
+ return revision;
}
}.execute();
}
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStoreAccessor.java
index 065b98dad9..ea817c6e61 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/MongoDBStoreAccessor.java
@@ -139,7 +139,7 @@ public class MongoDBStoreAccessor extends StoreAccessorBase implements IMongoDBS
public IQueryHandler getQueryHandler(CDOQueryInfo info)
{
- throw new UnsupportedOperationException("Not yet implemented"); // TODO Implement me
+ return null;
}
public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo)
@@ -187,7 +187,7 @@ public class MongoDBStoreAccessor extends StoreAccessorBase implements IMongoDBS
@Override
protected void doRollback(CommitContext commitContext)
{
- throw new UnsupportedOperationException("Not yet implemented"); // TODO Implement me
+ // Do nothing
}
@Override

Back to the top