FileDocCategorySizeDatePackage
JavaBindingWriter.javaAPI DocApache Axis 1.47092Sat Apr 22 18:57:28 BST 2006org.apache.axis.wsdl.toJava

JavaBindingWriter

public class JavaBindingWriter extends Object implements org.apache.axis.wsdl.gen.Generator
This is Wsdl2java's Binding Writer. It writes the following files, as appropriate: Stub.java, Skeleton.java, Impl.java.

Fields Summary
protected org.apache.axis.wsdl.gen.Generator
stubWriter
Field stubWriter
protected org.apache.axis.wsdl.gen.Generator
skelWriter
Field skelWriter
protected org.apache.axis.wsdl.gen.Generator
implWriter
Field implWriter
protected org.apache.axis.wsdl.gen.Generator
interfaceWriter
Field interfaceWriter
protected Emitter
emitter
Field emitter
protected javax.wsdl.Binding
binding
Field binding
protected org.apache.axis.wsdl.symbolTable.SymbolTable
symbolTable
Field symbolTable
public static String
INTERFACE_NAME
Field INTERFACE_NAME
Constructors Summary
public JavaBindingWriter(Emitter emitter, javax.wsdl.Binding binding, org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)
Constructor.

param
emitter
param
binding
param
symbolTable


                            
        
                               

        this.emitter = emitter;
        this.binding = binding;
        this.symbolTable = symbolTable;
    
Methods Summary
public voidgenerate()
Write all the binding bindings: stub, skeleton, and impl.

throws
IOException


        setGenerators();
        postSetGenerators();

        if (interfaceWriter != null) {
            interfaceWriter.generate();
        }

        if (stubWriter != null) {
            stubWriter.generate();
        }

        if (skelWriter != null) {
            skelWriter.generate();
        }

        if (implWriter != null) {
            implWriter.generate();
        }
    
protected org.apache.axis.wsdl.gen.GeneratorgetJavaImplWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.BindingEntry bEntry, org.apache.axis.wsdl.symbolTable.SymbolTable st)
getJavaImplWriter

param
emitter
param
bEntry
param
st
return

        return new JavaImplWriter(emitter, bEntry, st);
    
protected org.apache.axis.wsdl.gen.GeneratorgetJavaInterfaceWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.PortTypeEntry ptEntry, org.apache.axis.wsdl.symbolTable.BindingEntry bEntry, org.apache.axis.wsdl.symbolTable.SymbolTable st)
getJavaInterfaceWriter

param
emitter
param
ptEntry
param
bEntry
param
st
return

        return new JavaInterfaceWriter(emitter, ptEntry, bEntry, st);
    
protected org.apache.axis.wsdl.gen.GeneratorgetJavaSkelWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.BindingEntry bEntry, org.apache.axis.wsdl.symbolTable.SymbolTable st)
getJavaSkelWriter

param
emitter
param
bEntry
param
st
return

        return new JavaSkelWriter(emitter, bEntry, st);
    
protected org.apache.axis.wsdl.gen.GeneratorgetJavaStubWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.BindingEntry bEntry, org.apache.axis.wsdl.symbolTable.SymbolTable st)
getJavaStubWriter

param
emitter
param
bEntry
param
st
return

        return new JavaStubWriter(emitter, bEntry, st);
    
protected voidpostSetGenerators()
Set the writer based on the other condition after generate() is called.

        if (emitter.isDeploy()) {
            interfaceWriter = null;
            stubWriter = null;
            skelWriter = null;	       
            implWriter = null;
        }	       
    
protected voidsetGenerators()
setGenerators Logic to set the generators that are based on the Binding This logic was moved from the constructor so extended interfaces can more effectively use the hooks.


        BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());

        // Interface writer
        PortTypeEntry ptEntry =
                symbolTable.getPortTypeEntry(binding.getPortType().getQName());

        if (ptEntry.isReferenced()) {
            interfaceWriter = getJavaInterfaceWriter(emitter, ptEntry, bEntry,
                    symbolTable);
        }

        if (bEntry.isReferenced()) {

            // Stub writer
            stubWriter = getJavaStubWriter(emitter, bEntry, symbolTable);

            // Skeleton and Impl writers
            if (emitter.isServerSide()) {
                if (emitter.isSkeletonWanted()) {
                    skelWriter = getJavaSkelWriter(emitter, bEntry,
                            symbolTable);
                }

                // Use custom implementation classname if available
                String fileName = emitter.getImplementationClassName(); 
                if ( fileName == null)
					fileName = Utils.getJavaLocalName(bEntry.getName())
                    	    + "Impl.java";
				else
					fileName = Utils.getJavaLocalName(fileName) + ".java";

                try {
                    if (Utils.fileExists(fileName,
                            binding.getQName().getNamespaceURI(),
                            emitter.getNamespaces())) {
                        if (!emitter.isQuiet()) {
                            System.out.println(
                                 Messages.getMessage("wontOverwrite",
                                                     fileName));
                        }
                    } else {
                        implWriter = getJavaImplWriter(emitter, bEntry,
                                symbolTable);
                    }
                } catch (IOException ioe) {
                    System.err.println(Messages.getMessage("fileExistError00",
                            fileName));
                }
            }
        }