org.neo4j.remote
Interface RemoteConnection


public interface RemoteConnection

Represents a connection to a remote site.

Author:
Tobias Ivarsson

Method Summary
 int beginTransaction()
          Start a new transaction.
 void close()
          Close the remote connection, rolling back all active transactions.
 RemoteResponse<Void> closeNodeIterator(int transactionId, int requestToken)
          Close an iterator over nodes.
 RemoteResponse<Void> closePropertyKeyIterator(int transactionId, int requestToken)
          Close an iterator over property keys.
 RemoteResponse<Void> closeRelationshipIterator(int transactionId, int requestToken)
          Close an iterator over relationships.
 RemoteResponse<Void> closeRelationshipTypeIterator(int transactionId, int requestToken)
          Close an iterator over relationship types.
 void commit(int transactionId)
          Commit a transaction.
 ClientConfigurator configure(Configuration config)
          Co-configure the client and the server for this connection.
 RemoteResponse<NodeSpecification> createNode(int transactionId)
          Create a new node.
 RemoteResponse<RelationshipSpecification> createRelationship(int transactionId, String relationshipTypeName, long startNodeId, long endNodeId)
          Create a new relationship.
 RemoteResponse<Void> deleteNode(int transactionId, long nodeId)
          Delete a node.
 RemoteResponse<Void> deleteRelationship(int transactionId, long relationshipId)
          Delete a relationship.
 RemoteResponse<IterableSpecification<NodeSpecification>> getAllNodes(int transactionId)
          Get all nodes.
 RemoteResponse<IterableSpecification<RelationshipSpecification>> getAllRelationships(int transactionId, long nodeId, Direction direction)
          Get all relationships from a given node.
 RemoteResponse<IterableSpecification<NodeSpecification>> getIndexNodes(int transactionId, int indexId, String key, Object value)
          Get all nodes stored under a specific value in a specific index.
 RemoteResponse<Integer> getIndexServiceId(String indexName)
          Get the id of an index service.
 RemoteResponse<IterableSpecification<NodeSpecification>> getMoreNodes(int transactionId, int requestToken)
          Get the next chunk of the lazy iterator of nodes.
 RemoteResponse<IterableSpecification<String>> getMorePropertyKeys(int transactionId, int requestToken)
          Get the next chunk of the lazy iterator of property keys.
 RemoteResponse<IterableSpecification<RelationshipSpecification>> getMoreRelationships(int transactionId, int requestToken)
          Get the next chunk of the lazy iterator of relationships.
 RemoteResponse<IterableSpecification<String>> getMoreRelationshipTypes(int transactionId, int requestToken)
          Get the next chunk of the lazy iterator of relationship types.
 RemoteResponse<Object> getNodeProperty(int transactionId, long nodeId, String key)
          Get a property from a node.
 RemoteResponse<IterableSpecification<String>> getNodePropertyKeys(int transactionId, long nodeId)
          Get the property keys for a node.
 RemoteResponse<NodeSpecification> getReferenceNode(int transactionId)
          Get the reference node.
 RemoteResponse<RelationshipSpecification> getRelationshipById(int transactionId, long relationshipId)
          Get a relationship.
 RemoteResponse<Object> getRelationshipProperty(int transactionId, long relationshipId, String key)
          Get a property from a relationship.
 RemoteResponse<IterableSpecification<String>> getRelationshipPropertyKeys(int transactionId, long relationshipId)
          Get the property keys for a relationship.
 RemoteResponse<IterableSpecification<RelationshipSpecification>> getRelationships(int transactionId, long nodeId, Direction direction, String[] relationshipTypeNames)
          Get relationships from a given node.
 RemoteResponse<IterableSpecification<String>> getRelationshipTypes(int transactionId)
          Get the relationship types that are registered with the server.
 RemoteResponse<Boolean> hasNodeProperty(int transactionId, long nodeId, String key)
          Check if a node has a specific property.
 RemoteResponse<Boolean> hasNodeWithId(int transactionId, long nodeId)
          Check if a node with the specified id exists.
 RemoteResponse<Boolean> hasRelationshipProperty(int transactionId, long relationshipId, String key)
          Check if a relationship has a specific property.
 RemoteResponse<Void> indexNode(int transactionId, int indexId, long nodeId, String key, Object value)
          Store a node in an index.
 RemoteResponse<Void> removeIndexNode(int transactionId, int indexId, long nodeId, String key, Object value)
          Remove a node from an index.
 RemoteResponse<Object> removeNodeProperty(int transactionId, long nodeId, String key)
          Remove a property from a node.
 RemoteResponse<Object> removeRelationshipProperty(int transactionId, long relationshipId, String key)
          Remove a property from a relationship.
 void rollback(int transactionId)
          Roll back a transaction.
 RemoteResponse<Object> setNodeProperty(int transactionId, long nodeId, String key, Object value)
          Set a property from a node.
 RemoteResponse<Object> setRelationshipProperty(int transactionId, long relationshipId, String key, Object value)
          Set a property from a relationship.
 

