Skip to content

Commit

Permalink
Core: remove Neo4j MehtaGraph dependency (#390).
Browse files Browse the repository at this point in the history
Does not yet compile.

See ticket 390.
  • Loading branch information
jri committed Dec 26, 2012
1 parent c68591c commit 684d615
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 49 deletions.
Expand Up @@ -8,7 +8,6 @@
<bundle>mvn:com.sun.jersey/jersey-server/1.14</bundle>
<bundle>mvn:com.sun.jersey/jersey-servlet/1.14</bundle>
<bundle>mvn:org.codehaus.jettison/jettison/1.3.2</bundle>
<bundle>mvn:de.deepamehta/neo4j-mehtagraph/1.8</bundle>
<bundle>mvn:commons-fileupload/commons-fileupload/1.2.2</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-io/1.3.2_5</bundle>
<bundle>mvn:org.apache.felix/org.apache.felix.http.jetty/2.2.0</bundle>
Expand Down
5 changes: 0 additions & 5 deletions modules/dm4-core/pom.xml
Expand Up @@ -18,11 +18,6 @@
</parent>

<dependencies>
<!-- Neo4j Metagraph -->
<dependency>
<groupId>de.deepamehta</groupId>
<artifactId>neo4j-mehtagraph</artifactId>
</dependency>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
Expand Down
@@ -1,4 +1,4 @@
package de.deepamehta.core.impl.storage;
package de.deepamehta.core.impl.storage.neo4j;

import de.deepamehta.core.DeepaMehtaTransaction;

Expand Down
@@ -1,4 +1,4 @@
package de.deepamehta.core.impl.storage;
package de.deepamehta.core.impl.storage.neo4j;

import de.deepamehta.core.DeepaMehtaTransaction;
import de.deepamehta.core.ResultSet;
Expand All @@ -14,14 +14,8 @@
import de.deepamehta.core.service.accesscontrol.AccessControlList;
import de.deepamehta.core.storage.DeepaMehtaStorage;

import de.deepamehta.mehtagraph.ConnectedMehtaEdge;
import de.deepamehta.mehtagraph.ConnectedMehtaNode;
import de.deepamehta.mehtagraph.MehtaEdge;
import de.deepamehta.mehtagraph.MehtaGraph;
import de.deepamehta.mehtagraph.MehtaGraphIndexMode;
import de.deepamehta.mehtagraph.MehtaNode;
import de.deepamehta.mehtagraph.MehtaObject;
import de.deepamehta.mehtagraph.MehtaObjectRole;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;

import org.codehaus.jettison.json.JSONObject;

Expand All @@ -37,23 +31,27 @@


/**
* A DeepaMehta storage implementation by the means of a MehtaGraph implementation.
* A DeepaMehta storage implementation by the means of a MehtaGraph implementation. ### FIXDOC
* <p>
* The DeepaMehta service knows nothing about a MehtaGraph and a MehtaGraph knows nothing about DeepaMehta.
* This class bridges between them.
* This class bridges between them. ### FIXDOC
*/
public class MGStorageBridge implements DeepaMehtaStorage {
public class Neo4jStorage implements DeepaMehtaStorage {

// ---------------------------------------------------------------------------------------------- Instance Variables

private MehtaGraph mg;
private GraphDatabaseService neo4j = null;

private final Logger logger = Logger.getLogger(getClass().getName());

// ---------------------------------------------------------------------------------------------------- Constructors

public MGStorageBridge(MehtaGraph mg) {
this.mg = mg;
public Neo4jStorage(String databasePath) {
try {
this.neo4j = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
} catch (Exception e) {
throw new RuntimeException("Creating a Neo4j GraphDatabaseService instance failed", e);
}
}

// -------------------------------------------------------------------------------------------------- Public Methods
Expand Down
Expand Up @@ -2,11 +2,9 @@

import de.deepamehta.core.impl.service.EmbeddedService;
import de.deepamehta.core.impl.service.WebPublishingService;
import de.deepamehta.core.impl.storage.MGStorageBridge;
import de.deepamehta.core.impl.storage.neo4j.Neo4jStorage;
import de.deepamehta.core.service.DeepaMehtaService;

import de.deepamehta.mehtagraph.MehtaGraph;
import de.deepamehta.mehtagraph.MehtaGraphFactory;
import de.deepamehta.core.storage.DeepaMehtaStorage;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
Expand Down Expand Up @@ -45,7 +43,7 @@ public class CoreActivator implements BundleActivator {
public void start(BundleContext context) {
try {
logger.info("========== Starting \"DeepaMehta 4 Core\" ==========");
dms = new EmbeddedService(new MGStorageBridge(openDB()), context);
dms = new EmbeddedService(createStorage(), context);
dms.setupDB();
//
logger.info("Registering DeepaMehta 4 core service at OSGi framework");
Expand Down Expand Up @@ -78,10 +76,10 @@ public void stop(BundleContext context) {

// ------------------------------------------------------------------------------------------------- Private Methods

private MehtaGraph openDB() {
private DeepaMehtaStorage createStorage() {
try {
logger.info("Creating database and indexing services (path=" + DATABASE_PATH + ")");
return MehtaGraphFactory.createInstance(DATABASE_PATH);
return new Neo4jStorage(DATABASE_PATH);
} catch (Exception e) {
throw new RuntimeException("Opening database failed (path=" + DATABASE_PATH + ")", e);
}
Expand Down
@@ -1,11 +1,8 @@
package de.deepamehta.core.impl.service;

import de.deepamehta.core.impl.storage.MGStorageBridge;
import de.deepamehta.core.impl.storage.neo4j.Neo4jStorage;
import de.deepamehta.core.util.JavaUtils;

import de.deepamehta.mehtagraph.MehtaGraph;
import de.deepamehta.mehtagraph.MehtaGraphFactory;

import org.junit.After;
import org.junit.Before;

Expand All @@ -26,8 +23,8 @@ public void setup() {
try {
logger.info("Creating DB and indexing services");
dbPath = JavaUtils.createTempDirectory("dm4-");
MehtaGraph mehtaGraph = MehtaGraphFactory.createInstance(dbPath.getAbsolutePath());
dms = new EmbeddedService(new MGStorageBridge(mehtaGraph), null);
DeepaMehtaStorage storage = new Neo4jStorage(dbPath.getAbsolutePath());
dms = new EmbeddedService(storage, null);
dms.setupDB();
} catch (Exception e) {
throw new RuntimeException("Opening database failed (path=" + dbPath + ")", e);
Expand Down
7 changes: 1 addition & 6 deletions modules/dm4-parent/pom.xml
Expand Up @@ -16,12 +16,6 @@

<dependencyManagement>
<dependencies>
<!-- Neo4j Metagraph -->
<dependency>
<groupId>de.deepamehta</groupId>
<artifactId>neo4j-mehtagraph</artifactId>
<version>1.8</version>
</dependency>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
Expand Down Expand Up @@ -173,6 +167,7 @@
<repository>
<id>deepamehta-public-repository</id>
<url>scpexe://deepamehta.newthinking.net/var/lib/tomcat-6/webapps/ROOT/maven2</url>
<!--url>scpexe://www.deepamehta.de/incoming/public_html/maven2</url-->
</repository>
</distributionManagement>
</project>
7 changes: 0 additions & 7 deletions modules/dm4-provision/3rd-party-bundles/pom.xml
Expand Up @@ -43,13 +43,6 @@
<version>1.3.2</version>
</dependency>

<!-- Neo4j Metagraph -->
<dependency>
<groupId>de.deepamehta</groupId>
<artifactId>neo4j-mehtagraph</artifactId>
<version>1.8</version>
</dependency>

<!-- Commons FileUpload -->
<dependency>
<groupId>commons-fileupload</groupId>
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Expand Up @@ -153,7 +153,6 @@
<show>private</show>
<linksource>true</linksource>
<links>
<link>http://www.deepamehta.de/apidocs/neo4j-mehtagraph/1.1/</link>
<link>http://jersey.java.net/nonav/apidocs/1.8/jersey/</link>
<link>http://jettison.codehaus.org/apidocs/</link> <!-- version 1.2 -->
<link>http://www.osgi.org/javadoc/r4v401/</link>
Expand Down

0 comments on commit 684d615

Please sign in to comment.