org.idoox.wasp.tools.java2schema
Interface Java2Schema


public interface Java2Schema

XML Schema generator tool.

See Java2SchemaFactory how to get an instance of the Java2Schema and how to use it via API.

Since:
4.0
Component:
Core

Field Summary
static int MODE_INTERFACE_TO_REMOTE_REF
          Map interfaces to remote references.
static int MODE_INTERFACE_TO_STRUCTURE
          Map interfaces to structures.
static int SOAP_USE_ENCODED
          Use SOAP-ENC encoding.
static int SOAP_USE_LITERAL
          Use literal encoding.
 
Method Summary
 java.util.Map getAllSchemas()
          Returns all schema elements across all targetNamespaces.
 java.lang.String getAttachmentType()
           
 Processing getDDProcessing()
          Returns the DeploymentDescriptor processing
 java.util.Set getExcludedClasses()
          Returns a set of excluded classes.
 java.util.Set getImportReferences(java.lang.String targetNamespace)
          Returns set of elements engaged in element along the specified targetNamespace.
 java.util.Set getIncludedClasses()
          Returns a set of included classes.
 java.util.Map getInheritanceMapping()
          Returns inheritance map.
 int getInterfaceMappingMode()
          Returns mode of interface mapping.
 java.util.Map getPackageMapping()
          Returns package namespace map.
 org.w3c.dom.Document getSchemaBuilder()
          Returns main document for node creation.
 java.lang.String getSerializationID()
          Returns serialization ID to use.
 int getSOAPEncoding()
          Returns type of SOAP encoding.
 TypeMappingContext getTypeMappingContext()
          Returns type mapping context, default one is "java".
 boolean isJavaMappingExtension()
          Returns if java mapping extensibility elements are enabled.
 boolean isMapAttachmentToWsiSwaRef()
          Getter of the property value.
 boolean isMultidimArrays()
          Returns type of generated arrays.
 boolean isSortingFields()
          Returns true fields are alphabetically sorted.
 boolean isUseNillable()
          Returns whether attribute nillable='true' or attributes minOccurs='0' maxOccurs='1' will be generated into XML schema for Java reference data types.
 boolean isVerbose()
          Returns if in verbose mode.
 QName mapJavaType(java.lang.Class typeClass)
          Mapping of java types to schema types.
 QName mapJavaType(java.lang.Class typeClass, java.util.Set schemaSet)
          Mapping of java types to schema types.
 QName mapSchemaType(java.lang.Class typeClass, QName schemaElement, QName schemaType)
          Mapping of schema type to schema element.
 QName mapSchemaType(java.lang.Class typeClass, QName schemaElement, QName schemaType, java.util.Set schemaSet)
          Mapping of schema type to schema element.
 void resetCompiler()
          Resets Java2Schema.
 void setAttachmentType(java.lang.String attachmentType)
          Sets attachment type - it affects schema type generated for attachments.
 void setDDProcessing(Processing processing)
          Sets the DeploymentDescriptor processing
 void setInheritanceMapping(java.util.Map map)
          Sets inheritance map.
 void setInterfaceMappingMode(int mode)
          Sets mode of interface mapping, default is MODE_INTERFACE_TO_STRUCTURE.
 void setJavaMappingExtension(boolean javaMappingExtension)
          Enables/disables java mapping extensibility elements.
 void setMapAttachmentToWsiSwaRef(boolean newValue)
          Setter, see isMapAttachmentToWsiSwaRef().
 void setMappingSchemas(java.util.Set referencedSchemas, java.util.Set insertedSchemas)
          Sets XML Schemas / WSDLs to take its types as the base for compilation.
 void setMultidimArrays(boolean multidimArrays)
          Enables/disables generating of multidimensional arrays.
 void setPackageMapping(java.util.Map packageNamespaceMap)
          Sets package namespace map.
 void setSchemaBuilder(org.w3c.dom.Document schemaDocument)
          Sets main document for node creation.
 void setSerializationID(java.lang.String serializationID)
          Sets serialization ID to use.
 void setSOAPEncoding(int soapEncoding)
          Sets type of SOAP encoding.
 void setSortingFields(boolean sortingFields)
          Enables alphabetically sorting fields.
 void setTypeMappingContext(TypeMappingContext typeMappingContext)
          Sets type mapping context, default one is "java".
 void setUseNillable(boolean b)
          Sets whether attribute nillable='true' or attributes minOccurs='0' maxOccurs='1' should be generated into XML schema for Java reference data types.
 void setVerbose(boolean verbose)
          Enables/disables verbose mode.
 void setVerbose(int length)
          Enables verbose mode and sets output message max length.
 boolean testClassInclusion(java.lang.String className)
          Returns if class should be processed or will be excluded.
 

Field Detail

SOAP_USE_ENCODED

public static final int SOAP_USE_ENCODED
Use SOAP-ENC encoding.

See Also:
Constant Field Values

SOAP_USE_LITERAL

public static final int SOAP_USE_LITERAL
Use literal encoding.

See Also:
Constant Field Values

