org.apache.wsif.util
Class WSIFUtils

java.lang.Object
  extended by org.apache.wsif.util.WSIFUtils
Direct Known Subclasses:
WSIFUtils_JCA

public class WSIFUtils
extends java.lang.Object

This class provides utilities for WSIF runtime and generated stubs.

Author:
Alekander Slominski, Matthew J. Duftler, Sanjiva Weerawarana, Owen Burroughs , Ant Elder , Jeremy Hughes , Mark Whitlock , Piotr Przybylski

Constructor Summary
WSIFUtils()
           
 
Method Summary
static void addDefinedItems(java.util.Map fromItems, java.lang.String itemType, java.util.Map toItems)
           
static void createSimpleTypesMap()
          Create a map of all schema simple types and there Java equivalents.
static java.util.Map getAllItems(javax.wsdl.Definition def, java.lang.String itemType)
           
static javax.wsdl.BindingOperation getBindingOperation(javax.wsdl.Binding binding, javax.wsdl.Operation portTypeOp)
          Get a binding operation for a portType operation.
static javax.wsdl.BindingOperation getBindingOperation(javax.wsdl.Binding binding, java.lang.String opName, java.lang.String inName, java.lang.String outName)
          Get a binding operation for a portType operation.
static javax.wsdl.Definition getDefinitionFromContent(java.lang.String contextURL, java.lang.String content)
           
static javax.wsdl.Definition getDefinitionFromLocation(java.lang.String contextURL, java.lang.String location)
           
static javax.wsdl.extensions.ExtensionRegistry getExtensionRegistry()
          Gets the WSIF WSDL Extensions Registry This calls initializeProviders to ensure all providers have registered any custom WSDL extensions.
static WSIFFormatHandler getFormatHandler(javax.wsdl.Part part, javax.wsdl.Definition definition, javax.wsdl.Binding binding)
           
static java.lang.String getFormatHandlerName(javax.wsdl.Part part, javax.wsdl.Definition definition, javax.wsdl.Binding binding)
           
static java.lang.String getFormatStylePackage(javax.wsdl.Binding bindingModel)
           
static java.lang.String getJavaClassNameFromXMLName(java.lang.String xmlName)
           
static java.lang.String getJavaClassNameFromXMLName(java.lang.String xmlName, java.lang.String delims)
           
static java.lang.String getJavaNameFromXMLName(java.lang.String xmlName)
           
static java.lang.String getJavaNameFromXMLName(java.lang.String xmlName, java.lang.String delims)
           
static java.lang.Object getNamedItem(java.util.Map items, javax.xml.namespace.QName qname, java.lang.String itemType)
           
static java.lang.String getPackageNameFromNamespaceURI(java.lang.String namespaceURI)
           
static java.lang.String getPackageNameFromXMLName(java.lang.String xmlName)
           
static java.util.Map getSimpleTypesMap()
          Get a map of all schema simple types and there Java equivalents.
static javax.wsdl.Part getWrappedDocLiteralPart(java.util.List parts, java.lang.String operationName)
          Deprecated. use org.apache.wsif.providers.ProviderUtils.getWrapperPart
static java.lang.String getXSDNamespaceFromPackageName(java.lang.String packageName)
           
static void initializeProviders()
          Initialize the WSIF providers.
static boolean isJNDIAvailable()
          This checks whether JNDI classes are available at runtime.
static boolean isWrappedDocLiteral(java.util.List parts, java.lang.String name)
          Deprecated. use org.apache.wsif.providers.ProviderUtils.isWrappedDocLiteral
static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI, org.w3c.dom.Document wsdlDocument)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI, org.w3c.dom.Element wsdlServicesElement)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI, java.io.Reader reader)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.lang.String documentBase, java.io.Reader reader, java.lang.ClassLoader cl)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.lang.String contextURL, java.lang.String wsdlLoc)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.net.URL documentBase, java.io.Reader reader, java.lang.ClassLoader cl)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(java.net.URL contextURL, java.lang.String wsdlLoc, java.lang.ClassLoader cl)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDL(javax.wsdl.xml.WSDLLocator loc)
          Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.
static javax.wsdl.Definition readWSDLThroughAuthProxy(java.lang.String wsdlLoc, java.net.PasswordAuthentication pa)
          Read WSDL through an authenticating proxy.
static javax.wsdl.PortType selectPortType(javax.wsdl.Definition def, java.lang.String portTypeNS, java.lang.String portTypeName)
           
static javax.wsdl.Service selectService(javax.wsdl.Definition def, java.lang.String serviceNS, java.lang.String serviceName)
           
static java.util.List unWrapPart(javax.wsdl.Part p, javax.wsdl.Definition def)
          Deprecated. use org.apache.wsif.providers.ProviderUtils.unWrapPart
static boolean wildcardCompare(java.lang.String s1, java.lang.String s2, char wild)
          Compares two strings taking acount of a wildcard.
