springs.context
Class ContextAddress

java.lang.Object
  |
  +--springs.context.ContextAddress
All Implemented Interfaces:
java.io.Serializable

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

A context address.

Author:
Sergio Ilarri Artigas
See Also:
Serialized Form

Field Summary
private  java.lang.String _hostname
           
private  java.lang.String _name
           
private  int _numPort
           
private  java.lang.String _protocol
           
static java.lang.String NOT_SPECIFIED_CONTEXT_NAME
           
 
Constructor Summary
ContextAddress(java.lang.String name, java.lang.String string)
          Constructor.
ContextAddress(java.lang.String name, java.lang.String url, int numPort)
          Constructor.
ContextAddress(java.lang.String name, java.lang.String protocol, java.lang.String url, int numPort)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getHostname()
          Gets the hostname.
 java.lang.String getName()
          Gets the name of the context.
 int getPort()
          Gets the port.
 java.lang.String getProtocol()
          Gets the protocol.
 java.lang.String getURL()
          Gets the URL.
 int increasePortNumber()
          Increases the port number.
 springs.context.ContextAddress replaceHostnameWith(java.lang.String newHostname)
          Obtains a copy of this context address but replacing first hostname.
 java.lang.String toString()
           
 java.lang.String toStringAsLocalhost()
          Converts the context address into a string but replacing the URL by "localhos".
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_SPECIFIED_CONTEXT_NAME

public static final java.lang.String NOT_SPECIFIED_CONTEXT_NAME
See Also:
Constant Field Values

_name

private java.lang.String _name

_protocol

private java.lang.String _protocol

_hostname

private java.lang.String _hostname

_numPort

private int _numPort
Constructor Detail

ContextAddress

public ContextAddress(java.lang.String name,
                      java.lang.String protocol,
                      java.lang.String url,
                      int numPort)
Constructor.

Parameters:
name - the name of the context.
protocol - the protocol (e.g. "socket", "http", "rmi",...).
url - the url (e.g. rdp10.cps.unizar.es or 155.210.155.63).
numPort - the port number (e.g. 9500).
See Also:
String

ContextAddress

public ContextAddress(java.lang.String name,
                      java.lang.String string)
Constructor.

Parameters:
name - the name of the context.
string - a string representation of the ContextAddress (e.g. rmi://rdp10.cps.unizar.es:9506).
See Also:
String

ContextAddress

public ContextAddress(java.lang.String name,
                      java.lang.String url,
                      int numPort)
Constructor.

Parameters:
name - the name of the context.
url - the url (e.g. rdp10.cps.unizar.es or 155.210.155.63).
numPort - the port number (e.g. 9500).
See Also:
String
Method Detail

increasePortNumber

public int increasePortNumber()
Increases the port number.

Returns:
the new port number.

replaceHostnameWith

public springs.context.ContextAddress replaceHostnameWith(java.lang.String newHostname)
Obtains a copy of this context address but replacing first hostname.

Parameters:
newHostname - the new hostname.
Returns:
the new context address.
See Also:
ContextAddress, String

getHostname

public java.lang.String getHostname()
Gets the hostname.

Returns:
the hostname.
See Also:
String

getURL

public java.lang.String getURL()
Gets the URL.

Returns:
the URL.
See Also:
String

getName

public java.lang.String getName()
Gets the name of the context.

Returns:
the name.
See Also:
String

getProtocol

public java.lang.String getProtocol()
Gets the protocol.

Returns:
the protocol.
See Also:
String

getPort

public int getPort()
Gets the port.

Returns:
the port.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringAsLocalhost

public java.lang.String toStringAsLocalhost()
Converts the context address into a string but replacing the URL by "localhos".

Returns:
the converted string.
See Also:
String