org.neo4j.remote.transports
Class RmiTransport

java.lang.Object
  extended by org.neo4j.remote.Transport
      extended by org.neo4j.remote.transports.RmiTransport

public final class RmiTransport
extends Transport

A Transport that communicates with a remote graph database using RMI.

Author:
Tobias Ivarsson

Constructor Summary
RmiTransport()
          Create a new Transport for the rmi:// protocol.
 
Method Summary
protected  ConnectionTarget create(URI resourceUri)
          Create a RemoteSite that connects to a remote graph database resource on the specified URI.
protected  boolean handlesUri(URI resourceUri)
          Determine if this remote site can handle the specified URI.
static void main(String[] args)
          Start a stand alone Remote graph database / RMI server.
static void register(BasicGraphDatabaseServer server, String resourceUri)
          Registers a GraphDatabaseService as an RMI service with a given name.
static void register(BasicGraphDatabaseServer server, String resourceUri, int port)
          Registers a GraphDatabaseService as an RMI service with a given name on a given port.
static void register(BasicGraphDatabaseServer server, String resourceUri, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
          Registers a GraphDatabaseService as an RMI service with a given name on a given port.
 
Methods inherited from class org.neo4j.remote.Transport
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RmiTransport

public RmiTransport()
Create a new Transport for the rmi:// protocol.

Method Detail

handlesUri

protected boolean handlesUri(URI resourceUri)
Description copied from class: Transport
Determine if this remote site can handle the specified URI. In it's most simple implementation this method can just check if the URI starts with a supported protocol scheme identifier or even simply always return true. A more advanced implementation might connect to the resource on the specified URI to determine if it communicates in a way supported by this remote site. A well behaving implementation returns false instead of throwing an exception.

Specified by:
handlesUri in class Transport
Parameters:
resourceUri - the URI of the remote graph database resource.
Returns:
true if this site can handle the specified URI.

create

protected ConnectionTarget create(URI resourceUri)
Description copied from class: Transport
Create a RemoteSite that connects to a remote graph database resource on the specified URI. If login is required the supplied user name and password are used.

Specified by:
create in class Transport
Parameters:
resourceUri - the URI of the remote graph database resource.
Returns:
an instance of the specific ConnectionTarget, that connects to the specified URI.

register

public static void register(BasicGraphDatabaseServer server,
                            String resourceUri)
                     throws RemoteException,
                            MalformedURLException
Registers a GraphDatabaseService as an RMI service with a given name. If a resource is already registered with the specified name, that resources is replaced. Use Naming.unbind(String) to unregister the GraphDatabaseService.

Parameters:
server - the graph database server to register as an RMI service.
resourceUri - the name in URL form to register the exported graph database server as.
Throws:
RemoteException - if the RMI registry could not be contacted.
MalformedURLException - if the resourceUri is not properly formatted.

register

public static void register(BasicGraphDatabaseServer server,
                            String resourceUri,
                            int port)
                     throws RemoteException,
                            MalformedURLException
Registers a GraphDatabaseService as an RMI service with a given name on a given port. If a resource is already registered with the specified name, that resources is replaced. Use Naming.unbind(String) to unregister the GraphDatabaseService.

Parameters:
server - the graph database server to register as an RMI service.
resourceUri - the name in URL form to register the exported graph database server as.
port - the port number on which the remote object receives calls (if port is zero, an anonymous port is chosen).
Throws:
RemoteException - if the RMI registry could not be contacted.
MalformedURLException - if the resourceUri is not properly formatted.

register

public static void register(BasicGraphDatabaseServer server,
                            String resourceUri,
                            int port,
                            RMIClientSocketFactory csf,
                            RMIServerSocketFactory ssf)
                     throws RemoteException,
                            MalformedURLException
Registers a GraphDatabaseService as an RMI service with a given name on a given port. Uses the specified socket factories to get the sockets for the connections. If a resource is already registered with the specified name, that resources is replaced. Use Naming.unbind(String) to unregister the GraphDatabaseService.

Parameters:
server - the graph database server to register as an RMI service.
resourceUri - the name in URL form to register the exported graph database server as.
port - the port number on which the remote object receives calls (if port is zero, an anonymous port is chosen).
csf - the client-side socket factory for making calls to the remote object.
ssf - the server-side socket factory for receiving remote calls.
Throws:
RemoteException - if the RMI registry could not be contacted.
MalformedURLException - if the resourceUri is not properly formatted.

main

public static void main(String[] args)
                 throws RemoteException,
                        IllegalArgumentException
Start a stand alone Remote graph database / RMI server.

Usage:

 java -cp kernel.jar:jta.jar:remote.jar org.neo4j.remote.sites.RmiSite PATH RESOURCE_URI
 

If the host in the RESOURCE_URI resolves to the local host a registry will be started if none is running.

Any further arguments will be used to register index services. These take the form of:

 class.name.for.the.IndexServiceImplementation:index-service-identifier
 

Parameters:
args - The arguments passed on the command line.
Throws:
RemoteException - when the registration of the server fails.
IllegalArgumentException - when an error was found in the command line arguments.


Copyright © 2010 Neo4j. All Rights Reserved.