MODE_INTERFACE_TO_STRUCTURE

public static final int MODE_INTERFACE_TO_STRUCTURE
Map interfaces to structures.

See Also:
Constant Field Values

MODE_INTERFACE_TO_REMOTE_REF

public static final int MODE_INTERFACE_TO_REMOTE_REF
Map interfaces to remote references.

See Also:
Constant Field Values
Method Detail

resetCompiler

public void resetCompiler()
Resets Java2Schema. Removes all defined schemas and types. Leaves configuration as it is. Use when new compilation is needed with actual parameters.


mapJavaType

public QName mapJavaType(java.lang.Class typeClass)
Mapping of java types to schema types.

Parameters:
typeClass - type to map to schema
Returns:
qualified name of mapped type

mapJavaType

public QName mapJavaType(java.lang.Class typeClass,
                         java.util.Set schemaSet)
Mapping of java types to schema types.

Parameters:
typeClass - type to map to schema
schemaSet - set to store all the schema elements with actually mapped types, each entry in set is type of Element
Returns:
qualified name of mapped type

mapSchemaType

public QName mapSchemaType(java.lang.Class typeClass,
                           QName schemaElement,
                           QName schemaType)
Mapping of schema type to schema element.

Parameters:
typeClass - original java type
schemaElement - qualified name of element to create
schemaType - qualified name of schema type to map to element
Returns:
qualified name of created element

mapSchemaType

public QName mapSchemaType(java.lang.Class typeClass,
                           QName schemaElement,
                           QName schemaType,
                           java.util.Set schemaSet)
Mapping of schema type to schema element.

Parameters:
typeClass - original java type
schemaElement - qualified name of element to create
schemaType - qualified name of schema type to map to element
schemaSet - set to store all the schema elements with actually mapped types, each entry in set is type of Element
Returns:
qualified name of created element

setSchemaBuilder

public void setSchemaBuilder(org.w3c.dom.Document schemaDocument)
Sets main document for node creation.

Parameters:
schemaDocument - document to use when nodes are created

getSchemaBuilder

public org.w3c.dom.Document getSchemaBuilder()
Returns main document for node creation.

Returns:
document which is used when nodes are created

getAllSchemas

public java.util.Map getAllSchemas()
Returns all schema elements across all targetNamespaces. Each entry in map is in form of targetNamespace -> element. Take care of use of this method. Because of performance some caching is provided and unpredictable behaviour may occur. We strongly recommend use of this method before mapping any type, only.

Returns:
map of all defined elements and targetNamespaces

getImportReferences

public java.util.Set getImportReferences(java.lang.String targetNamespace)
Returns set of elements engaged in element along the specified targetNamespace. Each entry of set is element in form . If no "cross-reference" is found, empty set is returned.

Parameters:
targetNamespace - required targetNamespace
Returns:
set of elements, each entry in set is type of Element

getPackageMapping

public java.util.Map getPackageMapping()
Returns package namespace map. Engages mapping of package name -> namespace. Map is used when mapping java types to targetNamespace.

Returns:
map of pairs package name -> namespace, keys and values in Map are both type of String

setPackageMapping

public void setPackageMapping(java.util.Map packageNamespaceMap)
Sets package namespace map. Engages mapping of package name -> namespace. Map is used when mapping java types to targetNamespace.

Parameters:
packageNamespaceMap - map of pairs package name -> namespace, keys and values in Map are both type of String

getInterfaceMappingMode

public int getInterfaceMappingMode()
Returns mode of interface mapping.

Returns:
mode of interface mapping

setInterfaceMappingMode

public void setInterfaceMappingMode(int mode)
Sets mode of interface mapping, default is MODE_INTERFACE_TO_STRUCTURE.

Parameters:
mode - mode of interface mapping

getTypeMappingContext

public TypeMappingContext getTypeMappingContext()
Returns type mapping context, default one is "java".

Returns:
TypeMappingContext

setTypeMappingContext

public void setTypeMappingContext(TypeMappingContext typeMappingContext)
Sets type mapping context, default one is "java".

Parameters:
typeMappingContext - custom type mapping context

getInheritanceMapping

public java.util.Map getInheritanceMapping()
Returns inheritance map. Engages pairs in form of class -> superclass. Used for choosing of parent class when mapping types.

Returns:
inheritance map, keys and values in Map are both type of String

setInheritanceMapping

public void setInheritanceMapping(java.util.Map map)
Sets inheritance map. Must engage pairs in form of class -> superclass. Used for choosing of parent class when mapping types.

Parameters:
map - inheritance map, keys and values in Map are both type of String

isJavaMappingExtension

public boolean isJavaMappingExtension()
Returns if java mapping extensibility elements are enabled.

Returns:
true if java mapping extensibility elements are enabled.

setJavaMappingExtension

public void setJavaMappingExtension(boolean javaMappingExtension)
Enables/disables java mapping extensibility elements.

Parameters:
javaMappingExtension -

getExcludedClasses

