|
||||||||
| 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:
NeoService neo = new EmbeddedNeo( MyRelationshipTypes.class, "var/neo" );
// ... 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(java.lang.Class<? extends RelationshipType> validRelationshipTypes,
java.lang.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(java.lang.Class<? extends RelationshipType> validRelationshipTypes,
java.lang.String storeDir,
boolean create)
Creates an embedded neo instance with a given set of relationship types and that reads data from a given store. |
|
EmbeddedNeo(java.lang.String dir,
java.lang.Iterable<RelationshipType> relationshipTypes)
|
|
EmbeddedNeo(java.lang.String dir,
RelationshipType[] relationshipTypes)
|
|
EmbeddedNeo(java.lang.String dir,
RelationshipType[] relationshipTypes,
java.util.Map<java.lang.String,java.lang.String> params)
|
|
| Method Summary | |
|---|---|
RelationshipType |
createAndRegisterRelationshipType(java.lang.String name)
|
Node |
createNode()
Creates a Node. |
boolean |
enableRemoteShell()
Enables remote shell access to this Neo instance, if the Neo4j shell project is available on the classpath. |
boolean |
enableRemoteShell(java.util.Map<java.lang.String,java.io.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. |
RelationshipType |
getRelationshipType(java.lang.String name)
|
java.lang.Iterable<RelationshipType> |
getRelationshipTypes()
|
boolean |
hasRelationshipType(java.lang.String name)
|
void |
registerEnumRelationshipTypes(java.lang.Class<? extends RelationshipType> relationshipTypes)
|
RelationshipType |
registerRelationshipType(java.lang.String name)
|
void |
registerRelationshipTypes(java.lang.Iterable<RelationshipType> types)
|
void |
registerRelationshipTypes(RelationshipType[] types)
|
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(java.lang.Class<? extends RelationshipType> validRelationshipTypes,
java.lang.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
java.lang.NullPointerException - if clazz is null
java.lang.IllegalArgumentException - if clazz is not an enum
public EmbeddedNeo(java.lang.Class<? extends RelationshipType> validRelationshipTypes,
java.lang.String storeDir)
new EmbeddedNeo( clazz, storeDir, true ).
validRelationshipTypes - an enum class containing your relationship typesstoreDir - the store directory for the neo db files
java.lang.NullPointerException - if clazz is null
java.lang.IllegalArgumentException - if clazz not an enum
public EmbeddedNeo(java.lang.String dir,
RelationshipType[] relationshipTypes)
public EmbeddedNeo(java.lang.String dir,
RelationshipType[] relationshipTypes,
java.util.Map<java.lang.String,java.lang.String> params)
public EmbeddedNeo(java.lang.String dir,
java.lang.Iterable<RelationshipType> relationshipTypes)
| Method Detail |
|---|
public Node createNode()
NeoServiceNode.
createNode in interface NeoServicepublic Node getNodeById(long id)
NeoService
getNodeById in interface NeoServiceid - the id of the node
id if foundpublic Node getReferenceNode()
NeoService
getReferenceNode in interface NeoServicepublic void shutdown()
NeoService
shutdown in interface NeoServicepublic boolean enableRemoteShell()
NeoServiceshell project is available on the classpath. This method
passed no configuration parameters and is identical to invoking
enableRemoteShell( null ).
enableRemoteShell in interface NeoServicetrue if the shell has been enabled,
false otherwise (false usually indicates that
the shell jar dependency is not on the classpath)public boolean enableRemoteShell(java.util.Map<java.lang.String,java.io.Serializable> initialProperties)
NeoServiceshell 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
enableRemoteShell in interface NeoServiceinitialProperties - 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 void registerEnumRelationshipTypes(java.lang.Class<? extends RelationshipType> relationshipTypes)
registerEnumRelationshipTypes in interface NeoServicepublic java.lang.Iterable<RelationshipType> getRelationshipTypes()
getRelationshipTypes in interface NeoServicepublic RelationshipType getRelationshipType(java.lang.String name)
getRelationshipType in interface NeoServicepublic boolean hasRelationshipType(java.lang.String name)
hasRelationshipType in interface NeoServicepublic RelationshipType createAndRegisterRelationshipType(java.lang.String name)
createAndRegisterRelationshipType in interface NeoServicepublic RelationshipType registerRelationshipType(java.lang.String name)
registerRelationshipType in interface NeoServicepublic void registerRelationshipTypes(java.lang.Iterable<RelationshipType> types)
registerRelationshipTypes in interface NeoServicepublic void registerRelationshipTypes(RelationshipType[] types)
registerRelationshipTypes in interface NeoService
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||