org.apache.axis.wsdl.toJava

Class Emitter

public class Emitter extends Parser

This class produces java files for stubs, skeletons, and types from a WSDL document.

Author: Russell Butek (butek@us.ibm.com) Tom Jordahl (tjordahl@macromedia.com) Rich Scheuerle (scheu@us.ibm.com) Steve Graham (sggraham@us.ibm.com)

Field Summary
protected BaseTypeMappingbaseTypeMapping
Field baseTypeMapping
static StringDEFAULT_NSTOPKG_FILE
Field DEFAULT_NSTOPKG_FILE
protected HashMapnamespaceMap
Field namespaceMap
protected Namespacesnamespaces
Field namespaces
protected ListnsExcludes
Field nsIncludes - defines a list of namespaces to specifically exclude from generated source code.
protected ListnsIncludes
Field nsIncludes - defines a list of namespaces to specifically include in the generated source code.
protected StringNStoPkgFilename
Field NStoPkgFilename
protected Listproperties
Field properties - defines a set of general purpose properties that can be used by custom JavaGeneratorFactories.
protected StringtypeMappingVersion
Field typeMappingVersion
Constructor Summary
Emitter()
Default constructor.
Method Summary
voiddebug(boolean value)
Turn on/off debug messages.
voiddeploySkeleton(boolean value)
Turn on/off server skeleton deploy
protected booleandoesExist(String className)
Check if the className exists.
voidemit(String uri)
Call this method if you have a uri for the WSDL document
voidemit(String context, Document doc)
Call this method if your WSDL document has already been parsed as an XML DOM document.
voidgenerateAll(boolean all)
voidgenerateImports(boolean generateImports)
Turn on/off generation of elements from imported files.
voidgenerateServerSide(boolean value)
Turn on/off server-side binding generation
voidgenerateTestCase(boolean value)
Turn on/off test case creation
booleangetDebug()
Return the status of the debug switch.
TypeMappinggetDefaultTypeMapping()
Returns the default TypeMapping used by the service
booleangetDeploySkeleton()
Indicate if we should be deploying skeleton or implementation
ListgetGeneratedClassNames()
This method returns a list of all generated class names.
GeneratedFileInfogetGeneratedFileInfo()
Returns an object which contains of information on all generated files including the class name, filename and a type string.
ListgetGeneratedFileNames()
This method returns a list of all generated file names.
booleangetGenerateServerSide()
Indicate if we should be emitting server side code and deploy/undeploy
booleangetHelperGeneration()
Indicate if we should be generating Helper classes
StringgetImplementationClassName()
Get an implementation classname to use instead of the default.
StringgetJavaName(QName qName)
Convert the specified QName into a full Java Name.
protected StringgetJavaNameHook(QName qname)
StringgetJavaVariableName(QName typeQName, QName xmlName, boolean isElement)
protected StringgetJavaVariableNameHook(QName typeQName, QName xmlName, boolean isElement)
ListgetNamespaceExcludes()
Returns the list of excludes to specifically exclude from the generated source.
ListgetNamespaceIncludes()
Returns the list of namespaces specifically excluded from the generated code.
HashMapgetNamespaceMap()
Get the map of namespace -> Java package names
NamespacesgetNamespaces()
Method getNamespaces
StringgetOutputDir()
Get the output directory to use for emitted source files
StringgetPackage(String namespace)
Get the Package name for the specified namespace
StringgetPackage(QName qName)
Get the Package name for the specified QName
StringgetPackageName()
Get global package name to use instead of mapping namespaces
ListgetProperties()
Gets the list of extension properties for custom JavaGeneratorFactories.
HashMapgetQName2ClassMap()
Get the type qname to java class map
ScopegetScope()
Get the scope for the deploy.xml file.
ServiceDescgetServiceDesc()
Retruns the SericeDesc object
StringgetTypeMappingVersion()
Get the typemapping version
booleangetVerbose()
Return the status of the verbose switch
GeneratorFactorygetWriterFactory()
Get the GeneratorFactory.
booleanisAllowInvalidURL()
booleanisAllWanted()
Method isAllWanted
booleanisBuildFileWanted()
get the build file genaeration state
booleanisDeploy()
Returns the deploy mode flag
booleanisHelperWanted()
Indicate if we should be generating Helper classes
booleanisServerSide()
Indicate if we should be emitting server side code and deploy/undeploy
booleanisSkeletonWanted()
Indicate if we should be deploying skeleton or implementation
booleanisTestCaseWanted()
Method isTestCaseWanted
booleanisTypeCollisionProtection()
Get the type collision protection setting
voidrun(String wsdlURL)
Emit appropriate Java files for a WSDL at a given URL.
voidrun(String context, Document doc)
Call this method if your WSDL document has already been parsed as an XML DOM document.
protected voidsanityCheck(SymbolTable symbolTable)
Method sanityCheck
voidsetAllowInvalidURL(boolean allowInvalidURL)
voidsetAllWanted(boolean all)
By default, code is generated only for referenced elements.
voidsetBuildFileWanted(boolean value)
turn the build file genaration ON
voidsetDefaultTypeMapping(TypeMapping defaultTM)
Sets the default TypeMapping used by the service
voidsetDeploy(boolean isDeploy)
Sets the deploy mode flag
voidsetFactory(String factory)
Sets the WriterFactory Class to use
voidsetHelperGeneration(boolean value)
Turn on/off Helper class generation
voidsetHelperWanted(boolean value)
Turn on/off Helper class generation
voidsetImplementationClassName(String implementationClassName)
Set an implementation classname to use instead of the default.
voidsetNamespaceExcludes(List nsExcludes)
Sets the list of namespaces to specifically exclude from the generated source.
voidsetNamespaceIncludes(List nsIncludes)
Sets the list of namespaces to specifically include in the generated code.
voidsetNamespaceMap(HashMap map)
Set a map of namespace -> Java package names
voidsetNStoPkg(String NStoPkgFilename)
Set the NStoPkg mappings filename.
voidsetOutputDir(String outputDir)
Set the output directory to use in emitted source files
voidsetPackageName(String packageName)
Set a global package name to use instead of mapping namespaces
voidsetProperties(List properties)
Sets the list of extension properties for custom JavaGeneratorFactories.
voidsetQName2ClassMap(HashMap map)
Set the type qname to java class map
voidsetScope(Scope scope)
Set the scope for the deploy.xml file.
voidsetServerSide(boolean value)
Turn on/off server skeleton creation
voidsetServiceDesc(ServiceDesc serviceDesc)
Sets the ServicdDesc object
voidsetSkeletonWanted(boolean value)
Turn on/off server skeleton deploy
voidsetTestCaseWanted(boolean value)
Turn on/off test case creation
voidsetTypeCollisionProtection(boolean value)
Enable/disable type collision protection
voidsetTypeMappingVersion(String typeMappingVersion)
Method setTypeMappingVersion
voidsetWrapArrays(boolean wrapArrays)
voidverbose(boolean value)
Turn on/off verbose messages

