org.jboss.services.binding
Class ServiceBindingManager

java.lang.Object
  extended by org.jboss.services.binding.ServiceBindingManager
All Implemented Interfaces:
ServiceBindingManagerMBean

public class ServiceBindingManager
extends Object
implements ServiceBindingManagerMBean

The services configuration binding manager implementation.

The ServiceBindingManager enables the centralized management of ports, by service. The port configuration store is abstracted out using the ServiceBindingStore interface.

Version:
$Revision: 88905 $
Author:
Mike Finn, Scott.Stark@jboss.org, Dimitris Andreadis, Brian Stansberry

Nested Class Summary
static class ServiceBindingManager.BindingType
          Enumeration of types of binding requests
 
Constructor Summary
ServiceBindingManager(String serverName, ServiceBindingStore store)
           
 
Method Summary
 Element getElementBinding(String serviceName, Element input)
          Gets an Element containing the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.
 Element getElementBinding(String serviceName, String bindingName, Element input)
          Gets an Element containing the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.
 Element getElementBinding(String serviceName, String bindingName, Element input, String hostName, int basePort)
          Same as getElementBinding(String, String, Element) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 Element getElementBinding(String serviceName, String bindingName, Element input, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getElementBinding(String, String, Element) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 Object getGenericBinding(String serviceName, Object... params)
          Gets the detyped binding value for the ServiceBinding with the given serviceName and bindingName qualifier.
 Object getGenericBinding(String serviceName, String bindingName, Object... params)
          Gets the detyped binding value for the ServiceBinding with the given serviceName and bindingName qualifier.
 InetAddress getInetAddressBinding(String serviceName)
          Gets the InetAddress binding value for the ServiceBinding with the given serviceName and no binding name qualifier.
 InetAddress getInetAddressBinding(String serviceName, String bindingName)
          Gets the InetAddress binding value for the ServiceBinding with the given serviceName and bindingName qualifier.
 InetAddress getInetAddressBinding(String serviceName, String bindingName, String hostName, int basePort)
          Same as getInetAddressBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 InetAddress getInetAddressBinding(String serviceName, String bindingName, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getInetAddressBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 int getIntBinding(String serviceName)
          Gets the int binding value for the ServiceBinding with the given serviceName and no binding name qualifier.
 int getIntBinding(String serviceName, String bindingName)
          Gets the int binding value for the ServiceBinding with the given serviceName and bindingName qualifier.
 int getIntBinding(String serviceName, String bindingName, String hostName, int basePort)
          Same as getIntBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 int getIntBinding(String serviceName, String bindingName, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getIntBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 String getResourceBinding(String serviceName, String input)
          Gets a filesystem path pointing to content that contains the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.
 String getResourceBinding(String serviceName, String bindingName, String input)
          Gets a filesystem path pointing to content that contains the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.
 String getResourceBinding(String serviceName, String bindingName, String input, String hostName, int basePort)
          Same as getResourceBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 String getResourceBinding(String serviceName, String bindingName, String input, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getResourceBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 String getServerName()
          Gets the value of the serverName param this instance should pass to ServiceBindingStore when requesting bindings.
 Set<ServiceBinding> getServiceBindings()
           
static ServiceBindingValueSource getServiceBindingValueSource(ServiceBinding binding, ServiceBindingManager.BindingType bindingType)
          Algorithm for obtaining a ServiceBindingValueSource given a particular binding and binding type.
 String getStringBinding(String serviceName)
          Gets the String binding value for the ServiceBinding with the given serviceName and no binding name qualifier.
 String getStringBinding(String serviceName, String input)
          Gets the String binding value for the ServiceBinding with the given serviceName and no binding name qualifier.
 String getStringBinding(String serviceName, String bindingName, String input)
          Gets the String binding value for the ServiceBinding with the given serviceName and bindingName qualifier.
 String getStringBinding(String serviceName, String bindingName, String input, String hostName, int basePort)
          Same as getStringBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 String getStringBinding(String serviceName, String bindingName, String input, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getStringBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 URL getURLBinding(String serviceName, String bindingName, URL input)
          Gets a URL pointing to content that contains the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.
 URL getURLBinding(String serviceName, String bindingName, URL input, String hostName, int basePort)
          Same as getURLBinding(String, String, URL) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 URL getURLBinding(String serviceName, String bindingName, URL input, String hostName, int basePort, boolean fixedPort, boolean fixedHostName)
          Same as getURLBinding(String, String, URL) but, if no matching service binding is found, creates a new one using the given hostName and basePort.
 URL getURLBinding(String serviceName, URL input)
          Gets a URL pointing to content that contains the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.
 void setServerName(String serverName)
          Sets the value of the serverName param this instance should pass to ServiceBindingStore when requesting bindings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceBindingManager

public ServiceBindingManager(String serverName,
                             ServiceBindingStore store)
Method Detail

getServiceBindingValueSource

public static ServiceBindingValueSource getServiceBindingValueSource(ServiceBinding binding,
                                                                     ServiceBindingManager.BindingType bindingType)
Algorithm for obtaining a ServiceBindingValueSource given a particular binding and binding type.

Parameters:
binding - the binding
bindingType - the binding type
Returns:
the appropriate ServiceBindingValueSource. Will not return null.
Throws:
ClassNotFoundException - if any ServiceBinding.getServiceBindingValueSourceClassName() cannot be found
InstantiationException - if any ServiceBinding.getServiceBindingValueSourceClassName() cannot be instantiated
IllegalAccessException - if any ServiceBinding.getServiceBindingValueSourceClassName() is not public
IllegalStateException - if no appropriate ServiceBindingValueSource can be identified

getServerName

public String getServerName()
Gets the value of the serverName param this instance should pass to ServiceBindingStore when requesting bindings.

Specified by:
getServerName in interface ServiceBindingManagerMBean
Returns:
name of the set of bindings this server uses

setServerName

public void setServerName(String serverName)
Sets the value of the serverName param this instance should pass to ServiceBindingStore when requesting bindings.

Throws:
IllegalArgumentException - if serverName is null

getServiceBindings

public Set<ServiceBinding> getServiceBindings()

getIntBinding

public int getIntBinding(String serviceName)
                  throws NoSuchBindingException
Gets the int binding value for the ServiceBinding with the given serviceName and no binding name qualifier.

This is typically the port.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
Returns:
the binding value as an int
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
IntServiceBindingValueSource

getIntBinding

public int getIntBinding(String serviceName,
                         String bindingName)
                  throws NoSuchBindingException
Gets the int binding value for the ServiceBinding with the given serviceName and bindingName qualifier.

This is typically the port.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
Returns:
the binding value as an int
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
IntServiceBindingValueSource

getIntBinding

public int getIntBinding(String serviceName,
                         String bindingName,
                         String hostName,
                         int basePort)
                  throws UnknownHostException,
                         DuplicateServiceException
Same as getIntBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
the binding value as an int
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getIntBinding

public int getIntBinding(String serviceName,
                         String bindingName,
                         String hostName,
                         int basePort,
                         boolean fixedPort,
                         boolean fixedHostName)
                  throws UnknownHostException,
                         DuplicateServiceException
Same as getIntBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
the binding value as an int
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getInetAddressBinding

public InetAddress getInetAddressBinding(String serviceName)
                                  throws NoSuchBindingException
Gets the InetAddress binding value for the ServiceBinding with the given serviceName and no binding name qualifier.

This is typically the bind address.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
InetAddressServiceBindingValueSource

getInetAddressBinding

public InetAddress getInetAddressBinding(String serviceName,
                                         String bindingName)
                                  throws NoSuchBindingException
Gets the InetAddress binding value for the ServiceBinding with the given serviceName and bindingName qualifier.

This is typically the bind address.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
InetAddressServiceBindingValueSource

getInetAddressBinding

public InetAddress getInetAddressBinding(String serviceName,
                                         String bindingName,
                                         String hostName,
                                         int basePort)
                                  throws UnknownHostException,
                                         DuplicateServiceException
Same as getInetAddressBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
the binding value as an InetAddress
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getInetAddressBinding

public InetAddress getInetAddressBinding(String serviceName,
                                         String bindingName,
                                         String hostName,
                                         int basePort,
                                         boolean fixedPort,
                                         boolean fixedHostName)
                                  throws UnknownHostException,
                                         DuplicateServiceException
Same as getInetAddressBinding(String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
the binding value as an InetAddress
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getStringBinding

public String getStringBinding(String serviceName)
                        throws NoSuchBindingException
Gets the String binding value for the ServiceBinding with the given serviceName and no binding name qualifier.

This is typically the host name.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
Returns:
the raw binding value.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
StringServiceBindingValueSource

getStringBinding

public String getStringBinding(String serviceName,
                               String input)
                        throws NoSuchBindingException
Gets the String binding value for the ServiceBinding with the given serviceName and no binding name qualifier.

This is typically the host name.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
Returns:
the raw binding value, or a transformed string based on the raw binding value and input.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
StringServiceBindingValueSource

getStringBinding

public String getStringBinding(String serviceName,
                               String bindingName,
                               String input)
                        throws NoSuchBindingException
Gets the String binding value for the ServiceBinding with the given serviceName and bindingName qualifier.

This is typically the host name.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
Returns:
the raw binding value, or a transformed string based on the raw binding value and input.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
StringServiceBindingValueSource

getStringBinding

public String getStringBinding(String serviceName,
                               String bindingName,
                               String input,
                               String hostName,
                               int basePort)
                        throws UnknownHostException,
                               DuplicateServiceException
Same as getStringBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
the raw binding value, or a transformed string based on the raw binding value and input.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getStringBinding

public String getStringBinding(String serviceName,
                               String bindingName,
                               String input,
                               String hostName,
                               int basePort,
                               boolean fixedPort,
                               boolean fixedHostName)
                        throws UnknownHostException,
                               DuplicateServiceException
Same as getStringBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
the raw binding value, or a transformed string based on the raw binding value and input.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getElementBinding

public Element getElementBinding(String serviceName,
                                 Element input)
                          throws NoSuchBindingException
Gets an Element containing the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.

Used to perform transformations on values embedded in DOM elements.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
input - element that should be used as a source for transformations
Returns:
transformed element based on the raw binding value(s) and input.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
ElementServiceBindingValueSource

getElementBinding

public Element getElementBinding(String serviceName,
                                 String bindingName,
                                 Element input)
                          throws NoSuchBindingException
Gets an Element containing the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.

Used to perform transformations on values embedded in DOM elements.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - element that should be used as a source for transformations
Returns:
transformed element based on the raw binding value(s) and input.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
ElementServiceBindingValueSource

getElementBinding

public Element getElementBinding(String serviceName,
                                 String bindingName,
                                 Element input,
                                 String hostName,
                                 int basePort)
                          throws UnknownHostException,
                                 DuplicateServiceException
Same as getElementBinding(String, String, Element) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
transformed element based on the raw binding value(s) and input.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getElementBinding

public Element getElementBinding(String serviceName,
                                 String bindingName,
                                 Element input,
                                 String hostName,
                                 int basePort,
                                 boolean fixedPort,
                                 boolean fixedHostName)
                          throws UnknownHostException,
                                 DuplicateServiceException
Same as getElementBinding(String, String, Element) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
transformed element based on the raw binding value(s) and input.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getURLBinding

public URL getURLBinding(String serviceName,
                         URL input)
                  throws NoSuchBindingException
Gets a URL pointing to content that contains the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.

Typical usage is in file transformation operations, where the content of the given input URL is read, transformed, written to a temp file, and the URL of the temp file returned.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
input - URL of content that should be used as a source for transformations
Returns:
URL pointing to the output of the transformation.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
URLServiceBindingValueSource

getURLBinding

public URL getURLBinding(String serviceName,
                         String bindingName,
                         URL input)
                  throws NoSuchBindingException
Gets a URL pointing to content that contains the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.

Typical usage is in file transformation operations, where the content of the given input URL is read, transformed, written to a temp file, and the URL of the temp file returned.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - URL of content that should be used as a source for transformations
Returns:
URL pointing to the output of the transformation.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
URLServiceBindingValueSource

getURLBinding

public URL getURLBinding(String serviceName,
                         String bindingName,
                         URL input,
                         String hostName,
                         int basePort)
                  throws UnknownHostException,
                         DuplicateServiceException
Same as getURLBinding(String, String, URL) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
URL pointing to the output of the transformation.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getURLBinding

public URL getURLBinding(String serviceName,
                         String bindingName,
                         URL input,
                         String hostName,
                         int basePort,
                         boolean fixedPort,
                         boolean fixedHostName)
                  throws UnknownHostException,
                         DuplicateServiceException
Same as getURLBinding(String, String, URL) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
URL pointing to the output of the transformation.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getResourceBinding

public String getResourceBinding(String serviceName,
                                 String input)
                          throws NoSuchBindingException
Gets a filesystem path pointing to content that contains the binding values for the ServiceBinding with the given serviceName and no binding name qualifier.

Typical usage is in file transformation operations, where the content of the given input classpath resource is read, transformed, written to a temp file, and the filesystem path of the temp file returned.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
input - location of content that should be used as a source for transformations; either a String representation of a URL or a value that can be passed to ClassLoader.getResourceAsStream(String). Cannot be null.
Returns:
a filesystem path pointing to the output of the transformation. May return null.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
URLServiceBindingValueSource

getResourceBinding

public String getResourceBinding(String serviceName,
                                 String bindingName,
                                 String input)
                          throws NoSuchBindingException
Gets a filesystem path pointing to content that contains the binding values for the ServiceBinding with the given serviceName and bindingName qualifier.

Typical usage is in file transformation operations, where the content of the given input classpath resource is read, transformed, written to a temp file, and the filesystem path of the temp file returned.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - location of content that should be used as a source for transformations; either a String representation of a URL or a value that can be passed to ClassLoader.getResourceAsStream(String). Cannot be null.
Returns:
a filesystem path pointing to the output of the transformation. May return null.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
URLServiceBindingValueSource

getResourceBinding

public String getResourceBinding(String serviceName,
                                 String bindingName,
                                 String input,
                                 String hostName,
                                 int basePort)
                          throws UnknownHostException,
                                 DuplicateServiceException
Same as getResourceBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
Returns:
a filesystem path pointing to the output of the transformation. May return null.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getResourceBinding

public String getResourceBinding(String serviceName,
                                 String bindingName,
                                 String input,
                                 String hostName,
                                 int basePort,
                                 boolean fixedPort,
                                 boolean fixedHostName)
                          throws UnknownHostException,
                                 DuplicateServiceException
Same as getResourceBinding(String, String, String) but, if no matching service binding is found, creates a new one using the given hostName and basePort.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
input - string that should be used as a source for transformations (e.g. string replacement), or null if no transformation is needed
hostName - Host name to use for new service binding if one is created.
basePort - base port to use for the binding; ServiceBindingStore may adjust this.
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.
Returns:
a filesystem path pointing to the output of the transformation. May return null.
Throws:
DuplicateServiceException - in unlikely event of concurrent attempts to create same binding with different binding values
UnknownHostException - if no IP address for the hostName could be found

getGenericBinding

public Object getGenericBinding(String serviceName,
                                Object... params)
                         throws NoSuchBindingException
Gets the detyped binding value for the ServiceBinding with the given serviceName and bindingName qualifier.

This method is an extension point to allow integration of custom ServiceBindingValueSource implementations.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
params - arbitrary parameters understood by the @{link ServiceBindingValueSource associated with the binding.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
ServiceBinding.getServiceBindingValueSource()

getGenericBinding

public Object getGenericBinding(String serviceName,
                                String bindingName,
                                Object... params)
                         throws NoSuchBindingException
Gets the detyped binding value for the ServiceBinding with the given serviceName and bindingName qualifier.

This method is an extension point to allow integration of custom ServiceBindingValueSource implementations.

Parameters:
serviceName - value to match to ServiceBinding.getServiceName() to identify the appropriate binding. Cannot be null.
bindingName - value to match to ServiceBinding.getBindingName() to identify the appropriate binding. May be null.
params - arbitrary parameters understood by the @{link ServiceBindingValueSource associated with the binding.
Throws:
NoSuchBindingException - if a matching ServiceBinding could not be found
See Also:
ServiceBinding.getServiceBindingValueSource()


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