org.jacorb.orb.iiop
Class IIOPAddress

java.lang.Object
  extended byorg.jacorb.orb.etf.ProtocolAddressBase
      extended byorg.jacorb.orb.iiop.IIOPAddress
All Implemented Interfaces:
java.lang.Cloneable, org.apache.avalon.framework.configuration.Configurable

public class IIOPAddress
extends ProtocolAddressBase

Version:
$Id: IIOPAddress.java,v 1.8 2006/05/02 14:46:25 andre.spiegel Exp $
Author:
Andre Spiegel, Phil Mesnier

Field Summary
 
Fields inherited from class org.jacorb.orb.etf.ProtocolAddressBase
configuration, next, stringified
 
Constructor Summary
IIOPAddress()
          Creates a new IIOPAddress that will be initialized later by a string
IIOPAddress(java.lang.String hoststr, int port)
          Creates a new IIOPAddress for host and port.
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 boolean equals(java.lang.Object other)
           
 boolean fromString(java.lang.String s)
           
 java.net.InetAddress getConfiguredHost()
          Returns the host as supplied to the constructor.
 java.lang.String getHostname()
          Returns the host part of this IIOPAddress, as a DNS hostname.
 java.lang.String getIP()
          Returns the host part of this IIOPAddress, as a numeric IP address in dotted decimal form.
 java.lang.String getOriginalHost()
          Method for use by the PrintIOR utility.
 int getPort()
          Returns the port number of this address, represented as an integer in the range 0..65535.
 int hashCode()
           
static IIOPAddress read(CDRInputStream cdr)
           
static IIOPAddress read(InputStream in)
           
 void setHostname(java.lang.String hn)
          Used by the ORB to configure just the hostname portion of a proxy IOR address
 void setPort(int p)
           
 java.lang.String toString()
           
 void write(CDROutputStream cdr)
           
 
Methods inherited from class org.jacorb.orb.etf.ProtocolAddressBase
copy, get_next, toCDR
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IIOPAddress

public IIOPAddress(java.lang.String hoststr,
                   int port)
Creates a new IIOPAddress for host and port.

Parameters:
port - the port number represented as an integer, in the range 0..65535. As a special convenience, a negative number is converted by adding 65536 to it; this helps using values that were previously stored in a Java short.

IIOPAddress

public IIOPAddress()
Creates a new IIOPAddress that will be initialized later by a string

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class ProtocolAddressBase
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

read

public static IIOPAddress read(InputStream in)

getIP

public java.lang.String getIP()
Returns the host part of this IIOPAddress, as a numeric IP address in dotted decimal form. If the numeric IP address was specified when this object was created, then that address is returned. Otherwise, this method performs a DNS lookup on the hostname.


getHostname

public java.lang.String getHostname()
Returns the host part of this IIOPAddress, as a DNS hostname. If the DNS name was specified when this IIOPAddress was created, then that name is returned. Otherwise, this method performs a reverse DNS lookup on the IP address.


setHostname

public void setHostname(java.lang.String hn)
Used by the ORB to configure just the hostname portion of a proxy IOR address


getConfiguredHost

public java.net.InetAddress getConfiguredHost()
Returns the host as supplied to the constructor. This replaces IIOPListener.getConfiguredHost().


getPort

public int getPort()
Returns the port number of this address, represented as an integer in the range 0..65535.


setPort

public void setPort(int p)

equals

public boolean equals(java.lang.Object other)

hashCode

public int hashCode()

toString

public java.lang.String toString()
Specified by:
toString in class ProtocolAddressBase

fromString

public boolean fromString(java.lang.String s)
Specified by:
fromString in class ProtocolAddressBase

write

public void write(CDROutputStream cdr)
Specified by:
write in class ProtocolAddressBase

read

public static IIOPAddress read(CDRInputStream cdr)

getOriginalHost

public java.lang.String getOriginalHost()
Method for use by the PrintIOR utility. Previously it called getHostname() which may or may not have returned what was actually encoded in the IOR. This is of limited use for debugging purposes. This method attempts to return the string that this address was actually constructed with (i.e. what the IOR actually contains as its host string).

Returns:
Host name or IP address or both if the original host string cannot be determined.