Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-02-19 05:52:48 +0000
committerEike Stepper2011-02-19 05:52:48 +0000
commit85a99073e5f63dc3dcc2dd0db8c41460392791c9 (patch)
treeb403c92a60777b1e296ebe34917c111802bf736a /plugins/org.eclipse.emf.cdo.server.mongodb/src
parent964754c1fa45b319cceff300da3200fe79ac57e1 (diff)
downloadcdo-85a99073e5f63dc3dcc2dd0db8c41460392791c9.tar.gz
cdo-85a99073e5f63dc3dcc2dd0db8c41460392791c9.tar.xz
cdo-85a99073e5f63dc3dcc2dd0db8c41460392791c9.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/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Expr.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Expr.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Expr.java
new file mode 100644
index 0000000000..ec547c74e3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Expr.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2004 - 2011 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.internal.mongodb;
+
+import com.mongodb.DBCollection;
+import com.mongodb.DBCursor;
+import com.mongodb.DBObject;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Expr
+{
+ public void evaluate(DBCollection collection, ResultHandler handler)
+ {
+ DBCursor cursor = findDocuments(collection);
+
+ try
+ {
+ while (cursor.hasNext())
+ {
+ DBObject doc = cursor.next();
+ handleDocument(doc, handler);
+ }
+ }
+ finally
+ {
+ cursor.close();
+ }
+ }
+
+ protected void handleDocument(DBObject doc, ResultHandler handler)
+ {
+ }
+
+ protected abstract DBCursor findDocuments(DBCollection collection);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface ResultHandler
+ {
+
+ }
+}

Back to the top