org.apache.wsif.util
Class WSIFPluggableProviders

java.lang.Object
  extended byorg.apache.wsif.util.WSIFPluggableProviders

public class WSIFPluggableProviders
extends java.lang.Object

Utility methods for pluggable provider support.

A WSIF provider is a class that implements the org.apache.wsif.spi.Provider interface. A Provider is the logic that supports any particular WSDL binding extension.

WSIF providers are packaged in JAR files, and use the J2SE 1.3 JAR file extensions to support service providers. A WSIF Provider JAR will contain the following file:

META-INF/services/com.ibm.wsif.spi.WSIFProvider

This file will contain a list of the class names of the Provider classes in the JAR (which must implement com.ibm.wsif.spi.WSIFProvider). When the first request for a provider is made all the providers defined in the META-INF/services files will be instantiated. This can be prevented from happening by using the setAutoLoadProviders<\code> method. When this is done providers must be manually defined by using the overrideDefaultProvider<\code> method.

It is possible to have multiple providers supporting the same binding namespace. When this occurs the provider used is chosen in the following order: 1 - the provider explicitly set for the namespace with the overrideDefaultProvider<\code> method. 2 - the provider defined in the WSIF properties file as being the default provider for the binding namespace 3 - the provider defined first in the META-INF/services file in the jar file found first in the classpath.

Author:
Ant Elder

Constructor Summary
WSIFPluggableProviders()
           
 
Method Summary
static WSIFProvider getProvider(java.lang.String namespaceURI)
          Gets a WSIFProvider for a particular bindng namespace URI.
static boolean isAutoLoadProviders()
          Tests if providers are set to be automatically loaded.
static boolean isProviderAvailable(java.lang.String ns1)
          Tests if a provider is available for the given namespace.
static boolean isProviderAvailable(java.lang.String ns1, java.lang.String ns2)
          Tests if a provider is available for the given namespaces.
static void overrideDefaultProvider(java.lang.String providerNamespaceURI, WSIFProvider provider)
          Change the WSIFProvider used for a particular binding namespace.
static void setAutoLoadProviders(boolean b)
          This sets if the WSIFProviders will be automatically loaded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSIFPluggableProviders

public WSIFPluggableProviders()
Method Detail

getProvider

public static WSIFProvider getProvider(java.lang.String namespaceURI)
Gets a WSIFProvider for a particular bindng namespace URI.

Parameters:
namespaceURI - the URI of the binding namespace that the WSIFProvider must support
Returns:
a WSIFProvider supporting the requested binding namespace, or null if no providers are available.

overrideDefaultProvider

public static void overrideDefaultProvider(java.lang.String providerNamespaceURI,
                                           WSIFProvider provider)
Change the WSIFProvider used for a particular binding namespace. Calling this with a null provider removes the previously chosen provider for the binding namespace causing the next request for a provider for the namespace to use the default search order.

Parameters:
providerNamespaceURI - the binding namespace to be overriden
provider - the WSIFProvider to be used for the binding namespace

isProviderAvailable

public static boolean isProviderAvailable(java.lang.String ns1)
Tests if a provider is available for the given namespace.

Parameters:
ns1 - the WSDL binding namespace URI
Returns:
true if a provider is available for the given binding namespace, otherwise false.

isProviderAvailable

public static boolean isProviderAvailable(java.lang.String ns1,
                                          java.lang.String ns2)
Tests if a provider is available for the given namespaces.

Parameters:
ns1 - the WSDL binding namespace URI
ns2 - the WSDL port addresses namespace URI
Returns:
true if a provider is available for the given namespaces, otherwise false.

setAutoLoadProviders

public static void setAutoLoadProviders(boolean b)
This sets if the WSIFProviders will be automatically loaded. If this is set to false any providers required msut be explicitly defined by using the overrideDefaultProvider<\code> method. Changing the state of the auto loading of providers clears any providers that have already been loaded or choosen as a default provider.

Parameters:
b - true means all the WSIFProviders will be loaded automatically, false means all WSIFProviders must be manually set with the setDynamicWSIFProvider method

isAutoLoadProviders

public static boolean isAutoLoadProviders()
Tests if providers are set to be automatically loaded.

Returns:
true if providers will be loaded automatically, otherwise false.


Copyright ? 2002, 2006 Apache XML Project. All Rights Reserved.