Field Detail

baseTypeMapping

protected BaseTypeMapping baseTypeMapping
Field baseTypeMapping

DEFAULT_NSTOPKG_FILE

public static final String DEFAULT_NSTOPKG_FILE
Field DEFAULT_NSTOPKG_FILE

namespaceMap

protected HashMap namespaceMap
Field namespaceMap

namespaces

protected Namespaces namespaces
Field namespaces

nsExcludes

protected List nsExcludes
Field nsIncludes - defines a list of namespaces to specifically exclude from generated source code. Any entry in this list that is in conflict with the includes list should be ignored and generated.

nsIncludes

protected List nsIncludes
Field nsIncludes - defines a list of namespaces to specifically include in the generated source code. If non-empty, anything not in this list should be excluded. If empty, everything in this and not specifically excluded should be generated.

NStoPkgFilename

protected String NStoPkgFilename
Field NStoPkgFilename

properties

protected List properties
Field properties - defines a set of general purpose properties that can be used by custom JavaGeneratorFactories.

typeMappingVersion

protected String typeMappingVersion
Field typeMappingVersion

Constructor Detail

Emitter

public Emitter()
Default constructor.

Method Detail

debug

public void debug(boolean value)

Deprecated: Use setDebug(value)

Turn on/off debug messages.

Parameters: value

deploySkeleton

public void deploySkeleton(boolean value)

Deprecated: Use setSkeletonWanted(value)

Turn on/off server skeleton deploy

Parameters: value

doesExist

protected boolean doesExist(String className)
Check if the className exists.

Parameters: className className to check

Returns: true if exists, false if not

emit

public void emit(String uri)

Deprecated: Call run(uri) instead.

Call this method if you have a uri for the WSDL document

Parameters: uri wsdlURI the location of the WSDL file.

Throws: Exception

emit

public void emit(String context, Document doc)

Deprecated: Call run(context, doc) instead.

Call this method if your WSDL document has already been parsed as an XML DOM document.

Parameters: context context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory. doc doc This is the XML Document containing the WSDL.

Throws: IOException SAXException WSDLException ParserConfigurationException

generateAll

public void generateAll(boolean all)

Deprecated: Use setAllWanted(all)

Parameters: all

generateImports

public void generateImports(boolean generateImports)

Deprecated: Use setImports(generateImports)

