Package org.apache.axis.wsdl

Examples of org.apache.axis.wsdl.Emitter


            log("\tdeployScope:" + deployScope, Project.MSG_VERBOSE);
            log("\tURL:" + url, Project.MSG_VERBOSE);
           
            // Instantiate the emitter
            JavaWriterFactory writerFactory = new JavaWriterFactory();
            Emitter emitter = new Emitter(writerFactory);
            writerFactory.setEmitter(emitter);

            if ("application".equalsIgnoreCase(deployScope)) {
                emitter.setScope(Emitter.APPLICATION_SCOPE);
            }
            else if ("request".equalsIgnoreCase(deployScope)) {
                emitter.setScope(Emitter.REQUEST_SCOPE);
            }
            else if ("session".equalsIgnoreCase(deployScope)) {
                emitter.setScope(Emitter.SESSION_SCOPE);
            }
            else if ("none".equalsIgnoreCase(deployScope)) {
                emitter.setScope(Emitter.NO_EXPLICIT_SCOPE);
            }
            else {
                log("Unrecognized scope:  " + deployScope + ".  Ignoring it.", Project.MSG_VERBOSE);
            }
            if (!namespaceMap.isEmpty()) {
                emitter.setNamespaceMap(namespaceMap);
            }
            emitter.generateTestCase(testCase);
            emitter.generateImports(!noImports);
            emitter.setOutputDir(output);
            emitter.generateMessageContext(messageContext);
            emitter.generateSkeleton(skeleton);
            emitter.verbose(verbose);
            emitter.emit(url);
        } catch (Throwable t) {
            throw new BuildException("Error while running " + getClass().getName(), t);
        }
    }
View Full Code Here


     * have to make an acceptible wrapper class.  We generate the package name to be "org.apache.axisttest" with the
     * testNum appended to it.  We also enablt skeleton generation and testcase generation.  We also turn on verbosity.
     */
    protected void prepareTest(String fileName, int testNum) throws Exception {
        JavaWriterFactory writerFactory = new JavaWriterFactory();
        Emitter wsdl2java = new Emitter(writerFactory);
        writerFactory.setEmitter(wsdl2java);
        wsdl2java.setOutputDir(Wsdl2javaTestSuite.WORK_DIR);
        wsdl2java.generateSkeleton(true);
        wsdl2java.generateTestCase(true);

        /* Copy concrete implementation files to the work directory.
         */
        File implDir = new File(fileName.substring(0, fileName.lastIndexOf('/')));
        if (implDir.isDirectory()) {
            File[] files = implDir.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].getName().endsWith("Impl.java") || files[i].getName().endsWith("TestCase.java")) {
                    File subDir = new File(Wsdl2javaTestSuite.WORK_DIR, implDir.toString());
                    subDir.mkdirs();
                    File newFile = new File(subDir, files[i].getName());
                    BufferedInputStream is = new BufferedInputStream(new FileInputStream(files[i]));
                    BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(newFile));
                    byte[] buffer = new byte[1024];
                    int length = -1;
                    while ((length = is.read(buffer)) != -1) {
                        os.write(buffer, 0, length);
                    }
                    os.flush();
                    is.close();
                    os.close();
                }
            }
        }

        wsdl2java.emit(fileName);

        Wsdl2javaTestSuite.classNames.add(testNum, wsdl2java.getGeneratedClassNames());
        Wsdl2javaTestSuite.fileNames.add(testNum, wsdl2java.getGeneratedFileNames());

        this.testSuiteProject.executeTarget(Wsdl2javaTestSuite.COMPILE_TASK);
    } //protected void prepareTest()
View Full Code Here

TOP

Related Classes of org.apache.axis.wsdl.Emitter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.