Method Detail

configure

ClientConfigurator configure(Configuration config)
Co-configure the client and the server for this connection.

Parameters:
config - An object that represents the configuration of the client.
Returns:
An object that can set up the client according to the agreed configuration.

close

void close()
Close the remote connection, rolling back all active transactions.


beginTransaction

int beginTransaction()
Start a new transaction.

Returns:
an id that represents the transaction.

commit

void commit(int transactionId)
Commit a transaction.

Parameters:
transactionId - The id that represents the transaction to be committed.

rollback

void rollback(int transactionId)
Roll back a transaction.

Parameters:
transactionId - The id that represents the transaction to be rolled back.

getRelationshipTypes

RemoteResponse<IterableSpecification<String>> getRelationshipTypes(int transactionId)
Get the relationship types that are registered with the server.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
Returns:
A serialized iterator containing the names of the relationship types.

getMoreRelationshipTypes

RemoteResponse<IterableSpecification<String>> getMoreRelationshipTypes(int transactionId,
                                                                       int requestToken)
Get the next chunk of the lazy iterator of relationship types.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
A serialized iterator containing the names of the relationship types.

closeRelationshipTypeIterator

RemoteResponse<Void> closeRelationshipTypeIterator(int transactionId,
                                                   int requestToken)
Close an iterator over relationship types.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
nothing.

createNode

RemoteResponse<NodeSpecification> createNode(int transactionId)
Create a new node.

Parameters:
transactionId - the id of the transaction to create the node in.
Returns:
A serialized representation of the created node.

getReferenceNode

RemoteResponse<NodeSpecification> getReferenceNode(int transactionId)
Get the reference node.

Parameters:
transactionId - the id of the transaction to get the reference node in.
Returns:
A serialized representation of the reference node.

hasNodeWithId

RemoteResponse<Boolean> hasNodeWithId(int transactionId,
                                      long nodeId)
Check if a node with the specified id exists.

Parameters:
transactionId - the transaction to check for the node in.
nodeId - the id of the node to check for.
Returns:
true if the node exists, false otherwise.

deleteNode

RemoteResponse<Void> deleteNode(int transactionId,
                                long nodeId)
Delete a node.

Parameters:
transactionId - the id of the transaction to delete the node in.
nodeId - the id of the node to delete.
Returns:
nothing.

getAllNodes

RemoteResponse<IterableSpecification<NodeSpecification>> getAllNodes(int transactionId)
Get all nodes.

Parameters:
transactionId - the id of the transaction to get all nodes in.
Returns:
A serialized iterator containing nodes.

getMoreNodes

RemoteResponse<IterableSpecification<NodeSpecification>> getMoreNodes(int transactionId,
                                                                      int requestToken)
Get the next chunk of the lazy iterator of nodes.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
A serialized iterator containing nodes.

closeNodeIterator

RemoteResponse<Void> closeNodeIterator(int transactionId,
                                       int requestToken)
Close an iterator over nodes.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
nothing.

createRelationship