Turn on/off generation of elements from imported files.

Parameters: generateImports

generateServerSide

public void generateServerSide(boolean value)

Deprecated: Use setServerSide(value)

Turn on/off server-side binding generation

Parameters: value

generateTestCase

public void generateTestCase(boolean value)

Deprecated: Use setTestCaseWanted()

Turn on/off test case creation

Parameters: value

getDebug

public boolean getDebug()

Deprecated: Use isDebug()

Return the status of the debug switch.

Returns:

getDefaultTypeMapping

public TypeMapping getDefaultTypeMapping()
Returns the default TypeMapping used by the service

Returns: the default TypeMapping used by the service

getDeploySkeleton

public boolean getDeploySkeleton()

Deprecated: Use isSkeletonWanted()

Indicate if we should be deploying skeleton or implementation

Returns:

getGeneratedClassNames

public List getGeneratedClassNames()
This method returns a list of all generated class names.

Returns:

getGeneratedFileInfo

public GeneratedFileInfo getGeneratedFileInfo()
Returns an object which contains of information on all generated files including the class name, filename and a type string.

Returns: An org.apache.axis.wsdl.toJava.GeneratedFileInfo object

See Also: GeneratedFileInfo

getGeneratedFileNames

public List getGeneratedFileNames()
This method returns a list of all generated file names.

Returns:

getGenerateServerSide

public boolean getGenerateServerSide()

Deprecated: Use isServerSide()

Indicate if we should be emitting server side code and deploy/undeploy

Returns:

getHelperGeneration

public boolean getHelperGeneration()

Deprecated: Use isHelperWanted()

Indicate if we should be generating Helper classes

Returns:

getImplementationClassName

public String getImplementationClassName()
Get an implementation classname to use instead of the default.

Returns:

getJavaName

public String getJavaName(QName qName)
Convert the specified QName into a full Java Name.

Parameters: qName

Returns:

getJavaNameHook

protected String getJavaNameHook(QName qname)

getJavaVariableName

public String getJavaVariableName(QName typeQName, QName xmlName, boolean isElement)

Parameters: typeQName QName for containing xml type xmlName QName for element

Returns:

getJavaVariableNameHook

protected String getJavaVariableNameHook(QName typeQName, QName xmlName, boolean isElement)

getNamespaceExcludes

public List getNamespaceExcludes()
Returns the list of excludes to specifically exclude from the generated source.

getNamespaceIncludes

public List getNamespaceIncludes()
Returns the list of namespaces specifically excluded from the generated code.

getNamespaceMap

public HashMap getNamespaceMap()
Get the map of namespace -> Java package names

Returns:

getNamespaces

public Namespaces getNamespaces()
Method getNamespaces

Returns:

getOutputDir

public String getOutputDir()
Get the output directory to use for emitted source files

Returns:

getPackage

public String getPackage(String namespace)
Get the Package name for the specified namespace

Parameters: namespace

Returns:

getPackage

public String getPackage(QName qName)
Get the Package name for the specified QName

Parameters: qName

Returns:

getPackageName

public String getPackageName()
Get global package name to use instead of mapping namespaces

Returns:

getProperties

public List getProperties()
Gets the list of extension properties for custom JavaGeneratorFactories.

getQName2ClassMap

public HashMap getQName2ClassMap()
Get the type qname to java class map

Returns: the type qname to java class map

getScope

public Scope getScope()
Get the scope for the deploy.xml file.

Returns:

getServiceDesc

public ServiceDesc getServiceDesc()
Retruns the SericeDesc object

Returns:

getTypeMappingVersion

public String getTypeMappingVersion()
Get the typemapping version

getVerbose

public boolean getVerbose()

Deprecated: Use isVerbose()

Return the status of the verbose switch

Returns:

getWriterFactory

public GeneratorFactory getWriterFactory()

Deprecated: Call getFactory instead. This doesn't return a WriterFactory, it returns a GeneratorFactory.

Get the GeneratorFactory.

Returns:

isAllowInvalidURL

public boolean isAllowInvalidURL()

Returns: Returns the allowInvalidURL.

isAllWanted

public boolean isAllWanted()
Method isAllWanted

Returns:

isBuildFileWanted

public boolean isBuildFileWanted()
get the build file genaeration state

Returns:

isDeploy

public boolean isDeploy()
Returns the deploy mode flag

Returns:

isHelperWanted

public boolean isHelperWanted()
Indicate if we should be generating Helper classes

Returns:

isServerSide

public boolean isServerSide()
Indicate if we should be emitting server side code and deploy/undeploy

Returns:

isSkeletonWanted

public boolean isSkeletonWanted()
Indicate if we should be deploying skeleton or implementation

Returns:

isTestCaseWanted

