org.ow2.cmi.reference
Class ServerRef

java.lang.Object
  extended by org.ow2.cmi.reference.ServerRef
All Implemented Interfaces:
java.io.Serializable, LoadBalanceable
Direct Known Subclasses:
ServerId

@Immutable
public class ServerRef
extends java.lang.Object
implements LoadBalanceable, java.io.Serializable

Represents a reference on a server.

Author:
The new CMI team
See Also:
Serialized Form

Constructor Summary
ServerRef(java.lang.String providerURL)
          Construct a new reference for a server.
ServerRef(java.lang.String protocol, java.lang.String providerURL)
          Construct a new identifier for a server.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getHostname()
           
 java.net.InetAddress getInetAddress()
           
 int getPort()
           
 java.lang.String getProtocol()
           
 java.lang.String getProviderURL()
           
 java.lang.String getScheme()
           
 ServerRef getServerRef()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerRef

public ServerRef(java.lang.String protocol,
                 java.lang.String providerURL)
          throws java.net.MalformedURLException,
                 java.net.UnknownHostException
Construct a new identifier for a server. Check if the given protocol is consistent with the provider URL.

Parameters:
protocol - a name of protocol
providerURL - a provider URL
Throws:
java.net.MalformedURLException - if the URL is malformed
java.net.UnknownHostException - if the given host cannot be resolved

ServerRef

public ServerRef(java.lang.String providerURL)
          throws java.net.MalformedURLException,
                 java.net.UnknownHostException
Construct a new reference for a server.

Parameters:
providerURL - a provider URL
Throws:
java.net.MalformedURLException - if the URL is malformed
java.net.UnknownHostException - if the given host cannot be resolved
Method Detail

getInetAddress

public java.net.InetAddress getInetAddress()
Returns:
the address of the server

getHostname

public java.lang.String getHostname()
Returns:
the host name

getScheme

public java.lang.String getScheme()
Returns:
the scheme

getPort

public int getPort()
Returns:
port of the provider URL

toString

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

getProtocol

public java.lang.String getProtocol()
Returns:
the protocol of this reference

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getProviderURL

public java.lang.String getProviderURL()
Returns:
a provider URL

getServerRef

public ServerRef getServerRef()
Specified by:
getServerRef in interface LoadBalanceable
Returns:
the reference of server on which is deployed this object.


Copyright © 2009 OW2 Consortium. All Rights Reserved.