RemoteResponse<RelationshipSpecification> createRelationship(int transactionId,
                                                             String relationshipTypeName,
                                                             long startNodeId,
                                                             long endNodeId)
Create a new relationship.

Parameters:
transactionId - the id of the transaction to create the relationship in.
relationshipTypeName - the type name of the relationship to create.
startNodeId - the id of the start node for the relationship.
endNodeId - the id of the end node of the relationship.
Returns:
A serialized representation of the created relationship.

getRelationshipById

RemoteResponse<RelationshipSpecification> getRelationshipById(int transactionId,
                                                              long relationshipId)
Get a relationship.

Parameters:
transactionId - the id of the transaction to get the relationship in.
relationshipId - the id of the relationship to get.
Returns:
A serialized representation of the requested relationship.

getAllRelationships

RemoteResponse<IterableSpecification<RelationshipSpecification>> getAllRelationships(int transactionId,
                                                                                     long nodeId,
                                                                                     Direction direction)
Get all relationships from a given node.

Parameters:
transactionId - the id of the transaction to get the relationships in.
nodeId - the id of the node to get the relationships from.
direction - the direction of the relationships from the node.
Returns:
A serialized iterator of relationships.

getRelationships

RemoteResponse<IterableSpecification<RelationshipSpecification>> getRelationships(int transactionId,
                                                                                  long nodeId,
                                                                                  Direction direction,
                                                                                  String[] relationshipTypeNames)
Get relationships from a given node.

Parameters:
transactionId - the id of the transaction to get the relationships in.
nodeId - the id of the node to get the relationships from.
direction - the direction of the relationships from the node.
relationshipTypeNames - the names of the relationship types to get.
Returns:
A serialized iterator of relationships.

getMoreRelationships

RemoteResponse<IterableSpecification<RelationshipSpecification>> getMoreRelationships(int transactionId,
                                                                                      int requestToken)
Get the next chunk of the lazy iterator of relationships.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
A serialized iterator containing relationships.

closeRelationshipIterator

RemoteResponse<Void> closeRelationshipIterator(int transactionId,
                                               int requestToken)
Close an iterator over relationships.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
nothing.

deleteRelationship

RemoteResponse<Void> deleteRelationship(int transactionId,
                                        long relationshipId)
Delete a relationship.

Parameters:
transactionId - the id of the transaction to delete the relationship in.
relationshipId - the id of the relationship to delete.
Returns:
nothing.

getNodeProperty

RemoteResponse<Object> getNodeProperty(int transactionId,
                                       long nodeId,
                                       String key)
Get a property from a node.

Parameters:
transactionId - the id of the transaction to get the property in.
nodeId - the id of the node to get the property from.
key - the key for the property.
Returns:
the property value.

getRelationshipProperty

RemoteResponse<Object> getRelationshipProperty(int transactionId,
                                               long relationshipId,
                                               String key)
Get a property from a relationship.

Parameters:
transactionId - the id of the transaction to get the property in.
relationshipId - the id of the relationship to get the property from.
key - the key for the property.
Returns:
the property value.

setNodeProperty

RemoteResponse<Object> setNodeProperty(int transactionId,
                                       long nodeId,
                                       String key,
                                       Object value)
Set a property from a node.

Parameters:
transactionId - the id of the transaction to get the property in.
nodeId - the id of the node to get the property from.
key - the key for the property.
value - the new value for the property.
Returns:
nothing.

setRelationshipProperty

RemoteResponse<Object> setRelationshipProperty(int transactionId,
                                               long relationshipId,
                                               String key,
                                               Object value)
Set a property from a relationship.

Parameters:
transactionId - the id of the transaction to get the property in.
relationshipId - the id of the relationship to get the property from.
key - the key for the property.
value - the new value for the property.
Returns:
nothing.

getNodePropertyKeys

RemoteResponse<IterableSpecification<String>> getNodePropertyKeys(int transactionId,
                                                                  long nodeId)
Get the property keys for a node.