public boolean isTestCaseWanted()
Method isTestCaseWanted

Returns:

isTypeCollisionProtection

public boolean isTypeCollisionProtection()
Get the type collision protection setting

Returns:

run

public void run(String wsdlURL)
Emit appropriate Java files for a WSDL at a given URL.

This method will time out after the number of milliseconds specified by our timeoutms member.

Parameters: wsdlURL

Throws: Exception

run

public void run(String context, Document doc)
Call this method if your WSDL document has already been parsed as an XML DOM document.

Parameters: context context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory. doc doc This is the XML Document containing the WSDL.

Throws: IOException SAXException WSDLException ParserConfigurationException

sanityCheck

protected void sanityCheck(SymbolTable symbolTable)
Method sanityCheck

Parameters: symbolTable

setAllowInvalidURL

public void setAllowInvalidURL(boolean allowInvalidURL)

Parameters: allowInvalidURL The allowInvalidURL to set.

setAllWanted

public void setAllWanted(boolean all)
By default, code is generated only for referenced elements. Call bGenerateAll(true) and WSDL2Java will generate code for all elements in the scope regardless of whether they are referenced. Scope means: by default, all WSDL files; if generateImports(false), then only the immediate WSDL file.

Parameters: all

setBuildFileWanted

public void setBuildFileWanted(boolean value)
turn the build file genaration ON

Parameters: value

setDefaultTypeMapping

public void setDefaultTypeMapping(TypeMapping defaultTM)
Sets the default TypeMapping used by the service

Parameters: defaultTM the default TypeMapping used by the service

setDeploy

public void setDeploy(boolean isDeploy)
Sets the deploy mode flag

Parameters: isDeploy deploy mode flag

setFactory

public void setFactory(String factory)
Sets the WriterFactory Class to use

Parameters: factory the name of the factory Class

setHelperGeneration

public void setHelperGeneration(boolean value)

Deprecated: Use setHelperWanted(value)

Turn on/off Helper class generation

Parameters: value

setHelperWanted

public void setHelperWanted(boolean value)
Turn on/off Helper class generation

Parameters: value

setImplementationClassName

public void setImplementationClassName(String implementationClassName)
Set an implementation classname to use instead of the default.

Parameters: implementationClassName

setNamespaceExcludes

public void setNamespaceExcludes(List nsExcludes)
Sets the list of namespaces to specifically exclude from the generated source.

setNamespaceIncludes

public void setNamespaceIncludes(List nsIncludes)
Sets the list of namespaces to specifically include in the generated code.

setNamespaceMap

public void setNamespaceMap(HashMap map)
Set a map of namespace -> Java package names

Parameters: map

setNStoPkg

public void setNStoPkg(String NStoPkgFilename)
Set the NStoPkg mappings filename.

Parameters: NStoPkgFilename

setOutputDir

public void setOutputDir(String outputDir)
Set the output directory to use in emitted source files

Parameters: outputDir

setPackageName

public void setPackageName(String packageName)
Set a global package name to use instead of mapping namespaces

Parameters: packageName

setProperties

public void setProperties(List properties)
Sets the list of extension properties for custom JavaGeneratorFactories.

setQName2ClassMap

public void setQName2ClassMap(HashMap map)
Set the type qname to java class map

Parameters: map a type qname to javaclass map (from Java2Wsdl emitter)

setScope

public void setScope(Scope scope)
Set the scope for the deploy.xml file.

Parameters: scope One of 'null', Scope.APPLICATION, Scope.REQUEST, Scope.SESSION. Anything else is equivalent to 'null' null and no explicit scope tag will appear in deploy.xml.

setServerSide

public void setServerSide(boolean value)
Turn on/off server skeleton creation

Parameters: value

setServiceDesc

public void setServiceDesc(ServiceDesc serviceDesc)
Sets the ServicdDesc object

Parameters: serviceDesc ServiceDesc to set

setSkeletonWanted

public void setSkeletonWanted(boolean value)
Turn on/off server skeleton deploy

Parameters: value

setTestCaseWanted

public void setTestCaseWanted(boolean value)
Turn on/off test case creation

Parameters: value

setTypeCollisionProtection

public void setTypeCollisionProtection(boolean value)
Enable/disable type collision protection

Parameters: value

setTypeMappingVersion

public void setTypeMappingVersion(String typeMappingVersion)
Method setTypeMappingVersion

Parameters: typeMappingVersion

setWrapArrays

public void setWrapArrays(boolean wrapArrays)

verbose

public void verbose(boolean value)

Deprecated: Use setVerbose(value)

Turn on/off verbose messages

Parameters: value

Copyright B) 2005 Apache Web Services Project. All Rights Reserved.