org.neo4j.remote
Class BasicGraphDatabaseServer

java.lang.Object
  extended by org.neo4j.remote.BasicGraphDatabaseServer
All Implemented Interfaces:
ConnectionTarget
Direct Known Subclasses:
LocalGraphDatabase

public abstract class BasicGraphDatabaseServer
extends Object
implements ConnectionTarget

A Basic implementation of a Server for a remote graph database. This implementation relies on the GraphDatabaseService API to perform the actions of the remote graph database communication protocol. To make a concrete implementation the subclass needs to implement the two abstract methods that provide a GraphDatabaseService implementation upon connection. One for authenticated connection and one for unauthenticated connection. One also needs to provide the transaction manager used by the GraphDatabaseService to the constructor of the server.

Author:
Tobias Ivarsson

Constructor Summary
protected BasicGraphDatabaseServer(TransactionManager txManager)
          Create a new server for a remote graph database.
 
Method Summary
 RemoteConnection connect()
          Connect to the remote site.
 RemoteConnection connect(String username, String password)
          Connect to the remote site.
protected abstract  GraphDatabaseService connectGraphDatabase()
          Create an unauthenticated connection.
protected abstract  GraphDatabaseService connectGraphDatabase(String username, String password)
          Create an authenticated connection.
protected  int getKeysBatchSize(int returned)
          Get the size of the next batch of property keys sent to the client in an iteration.
protected  int getNodesBatchSize(int returned)
          Get the size of the next batch of Nodes sent to the client in an iteration.
protected  int getRelationshipsBatchSize(int returned)
          Get the size of the next batch of Relationships sent to the client in an iteration.
 long getTotalNumberOfNodes(GraphDatabaseService neo)
           
protected  int getTypesBatchSize(int returned)
          Get the size of the next batch of RelationshipTypes sent to the client in an iteration.
 void registerIndexService(String name, IndexService index)
          Register a server side index service implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGraphDatabaseServer

protected BasicGraphDatabaseServer(TransactionManager txManager)
Create a new server for a remote graph database.

Parameters:
txManager - The transaction manager to use on the server.
Method Detail

connectGraphDatabase

protected abstract GraphDatabaseService connectGraphDatabase()
Create an unauthenticated connection.

Returns:
The GraphDatabaseService implementation to use for the connection.

connectGraphDatabase

protected abstract GraphDatabaseService connectGraphDatabase(String username,
                                                             String password)
Create an authenticated connection.

Parameters:
username - The name of the authenticating user.
password - The password for the authenticating user.
Returns:
The GraphDatabaseService implementation to use for the connection.

getNodesBatchSize

protected int getNodesBatchSize(int returned)
Get the size of the next batch of Nodes sent to the client in an iteration. Override to change the default batch size or create a smarter batching scheme.

Parameters:
returned - The number of previously returned elements in the iteration.
Returns:
The size of the next batch of elements to send to the client.

getTypesBatchSize

protected int getTypesBatchSize(int returned)
Get the size of the next batch of RelationshipTypes sent to the client in an iteration. Override to change the default batch size or create a smarter batching scheme.

Parameters:
returned - The number of previously returned elements in the iteration.
Returns:
The size of the next batch of elements to send to the client.

getRelationshipsBatchSize

protected int getRelationshipsBatchSize(int returned)
Get the size of the next batch of Relationships sent to the client in an iteration. Override to change the default batch size or create a smarter batching scheme.

Parameters:
returned - The number of previously returned elements in the iteration.
Returns:
The size of the next batch of elements to send to the client.

getKeysBatchSize

protected int getKeysBatchSize(int returned)
Get the size of the next batch of property keys sent to the client in an iteration. Override to change the default batch size or create a smarter batching scheme.

Parameters:
returned - The number of previously returned elements in the iteration.
Returns:
The size of the next batch of elements to send to the client.

registerIndexService

public void registerIndexService(String name,
                                 IndexService index)
Register a server side index service implementation.

Parameters:
name - A name that identifies the index service implementation.
index - The index service implementation to register.

connect

public final RemoteConnection connect()
Description copied from interface: ConnectionTarget
Connect to the remote site.

Specified by:
connect in interface ConnectionTarget
Returns:
The connection to the remote site.

connect

public RemoteConnection connect(String username,
                                String password)
Description copied from interface: ConnectionTarget
Connect to the remote site.

Specified by:
connect in interface ConnectionTarget
Parameters:
username - The name of the user that makes the connection.
password - The password for the user that makes the connection.
Returns:
The connection to the remote site.

getTotalNumberOfNodes

public long getTotalNumberOfNodes(GraphDatabaseService neo)


Copyright © 2010 Neo4j. All Rights Reserved.