org.neo4j.remote
Class Transport

java.lang.Object
  extended by org.neo4j.remote.Transport
Direct Known Subclasses:
LocalTransport, RmiTransport

public abstract class Transport
extends Object

An object that specifies which URIs a specific ConnectionTarget can handle, and can create instances of that ConnectionTarget. The contract for extending this class is that each instance of the same extending class should behave in the same way, they will be treated as equal by the framework.

Author:
Tobias Ivarsson

Constructor Summary
protected Transport(String... protocols)
          Create a new Transport that supports the protocols specified by the supplied protocol schema identifiers.
 
Method Summary
protected abstract  ConnectionTarget create(URI resourceUri)
          Create a RemoteSite that connects to a remote graph database resource on the specified URI.
 boolean equals(Object other)
           
protected abstract  boolean handlesUri(URI resourceUri)
          Determine if this remote site can handle the specified URI.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transport

protected Transport(String... protocols)
Create a new Transport that supports the protocols specified by the supplied protocol schema identifiers. A protocol scheme identifier consists of alphanumeric characters or any of the characters "-.+". The first character of the scheme identifier is always an alphabetic character.

Parameters:
protocols - all the protocol scheme identifiers that this remote site supports.
Throws:
IllegalArgumentException - if no protocols where specified.
See Also:
URI.getScheme()
Method Detail

create

protected abstract ConnectionTarget create(URI resourceUri)
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.

Parameters:
resourceUri - the URI of the remote graph database resource.
Returns:
an instance of the specific ConnectionTarget, that connects to the specified URI.

handlesUri

protected abstract boolean handlesUri(URI resourceUri)
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.

Parameters:
resourceUri - the URI of the remote graph database resource.
Returns:
true if this site can handle the specified URI.

equals

public final boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2010 Neo4j. All Rights Reserved.