org.apache.axis.wsdl.toJava
Class JavaWriter

java.lang.Object
  |
  +--org.apache.axis.wsdl.toJava.JavaWriter
All Implemented Interfaces:
Writer
Direct Known Subclasses:
JavaComplexTypeWriter, JavaDeployWriter, JavaEnumTypeWriter, JavaFaultWriter, JavaHolderWriter, JavaImplWriter, JavaInterfaceWriter, JavaServiceIfaceWriter, JavaServiceImplWriter, JavaSkelWriter, JavaStubWriter, JavaTestCaseWriter, JavaUndeployWriter

public abstract class JavaWriter
extends java.lang.Object
implements Writer

All of Wsdl2java's Writer implementations do some common stuff. All this common stuff resides in this abstract base class. All that extensions to this class have to do is implement writeFileBody. Emitter knows about WSDL writers, one each for PortType, Binding, Service, Definition, Type. But for some of these WSDL types, Wsdl2java generates multiple files. Each of these files has a corresponding writer that extends JavaWriter. So the Java WSDL writers (JavaPortTypeWriter, JavaBindingWriter, etc.) each calls a file writer (JavaStubWriter, JavaSkelWriter, etc.) for each file that that WSDL generates. For example, when Emitter calls JavaWriterFactory for a Binding Writer, it returns a JavaBindingWriter. JavaBindingWriter, in turn, contains a JavaStubWriter, JavaSkelWriter, and JavaImplWriter since a Binding may cause a stub, skeleton, and impl template to be generated. Note that the writers that are given to Emitter by JavaWriterFactory DO NOT extend JavaWriter. They simply implement Writer and delegate the actual task of writing to extensions of JavaWriter.


Field Summary
protected  java.lang.String className
           
protected  Emitter emitter
           
protected  java.lang.String fileName
           
protected  java.lang.String message
           
protected  Namespaces namespaces
           
protected  java.lang.String packageName
           
protected  java.io.PrintWriter pw
           
protected  javax.wsdl.QName qname
           
protected  java.lang.String type
           
 
Constructor Summary
protected JavaWriter(Emitter emitter, javax.wsdl.QName qname, java.lang.String suffix, java.lang.String extension, java.lang.String message, java.lang.String type)
          Constructor.
protected JavaWriter(Emitter emitter, SymTabEntry entry, java.lang.String suffix, java.lang.String extension, java.lang.String message, java.lang.String type)
          Constructor.
 
Method Summary
protected  boolean fileExists(java.lang.String name, java.lang.String namespace)
          Does the given file already exist?
protected  java.lang.String getResponseString(TypeEntry type, java.lang.String var)
          Return the Object variable 'var' cast to the appropriate type doing the right thing for the primitive types.
protected  void initializeDeploymentDoc(java.lang.String deploymentOpName)
          Initialize the deployment document, spit out preamble comments and opening tag.
protected  boolean isPrimitiveType(TypeEntry type)
           
protected  java.lang.String wrapPrimitiveType(TypeEntry type, java.lang.String var)
          Return a string with "var" wrapped as an Object type if needed
 void write()
          Create the file, write the header, write the body.
protected  void writeComment(java.io.PrintWriter pw, org.w3c.dom.Element element)
          output documentation element as a Java comment.
protected abstract  void writeFileBody()
          Write the body of the file.
protected  void writeFileHeader()
          Write a common header, including the package name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emitter

protected Emitter emitter

qname

protected javax.wsdl.QName qname

namespaces

protected Namespaces namespaces

className

protected java.lang.String className

fileName

protected java.lang.String fileName

packageName

protected java.lang.String packageName

pw

protected java.io.PrintWriter pw

message

protected java.lang.String message

type

protected java.lang.String type
Constructor Detail

JavaWriter

protected JavaWriter(Emitter emitter,
                     SymTabEntry entry,
                     java.lang.String suffix,
                     java.lang.String extension,
                     java.lang.String message,
                     java.lang.String type)
Constructor. Use this one to pass in a Type. Type contains QName and java name.

JavaWriter

protected JavaWriter(Emitter emitter,
                     javax.wsdl.QName qname,
                     java.lang.String suffix,
                     java.lang.String extension,
                     java.lang.String message,
                     java.lang.String type)
Constructor. Use Set up all the variables needed to write a file.
Method Detail

write

public void write()
           throws java.io.IOException
Create the file, write the header, write the body.
Specified by:
write in interface Writer

writeFileHeader

protected void writeFileHeader()
                        throws java.io.IOException
Write a common header, including the package name.

writeComment

protected void writeComment(java.io.PrintWriter pw,
                            org.w3c.dom.Element element)
output documentation element as a Java comment.

wrapPrimitiveType

protected java.lang.String wrapPrimitiveType(TypeEntry type,
                                             java.lang.String var)
Return a string with "var" wrapped as an Object type if needed

getResponseString

protected java.lang.String getResponseString(TypeEntry type,
                                             java.lang.String var)
Return the Object variable 'var' cast to the appropriate type doing the right thing for the primitive types.

isPrimitiveType

protected boolean isPrimitiveType(TypeEntry type)

initializeDeploymentDoc

protected void initializeDeploymentDoc(java.lang.String deploymentOpName)
                                throws java.io.IOException
Initialize the deployment document, spit out preamble comments and opening tag.

fileExists

protected boolean fileExists(java.lang.String name,
                             java.lang.String namespace)
                      throws java.io.IOException
Does the given file already exist?

writeFileBody

protected abstract void writeFileBody()
                               throws java.io.IOException
Write the body of the file. This is what extenders of this class must implement


Copyright © 2001 Apache XML Project. All Rights Reserved.