org.jboss.services.binding
Class ServiceBindingMetadata

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

public class ServiceBindingMetadata
extends Object
implements Comparable<ServiceBindingMetadata>

Metadata about a ServiceBinding that management tools can use. Does not represent the runtime binding information, but rather the metadata used to create the binding.

Author:
Brian Stansberry

Constructor Summary
ServiceBindingMetadata()
          Create a new ServiceBindingMetadata.
ServiceBindingMetadata(ServiceBinding binding)
          Create a new ServiceBindingMetadata from a runtime ServiceBinding.
ServiceBindingMetadata(ServiceBindingMetadata binding)
          Copy constructor.
ServiceBindingMetadata(String serviceName)
          Create a new ServiceBindingMetadata with given service name.
ServiceBindingMetadata(String serviceName, String bindingName)
          Create a new ServiceBindingMetadata with given service and binding names.
ServiceBindingMetadata(String serviceName, String bindingName, String hostName, int port)
          Create a new ServiceBindingMetadata with given property values and a non-fixed port.
ServiceBindingMetadata(String serviceName, String bindingName, String hostName, int port, boolean fixedPort, boolean fixedHostName)
          Create a new ServiceBindingMetadata with given property values.
 
Method Summary
static String canonicalizeServiceName(String serviceName)
          Checks if serviceName can be converted into an ObjectName; if it can, converts it and returns its canonical form.
 int compareTo(ServiceBindingMetadata other)
           
 boolean equals(Object obj)
          Equality is based on our serviceName and our bindingName.
 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()
           
 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.
 boolean isFixedHostName()
          Gets whether runtime @{link ServiceBinding}s created from this metadata can alter the hostName value based on the server on which the binding is running.
 boolean isFixedPort()
          Gets whether runtime @{link ServiceBinding}s created from this metadata can alter the port value based on the server on which the binding is running.
 void setBindingName(String bindingName)
          Sets a qualifier identifying which particular binding within the service this is.
 void setDescription(String description)
          Sets a description of the binding suitable for display by management tools.
 void setFixedHostName(boolean fixedHostName)
          Sets whether runtime @{link ServiceBinding}s created from this metadata can alter the hostName value based on the server on which the binding is running.
 void setFixedPort(boolean fixedPort)
          Sets whether runtime @{link ServiceBinding}s created from this metadata can alter the port value based on the server on which the binding is running.
 void setHostName(String hostName)
          Sets the host name or string notation IP address to use for the binding.
 void setPort(int port)
          Sets the port to use for the binding.
 void setServiceBindingValueSource(ServiceBindingValueSource serviceBindingValueSource)
          Sets the object that can return this ServiceBinding's values in formats usable by consumers.
 void setServiceBindingValueSourceClassName(String serviceBindingValueSourceClassName)
          Sets the fully qualified class name of the serviceBindingValueSource.
 void setServiceBindingValueSourceConfig(Object serviceBindingValueSourceConfig)
          Sets the configuration object the serviceBindingValueSource should use.
 void setServiceName(String serviceName)
          Sets the name of the service to which this binding applies.
 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

ServiceBindingMetadata

public ServiceBindingMetadata()
Create a new ServiceBindingMetadata.


ServiceBindingMetadata

public ServiceBindingMetadata(String serviceName)
Create a new ServiceBindingMetadata with given service name.

Parameters:
serviceName - the name of the service to which this binding applies. Cannot be null
Throws:
IllegalArgumentException - if serviceName is null

ServiceBindingMetadata

public ServiceBindingMetadata(String serviceName,
                              String bindingName)
Create a new ServiceBindingMetadata with given service and binding names.

Parameters:
serviceName - the name of the service to which this binding applies. Cannot be null
bindingName - qualifier identifying which particular binding within the service this is. May be null
Throws:
IllegalArgumentException - if serviceName is null

ServiceBindingMetadata

public ServiceBindingMetadata(String serviceName,
                              String bindingName,
                              String hostName,
                              int port)
Create a new ServiceBindingMetadata with given property values and a non-fixed port. The hostname is fixed if the provided hostName is not null.

Parameters:
serviceName - the name of the service to which this binding applies. Cannot be null
bindingName - qualifier identifying which particular binding within the service this is. May be null
hostName - the host name or string notation IP address of the interface to bind to
port - the port to bind to
Throws:
IllegalArgumentException - if serviceName is null

