org.neo4j.remote
Class RemoteIndexService

java.lang.Object
  extended by org.neo4j.remote.RemoteIndexService
All Implemented Interfaces:
IndexService

public final class RemoteIndexService
extends Object
implements IndexService

An implementation of IndexService for the client side of RemoteGraphDatabase. This requires that IndexServices are registered on the server using BasicGraphDatabaseServer.registerIndexService(String, IndexService).

Author:
Tobias Ivarsson

Constructor Summary
RemoteIndexService(GraphDatabaseService neo, String name)
          Create a new client for an IndexService.
 
Method Summary
 IndexHits<Node> getNodes(String key, Object value)
          Returns all nodes indexed with key and value.
 Node getSingleNode(String key, Object value)
          Returns a single node indexed with associated with key and value.
 void index(Node node, String key, Object value)
          Index node with key and value.
 void removeIndex(Node node, String key, Object value)
          Dissociates a key-value pair from node.
 void setIsolation(Isolation level)
          This operation is not supported by the RemoteIndexService.
 void shutdown()
          Stops this indexing service committing any asynchronous requests that are currently queued (see Isolation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteIndexService

public RemoteIndexService(GraphDatabaseService neo,
                          String name)
Create a new client for an IndexService.

Parameters:
neo - The RemoteGraphDatabase that owns the index.
name - the token that the IndexService was registered under on the server (in BasicGraphDatabaseServer.registerIndexService(String, IndexService) ).
Method Detail

shutdown

public void shutdown()
Description copied from interface: IndexService
Stops this indexing service committing any asynchronous requests that are currently queued (see Isolation). After this method has been invoked any following method invocation on this instance is invalid.

Specified by:
shutdown in interface IndexService

getNodes

public IndexHits<Node> getNodes(String key,
                                Object value)
Description copied from interface: IndexService
Returns all nodes indexed with key and value.

Specified by:
getNodes in interface IndexService
Parameters:
key - the key for index
value - the value for index
Returns:
nodes that have been indexed with key and value

getSingleNode

public Node getSingleNode(String key,
                          Object value)
Description copied from interface: IndexService
Returns a single node indexed with associated with key and value. If no such node exist null is returned. If more then one node is found a runtime exception is thrown.

Specified by:
getSingleNode in interface IndexService
Parameters:
key - the key for index
value - the value for index
Returns:
node that has been indexed with key and value or null

index

public void index(Node node,
                  String key,
                  Object value)
Description copied from interface: IndexService
Index node with key and value. A node can be associated with any number of key-value pairs.

Note about updating an index: If you've indexed a value from a property on a Node and that value gets updated, you'll have to remove the old value in addition to indexing the new value, else both values (the new and the old) will be indexed for that node.

When deleting a Node, application should remove the index entries for the node as well, to keep the index consistent with the node space.

Specified by:
index in interface IndexService
Parameters:
node - node to index
key - the key in the key-value pair to associate with node.
value - the value in the key-value pair to associate with node.

removeIndex

public void removeIndex(Node node,
                        String key,
                        Object value)
Description copied from interface: IndexService
Dissociates a key-value pair from node. If no such association exist this method silently returns.

Specified by:
removeIndex in interface IndexService
Parameters:
node - the node to dissociate from the key-value pair.
key - the key in the key-value pair.
value - the value in the key-value pair.

setIsolation

public void setIsolation(Isolation level)
This operation is not supported by the RemoteIndexService.

Specified by:
setIsolation in interface IndexService
Parameters:
level - the Isolation level to set.
See Also:
IndexService.setIsolation(Isolation)


Copyright © 2010 Neo4j. All Rights Reserved.