org.jboss.services.binding
Class ServiceBinding

java.lang.Object
  extended by org.jboss.services.binding.ServiceBinding
All Implemented Interfaces:
Comparable<ServiceBinding>

public class ServiceBinding
extends Object
implements Comparable<ServiceBinding>

A ServiceBinding is a {name,virtualHost,port,interfaceAddress} quad specifying a named binding for a service.

Version:
$Revision: 88012 $
Author:
Mike Finn., Scott.Stark@jboss.org

Constructor Summary
ServiceBinding(ServiceBindingMetadata metadata, String defaulHostName, int portOffset)
          Build a ServiceBinding from metadata.
 
Method Summary
 int compareTo(ServiceBinding o)
           
 boolean equals(Object obj)
          Equality is based on our serviceName and our bindingName.
 InetAddress getBindAddress()
          Gets the InetAddress of the interface to use for the binding.
 String getBindingName()
          Gets a qualifier identifying which particular binding within the service this is.
 String getDescription()
          Gets a description of the binding suitable for display by management tools.
 String getFullyQualifiedName()
          Gets the fully qualified binding name.
 String getHostName()
          Gets the host name or string notation IP address to use for the binding.
 int getPort()
          Gets the port to use for the binding.
 ServiceBindingValueSource getServiceBindingValueSource()
          Gets the object that can return this ServiceBinding's values in formats usable by consumers.
 String getServiceBindingValueSourceClassName()
          Gets the fully qualified class name of the serviceBindingValueSource.
 Object getServiceBindingValueSourceConfig()
          Gets the configuration object the serviceBindingValueSource should use.
 String getServiceName()
          Gets the name of the service to which this binding applies.
 int hashCode()
          Hashcode is based on our serviceName and our bindingName.
 void setDescription(String description)
          Sets a description of the binding suitable for display by management tools.
 String toString()
          Create string representation of the service descriptor
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceBinding

public ServiceBinding(ServiceBindingMetadata metadata,
                      String defaulHostName,
                      int portOffset)
               throws UnknownHostException
Build a ServiceBinding from metadata.

Parameters:
metadata - the binding metadata. Cannot be null
defaultHostName - host name to use if the metadata's hostname is not fixed
portOffset - offset to apply to the metadata port value if it is not fixed
Throws:
UnknownHostException - if no IP address for the hostName could be found
IllegalArgumentException - if metadata is nullll
IllegalStateException - if metadata's serviceName is null
RuntimeException - if a serviceBindingValueSourceClassName is provided but there is a problem instantiating an instance of it via Class.newInstance()
Method Detail

getServiceName

public String getServiceName()
Gets the name of the service to which this binding applies.

Returns:
the name. Will not be null.

getBindingName

public String getBindingName()
Gets a qualifier identifying which particular binding within the service this is.

Returns:
the name, or null if this is an unnamed default binding for the service.

getFullyQualifiedName

public String getFullyQualifiedName()
Gets the fully qualified binding name.

Returns:
the serviceName:bindingName or just the service name if the binding name is null.

getHostName

public String getHostName()
Gets the host name or string notation IP address to use for the binding.

Returns:
the hostname or address

getPort

public int getPort()
Gets the port to use for the binding.

Returns:
The port

getBindAddress

public InetAddress getBindAddress()
Gets the InetAddress of the interface to use for the binding.

Returns:
The binding address

getDescription

public String getDescription()
Gets a description of the binding suitable for display by management tools.

Returns:
the description, or null if there isn't one

setDescription

public void setDescription(String description)
Sets a description of the binding suitable for display by management tools.

Parameters:
description - the description; may be null

getServiceBindingValueSource

public ServiceBindingValueSource getServiceBindingValueSource()
Gets the object that can return this ServiceBinding's values in formats usable by consumers. If unset (the norm), ServiceBindingManager will use reasonable defaults based on the format requested by the consumer.

Returns:
the ServiceBindingValueSource; may be null

getServiceBindingValueSourceClassName

public String getServiceBindingValueSourceClassName()
Gets the fully qualified class name of the serviceBindingValueSource.

Returns:
the binding value source class, or null

getServiceBindingValueSourceConfig

public Object getServiceBindingValueSourceConfig()
Gets the configuration object the serviceBindingValueSource should use.

Returns:
the configuration object, or null

compareTo

public int compareTo(ServiceBinding o)
Specified by:
compareTo in interface Comparable<ServiceBinding>

equals

public boolean equals(Object obj)
Equality is based on our serviceName and our bindingName.

Overrides:
equals in class Object

hashCode

public int hashCode()
Hashcode is based on our serviceName and our bindingName.

Overrides:
hashCode in class Object

toString

public String toString()
Create string representation of the service descriptor

Overrides:
toString in class Object
Returns:
String containing service descriptor properties


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.