ServiceBindingMetadata

public ServiceBindingMetadata(String serviceName,
                              String bindingName,
                              String hostName,
                              int port,
                              boolean fixedPort,
                              boolean fixedHostName)
Create a new ServiceBindingMetadata with given property values.

Parameters:
serviceName - the name of the service to which this binding applies. Cannot be null
bindingName - qualifier identifying which particular binding within the service this is. May be null
hostName - the host name or string notation IP address of the interface to bind to
port - the port to bind to
fixedPort - whether runtime @{link ServiceBinding}s created from this metadata can alter the port value based on the server on which the binding is running.
fixedHostName - whether runtime @{link ServiceBinding}s created from this metadata can alter the hostName value based on the server on which the binding is running.
Throws:
IllegalArgumentException - if serviceName is null

ServiceBindingMetadata

public ServiceBindingMetadata(ServiceBinding binding)
Create a new ServiceBindingMetadata from a runtime ServiceBinding. The resulting object has a fixed port and host name.

Parameters:
binding - the binding. Cannot be null

ServiceBindingMetadata

public ServiceBindingMetadata(ServiceBindingMetadata binding)
Copy constructor.

Parameters:
binding - the metadata to copy. Cannot be null
Method Detail

canonicalizeServiceName

public static String canonicalizeServiceName(String serviceName)
Checks if serviceName can be converted into an ObjectName; if it can, converts it and returns its canonical form.

Parameters:
serviceName - the service name
Returns:
the canonicalized form, or serviceName if it cannot be converted into an ObjectName.

getServiceName

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

Returns:
the name.

setServiceName

public void setServiceName(String serviceName)
Sets the name of the service to which this binding applies.

Parameters:
serviceName - the name. Cannot be null.
Throws:
IllegalArgumentException - if serviceName is 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.

setBindingName

public void setBindingName(String bindingName)
Sets a qualifier identifying which particular binding within the service this is.

Parameters:
bindingName - 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.
Throws:
IllegalStateException - if serviceName 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. May be null

setHostName

public void setHostName(String hostName)
Sets the host name or string notation IP address to use for the binding.

Parameters:
hostName - the hostname or address. May be null

getPort

public int getPort()

setPort

public void setPort(int port)
Sets the port to use for the binding.

Parameters:
port - the port

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

setServiceBindingValueSource

public void setServiceBindingValueSource(ServiceBindingValueSource serviceBindingValueSource)
Sets the object that can return this ServiceBinding's values in formats usable by consumers.

Parameters:
serviceBindingValueSource - 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

setServiceBindingValueSourceClassName

public void setServiceBindingValueSourceClassName(String serviceBindingValueSourceClassName)
Sets the fully qualified class name of the serviceBindingValueSource.

Parameters:
serviceBindingValueSourceClassName - 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

setServiceBindingValueSourceConfig

public void setServiceBindingValueSourceConfig(Object serviceBindingValueSourceConfig)
Sets the configuration object the serviceBindingValueSource should use.

Parameters:
serviceBindingValueSourceConfig - the configuration object, or null

isFixedPort

public boolean isFixedPort()
Gets whether runtime @{link ServiceBinding}s created from this metadata can alter the port value based on the server on which the binding is running.

Returns:
true if the getPort() value from this object must be respected; false if it can be altered.

setFixedPort

public void setFixedPort(boolean fixedPort)
Sets whether runtime @{link ServiceBinding}s created from this metadata can alter the port value based on the server on which the binding is running. param fixedPort true if the getPort() value from this object must be respected; false if it can be altered.


isFixedHostName

public boolean isFixedHostName()
Gets whether runtime @{link ServiceBinding}s created from this metadata can alter the hostName value based on the server on which the binding is running.

Returns:
true if the getHostName() value from this object must be respected; false if it can be altered.

setFixedHostName

public void setFixedHostName(boolean fixedHostName)
Sets whether runtime @{link ServiceBinding}s created from this metadata can alter the hostName value based on the server on which the binding is running. param fixedHostName true if the getHostName() value from this object must be respected; false if it can be altered.


compareTo

public int compareTo(ServiceBindingMetadata other)
Specified by:
compareTo in interface Comparable<ServiceBindingMetadata>

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.