|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.neo4j.api.core.EmbeddedNeo
public class EmbeddedNeo
The main Neo factory, with functionality to start and shutdown Neo, create and get nodes and define valid relationship types. This class is typically used in the outer loop in a Neo-enabled application, for example as follows:
EmbeddedNeo neo = new EmbeddedNeo( MyRelationshipTypes.class, "var/neo", true );
// ... use neo
neo.shutdown();
Neo is started when this class is instantiated. It provides operations to
create notes, get nodes
given an id, get the reference node and
ultimately shutdown Neo. Typically, once instantiated
the reference to EmbeddedNeo is stored away in a service registry or in
a singleton instance.
Please note that after startup (i.e. constructor invocation), all operations
that read or write to the node space must be invoked in a transactional context.
| Constructor Summary | |
|---|---|
EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypes,
String storeDir)
Creates an embedded neo instance with a given set of relationship types, that reads data from a given store which will be created if it doesn't already exist. |
|
EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypes,
String storeDir,
boolean create)
Creates an embedded neo instance with a given set of relationship types and that reads data from a given store. |
|
| Method Summary | |
|---|---|
Node |
createNode()
Creates a Node. |
boolean |
enableRemoteShell(Map<String,Serializable> initialProperties)
Enables remote shell access to this Neo instance, if the Neo4j shell project is available on the classpath. |
Node |
getNodeById(long id)
Looks up a node by id. |
Node |
getReferenceNode()
Returns the reference node. |
Class<? extends RelationshipType> |
getRelationshipTypes()
Returns the valid relationship types for this Neo instance invocation. |
void |
shutdown()
Shuts down Neo. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypes,
String storeDir,
boolean create)
validRelationshipTypes - an enum class containing your relationship typesstoreDir - the store directory for the neo db filescreate - whether a new store directory will be created if it doesn't
already exist
NullPointerException - if clazz is null
IllegalArgumentException - if clazz is not an enum
public EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypes,
String storeDir)
new EmbeddedNeo( clazz, storeDir, true ).
validRelationshipTypes - an enum class containing your relationship typesstoreDir - the store directory for the neo db files
NullPointerException - if clazz is null
IllegalArgumentException - if clazz not an enum| Method Detail |
|---|
public Node createNode()
Node.
public Node getNodeById(long id)
id - the id of the node
id if found
RuntimeException - if not foundpublic Node getReferenceNode()
RuntimeException - if unable to get the reference nodepublic void shutdown()
public Class<? extends RelationshipType> getRelationshipTypes()
public boolean enableRemoteShell(Map<String,Serializable> initialProperties)
shell project is available on the classpath. This will
publish a shell access interface on an RMI registry on localhost (with
configurable port and RMI binding name). It can be accessed by a
client that implements org.neo4j.util.shell.ShellClient
from the Neo4J shell project. Typically, the
neoshell 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 Neo shell will be bound, defaults to 1337
name, the String under which the Neo shell will
be bound in the RMI registry, defaults to neoshell
initialProperties - a set of properties that will be used to
configure the remote shell
true if the shell has been enabled,
false otherwise (false usually indicates that
the shell jar dependency is not on the classpath)
ClassCastException - if the shell library is available, but one
(or more) of the configuration properties have an unexpected type
IllegalStateException - if the shell library is available, but
the remote shell can't be enabled anyway
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||