com.ibm.di.connector.axis2.util
Class SchemaUtils

java.lang.Object
  extended by com.ibm.di.connector.axis2.util.SchemaUtils

public class SchemaUtils
extends Object

Converts TDI Schema to XML Schema and vice versa. Generates WSDL document from an Assembly Line configuration.

Since:
7.0

Constructor Summary
SchemaUtils()
           
 
Method Summary
static Element convertSchemaConfigItemToXSDElement(Document doc, SchemaItemConfig sic)
          Convert TDI Schema item to XML Schema element definition.
static Element convertSchemaConfigToXSDElement(Document doc, SchemaConfig schemaConfig, String wrapperName)
          Convert a TDI Schema to a XML Schema complex type element definition.
static Element createXSD(Document doc, String targetNamespace)
          Create an empty XML Schema.
static org.apache.ws.commons.schema.XmlSchema fromDOM(Document doc)
          Retrieves the XML schema from DOM document.
static void generateWsdl(BaseConfiguration config, String wsdlFileName, String serviceAddress, String wsdlVersion)
          Generate a WSDL file for an Assembly Line configuration.
static List<SchemaConfig> getInAndOutMessageSchema(org.apache.axis2.description.AxisService serviceInp, String operation)
          Retrieves the input and output message schema for the given operation from the give service.
static void getInOrOutMessageSchema(org.apache.axis2.description.AxisService serviceInp, String opName, boolean in, SchemaConfig schema)
          Fills TDI Schema (SchemaConfig) object with the XML Schema for the given operation.
static List<SchemaConfig> getSchemaForAllOperationsInService(org.apache.axis2.description.AxisService service)
          Returns a schema information for all operations in the given service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaUtils

public SchemaUtils()
Method Detail

generateWsdl

public static void generateWsdl(BaseConfiguration config,
                                String wsdlFileName,
                                String serviceAddress,
                                String wsdlVersion)
                         throws Exception
Generate a WSDL file for an Assembly Line configuration.

Parameters:
config - Either an AssemblyLineConfig object or a configuration object, whose hierarchy contains an AssemblyLineConfig object.
wsdlFileName - The name of the WSDL file, which will be generated.
serviceAddress - The URL of the web service, which will be described in the WSDL file.
wsdlVersion - WSDL version - either "1.1" or "2.0".
Throws:
Exception - The passed configuration object is invalid. Cannot generate a WSDL from the AL configuration. Or writing the WSDL file failed.

fromDOM

public static org.apache.ws.commons.schema.XmlSchema fromDOM(Document doc)
Retrieves the XML schema from DOM document.

Parameters:
doc - XML Schema as a DOM document.
Returns:
XML Schema object recognized by Axis2.

convertSchemaConfigToXSDElement

public static Element convertSchemaConfigToXSDElement(Document doc,
                                                      SchemaConfig schemaConfig,
                                                      String wrapperName)
Convert a TDI Schema to a XML Schema complex type element definition.

Parameters:
doc - A DOM document, used to create XML nodes.
schemaConfig - TDI Schema.
wrapperName - The name of the complex type element.
Returns:
DOM representation of a XML Schema definition of a complex element.

createXSD

public static Element createXSD(Document doc,
                                String targetNamespace)
Create an empty XML Schema.

Parameters:
doc - Used to create DOM nodes.
targetNamespace - The target namespace of the XML Schema.
Returns:
Empty XML Schema as DOM.

convertSchemaConfigItemToXSDElement

public static Element convertSchemaConfigItemToXSDElement(Document doc,
                                                          SchemaItemConfig sic)
Convert TDI Schema item to XML Schema element definition.

Parameters:
doc - Used to create DOM nodes.
sic - TDI Schema item.
Returns:
XML Schema element definition.

getInAndOutMessageSchema

public static List<SchemaConfig> getInAndOutMessageSchema(org.apache.axis2.description.AxisService serviceInp,
                                                          String operation)
                                                   throws Exception
Retrieves the input and output message schema for the given operation from the give service.

Parameters:
serviceInp - The input service from which we will get the operation from.
operation - The name of the operation for which the input and output message schema will be extracted.
Returns:
List with SchemaConfig objects containing the extracted schema.
Throws:
Exception - If the schema retrieving fails.

getSchemaForAllOperationsInService

public static List<SchemaConfig> getSchemaForAllOperationsInService(org.apache.axis2.description.AxisService service)
                                                             throws Exception
Returns a schema information for all operations in the given service. The schema is returned in TDI Schema (SchemaConfig) object and each operation schema is a separate item (SchemaConfigItem) in it.

Parameters:
service - The service object from which the operations will be extracted and their schema will be returned.
Returns:
List with Schema objects with schema for all operations in the service.
Throws:
Exception - If the schema retrieving fails.

getInOrOutMessageSchema

public static void getInOrOutMessageSchema(org.apache.axis2.description.AxisService serviceInp,
                                           String opName,
                                           boolean in,
                                           SchemaConfig schema)
                                    throws Exception
Fills TDI Schema (SchemaConfig) object with the XML Schema for the given operation.

Parameters:
serviceInp - The service where the operation can be found.
opName - The operation name for which the schema will be returned.
in - If true the input message schema will be returned. If false the output message schema will be returned.
schema - The object which will be populated with the message schema information.
Throws:
Exception - If the schema retrieving fails.