Package net.sourceforge.retroweaver

Examples of net.sourceforge.retroweaver.RetroWeaver


        getTopLevelAncestor().setCursor(
            Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        try {
          status.setText("Running");
          RetroWeaver weaver = new RetroWeaver(version);
          messages.setText("");
          weaver.setListener(RetroWeaverGui.this);

          String refCp = refClassPath.getText();

          if (refCp.length() != 0) {
            java.util.List<String> classpath = new ArrayList<String>();
            StringTokenizer st = new StringTokenizer(refCp,
                File.pathSeparator);
            while (st.hasMoreTokens()) {
              classpath.add(st.nextToken());
            }
            RefVerifier verifier = new RefVerifier(version, new EmptyVisitor(), classpath,
                RetroWeaverGui.this);
            weaver.setVerifier(verifier);
          }

          weaver.weave(path);

          status.setText("Done");
        } catch (Exception ex) {
          status.setText("Error: " + ex.getMessage());
        } finally {
View Full Code Here


          "Either attribute 'srcdir' or 'inputjar' must be used or atleast one fileset or dirset must be embedded.",
          getLocation());
    }
    //  Create and configure the weaver.

    RetroWeaver weaver = new RetroWeaver(itsVersion);
    weaver.setLazy(itsLazy);
    weaver.setStripSignatures(stripSignatures);
    weaver.setStripAttributes(stripAttributes);
   
    // Name space conversion
    List<NameSpace> l = new ArrayList<NameSpace>();
    for(Namespace n: namespaces) {
      l.add(new NameSpace(n.getFrom(), n.getTo()));
    }
    weaver.addNameSpaces(l);

    //  Set up a listener.
    weaver.setListener(new WeaveListener() {
      public void weavingStarted(String msg) {
        getProject().log(RetroWeaverTask.this, msg, Project.MSG_INFO);
      }

      public void weavingCompleted(String msg) {
        getProject().log(RetroWeaverTask.this, msg, Project.MSG_INFO);
      }

      public void weavingError(String msg) {
        getProject().log(RetroWeaverTask.this, msg, Project.MSG_ERR);
        throw new ExitStatusException("weaving error", 1);
      }

      public void weavingPath(String pPath) {
        if (itsVerbose) {
          getProject().log(RetroWeaverTask.this, "Weaving " + pPath,
              Project.MSG_INFO);
        }
      }
    });

    if (verifyClasspath != null && doVerify()) {

      List<String> refPath = new ArrayList<String>();

      for (String pathItem : verifyClasspath.list()) {
        refPath.add(pathItem);
      }
      if (itsDestDir != null) {
        refPath.add(itsDestDir.getPath());
      }

      RefVerifier rv = new RefVerifier(itsVersion, new EmptyVisitor(), refPath, new VerifierListener() {
        public void verifyPathStarted(String msg) {
          getProject().log(RetroWeaverTask.this, msg,
              Project.MSG_INFO);
        }

        public void verifyClassStarted(String msg) {
          if (itsVerbose) {
            getProject().log(RetroWeaverTask.this, msg, Project.MSG_INFO);
          }
        }

        public void acceptWarning(String msg) {
          getProject().log(RetroWeaverTask.this, msg, Project.MSG_WARN);
        }

        public void displaySummary(int warningCount) {
          String msg = "Verification complete, " + warningCount
              + " warning(s).";
          getProject().log(RetroWeaverTask.this, msg,
              Project.MSG_WARN);

          if (itsFailOnError) {
            throw new ExitStatusException(Integer
                .toString(warningCount)
                + " warning(s)", 1);
          }
        }
      });
      weaver.setVerifier(rv);
    }

    try {
      if (inputJar != null) {
        weaver.weaveJarFile(inputJar, outputJar);
      } else {
        //  Weave the files in the filesets.

        //  Process each fileset.
        String[][] fileSets = new String[itsFileSets.size()][];
        File[] baseDirs = new File[itsFileSets.size()];
        int i = 0;
        for (FileSet fileSet : itsFileSets) {
          //  Create a directory scanner for the fileset.
          File baseDir = fileSet.getDir(getProject());
          DirectoryScanner scanner = fileSet
              .getDirectoryScanner(getProject());
          fileSets[i] = scanner.getIncludedFiles();
          baseDirs[i++] = baseDir;
        }

        weaver.weave(baseDirs, fileSets, itsDestDir);
      }
    } catch (BuildException ex) {
      throw ex;
    } catch (Exception ex) {
      // unexpected exception
View Full Code Here

TOP

Related Classes of net.sourceforge.retroweaver.RetroWeaver

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.