Parameters:
transactionId - the id of the transaction to get the property keys in.
nodeId - the id of the node to get the property keys from.
Returns:
a serialized iterator of property keys.

getRelationshipPropertyKeys

RemoteResponse<IterableSpecification<String>> getRelationshipPropertyKeys(int transactionId,
                                                                          long relationshipId)
Get the property keys for a relationship.

Parameters:
transactionId - the id of the transaction to get the property keys in.
relationshipId - the id of the relationship to get the property keys from.
Returns:
a serialized iterator of property keys.

getMorePropertyKeys

RemoteResponse<IterableSpecification<String>> getMorePropertyKeys(int transactionId,
                                                                  int requestToken)
Get the next chunk of the lazy iterator of property keys.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
A serialized iterator of property keys.

closePropertyKeyIterator

RemoteResponse<Void> closePropertyKeyIterator(int transactionId,
                                              int requestToken)
Close an iterator over property keys.

Parameters:
transactionId - The id that represents the transaction the operation is executed in.
requestToken - An id that represents the request.
Returns:
nothing.

hasNodeProperty

RemoteResponse<Boolean> hasNodeProperty(int transactionId,
                                        long nodeId,
                                        String key)
Check if a node has a specific property.

Parameters:
transactionId - the id of the transaction to check for the property in.
nodeId - the id of the node where the property should be sought after.
key - the property key.
Returns:
true if the node has ha property with the given key, false otherwise.

hasRelationshipProperty

RemoteResponse<Boolean> hasRelationshipProperty(int transactionId,
                                                long relationshipId,
                                                String key)
Check if a relationship has a specific property.

Parameters:
transactionId - the id of the transaction to check for the property in.
relationshipId - the id of the relationship where the property should be sought after.
key - the property key.
Returns:
true if the relationship has ha property with the given key, false otherwise.

removeNodeProperty

RemoteResponse<Object> removeNodeProperty(int transactionId,
                                          long nodeId,
                                          String key)
Remove a property from a node.

Parameters:
transactionId - the id of the transaction to remove the property in.
nodeId - the id of the node to remove the property from.
key - the property key.
Returns:
the value of the property.

removeRelationshipProperty

RemoteResponse<Object> removeRelationshipProperty(int transactionId,
                                                  long relationshipId,
                                                  String key)
Remove a property from a relationship.

Parameters:
transactionId - the id of the transaction to remove the property in.
relationshipId - the id of the relationship to remove the property from.
key - the property key.
Returns:
the value of the property.

getIndexServiceId

RemoteResponse<Integer> getIndexServiceId(String indexName)
Get the id of an index service.

Parameters:
indexName - a string token that identifies the index service.
Returns:
the id of the identified index service.

getIndexNodes

RemoteResponse<IterableSpecification<NodeSpecification>> getIndexNodes(int transactionId,
                                                                       int indexId,
                                                                       String key,
                                                                       Object value)
Get all nodes stored under a specific value in a specific index.

Parameters:
transactionId - the id of the transaction to get the nodes in.
indexId - the id of the index service to get the nodes from.
key - the key for the index to get the nodes from.
value - the value that the nodes are stored under.
Returns:
A serialized iterator containing nodes.

indexNode

RemoteResponse<Void> indexNode(int transactionId,
                               int indexId,
                               long nodeId,
                               String key,
                               Object value)
Store a node in an index.

Parameters:
transactionId - the id of the transaction modify the index in.
indexId - the id of the index service to modify.
nodeId - the id of the node to store in the index.
key - the key for the index to store the node in.
value - the value that the node should be stored under.
Returns:
nothing.

removeIndexNode

RemoteResponse<Void> removeIndexNode(int transactionId,
                                     int indexId,
                                     long nodeId,
                                     String key,
                                     Object value)
Remove a node from an index.

Parameters:
transactionId - the id of the transaction modify the index in.
indexId - the id of the index service to modify.
nodeId - the id of the node to remove from the index.
key - the key for the index the node is stored in.
value - the value that the node is stored under.
Returns:
nothing.


Copyright © 2010 Neo4j. All Rights Reserved.