FileDocCategorySizeDatePackage
JavaUndeployWriter.javaAPI DocApache Axis 1.45248Sat Apr 22 18:57:26 BST 2006org.apache.axis.wsdl.toJava

JavaUndeployWriter

public class JavaUndeployWriter extends JavaWriter
This is Wsdl2java's deploy Writer. It writes the deploy.java file.

Fields Summary
protected javax.wsdl.Definition
definition
Field definition
Constructors Summary
public JavaUndeployWriter(Emitter emitter, javax.wsdl.Definition definition, org.apache.axis.wsdl.symbolTable.SymbolTable notUsed)
Constructor.

param
emitter
param
definition
param
notUsed


        super(emitter, "undeploy");

        this.definition = definition;
    
Methods Summary
public voidgenerate()
Generate undeploy.wsdd. Only generate it if the emitter is generating server-side mappings.

throws
IOException


        if (emitter.isServerSide()) {
            super.generate();
        }
    
protected java.lang.StringgetFileName()
Return the fully-qualified name of the undeploy.wsdd file to be generated.

return


        String dir =
                emitter.getNamespaces().getAsDir(definition.getTargetNamespace());

        return dir + "undeploy.wsdd";
    
protected java.io.PrintWritergetPrintWriter(java.lang.String filename)
Method getPrintWriter

param
filename
return
throws
IOException


        File file = new File(filename);
        File parent = new File(file.getParent());

        parent.mkdirs();

        FileOutputStream out = new FileOutputStream(file);
        OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");

        return new PrintWriter(writer);
    
protected voidwriteDeployPort(java.io.PrintWriter pw, javax.wsdl.Port port)
Write out deployment and undeployment instructions for given WSDL port

param
pw
param
port
throws
IOException


        String serviceName = port.getName();

        pw.println("  <service name=\"" + serviceName + "\"/>");
    
protected voidwriteDeployServices(java.io.PrintWriter pw)
Write out deployment and undeployment instructions for each WSDL service

param
pw
throws
IOException


        // deploy the ports on each service
        Map serviceMap = definition.getServices();

        for (Iterator mapIterator = serviceMap.values().iterator();
             mapIterator.hasNext();) {
            Service myService = (Service) mapIterator.next();

            pw.println();
            pw.println(
                    "  <!-- "
                    + Messages.getMessage(
                            "wsdlService00", myService.getQName().getLocalPart()) + " -->");
            pw.println();

            for (Iterator portIterator = myService.getPorts().values().iterator();
                 portIterator.hasNext();) {
                Port myPort = (Port) portIterator.next();

                writeDeployPort(pw, myPort);
            }
        }
    
protected voidwriteFileBody(java.io.PrintWriter pw)
Write the body of the deploy.wsdd file.

param
pw
throws
IOException

        writeDeployServices(pw);
        pw.println("</undeployment>");
    
protected voidwriteFileHeader(java.io.PrintWriter pw)
Replace the default file header with the deployment doc file header.

param
pw
throws
IOException


        pw.println(Messages.getMessage("deploy01"));
        pw.println(Messages.getMessage("deploy02"));
        pw.println(Messages.getMessage("deploy04"));
        pw.println(Messages.getMessage("deploy05"));
        pw.println(Messages.getMessage("deploy06"));
        pw.println(Messages.getMessage("deploy08"));
        pw.println(Messages.getMessage("deploy09"));
        pw.println();
        pw.println("<undeployment");
        pw.println("    xmlns=\"" + WSDDConstants.URI_WSDD + "\">");