Class SchemaUtils


  • public class SchemaUtils
    extends java.lang.Object
    Converts TDI Schema to XML Schema and vice versa. Generates WSDL document from an Assembly Line configuration.
    Since:
    7.0
    • Constructor Summary

      Constructors 
      Constructor Description
      SchemaUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.w3c.dom.Element convertSchemaConfigItemToXSDElement​(org.w3c.dom.Document doc, SchemaItemConfig sic)
      Convert TDI Schema item to XML Schema element definition.
      static org.w3c.dom.Element convertSchemaConfigToXSDElement​(org.w3c.dom.Document doc, SchemaConfig schemaConfig, java.lang.String wrapperName)
      Convert a TDI Schema to a XML Schema complex type element definition.
      static org.w3c.dom.Element createXSD​(org.w3c.dom.Document doc, java.lang.String targetNamespace)
      Create an empty XML Schema.
      static org.apache.ws.commons.schema.XmlSchema fromDOM​(org.w3c.dom.Document doc)
      Retrieves the XML schema from DOM document.
      static void generateWsdl​(BaseConfiguration config, java.lang.String wsdlFileName, java.lang.String serviceAddress, java.lang.String wsdlVersion)
      Generate a WSDL file for an Assembly Line configuration.
      static java.util.List<SchemaConfig> getInAndOutMessageSchema​(org.apache.axis2.description.AxisService serviceInp, java.lang.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, java.lang.String opName, boolean in, SchemaConfig schema)
      Fills TDI Schema (SchemaConfig) object with the XML Schema for the given operation.
      static java.util.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,
                                        java.lang.String wsdlFileName,
                                        java.lang.String serviceAddress,
                                        java.lang.String wsdlVersion)
                                 throws java.lang.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:
        java.lang.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​(org.w3c.dom.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 org.w3c.dom.Element convertSchemaConfigToXSDElement​(org.w3c.dom.Document doc,
                                                                          SchemaConfig schemaConfig,
                                                                          java.lang.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 org.w3c.dom.Element createXSD​(org.w3c.dom.Document doc,
                                                    java.lang.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 org.w3c.dom.Element convertSchemaConfigItemToXSDElement​(org.w3c.dom.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 java.util.List<SchemaConfig> getInAndOutMessageSchema​(org.apache.axis2.description.AxisService serviceInp,
                                                                            java.lang.String operation)
                                                                     throws java.lang.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:
        java.lang.Exception - If the schema retrieving fails.
      • getSchemaForAllOperationsInService

        public static java.util.List<SchemaConfig> getSchemaForAllOperationsInService​(org.apache.axis2.description.AxisService service)
                                                                               throws java.lang.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:
        java.lang.Exception - If the schema retrieving fails.
      • getInOrOutMessageSchema

        public static void getInOrOutMessageSchema​(org.apache.axis2.description.AxisService serviceInp,
                                                   java.lang.String opName,
                                                   boolean in,
                                                   SchemaConfig schema)
                                            throws java.lang.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:
        java.lang.Exception - If the schema retrieving fails.