Package org.jibx.ws.wsdl.tools
Class Jibx2Wsdl
- java.lang.Object
-
- org.jibx.ws.wsdl.tools.Jibx2Wsdl
-
public class Jibx2Wsdl extends java.lang.Object
Start-from-code WSDL generator using JiBX data binding. This starts from one or more service classes, each with one or more methods to be exposed as service operations, and generates complete bindings and WSDL for the services. Although many of the methods in this class usepublic
access, they are intended for use only by the JiBX developers and may change from one release to the next. To make use of this class from your own code, call themain(String[])
method with an appropriate argument list.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private BindGen
m_bindingGenerator
Binding generator.private WsdlGeneratorCommandLine
m_generationParameters
Parameter information for generation.private SchemaGen
m_schemaGenerator
Schema generator.private java.util.Map
m_uriSchemaMap
Map from schema namespace URIs to schema holders.private static Logger
s_logger
Logger for class.
-
Constructor Summary
Constructors Modifier Constructor Description private
Jibx2Wsdl(WsdlGeneratorCommandLine parms)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
accumulateBindingDefinitions(BindingElement binding, java.util.Map elemmap, java.util.Map typemap)
Accumulate all mapping definitions, including those found in included bindings.private void
accumulateData(ValueCustom value, java.util.Map clasmap, java.util.Set dataset)
Accumulate data type(s) from value to be included in binding.QName
addCollectionBinding(boolean doclit, ValueCustom value, java.util.Map typemap, BindingHolder bind)
Add the <mapping> definition for a typed collection to a binding.private void
addSchemaReference(QName qname, java.util.Map namemap, SchemaHolder holder)
Add reference to another schema.private ElementElement
buildValueElement(ValueCustom parm, java.util.Map typemap, java.util.Map namemap, SchemaHolder hold)
Build an element representing a parameter or return value.private Definitions
buildWSDL(ServiceCustom service, java.util.Map ptypemap, java.util.Map classelems, java.util.Map elemschemas, java.util.Map classtypes, java.util.Map typeschemas)
Build WSDL for service.private java.util.List
generate(java.util.List classes, java.util.List extras, java.util.Map classelems, java.util.Map elemschemas, java.util.Map classtypes, java.util.Map typeschemas, java.util.Collection exists)
Generate based on list of service classes.private QName
getMappingQName(java.lang.String type, MappingElement mapping)
Get the qualified name used for an abstract mapping.static void
main(java.lang.String[] args)
Run the WSDL generation using command line parameters.static BindingElement
processPregeneratedBinding(java.net.URL url, java.util.Map elemmap, java.util.Map typemap)
Load and validate binding and process all mapping definitions, including those in included bindings.
-
-
-
Field Detail
-
s_logger
private static final Logger s_logger
Logger for class.
-
m_generationParameters
private final WsdlGeneratorCommandLine m_generationParameters
Parameter information for generation.
-
m_bindingGenerator
private final BindGen m_bindingGenerator
Binding generator.
-
m_schemaGenerator
private final SchemaGen m_schemaGenerator
Schema generator.
-
m_uriSchemaMap
private final java.util.Map m_uriSchemaMap
Map from schema namespace URIs to schema holders.
-
-
Constructor Detail
-
Jibx2Wsdl
private Jibx2Wsdl(WsdlGeneratorCommandLine parms)
Constructor.- Parameters:
parms
- generation parameters
-
-
Method Detail
-
getMappingQName
private QName getMappingQName(java.lang.String type, MappingElement mapping)
Get the qualified name used for an abstract mapping. This throws an exception if the qualified name is not found.- Parameters:
type
-mapping
-- Returns:
- qualified name
-
addSchemaReference
private void addSchemaReference(QName qname, java.util.Map namemap, SchemaHolder holder)
Add reference to another schema. The reference may either be to a definition in a supplied schema (in which case it'll be in the map) or in a generated schema (in which case the namespace is used to lookup the schema).- Parameters:
qname
- referenced definition namenamemap
- map from qualified name to holder for defining schema (only for predefined schemas)holder
- schema making the reference
-
buildValueElement
private ElementElement buildValueElement(ValueCustom parm, java.util.Map typemap, java.util.Map namemap, SchemaHolder hold)
Build an element representing a parameter or return value.- Parameters:
parm
-typemap
- map from parameterized type to abstract mapping qualified namenamemap
- map from qualified name to holder for defining schema (only for predefined schemas)hold
- containing schema holder- Returns:
- constructed element
-
buildWSDL
private Definitions buildWSDL(ServiceCustom service, java.util.Map ptypemap, java.util.Map classelems, java.util.Map elemschemas, java.util.Map classtypes, java.util.Map typeschemas)
Build WSDL for service.- Parameters:
service
-ptypemap
- map from parameterized type to abstract mapping nameclasselems
- fully-qualified class name to element qualified name mapelemschemas
- element qualified name to schema holder mapclasstypes
- fully-qualified class name to type qualified name maptypeschemas
- type qualified name to schema holder map- Returns:
- constructed WSDL definitions
-
accumulateData
private void accumulateData(ValueCustom value, java.util.Map clasmap, java.util.Set dataset)
Accumulate data type(s) from value to be included in binding.- Parameters:
value
-clasmap
- map with classes to be excluded as keysdataset
- set of types for binding
-
addCollectionBinding
public QName addCollectionBinding(boolean doclit, ValueCustom value, java.util.Map typemap, BindingHolder bind)
Add the <mapping> definition for a typed collection to a binding. This always creates an abstract mapping with the type name based on both the item type and the collection type, except in the case where an array is being used in unwrapped (non-plain doc/lit) form.- Parameters:
doclit
- plain doc/lit handling flagvalue
- collection valuetypemap
- map from parameterized type to abstract mapping namebind
- target binding- Returns:
- qualified name for collection
-
generate
private java.util.List generate(java.util.List classes, java.util.List extras, java.util.Map classelems, java.util.Map elemschemas, java.util.Map classtypes, java.util.Map typeschemas, java.util.Collection exists) throws JiBXException, java.io.IOException
Generate based on list of service classes.- Parameters:
classes
- service class listextras
- list of extra classes for bindingclasselems
- fully-qualified class name to element qualified name mapelemschemas
- element qualified name to schema element mapclasstypes
- fully-qualified class name to type qualified name maptypeschemas
- type qualified name to schema element mapexists
- existing schemas potentially referenced- Returns:
- list of WSDLs
- Throws:
JiBXException
java.io.IOException
-
accumulateBindingDefinitions
private static void accumulateBindingDefinitions(BindingElement binding, java.util.Map elemmap, java.util.Map typemap)
Accumulate all mapping definitions, including those found in included bindings. For each named abstract mapping found, the class name is associated with the type name in the type map; for each concrete mapping found, the class name is associated with the element name in the element map. Included bindings are handled with recursive calls.- Parameters:
binding
- binding definition rootelemmap
- map from fully-qualified class name to element qualified nametypemap
- map from fully-qualified class name to type qualified name
-
processPregeneratedBinding
public static BindingElement processPregeneratedBinding(java.net.URL url, java.util.Map elemmap, java.util.Map typemap) throws JiBXException, java.io.IOException
Load and validate binding and process all mapping definitions, including those in included bindings.- Parameters:
url
- binding definition pathelemmap
- map from element qualified name to class datatypemap
- map from type qualified name to class data- Returns:
- binding
- Throws:
JiBXException
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws JiBXException, java.io.IOException
Run the WSDL generation using command line parameters.- Parameters:
args
-- Throws:
JiBXException
java.io.IOException
-
-