org.idoox.wasp.tools.schema2java
Interface Schema2Java


public interface Schema2Java

A Schema2Java tool interface.

This tools processes a XML Schema files and generates Java classes along the definitions.

A simple usage:

import org.idoox.wasp.tools.schema2java.*;

Schema2Java schema2Java = Schema2JavaFactory.newSchema2Java();
schema2Java.process("http://systinet.com/Service/interfaces.xsd");

Since:
4.5
Component:
Core-Tools

Field Summary
static int MODE_TYPES_AS_INTERFACES
           
static int MODE_TYPES_AS_JAVABEANS
           
static int MODE_TYPES_AS_STRUCTURES
          A modes for generating of structures.
 
Method Summary
 java.lang.String[] getAvailableBackends()
          Returns available WSDL2Java's backends.
 CompilerIO getCompilerIO()
          Returns previously set CompilerIO
 Processing getDDProcessing()
          Returns a Processing from a deployment-descriptor.
 java.util.Map getNamespace2PackageMapping()
          Returns a local mapping from XML schema namespace to Java package name.
 java.util.Map getSchema2JavaMapping()
          Returns a local mapping from XML Schema types to Java classes.
 int getTypesGeneratingMode()
          Returns a generating mode for types.
 java.lang.String getTypesPackage()
          Returns a package into which types are generated.
 int getVerbosityLevel()
          Returns verbose mode level.
 boolean isBeautifyingOutputStructures()
          Returns if a beautification of output structures is activated (by default it is activated).
 boolean isMapMixedToDom()
           
 void process(org.w3c.dom.Element[] element, java.lang.String schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void process(org.w3c.dom.Element element, java.lang.String schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void process(Endpoint schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void process(Endpoint[] schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void process(Schema schema)
          Processes an XML Schema and generates a Java classes and structures.
 void process(java.lang.String schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void process(java.lang.String[] schemaLocation)
          Processes an XML Schema and generates a Java classes and structures.
 void setBeautifyingOutputStructures(boolean beautifyingOutputStructures)
          Sets if beautifying output structures is activated.
 void setCompilerIO(CompilerIO compilerIO)
          Specifies an implementation of the CompilerIO interface which should be used to write the output of the compilation process.
 void setDDProcessing(Processing processing)
          Sets a Processing from a deployment-descriptor.
 void setMapMixedToDom(boolean value)
          Sets the property setting handling of mixed content.
 void setNamespace2PackageMapping(java.util.Map namespace2PackageMapping)
          Sets a local mapping from XML schema namespace to Java package name.
 void setOutputBackends(java.lang.String outputBackends)
          Sets the output backends mentioned in the configuration, for example java, java-async, java-impl.
 void setSchema2JavaMapping(java.util.Map schema2JavaMapping)
          Sets a local mapping from XML Schem types to Java classes.
 void setTypesGeneratingMode(int mode)
          Sets a generating mode for types.
 void setTypesPackage(java.lang.String packageName)
          Sets a package into which types are generated.
 void setVerbosityLevel(int verbosityLevel)
          Sets if verbose output is printed.
 

Field Detail

MODE_TYPES_AS_STRUCTURES

public static final int MODE_TYPES_AS_STRUCTURES
A modes for generating of structures.

See Also:
Constant Field Values

MODE_TYPES_AS_INTERFACES

public static final int MODE_TYPES_AS_INTERFACES
See Also:
Constant Field Values

MODE_TYPES_AS_JAVABEANS

public static final int MODE_TYPES_AS_JAVABEANS
See Also:
Constant Field Values
Method Detail

process

public void process(java.lang.String schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
schemaLocation - an XML Schema's URL to process
Throws:
Schema2JavaException - if something goes wrong

process

public void process(java.lang.String[] schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
schemaLocation - an XML Schema's URLs to process
Throws:
Schema2JavaException - if something goes wrong

process

public void process(Endpoint schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
schemaLocation - an XML Schema's endpoint to process
Throws:
Schema2JavaException - if something goes wrong

process

public void process(Endpoint[] schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
schemaLocation - an XML Schema's endpoints to process
Throws:
Schema2JavaException - if something goes wrong

process

public void process(org.w3c.dom.Element element,
                    java.lang.String schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
element - an element which presents an XML Schema
schemaLocation - a schema URL to use as a Schema location context
Throws:
Schema2JavaException - if something goes wrong

process

public void process(org.w3c.dom.Element[] element,
                    java.lang.String schemaLocation)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
element - an elements which presents an XML Schema
schemaLocation - a schema URL to use as a Schema location context
Throws:
Schema2JavaException - if something goes wrong

process

public void process(Schema schema)
             throws Schema2JavaException
Processes an XML Schema and generates a Java classes and structures. Before the process method is called, the output must be specified. Use the method setCompilerIO(org.idoox.wasp.tools.CompilerIO) to specify the output of the process.

Parameters:
schema - a Schema to process
Throws:
Schema2JavaException - if something goes wrong

setCompilerIO

public void setCompilerIO(CompilerIO compilerIO)
Specifies an implementation of the CompilerIO interface which should be used to write the output of the compilation process. This method must be called before the process is called.

Parameters:
compilerIO - of the CompilerIO interface which should be used to write the output of the compilation process

getCompilerIO

public CompilerIO getCompilerIO()
Returns previously set CompilerIO

Returns:
previously set implementation of the CompilerIO interface or null if was not set

setVerbosityLevel

public void setVerbosityLevel(int verbosityLevel)
Sets if verbose output is printed.

Parameters:
verbosityLevel - the verbosity level (0-10), 0 .. no output

getVerbosityLevel

public int getVerbosityLevel()
Returns verbose mode level.

Returns:
the verbosity level

setDDProcessing

public void setDDProcessing(Processing processing)
Sets a Processing from a deployment-descriptor. The deployment descriptor can be used to customize the schema compilation process.

Parameters:
processing -

getDDProcessing

public Processing getDDProcessing()
Returns a Processing from a deployment-descriptor.

Returns:
a processing

setTypesPackage

public void setTypesPackage(java.lang.String packageName)
Sets a package into which types are generated.

Parameters:
packageName - a package into which types are generated

getTypesPackage

public java.lang.String getTypesPackage()
Returns a package into which types are generated.

Returns:
a package into which types are generated

setTypesGeneratingMode

public void setTypesGeneratingMode(int mode)
Sets a generating mode for types.

Parameters:
mode - a generating mode for types, one of: MODE_TYPES_AS_STRUCTURES (default one), MODE_TYPES_AS_INTERFACES, MODE_TYPES_AS_JAVABEANS.

getTypesGeneratingMode

public int getTypesGeneratingMode()
Returns a generating mode for types.

Returns:
a generating mode for types

isBeautifyingOutputStructures

public boolean isBeautifyingOutputStructures()
Returns if a beautification of output structures is activated (by default it is activated).

Returns:
true if a beautification of output structures is activated

setBeautifyingOutputStructures

public void setBeautifyingOutputStructures(boolean beautifyingOutputStructures)
Sets if beautifying output structures is activated. (by default it is activated).
For better interoperability with Microsoft .NET, WSO2 SOA Enablement Server Schema2Java optimizes the XML Schema file. The structures so generated do not strictly conform to XML Schema.
This behavior can be switched off using this option.

Parameters:
beautifyingOutputStructures - if true a beautification mode is activated, if false otherwise.

getSchema2JavaMapping

public java.util.Map getSchema2JavaMapping()
Returns a local mapping from XML Schema types to Java classes.

Returns:
a local mapping

setSchema2JavaMapping

public void setSchema2JavaMapping(java.util.Map schema2JavaMapping)
Sets a local mapping from XML Schem types to Java classes.

Parameters:
schema2JavaMapping -

setNamespace2PackageMapping

public void setNamespace2PackageMapping(java.util.Map namespace2PackageMapping)
Sets a local mapping from XML schema namespace to Java package name. It overrides the behavior of setTypesPackage(java.lang.String). Type of the key is String, type of the value is String

Parameters:
namespace2PackageMapping -

getNamespace2PackageMapping

public java.util.Map getNamespace2PackageMapping()
Returns a local mapping from XML schema namespace to Java package name. This mapping overrides the behavior of setTypesPackage(java.lang.String).

Returns:
mapping from XML schema namespace to Java package name, type of the key is String, type of the value is String

setOutputBackends

public void setOutputBackends(java.lang.String outputBackends)
Sets the output backends mentioned in the configuration, for example java, java-async, java-impl.

Parameters:
outputBackends - name of backends set

getAvailableBackends

public java.lang.String[] getAvailableBackends()
Returns available WSDL2Java's backends.

Returns:
available WSDL2Java's backends

setMapMixedToDom

public void setMapMixedToDom(boolean value)
Sets the property setting handling of mixed content. true means that mixed complex type is mapped to an DOM element, false means that the character data are ignored and only subelements are considered.

Parameters:
value - a new value of the property
Since:
SSJ 6.5.2

isMapMixedToDom

public boolean isMapMixedToDom()
Returns:
the currently set of value of the property
Since:
SSJ 6.5.2
See Also:
setMapMixedToDom(boolean)