de.uniba.wiai.lspi.chord.data
Class URL

java.lang.Object
  extended by de.uniba.wiai.lspi.chord.data.URL
All Implemented Interfaces:
java.io.Serializable

public class URL
extends java.lang.Object
implements java.io.Serializable

Address of nodes. Once created, a URL instance is unmodifiable.

Version:
1.0.5
Author:
Sven Kaffille, Karsten Loesing
See Also:
Serialized Form

Field Summary
static java.util.List<java.lang.String> KNOWN_PROTOCOLS
          The names of the protocols known to this chord implementation.
static int LOCAL_PROTOCOL
          Index of thread protocol (for local chord network ) in KNOWN_PROTOCOLS.
static int RMI_PROTOCOL
          Index of socket protocol in KNOWN_PROTOCOLS.
static int SOCKET_PROTOCOL
          Index of socket protocol in KNOWN_PROTOCOLS.
 
Constructor Summary
URL(java.lang.String urlString)
          Create an instance of URL from urlString.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Overwritten from Object.
 java.lang.String getHost()
          Get the host name contained in this URL.
 java.lang.String getPath()
          Get the path contained in this URL.
 int getPort()
          Get the port contained in this URL.
 java.lang.String getProtocol()
          Get the protocol of this URL.
 int hashCode()
          Overwritten from Object.
 java.lang.String toString()
          Overwritten from Object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

KNOWN_PROTOCOLS

public static final java.util.List<java.lang.String> KNOWN_PROTOCOLS
The names of the protocols known to this chord implementation. The name for each protocol can be referenced with help of the constants for the protocoal e.g. SOCKET_PROTOCOL.


SOCKET_PROTOCOL

public static final int SOCKET_PROTOCOL
Index of socket protocol in KNOWN_PROTOCOLS.

See Also:
Constant Field Values

LOCAL_PROTOCOL

public static final int LOCAL_PROTOCOL
Index of thread protocol (for local chord network ) in KNOWN_PROTOCOLS.

See Also:
Constant Field Values

RMI_PROTOCOL

public static final int RMI_PROTOCOL
Index of socket protocol in KNOWN_PROTOCOLS.

See Also:
Constant Field Values
Constructor Detail

URL

public URL(java.lang.String urlString)
    throws java.net.MalformedURLException
Create an instance of URL from urlString.

Parameters:
urlString - The string to create an URL from.
Throws:
java.net.MalformedURLException - This can occur if urlString does not match the pattern protocol://host[:port]/path, an unknown protocol is specified, or port is negative.
Method Detail

getProtocol

public final java.lang.String getProtocol()
Get the protocol of this URL.

Returns:
The protocol of this URL.

getHost

public final java.lang.String getHost()
Get the host name contained in this URL.

Returns:
Host name contained in this URL.

getPath

public final java.lang.String getPath()
Get the path contained in this URL.

Returns:
The path contained in this URL.

getPort

public final int getPort()
Get the port contained in this URL.

Returns:
The port of this URL. Has value NO_PORT if no port has been specified for this URL.

hashCode

public final int hashCode()
Overwritten from Object.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code of this URL.

equals

public final boolean equals(java.lang.Object obj)
Overwritten from Object.

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
true if provided obj is an instance of URL and has the same attributes as this URL.

toString

public final java.lang.String toString()
Overwritten from Object.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this URL.