public java.util.Set getExcludedClasses()
Returns a set of excluded classes. Each entry is type of String representing full class name (e.g. "java.lang.String") or package name(e.g. "java.lang.*"). Changes of returned map causes immediate change of Java2Schema state.

Returns:
set of excluded classes

getIncludedClasses

public java.util.Set getIncludedClasses()
Returns a set of included classes. Each entry is type of String representing full class name. Changes of returned map causes immediate change of Java2Schema state.

Returns:
set of included classes

setMappingSchemas

public void setMappingSchemas(java.util.Set referencedSchemas,
                              java.util.Set insertedSchemas)
Sets XML Schemas / WSDLs to take its types as the base for compilation. Given files will be referenced by or will be directly inserted into target WSDL.

Parameters:
referencedSchemas - relative or absolute URLs of schema files (stored as String); these schemas will be referenced by element
insertedSchemas - relative or absolute URLs of schema files (stored as String); these schemas will be directly included

testClassInclusion

public boolean testClassInclusion(java.lang.String className)
Returns if class should be processed or will be excluded.

Parameters:
className - class to test
Returns:
true if class should be processed, false if will be excluded

isSortingFields

public boolean isSortingFields()
Returns true fields are alphabetically sorted.

Returns:
true if fields are alphabetically sorted, false otherwise

setSortingFields

public void setSortingFields(boolean sortingFields)
Enables alphabetically sorting fields.

Parameters:
sortingFields - true if fields should be alphabetically sorted, false otherwise

getSOAPEncoding

public int getSOAPEncoding()
Returns type of SOAP encoding.

Returns:
returns SOAP_USE_LITERAL or SOAP_USE_ENCODED

setSOAPEncoding

public void setSOAPEncoding(int soapEncoding)
Sets type of SOAP encoding. Type can be either SOAP_USE_LITERAL or SOAP_USE_ENCODED, default is SOAP_USE_LITERAL.

Parameters:
soapEncoding - type of SOAP encoding

isMultidimArrays

public boolean isMultidimArrays()
Returns type of generated arrays.

Returns:
returns true if multidim arrays are allowed, false otherwise

setMultidimArrays

public void setMultidimArrays(boolean multidimArrays)
Enables/disables generating of multidimensional arrays.

Parameters:
multidimArrays - set to true if multidim arrays are allowed

setDDProcessing

public void setDDProcessing(Processing processing)
Sets the DeploymentDescriptor processing

Parameters:
processing - DeploymentDescriptor processing

getDDProcessing

public Processing getDDProcessing()
Returns the DeploymentDescriptor processing

Returns:
the DeploymentDescriptor processing

setVerbose

public void setVerbose(boolean verbose)
Enables/disables verbose mode.

Parameters:
verbose - if true verbose mode is enabled and additional information is produced

setVerbose

public void setVerbose(int length)
Enables verbose mode and sets output message max length.

Parameters:
length - max length of output message, 0 means default length

isVerbose

public boolean isVerbose()
Returns if in verbose mode.

Returns:
true if being in verbose mode

getSerializationID

public java.lang.String getSerializationID()
Returns serialization ID to use. It is null, by default.

Returns:
serialization ID to use

setSerializationID

public void setSerializationID(java.lang.String serializationID)
Sets serialization ID to use. It is null, by default.

Parameters:
serializationID - serialization ID to use

setAttachmentType

public void setAttachmentType(java.lang.String attachmentType)
Sets attachment type - it affects schema type generated for attachments.

Parameters:
attachmentType - Message.CT_MULTIPART_RELATED for MIME, Message.CT_APPLICATION_DIME for DIME

getAttachmentType

public java.lang.String getAttachmentType()
Returns:
Message.CT_MULTIPART_RELATED for MIME, Message.CT_APPLICATION_DIME for DIME

setUseNillable

public void setUseNillable(boolean b)
Sets whether attribute nillable='true' or attributes minOccurs='0' maxOccurs='1' should be generated into XML schema for Java reference data types.

Parameters:
b - use true to generate with attribute nillable='true', use false to generate with attributes minOccurs='0' maxOccurs='1',

isUseNillable

public boolean isUseNillable()
Returns whether attribute nillable='true' or attributes minOccurs='0' maxOccurs='1' will be generated into XML schema for Java reference data types.

Returns:
true represents attribute nillable='true' false represents attributes minOccurs='0' maxOccurs='1',
See Also:
setUseNillable(boolean)

isMapAttachmentToWsiSwaRef

public boolean isMapAttachmentToWsiSwaRef()
Getter of the property value. If true message attachment will be mapped to {http://ws-i.org/profiles/basic/1.1/xsd}swaRef XML Schema simple type. This is a prerequisity to create WS-I Attachment Profile 1.0 compliant WSDLs.

Default is derived from WS-I compliance setting of the SSJ (WS-I compliant => true).

Returns:
the current property value

setMapAttachmentToWsiSwaRef

public void setMapAttachmentToWsiSwaRef(boolean newValue)
Setter, see isMapAttachmentToWsiSwaRef().

Parameters:
newValue - the new value to setd