EmbeddedNeo (Neo 1.0-b6 API)
Keywords: org.neo4j.api.core.EmbeddedNeo class

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.api.core
Class EmbeddedNeo

    java.lang.Object
      org.neo4j.api.core.EmbeddedNeo

All Implemented Interfaces:
  NeoService

    public final class EmbeddedNeo

extends Object
implements NeoService

An implementation of `NeoService` that is used to embed Neo in an application. You typically instantiate it by invoking the `single argument constructor` that takes a path to a directory where Neo will store its data files, as such: ``

    NeoService neo = new EmbeddedNeo( "var/neo" );
     // ... use neo
     neo.shutdown();

There's a `legacy constructor` which was used in earlier versions to define valid `relationship types`. Since version `1.0-b6`, relationship types are `dynamically created` so it's now been marked deprecated. The same goes for all the relationship type management operations. Expect them to be removed in future releases.

For more information, see `NeoService`.

Constructor Summary
`EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypesEnum, String storeDir)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`EmbeddedNeo(String storeDir)` Creates an embedded `NeoService` with a store located in `storeDir`, which will be created if it doesn't already exist.

Method Summary
`RelationshipType` | `createAndRegisterRelationshipType(String name)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`Node` | `createNode()` Creates a new node.
`boolean` | `enableRemoteShell()` Enables remote shell access (with default configuration) to this Neo instance, if the Neo4j `shell` component is available on the classpath.
`boolean` | `enableRemoteShell(Map<String,Serializable> initialProperties)` Enables remote shell access to this Neo instance, if the Neo4j `shell` component is available on the classpath.
`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.
`RelationshipType` | `getRelationshipType(String name)` Deprecated. Might not be needed now that relationship types are `created dynamically`.
`Iterable<RelationshipType>` | `getRelationshipTypes()` Deprecated. Might not be needed now that relationship types are `created dynamically`.
`boolean` | `hasRelationshipType(String name)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`void` | `registerEnumRelationshipTypes(Class<? extends RelationshipType> relationshipTypes)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`RelationshipType` | `registerRelationshipType(String name)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`void` | `registerRelationshipTypes(Iterable<RelationshipType> types)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`void` | `registerRelationshipTypes(RelationshipType[] types)` Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.
`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

### EmbeddedNeo

    public EmbeddedNeo(String storeDir)

  Creates an embedded `NeoService` with a store located in `storeDir`, which will be created if it doesn't already exist.

  Parameters:
    `storeDir` - the store directory for the neo db files

### EmbeddedNeo

    public EmbeddedNeo(Class<? extends RelationshipType> validRelationshipTypesEnum,
                       String storeDir)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

  Creates an embedded `NeoService` that uses the store located in `storeDir`. This constructor is kept for backwards compatibility. It accepted an enum which defined a valid set of relationship types. Relationship types are now `dynamically created`, so this constructor is deprecated. Invoking it is identical to invoking `EmbeddedNeo(storeDir)`.

  Parameters:
    `validRelationshipTypesEnum` - an enum class containing your relationship types, as described in the documentation of `RelationshipType`
    `storeDir` - the store directory for the neo db files
  Throws:
    `NullPointerException` - if validRelationshipTypesEnum is `null`
    `IllegalArgumentException` - if validRelationshipTypesEnum is not an enum that implements `RelationshipType`

Method Detail

### createNode

    public Node createNode()

  Description copied from interface: `NeoService`
  Creates a new node.

  Specified by:
    `createNode` in interface `NeoService`
  Returns:
    the created node.

### getNodeById

    public Node getNodeById(long id)

  Description copied from interface: `NeoService`
  Looks up a node by id.

  Specified by:
    `getNodeById` in interface `NeoService`
  Parameters:
    `id` - the id of the node
  Returns:
    the node with id `id` if found

### getReferenceNode

    public Node getReferenceNode()

  Description copied from interface: `NeoService`
  Returns the reference node, which is a "starting point" in the node space. Usually, a client attaches relationships to this node that leads into various parts of the node space. For more information about common node space organizational patterns, see the design guide at http://neo4j.org/doc.

  Specified by:
    `getReferenceNode` in interface `NeoService`
  Returns:
    the reference node

### shutdown

    public void shutdown()

  Description copied from interface: `NeoService`
  Shuts down Neo. After this method has been invoked, it's invalid to invoke any methods in the Neo API and all references to this instance of NeoService should be discarded.

  Specified by:
    `shutdown` in interface `NeoService`

### enableRemoteShell

    public boolean enableRemoteShell()

  Description copied from interface: `NeoService`
  Enables remote shell access (with default configuration) to this Neo instance, if the Neo4j `shell` component is available on the classpath. This method is identical to invoking `enableRemoteShell( null )`.

  Specified by:
    `enableRemoteShell` in interface `NeoService`
  Returns:
    `true` if the shell has been enabled, `false` otherwise (`false` usually indicates that the `shell` jar dependency is not on the classpath)

### enableRemoteShell

    public boolean enableRemoteShell(Map<String,Serializable> initialProperties)

  Description copied from interface: `NeoService`
  Enables remote shell access to this Neo instance, if the Neo4j `shell` component 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`

  Specified by:
    `enableRemoteShell` in interface `NeoService`
  Parameters:
    `initialProperties` - a set of properties that will be used to configure the remote shell, or `null` if the default properties should be used
  Returns:
    `true` if the shell has been enabled, `false` otherwise (`false` usually indicates that the `shell` jar dependency is not on the classpath)

### getRelationshipTypes

    public Iterable<RelationshipType> getRelationshipTypes()

  Deprecated. Might not be needed now that relationship types are `created dynamically`.

  Returns all relationship types in the underlying store. Relationship types are added to the underlying store the first time they are used in `Node.createRelationshipTo(org.neo4j.api.core.Node, org.neo4j.api.core.RelationshipType)`.

  Returns:
    all relationship types in the underlying store

### getRelationshipType

    public RelationshipType getRelationshipType(String name)

  Deprecated. Might not be needed now that relationship types are `created dynamically`.

  Returns a relationship type with the same name if it exists in the underlying store, or `null`. A new relationship type is added to the underlying store the first time a relationship with the new type is `created`.

  Parameters:
    `name` - the name of the relationship type
  Returns:
    a relationship type with the given name, or `null` if there's no such relationship type in the underlying store

### hasRelationshipType

    public boolean hasRelationshipType(String name)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

### registerEnumRelationshipTypes

    public void registerEnumRelationshipTypes(Class<? extends RelationshipType> relationshipTypes)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

### createAndRegisterRelationshipType

    public RelationshipType createAndRegisterRelationshipType(String name)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

### registerRelationshipType

    public RelationshipType registerRelationshipType(String name)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

### registerRelationshipTypes

    public void registerRelationshipTypes(Iterable<RelationshipType> types)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

### registerRelationshipTypes

    public void registerRelationshipTypes(RelationshipType[] types)

  Deprecated. Not required now that relationship types are `created dynamically`. Will be removed in next release.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Neo4j. All Rights Reserved.