Package org.apache.axis.wsdl.toJava
Class Emitter
- java.lang.Object
-
- org.apache.axis.wsdl.gen.Parser
-
- org.apache.axis.wsdl.toJava.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
Fields Modifier and Type Field Description protected BaseTypeMappingbaseTypeMappingField baseTypeMappingstatic java.lang.StringDEFAULT_NSTOPKG_FILEField DEFAULT_NSTOPKG_FILEprotected java.util.HashMapnamespaceMapField namespaceMapprotected NamespacesnamespacesField namespacesprotected java.util.ListnsExcludesField nsIncludes - defines a list of namespaces to specifically exclude from generated source code.protected java.util.ListnsIncludesField nsIncludes - defines a list of namespaces to specifically include in the generated source code.protected java.lang.StringNStoPkgFilenameField NStoPkgFilenameprotected java.util.ListpropertiesField properties - defines a set of general purpose properties that can be used by custom JavaGeneratorFactories.protected java.lang.StringtypeMappingVersionField typeMappingVersion
-
Constructor Summary
Constructors Constructor Description Emitter()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddebug(boolean value)Deprecated.Use setDebug(value)voiddeploySkeleton(boolean value)Deprecated.Use setSkeletonWanted(value)protected booleandoesExist(java.lang.String className)Check if the className exists.voidemit(java.lang.String uri)Deprecated.Call run(uri) instead.voidemit(java.lang.String context, org.w3c.dom.Document doc)Deprecated.Call run(context, doc) instead.voidgenerateAll(boolean all)Deprecated.Use setAllWanted(all)voidgenerateImports(boolean generateImports)Deprecated.Use setImports(generateImports)voidgenerateServerSide(boolean value)Deprecated.Use setServerSide(value)voidgenerateTestCase(boolean value)Deprecated.Use setTestCaseWanted()booleangetDebug()Deprecated.Use isDebug()TypeMappinggetDefaultTypeMapping()Returns the defaultTypeMappingused by the servicebooleangetDeploySkeleton()Deprecated.Use isSkeletonWanted()java.util.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.java.util.ListgetGeneratedFileNames()This method returns a list of all generated file names.booleangetGenerateServerSide()Deprecated.Use isServerSide()booleangetHelperGeneration()Deprecated.Use isHelperWanted()java.lang.StringgetImplementationClassName()Get an implementation classname to use instead of the default.java.lang.StringgetJavaName(QName qName)Convert the specified QName into a full Java Name.protected java.lang.StringgetJavaNameHook(QName qname)java.lang.StringgetJavaVariableName(QName typeQName, QName xmlName, boolean isElement)protected java.lang.StringgetJavaVariableNameHook(QName typeQName, QName xmlName, boolean isElement)java.util.ListgetNamespaceExcludes()Returns the list of excludes to specifically exclude from the generated source.java.util.ListgetNamespaceIncludes()Returns the list of namespaces specifically excluded from the generated code.java.util.HashMapgetNamespaceMap()Get the map of namespace -> Java package namesNamespacesgetNamespaces()Method getNamespacesjava.lang.StringgetOutputDir()Get the output directory to use for emitted source filesjava.lang.StringgetPackage(java.lang.String namespace)Get the Package name for the specified namespacejava.lang.StringgetPackage(QName qName)Get the Package name for the specified QNamejava.lang.StringgetPackageName()Get global package name to use instead of mapping namespacesjava.util.ListgetProperties()Gets the list of extension properties for custom JavaGeneratorFactories.java.util.HashMapgetQName2ClassMap()Get the type qname to java class mapScopegetScope()Get the scope for the deploy.xml file.ServiceDescgetServiceDesc()Retruns the SericeDesc objectjava.lang.StringgetTypeMappingVersion()Get the typemapping versionbooleangetVerbose()Deprecated.Use isVerbose()GeneratorFactorygetWriterFactory()Deprecated.Call getFactory instead.booleanisAllowInvalidURL()booleanisAllWanted()Method isAllWantedbooleanisBuildFileWanted()get the build file genaeration statebooleanisDeploy()Returns the deploy mode flagbooleanisHelperWanted()Indicate if we should be generating Helper classesbooleanisServerSide()Indicate if we should be emitting server side code and deploy/undeploybooleanisSkeletonWanted()Indicate if we should be deploying skeleton or implementationbooleanisTestCaseWanted()Method isTestCaseWantedbooleanisTypeCollisionProtection()Get the type collision protection settingvoidrun(java.lang.String wsdlURL)Emit appropriate Java files for a WSDL at a given URL.voidrun(java.lang.String context, org.w3c.dom.Document doc)Call this method if your WSDL document has already been parsed as an XML DOM document.protected voidsanityCheck(SymbolTable symbolTable)Method sanityCheckvoidsetAllowInvalidURL(boolean allowInvalidURL)voidsetAllWanted(boolean all)By default, code is generated only for referenced elements.voidsetBuildFileWanted(boolean value)turn the build file genaration ONvoidsetDefaultTypeMapping(TypeMapping defaultTM)Sets the defaultTypeMappingused by the servicevoidsetDeploy(boolean isDeploy)Sets the deploy mode flagvoidsetFactory(java.lang.String factory)Sets theWriterFactory Classto usevoidsetHelperGeneration(boolean value)Deprecated.Use setHelperWanted(value)voidsetHelperWanted(boolean value)Turn on/off Helper class generationvoidsetImplementationClassName(java.lang.String implementationClassName)Set an implementation classname to use instead of the default.voidsetNamespaceExcludes(java.util.List nsExcludes)Sets the list of namespaces to specifically exclude from the generated source.voidsetNamespaceIncludes(java.util.List nsIncludes)Sets the list of namespaces to specifically include in the generated code.voidsetNamespaceMap(java.util.HashMap map)Set a map of namespace -> Java package namesvoidsetNStoPkg(java.lang.String NStoPkgFilename)Set the NStoPkg mappings filename.voidsetOutputDir(java.lang.String outputDir)Set the output directory to use in emitted source filesvoidsetPackageName(java.lang.String packageName)Set a global package name to use instead of mapping namespacesvoidsetProperties(java.util.List properties)Sets the list of extension properties for custom JavaGeneratorFactories.voidsetQName2ClassMap(java.util.HashMap map)Set the type qname to java class mapvoidsetScope(Scope scope)Set the scope for the deploy.xml file.voidsetServerSide(boolean value)Turn on/off server skeleton creationvoidsetServiceDesc(ServiceDesc serviceDesc)Sets the ServicdDesc objectvoidsetSkeletonWanted(boolean value)Turn on/off server skeleton deployvoidsetTestCaseWanted(boolean value)Turn on/off test case creationvoidsetTypeCollisionProtection(boolean value)Enable/disable type collision protectionvoidsetTypeMappingVersion(java.lang.String typeMappingVersion)Method setTypeMappingVersionvoidsetWrapArrays(boolean wrapArrays)voidverbose(boolean value)Deprecated.Use setVerbose(value)-
Methods inherited from class org.apache.axis.wsdl.gen.Parser
getCurrentDefinition, getFactory, getPassword, getSymbolTable, getTimeout, getUsername, getWSDLURI, isDebug, isImports, isNowrap, isQuiet, isVerbose, setDebug, setFactory, setImports, setNowrap, setPassword, setQuiet, setTimeout, setUsername, setVerbose
-
-
-
-
Field Detail
-
DEFAULT_NSTOPKG_FILE
public static final java.lang.String DEFAULT_NSTOPKG_FILE
Field DEFAULT_NSTOPKG_FILE- See Also:
- Constant Field Values
-
namespaceMap
protected java.util.HashMap namespaceMap
Field namespaceMap
-
typeMappingVersion
protected java.lang.String typeMappingVersion
Field typeMappingVersion
-
baseTypeMapping
protected BaseTypeMapping baseTypeMapping
Field baseTypeMapping
-
namespaces
protected Namespaces namespaces
Field namespaces
-
NStoPkgFilename
protected java.lang.String NStoPkgFilename
Field NStoPkgFilename
-
nsIncludes
protected java.util.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.
-
nsExcludes
protected java.util.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.
-
properties
protected java.util.List properties
Field properties - defines a set of general purpose properties that can be used by custom JavaGeneratorFactories.
-
-
Method Detail
-
setServerSide
public void setServerSide(boolean value)
Turn on/off server skeleton creation- Parameters:
value-
-
isServerSide
public boolean isServerSide()
Indicate if we should be emitting server side code and deploy/undeploy- Returns:
-
setSkeletonWanted
public void setSkeletonWanted(boolean value)
Turn on/off server skeleton deploy- Parameters:
value-
-
isSkeletonWanted
public boolean isSkeletonWanted()
Indicate if we should be deploying skeleton or implementation- Returns:
-
setHelperWanted
public void setHelperWanted(boolean value)
Turn on/off Helper class generation- Parameters:
value-
-
isHelperWanted
public boolean isHelperWanted()
Indicate if we should be generating Helper classes- Returns:
-
setTestCaseWanted
public void setTestCaseWanted(boolean value)
Turn on/off test case creation- Parameters:
value-
-
isTestCaseWanted
public boolean isTestCaseWanted()
Method isTestCaseWanted- Returns:
-
isBuildFileWanted
public boolean isBuildFileWanted()
get the build file genaeration state- Returns:
-
setBuildFileWanted
public void setBuildFileWanted(boolean value)
turn the build file genaration ON- Parameters:
value-
-
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-
-
isAllWanted
public boolean isAllWanted()
Method isAllWanted- Returns:
-
getNamespaces
public Namespaces getNamespaces()
Method getNamespaces- Returns:
-
setOutputDir
public void setOutputDir(java.lang.String outputDir)
Set the output directory to use in emitted source files- Parameters:
outputDir-
-
getOutputDir
public java.lang.String getOutputDir()
Get the output directory to use for emitted source files- Returns:
-
getPackageName
public java.lang.String getPackageName()
Get global package name to use instead of mapping namespaces- Returns:
-
setPackageName
public void setPackageName(java.lang.String packageName)
Set a global package name to use instead of mapping namespaces- Parameters:
packageName-
-
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.
-
getScope
public Scope getScope()
Get the scope for the deploy.xml file.- Returns:
-
setNStoPkg
public void setNStoPkg(java.lang.String NStoPkgFilename)
Set the NStoPkg mappings filename.- Parameters:
NStoPkgFilename-
-
setNamespaceMap
public void setNamespaceMap(java.util.HashMap map)
Set a map of namespace -> Java package names- Parameters:
map-
-
getNamespaceMap
public java.util.HashMap getNamespaceMap()
Get the map of namespace -> Java package names- Returns:
-
setNamespaceIncludes
public void setNamespaceIncludes(java.util.List nsIncludes)
Sets the list of namespaces to specifically include in the generated code.
-
getNamespaceIncludes
public java.util.List getNamespaceIncludes()
Returns the list of namespaces specifically excluded from the generated code.
-
setNamespaceExcludes
public void setNamespaceExcludes(java.util.List nsExcludes)
Sets the list of namespaces to specifically exclude from the generated source.
-
getNamespaceExcludes
public java.util.List getNamespaceExcludes()
Returns the list of excludes to specifically exclude from the generated source.
-
setProperties
public void setProperties(java.util.List properties)
Sets the list of extension properties for custom JavaGeneratorFactories.
-
getProperties
public java.util.List getProperties()
Gets the list of extension properties for custom JavaGeneratorFactories.
-
getDefaultTypeMapping
public TypeMapping getDefaultTypeMapping()
Returns the defaultTypeMappingused by the service- Returns:
- the default
TypeMappingused by the service
-
setDefaultTypeMapping
public void setDefaultTypeMapping(TypeMapping defaultTM)
Sets the defaultTypeMappingused by the service- Parameters:
defaultTM- the defaultTypeMappingused by the service
-
setFactory
public void setFactory(java.lang.String factory)
Sets theWriterFactory Classto use- Parameters:
factory- the name of the factoryClass
-
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
-
getGeneratedClassNames
public java.util.List getGeneratedClassNames()
This method returns a list of all generated class names.- Returns:
-
getGeneratedFileNames
public java.util.List getGeneratedFileNames()
This method returns a list of all generated file names.- Returns:
-
getPackage
public java.lang.String getPackage(java.lang.String namespace)
Get the Package name for the specified namespace- Parameters:
namespace-- Returns:
-
getPackage
public java.lang.String getPackage(QName qName)
Get the Package name for the specified QName- Parameters:
qName-- Returns:
-
getJavaName
public java.lang.String getJavaName(QName qName)
Convert the specified QName into a full Java Name.- Parameters:
qName-- Returns:
-
getJavaNameHook
protected java.lang.String getJavaNameHook(QName qname)
-
getJavaVariableName
public java.lang.String getJavaVariableName(QName typeQName, QName xmlName, boolean isElement)
- Parameters:
typeQName- QName for containing xml typexmlName- QName for element- Returns:
-
getJavaVariableNameHook
protected java.lang.String getJavaVariableNameHook(QName typeQName, QName xmlName, boolean isElement)
-
run
public void run(java.lang.String wsdlURL) throws java.lang.ExceptionEmit 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.
-
run
public void run(java.lang.String context, org.w3c.dom.Document doc) throws java.io.IOException, org.xml.sax.SAXException, javax.wsdl.WSDLException, javax.xml.parsers.ParserConfigurationExceptionCall this method if your WSDL document has already been parsed as an XML DOM document.- Overrides:
runin classParser- 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:
java.io.IOExceptionorg.xml.sax.SAXExceptionjavax.wsdl.WSDLExceptionjavax.xml.parsers.ParserConfigurationException
-
sanityCheck
protected void sanityCheck(SymbolTable symbolTable)
Method sanityCheck- Overrides:
sanityCheckin classParser- Parameters:
symbolTable-
-
getTypeMappingVersion
public java.lang.String getTypeMappingVersion()
Get the typemapping version
-
setTypeMappingVersion
public void setTypeMappingVersion(java.lang.String typeMappingVersion)
Method setTypeMappingVersion- Parameters:
typeMappingVersion-
-
getWriterFactory
public GeneratorFactory getWriterFactory()
Deprecated.Call getFactory instead. This doesn't return a WriterFactory, it returns a GeneratorFactory.Get the GeneratorFactory.- Returns:
-
emit
public void emit(java.lang.String uri) throws java.lang.ExceptionDeprecated.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:
java.lang.Exception
-
emit
public void emit(java.lang.String context, org.w3c.dom.Document doc) throws java.io.IOException, org.xml.sax.SAXException, javax.wsdl.WSDLException, javax.xml.parsers.ParserConfigurationExceptionDeprecated.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:
java.io.IOExceptionorg.xml.sax.SAXExceptionjavax.wsdl.WSDLExceptionjavax.xml.parsers.ParserConfigurationException
-
generateServerSide
public void generateServerSide(boolean value)
Deprecated.Use setServerSide(value)Turn on/off server-side binding generation- Parameters:
value-
-
getGenerateServerSide
public boolean getGenerateServerSide()
Deprecated.Use isServerSide()Indicate if we should be emitting server side code and deploy/undeploy- Returns:
-
deploySkeleton
public void deploySkeleton(boolean value)
Deprecated.Use setSkeletonWanted(value)Turn on/off server skeleton deploy- Parameters:
value-
-
getDeploySkeleton
public boolean getDeploySkeleton()
Deprecated.Use isSkeletonWanted()Indicate if we should be deploying skeleton or implementation- Returns:
-
setHelperGeneration
public void setHelperGeneration(boolean value)
Deprecated.Use setHelperWanted(value)Turn on/off Helper class generation- Parameters:
value-
-
getHelperGeneration
public boolean getHelperGeneration()
Deprecated.Use isHelperWanted()Indicate if we should be generating Helper classes- Returns:
-
generateImports
public void generateImports(boolean generateImports)
Deprecated.Use setImports(generateImports)Turn on/off generation of elements from imported files.- Parameters:
generateImports-
-
debug
public void debug(boolean value)
Deprecated.Use setDebug(value)Turn on/off debug messages.- Parameters:
value-
-
getDebug
public boolean getDebug()
Deprecated.Use isDebug()Return the status of the debug switch.- Returns:
-
verbose
public void verbose(boolean value)
Deprecated.Use setVerbose(value)Turn on/off verbose messages- Parameters:
value-
-
getVerbose
public boolean getVerbose()
Deprecated.Use isVerbose()Return the status of the verbose switch- Returns:
-
generateTestCase
public void generateTestCase(boolean value)
Deprecated.Use setTestCaseWanted()Turn on/off test case creation- Parameters:
value-
-
generateAll
public void generateAll(boolean all)
Deprecated.Use setAllWanted(all)- Parameters:
all-
-
isTypeCollisionProtection
public boolean isTypeCollisionProtection()
Get the type collision protection setting- Returns:
-
setTypeCollisionProtection
public void setTypeCollisionProtection(boolean value)
Enable/disable type collision protection- Parameters:
value-
-
getImplementationClassName
public java.lang.String getImplementationClassName()
Get an implementation classname to use instead of the default.- Returns:
-
setImplementationClassName
public void setImplementationClassName(java.lang.String implementationClassName)
Set an implementation classname to use instead of the default.- Parameters:
implementationClassName-
-
isAllowInvalidURL
public boolean isAllowInvalidURL()
- Returns:
- Returns the allowInvalidURL.
-
setAllowInvalidURL
public void setAllowInvalidURL(boolean allowInvalidURL)
- Parameters:
allowInvalidURL- The allowInvalidURL to set.
-
setQName2ClassMap
public void setQName2ClassMap(java.util.HashMap map)
Set the type qname to java class map- Parameters:
map- a type qname to javaclass map (from Java2Wsdl emitter)
-
getQName2ClassMap
public java.util.HashMap getQName2ClassMap()
Get the type qname to java class map- Returns:
- the type qname to java class map
-
getServiceDesc
public ServiceDesc getServiceDesc()
Retruns the SericeDesc object- Returns:
-
setServiceDesc
public void setServiceDesc(ServiceDesc serviceDesc)
Sets the ServicdDesc object- Parameters:
serviceDesc- ServiceDesc to set
-
isDeploy
public boolean isDeploy()
Returns the deploy mode flag- Returns:
-
setDeploy
public void setDeploy(boolean isDeploy)
Sets the deploy mode flag- Parameters:
isDeploy- deploy mode flag
-
doesExist
protected boolean doesExist(java.lang.String className)
Check if the className exists.- Parameters:
className- className to check- Returns:
- true if exists, false if not
-
setWrapArrays
public void setWrapArrays(boolean wrapArrays)
-
-