Package net.sourceforge.cruisecontrol

Examples of net.sourceforge.cruisecontrol.CruiseControlException


    }
   
   
    public void validate() throws CruiseControlException {
        if (destdir == null) {
            throw new CruiseControlException(
                "'destdir' is required for FTPPublisher");
        }
        if (srcdir == null) {
            throw new CruiseControlException(
                "'srcdir' is required for FTPPublisher");
        }
        super.validate();
    }
View Full Code Here


    }

    void publishFile(File uniqueDest) throws CruiseControlException {
        File file = new File(targetFile);
        if (!file.exists()) {
            throw new CruiseControlException("target file " + file.getAbsolutePath() + " does not exist");
        }
        FileUtils utils = FileUtils.newFileUtils();
        try {
            utils.copyFile(file, new File(uniqueDest, file.getName()));
        } catch (IOException e) {
            throw new CruiseControlException(e);
        }
    }
View Full Code Here

    }

    void publishDirectory(Project project, File uniqueDest) throws CruiseControlException {
        File directory = new File(targetDirectory);
        if (!directory.exists()) {
            throw new CruiseControlException("target directory " + directory.getAbsolutePath() + " does not exist");
        }
        if (!directory.isDirectory()) {
            throw new CruiseControlException("target directory " + directory.getAbsolutePath() + " is not a directory");
        }
        FileSet set = new FileSet();
        set.setDir(directory);
        copier.addFileset(set);
        copier.setTodir(uniqueDest);
        copier.setProject(project);
        try {
            copier.execute();
        } catch (Exception e) {
            throw new CruiseControlException(e);
        }
    }
View Full Code Here

    @throws CruiseControlException if there was a configuration error.
    */
   public void validate() throws CruiseControlException {
      //xsltFile attribute is required
      if (xsltFile == null) {
         throw new CruiseControlException("'xsltFile' not specified in configuration file.");
      }
      //directory attribute is required
      if (directory == null) {
         throw new CruiseControlException("'directory' not specified in configuration file.");
      }
   }
View Full Code Here

      //If the outFileName attribute is null then construct the outFileName based
      //upon the build label that was created
      if (outFileName == null) {
         String label = helper.getCruiseControlInfoProperty("label");
         if (label == null || label.trim().length() == 0) {
            throw new CruiseControlException("The Label property is not set in the log file..."
                    + "unable to publish the log.");
         }
         LOG.debug(
            "Using the cruise control info label property to construct the file name which is set to: " + label);
         outFileName = label + ".log";
      }

      //Make sure that the directory exists and is a directory
      //Attempt to create an empty directory if necessary
      File dir = new File(directory);
      dir.mkdirs();
      if (!dir.isDirectory()) {
         throw new CruiseControlException(
            "Unable to locate or create the output directory (" + directory + "): Failed to publish log file.");
      }

      String filePath = directory + File.separator + outFileName;
      LOG.info("Publishing log file to: " + filePath);
View Full Code Here

      try {
         //Make sure that the xsltFile exists
         try {
            xslFileStream = new FileInputStream(this.xsltFile);
         } catch (IOException ioe) {
            throw new CruiseControlException("Error reading the xsltFile: " + this.xsltFile, ioe);
         }

         //construct a FileWriter to the outputFile path location
         try {
            out = new FileWriter(path);
         } catch (IOException ioe) {
            throw new CruiseControlException("Unable to write to th file location: " + path);
         }

         //Prepare the transformer
         TransformerFactory tFactory = TransformerFactory.newInstance();
         Transformer transformer = tFactory.newTransformer(new StreamSource(xslFileStream));

         //cruisecontrolLog.get
         XMLLogHelper helper = new XMLLogHelper(cruisecontrolLog);
         String logFileName = helper.getLogFileName();
         LOG.info("Transforming the log file: " + logFileName + " to: " + path + " using the xslt: " + this.xsltFile);

         //Create the temporary log file - since we do not have access to the actual log file location
         xmlFile = writeTempLogFile(cruisecontrolLog);
         if (xmlFile == null || !xmlFile.exists() || !xmlFile.canRead()) {
            throw new CruiseControlException("Unable to read the log file at path: " + logFileName);
         }

         //perform the transform, writing out the results to the output location
         transformer.transform(new StreamSource(xmlFile), new StreamResult(out));

      } catch (TransformerException te) {
         throw new CruiseControlException("An error occurred during the transformation process", te);
      } catch (Exception ioe) {
         throw new CruiseControlException("An unexpected exception occurred, unable to publish the log file.", ioe);
      } finally {
         //clean up
         if (xslFileStream != null) {
            try {
               xslFileStream.close();
View Full Code Here

         XMLOutputter outputter = null;
         outputter = new XMLOutputter("   ", true);
         logWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
         outputter.output(logElement, logWriter);
      } catch (Exception e) {
         throw new CruiseControlException("Failed to save temp log file", e);
      } finally {
         logWriter = null;
      }
      return file;
   }
View Full Code Here

     @throws CruiseControlException if there was a configuration error.
     */
    public void validate() throws CruiseControlException {
        if (sourceUser == null) {
            if (sourceHost != null) {
                throw new CruiseControlException("'sourceuser' not specified in configuration file");
            }
        }

        if (sourceHost == null) {
            if (sourceUser != null) {
                throw new CruiseControlException("'sourcehost' not specified in configuration file");
            }
        }

        if (targetUser == null) {
            if (targetHost != null) {
                throw new CruiseControlException("'targetuser' not specified in configuration file");
            }
        }

        if (targetHost == null) {
            if (targetUser != null) {
                throw new CruiseControlException("'targethost' not specified in configuration file");
            }
        }
    }
View Full Code Here

        Commandline command = createCommandline(file);
        LOG.info("executing command: " + command);
        try {
            Runtime.getRuntime().exec(command.getCommandline());
        } catch (IOException e) {
            throw new CruiseControlException(e);
        }
    }
View Full Code Here

    /**
     * Make sure any attributes provided by the user are correctly specified.
     */
    public void validate() throws CruiseControlException {
        if (logDir == null) {
            throw new CruiseControlException("The 'logdir' attribute is mandatory");
        }

        File logDirectory = new File(logDir);
        if (!logDirectory.exists()) {
            throw new CruiseControlException("Log directory does not exist: "
                     + logDirectory.getAbsolutePath());
        } else if (!logDirectory.isDirectory()) {
            throw new CruiseControlException("Log directory is not a directory: "
                     + logDirectory.getAbsolutePath());
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.CruiseControlException

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.