Mercurial > hg > AnnotationManagerN4J
changeset 7:798a65338565
move test class to old
author | casties |
---|---|
date | Wed, 11 Jul 2012 17:17:32 +0200 |
parents | 6dfbe2400f64 |
children | c3cc6a41dd1c |
files | src/main/java/de/mpiwg/itgroup/annotations/AnnotationServerDb.java src/main/java/de/mpiwg/itgroup/annotations/old/AnnotationServerDb.java |
diffstat | 2 files changed, 67 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/AnnotationServerDb.java Wed Jul 11 17:08:40 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -package de.mpiwg.itgroup.annotations; - -import org.neo4j.graphdb.GraphDatabaseService; -import org.neo4j.graphdb.factory.GraphDatabaseFactory; -import org.neo4j.kernel.AbstractGraphDatabase; -import org.neo4j.server.WrappingNeoServerBootstrapper; - -public class AnnotationServerDb { - - private static String DB_PATH = "target/neo4j-annotation-db"; - private static GraphDatabaseService graphDb; - - /** - * @param args - */ - public static void main(String[] args) { - AnnotationServerDb db = new AnnotationServerDb(); - db.createDb(); - // do something - AbstractGraphDatabase graphdb = (AbstractGraphDatabase) graphDb; - WrappingNeoServerBootstrapper srv; - srv = new WrappingNeoServerBootstrapper( graphdb ); - System.out.println("Starting server..."); - srv.start(); - // The server is now running - try { - Thread.sleep(300*1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // until we stop it: - System.out.println("Stopping server..."); - srv.stop(); - db.shutDown(); - } - - /** - * - */ - public void createDb() { - System.out.println(); - System.out.println("Starting database "+DB_PATH+" ..."); - graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH); - registerShutdownHook(graphDb); - } - - public void shutDown() { - System.out.println(); - System.out.println("Shutting down database ..."); - // START SNIPPET: shutdownServer - graphDb.shutdown(); - // END SNIPPET: shutdownServer - } - - private static void registerShutdownHook(final GraphDatabaseService graphDb) { - // Registers a shutdown hook for the Neo4j instance so that it - // shuts down nicely when the VM exits (even if you "Ctrl-C" the - // running example before it's completed) - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - graphDb.shutdown(); - } - }); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/itgroup/annotations/old/AnnotationServerDb.java Wed Jul 11 17:17:32 2012 +0200 @@ -0,0 +1,67 @@ +package de.mpiwg.itgroup.annotations.old; + +import org.neo4j.graphdb.GraphDatabaseService; +import org.neo4j.graphdb.factory.GraphDatabaseFactory; +import org.neo4j.kernel.AbstractGraphDatabase; +import org.neo4j.server.WrappingNeoServerBootstrapper; + +public class AnnotationServerDb { + + private static String DB_PATH = "target/neo4j-annotation-db"; + private static GraphDatabaseService graphDb; + + /** + * @param args + */ + public static void main(String[] args) { + AnnotationServerDb db = new AnnotationServerDb(); + db.createDb(); + // do something + AbstractGraphDatabase graphdb = (AbstractGraphDatabase) graphDb; + WrappingNeoServerBootstrapper srv; + srv = new WrappingNeoServerBootstrapper( graphdb ); + System.out.println("Starting server..."); + srv.start(); + // The server is now running + try { + Thread.sleep(300*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // until we stop it: + System.out.println("Stopping server..."); + srv.stop(); + db.shutDown(); + } + + /** + * + */ + public void createDb() { + System.out.println(); + System.out.println("Starting database "+DB_PATH+" ..."); + graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH); + registerShutdownHook(graphDb); + } + + public void shutDown() { + System.out.println(); + System.out.println("Shutting down database ..."); + // START SNIPPET: shutdownServer + graphDb.shutdown(); + // END SNIPPET: shutdownServer + } + + private static void registerShutdownHook(final GraphDatabaseService graphDb) { + // Registers a shutdown hook for the Neo4j instance so that it + // shuts down nicely when the VM exits (even if you "Ctrl-C" the + // running example before it's completed) + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + graphDb.shutdown(); + } + }); + } +}