org.avis.common
Class ElvinURI

java.lang.Object
  extended by org.avis.common.ElvinURI

public class ElvinURI
extends Object

An Elvin URI identifying an Elvin router as described in the "Elvin URI Scheme" specification at http://elvin.org/specs/draft-elvin-uri-prelim-02.txt. The most common Elvin URI for a TCP endpoint is of the form (sections in in [] are optional):

   elvin:[version]/[protocol]/hostname[:port][;options]
   
   version:  protocol version major.minor form e.g. "4.0"
   protocol: protocol stack in transport,security,marshalling order
             e.g. "tcp,none,xdr". Alternatively the alias "secure"
             can be used to denote the default secure stack
             ("ssl,none,xdr").
   options:  name1=value1[;name2=value2]* e.g. foo=bar;black=white
 

Example URI 1: elvin://localhost:2917

Example URI 2: elvin://192.168.0.2:2917;foo=true

Example URI 3: elvin:4.0/ssl,none,xdr/localhost:443

Author:
Matthew Phillips

Field Summary
 String host
          The host name.
 Map<String,String> options
          The URI options.
 int port
          The port.
 List<String> protocol
          The stack of protocol modules in (transport,security,marshalling) order.
 String scheme
          The URI scheme (i.e the part before the ":").
 String uriString
          The original URI string as passed into the constructor.
 int versionMajor
          Major protocol version.
 int versionMinor
          Minor protocol version.
 
Constructor Summary
ElvinURI(ElvinURI defaultUri)
          Create a copy of a URI.
ElvinURI(String uriString)
          Create a new instance.
ElvinURI(String uriString, ElvinURI defaultUri)
          Create a new instance using an existing URI for defaults.
ElvinURI(String host, int port)
          Create a new instance from a host and port using defaults for others.
 
Method Summary
static List<String> defaultProtocol()
          The default URI protocol stack: "tcp", "none", "xdr"
 boolean equals(ElvinURI uri)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isSecure()
          True if this URI specifies secure TLS transport (protocol.equals (secureProtocol ())).
static List<String> secureProtocol()
          The secure URI protocol stack: "ssl", "none", "xdr"
 String toCanonicalString()
          Generate a canonical text version of this URI.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

uriString

public String uriString
The original URI string as passed into the constructor.


scheme

public String scheme
The URI scheme (i.e the part before the ":"). This must be "elvin" for URI's referring to Elvin routers.


versionMajor

public int versionMajor
Major protocol version. Default is Common.CLIENT_VERSION_MAJOR.


versionMinor

public int versionMinor
Minor protocol version. Default is Common.CLIENT_VERSION_MINOR.


protocol

public List<String> protocol
The stack of protocol modules in (transport,security,marshalling) order. e.g. "tcp", "none", "xdr". See also defaultProtocol()


host

public String host
The host name.


port

public int port
The port. Default is Common.DEFAULT_PORT.


options

public Map<String,String> options
The URI options. e.g. elvin://host:port;option1=value1;option2=value2

Constructor Detail

ElvinURI

public ElvinURI(String uriString)
         throws InvalidURIException
Create a new instance.

Parameters:
uriString - The URI.
Throws:
InvalidURIException - if the URI is not valid.

ElvinURI

public ElvinURI(String host,
                int port)
Create a new instance from a host and port using defaults for others.

Parameters:
host - Host name or IP address
port - Port number.

ElvinURI

public ElvinURI(String uriString,
                ElvinURI defaultUri)
         throws InvalidURIException
Create a new instance using an existing URI for defaults.

Parameters:
uriString - The URI string.
defaultUri - The URI to use for any values that are not specified by uriString.
Throws:
InvalidURIException - if the URI is not valid.

ElvinURI

public ElvinURI(ElvinURI defaultUri)
Create a copy of a URI.

Parameters:
defaultUri - The URI to copy.
Method Detail

toString

public String toString()
Overrides:
toString in class Object

toCanonicalString

public String toCanonicalString()
Generate a canonical text version of this URI.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

equals

public boolean equals(ElvinURI uri)

defaultProtocol

public static List<String> defaultProtocol()
The default URI protocol stack: "tcp", "none", "xdr"


secureProtocol

public static List<String> secureProtocol()
The secure URI protocol stack: "ssl", "none", "xdr"


isSecure

public boolean isSecure()
True if this URI specifies secure TLS transport (protocol.equals (secureProtocol ())).



Copyright © 2008 Matthew Phillips. All Rights Reserved.