static void writeWSDL(javax.wsdl.Definition def, java.io.Writer sink)
          Write WSDL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSIFUtils

public WSIFUtils()
Method Detail

isJNDIAvailable

public static boolean isJNDIAvailable()
This checks whether JNDI classes are available at runtime.


selectService

public static javax.wsdl.Service selectService(javax.wsdl.Definition def,
                                               java.lang.String serviceNS,
                                               java.lang.String serviceName)
                                        throws WSIFException
Throws:
WSIFException

selectPortType

public static javax.wsdl.PortType selectPortType(javax.wsdl.Definition def,
                                                 java.lang.String portTypeNS,
                                                 java.lang.String portTypeName)
                                          throws WSIFException
Throws:
WSIFException

addDefinedItems

public static void addDefinedItems(java.util.Map fromItems,
                                   java.lang.String itemType,
                                   java.util.Map toItems)

getAllItems

public static java.util.Map getAllItems(javax.wsdl.Definition def,
                                        java.lang.String itemType)

getNamedItem

public static java.lang.Object getNamedItem(java.util.Map items,
                                            javax.xml.namespace.QName qname,
                                            java.lang.String itemType)
                                     throws WSIFException
Throws:
WSIFException

readWSDL

public static javax.wsdl.Definition readWSDL(java.lang.String contextURL,
                                             java.lang.String wsdlLoc)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
contextURL - The context in which to resolve the wsdlLoc, if the wsdlLoc is relative. Can be null, in which case it will be ignored.
wsdlLoc - a URI (can be a filename or URL) pointing to a WSDL XML definition.
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDLThroughAuthProxy

public static javax.wsdl.Definition readWSDLThroughAuthProxy(java.lang.String wsdlLoc,
                                                             java.net.PasswordAuthentication pa)
                                                      throws javax.wsdl.WSDLException
Read WSDL through an authenticating proxy. It is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
wsdlLoc - a URI (must be an http or ftp URL) pointing to a WSDL file
pa - A username and password for the proxy, encapsulated as a java.net.PasswordAuthentication object
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(javax.wsdl.xml.WSDLLocator loc)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
loc - A WSDLLocator to use in locating the wsdl file and its imports
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.net.URL documentBase,
                                             java.io.Reader reader,
                                             java.lang.ClassLoader cl)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
documentBase - A URL for the document base URI for the wsdl
reader - A Reader "pointing at" the wsdl file
cl - A ClassLoader used to resolve relative imports when files are in in the classpath
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.lang.String documentBase,
                                             java.io.Reader reader,
                                             java.lang.ClassLoader cl)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
documentBase - The document base URI for the wsdl
reader - A Reader "pointing at" the wsdl file
cl - A ClassLoader used to resolve relative imports when files are in in the classpath
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.net.URL contextURL,
                                             java.lang.String wsdlLoc,
                                             java.lang.ClassLoader cl)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
contextURL - The context in which to resolve the wsdlLoc, if the wsdlLoc is relative. Can be null, in which case it will be ignored.
wsdlLoc - a URI (can be a filename or URL) pointing to a WSDL XML definition.
cl - A ClassLoader used to resolve relative imports when files are in in the classpath
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI,
                                             java.io.Reader reader)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
documentBaseURI - the document base URI of the WSDL definition described by the element. Will be set as the documentBaseURI of the returned Definition. Can be null, in which case it will be ignored.
reader - A Reader "pointing at" the wsdl file
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI,
                                             org.w3c.dom.Document wsdlDocument)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
documentBaseURI - the document base URI of the WSDL definition described by the element. Will be set as the documentBaseURI of the returned Definition. Can be null, in which case it will be ignored.
wsdlDocument - The base wsdl document
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

readWSDL

public static javax.wsdl.Definition readWSDL(java.lang.String documentBaseURI,
                                             org.w3c.dom.Element wsdlServicesElement)
                                      throws javax.wsdl.WSDLException
Read WSDL - it is different from a WSDLReader readWSDL method in that it specifies the use of the WSIF WSDLFactory implementation which registers the extensiblity elements used by the WSIF providers.

Parameters:
documentBaseURI - the document base URI of the WSDL definition described by the element. Will be set as the documentBaseURI of the returned Definition. Can be null, in which case it will be ignored.
definitionsElement - the <wsdl:definitions> element
Returns:
Defintion object representing the definition in the wsdl
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be read

writeWSDL

public static void writeWSDL(javax.wsdl.Definition def,
                             java.io.Writer sink)
                      throws javax.wsdl.WSDLException
Write WSDL. This method will use the WSIF WSDLFactory implementation to create a WSDLWriter.

Parameters:
wsdlDef - the WSDL definition to be written.
sink - the Writer to write the xml to.
Throws:
javax.wsdl.WSDLException - Exception thrown if wsdl cannot be written

getDefinitionFromLocation

