|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.kernel.EmbeddedGraphDatabase
public final class EmbeddedGraphDatabase
An implementation of GraphDatabaseService that is used to embed Neo4j
in an application. You typically instantiate it by invoking the
single argument constructor that takes
a path to a directory where Neo4j will store its data files, as such:
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "var/graphdb" );
// ... use Neo4j
graphDb.shutdown();
For more information, see GraphDatabaseService.
| Constructor Summary | |
|---|---|
EmbeddedGraphDatabase(String storeDir)
Creates an embedded GraphDatabaseService with a store located in
storeDir, which will be created if it doesn't already exist. |
|
EmbeddedGraphDatabase(String storeDir,
Map<String,String> params)
A non-standard way of creating an embedded GraphDatabaseService
with a set of configuration parameters. |
|
| Method Summary | |
|---|---|
Transaction |
beginTx()
Starts a new transaction and associates it with the current thread. |
Node |
createNode()
Creates a new node. |
boolean |
enableRemoteShell()
Enables remote shell access (with default configuration) to this Neo4j instance, if the Neo4j shell component is available on the classpath. |
boolean |
enableRemoteShell(Map<String,Serializable> initialProperties)
Enables remote shell access to this Neo4j instance, if the Neo4j Shell component is available on the classpath. |
Iterable<Node> |
getAllNodes()
Returns all nodes in the node space. |
Config |
getConfig()
Returns a non-standard configuration object. |
Node |
getNodeById(long id)
Looks up a node by id. |
Node |
getReferenceNode()
Returns the reference node, which is a "starting point" in the node space. |
Relationship |
getRelationshipById(long id)
Looks up a relationship by id. |
Iterable<RelationshipType> |
getRelationshipTypes()
Returns all relationship types currently in the underlying store. |
String |
getStoreDir()
|
static Map<String,String> |
loadConfigurations(String file)
A non-standard convenience method that loads a standard property file and converts it into a generic Map. |
void |
shutdown()
Shuts down Neo4j. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EmbeddedGraphDatabase(String storeDir)
GraphDatabaseService with a store located in
storeDir, which will be created if it doesn't already exist.
storeDir - the store directory for the Neo4j store files
public EmbeddedGraphDatabase(String storeDir,
Map<String,String> params)
GraphDatabaseService
with a set of configuration parameters. Will most likely be removed in
future releases.
Creates an embedded GraphDatabaseService with a store located in
storeDir, which will be created if it doesn't already exist.
storeDir - the store directory for the db filesparams - configuration parameters| Method Detail |
|---|
public static Map<String,String> loadConfigurations(String file)
Map. Will most
likely be removed in future releases.
file - the property file to load
IllegalArgumentException - if file does not existpublic Node createNode()
GraphDatabaseService
createNode in interface GraphDatabaseServicepublic Node getNodeById(long id)
GraphDatabaseService
getNodeById in interface GraphDatabaseServiceid - the id of the node
id if foundpublic Relationship getRelationshipById(long id)
GraphDatabaseService
getRelationshipById in interface GraphDatabaseServiceid - the id of the relationship
id if foundpublic Node getReferenceNode()
GraphDatabaseService
getReferenceNode in interface GraphDatabaseServicepublic void shutdown()
GraphDatabaseService
shutdown in interface GraphDatabaseServicepublic boolean enableRemoteShell()
GraphDatabaseServiceenableRemoteShell( null ).
enableRemoteShell in interface GraphDatabaseServicetrue if the shell has been enabled,
false otherwise (false usually
indicates that the shell jar dependency is not on
the classpath)public boolean enableRemoteShell(Map<String,Serializable> initialProperties)
GraphDatabaseServiceorg.neo4j.shell.ShellClient from the Neo4j Shell project.
Typically, the neo4j-shell binary package is used (see neo4j.org/download).
The shell is parameterized by a map of properties passed in to this method. Currently, two properties are used:
port, an Integer describing the port of the RMI
registry where the Neo4j shell will be bound, defaults to
1337
name, the String under which the Neo4j shell
will be bound in the RMI registry, defaults to shell
enableRemoteShell in interface GraphDatabaseServiceinitialProperties - a set of properties that will be used to
configure the remote shell, or null if the
default properties should be used
true if the shell has been enabled,
false otherwise (false usually
indicates that the shell jar dependency is not on
the classpath)public Iterable<RelationshipType> getRelationshipTypes()
GraphDatabaseServicenode.createRelationshipTo(...). Note that this method is guaranteed to
return all known relationship types, but it does not guarantee that it
won't return more than that (e.g. it can return "historic"
relationship types that no longer have any relationships in the node
space).
getRelationshipTypes in interface GraphDatabaseServicepublic Transaction beginTx()
GraphDatabaseService
beginTx in interface GraphDatabaseServiceorg.neo4j.kernel.impl.transaction.TransactionFailureException - if unable to start transactionpublic Config getConfig()
public String toString()
toString in class Objectpublic String getStoreDir()
public Iterable<Node> getAllNodes()
GraphDatabaseService
getAllNodes in interface GraphDatabaseService
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||