public static javax.wsdl.Definition getDefinitionFromLocation(java.lang.String contextURL,
                                                              java.lang.String location)
                                                       throws WSIFException
Throws:
WSIFException

getDefinitionFromContent

public static javax.wsdl.Definition getDefinitionFromContent(java.lang.String contextURL,
                                                             java.lang.String content)
                                                      throws WSIFException
Throws:
WSIFException

initializeProviders

public static void initializeProviders()
Initialize the WSIF providers. Each provider initializes its WSDL extension registries. This has no effect if AutoLoad providers has been turned off on WSIFServiceImpl ... in that case it is the responsibility of the application to initialize providers.


createSimpleTypesMap

public static void createSimpleTypesMap()
Create a map of all schema simple types and there Java equivalents.


getSimpleTypesMap

public static java.util.Map getSimpleTypesMap()
Get a map of all schema simple types and there Java equivalents.

Returns:
The map of simple types

getFormatHandler

public static WSIFFormatHandler getFormatHandler(javax.wsdl.Part part,
                                                 javax.wsdl.Definition definition,
                                                 javax.wsdl.Binding binding)
                                          throws java.lang.InstantiationException,
                                                 java.lang.IllegalAccessException,
                                                 java.lang.ClassNotFoundException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

getPackageNameFromNamespaceURI

public static java.lang.String getPackageNameFromNamespaceURI(java.lang.String namespaceURI)

getJavaNameFromXMLName

public static java.lang.String getJavaNameFromXMLName(java.lang.String xmlName,
                                                      java.lang.String delims)

getJavaNameFromXMLName

public static java.lang.String getJavaNameFromXMLName(java.lang.String xmlName)

getPackageNameFromXMLName

public static java.lang.String getPackageNameFromXMLName(java.lang.String xmlName)

getFormatStylePackage

public static java.lang.String getFormatStylePackage(javax.wsdl.Binding bindingModel)

getFormatHandlerName

public static java.lang.String getFormatHandlerName(javax.wsdl.Part part,
                                                    javax.wsdl.Definition definition,
                                                    javax.wsdl.Binding binding)
                                             throws java.lang.InstantiationException,
                                                    java.lang.IllegalAccessException,
                                                    java.lang.ClassNotFoundException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

getJavaClassNameFromXMLName

public static java.lang.String getJavaClassNameFromXMLName(java.lang.String xmlName)

getJavaClassNameFromXMLName

public static java.lang.String getJavaClassNameFromXMLName(java.lang.String xmlName,
                                                           java.lang.String delims)

getXSDNamespaceFromPackageName

public static java.lang.String getXSDNamespaceFromPackageName(java.lang.String packageName)

getBindingOperation

public static javax.wsdl.BindingOperation getBindingOperation(javax.wsdl.Binding binding,
                                                              javax.wsdl.Operation portTypeOp)
                                                       throws WSIFException
Get a binding operation for a portType operation.

Parameters:
binding - the WSLD binding the operation will choosen from
portTypeOp - the portType operation the binding operation must match
Returns:
the BindingOperation
Throws:
WSIFException

getBindingOperation

public static javax.wsdl.BindingOperation getBindingOperation(javax.wsdl.Binding binding,
                                                              java.lang.String opName,
                                                              java.lang.String inName,
                                                              java.lang.String outName)
                                                       throws WSIFException
Get a binding operation for a portType operation.

Parameters:
binding - the WSLD binding the operation will choosen from
opName - the portType operation name of the wanted operation
inName - the portType operation input name
outName - the portType operation outpur name
Returns:
the BindingOperation
Throws:
WSIFException

wildcardCompare

public static boolean wildcardCompare(java.lang.String s1,
                                      java.lang.String s2,
                                      char wild)
Compares two strings taking acount of a wildcard. The first string is compared to the second string taking account of a wildcard character in the first string. For example, wildcardCompare( "*.ibm.com", "hursley.ibm.com", '*') would return true.


isWrappedDocLiteral

public static boolean isWrappedDocLiteral(java.util.List parts,
                                          java.lang.String name)
Deprecated. use org.apache.wsif.providers.ProviderUtils.isWrappedDocLiteral


getWrappedDocLiteralPart

public static javax.wsdl.Part getWrappedDocLiteralPart(java.util.List parts,
                                                       java.lang.String operationName)
Deprecated. use org.apache.wsif.providers.ProviderUtils.getWrapperPart


unWrapPart

public static java.util.List unWrapPart(javax.wsdl.Part p,
                                        javax.wsdl.Definition def)
                                 throws WSIFException
Deprecated. use org.apache.wsif.providers.ProviderUtils.unWrapPart

Throws:
WSIFException

getExtensionRegistry

public static javax.wsdl.extensions.ExtensionRegistry getExtensionRegistry()
Gets the WSIF WSDL Extensions Registry This calls initializeProviders to ensure all providers have registered any custom WSDL extensions.

Returns:
ExtensionRegistry the WSIF ExtensionRegistry


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