Package net.sourceforge.cruisecontrol

Examples of net.sourceforge.cruisecontrol.CruiseControlException


                transport.close();
            } else {
                Transport.send(msg);
            }
        } catch (MessagingException e) {
            throw new CruiseControlException(e.getMessage());
        }
    }
View Full Code Here


        return properties;
    }

    public void validate() throws CruiseControlException {
        if (cvsroot == null && local == null) {
            throw new CruiseControlException(
                "at least one of 'localWorkingCopy'"
                    + " or 'cvsroot' is a required attribute on CVS");
        }

        if (local != null && !new File(local).exists()) {
            throw new CruiseControlException(
                "Local working copy \"" + local + "\" does not exist!");
        }
    }
View Full Code Here

        thisElement = element;
        List children = element.getChildren();
        if (children.size() > 1) {
            String message = "DistributedMasterBuilder can only have one nested builder";
            LOG.error(message);
            throw new CruiseControlException(message);
        } else if (children.size() == 0) {
            // @todo Clarify when configure() can be called...
            String message = "Nested Builder required by DistributedMasterBuilder, "
                    + "ignoring and assuming this call is during plugin-preconfig";
            LOG.warn(message);
            return;
        }
        childBuilderElement = (Element) children.get(0);
        // Add default/preconfigured props to builder element
        addMissingPluginDefaults(childBuilderElement);

        // Add default/preconfigured props to distributed element
        addMissingPluginDefaults(element);

        Attribute tempAttribute = thisElement.getAttribute("entries");
        entries = tempAttribute != null ? tempAttribute.getValue() : "";

        tempAttribute = thisElement.getAttribute("module");
        if (tempAttribute != null) {
            module = tempAttribute.getValue();
        } else {
            // try to use project name as default value
            final Element elmProj = getElementProject(thisElement);
            if (elmProj != null) {
                module = elmProj.getAttributeValue("name");
            } else {
                module = null;
            }
        }

        // optional attributes
        tempAttribute = thisElement.getAttribute("agentlogdir");
        setAgentLogDir(tempAttribute != null ? tempAttribute.getValue() : "");

        tempAttribute = thisElement.getAttribute("agentoutputdir");
        setAgentOutputDir(tempAttribute != null ? tempAttribute.getValue() : "");

        tempAttribute = thisElement.getAttribute("masterlogdir");
        setMasterLogDir(tempAttribute != null ? tempAttribute.getValue() : "");

        tempAttribute = thisElement.getAttribute("masteroutputdir");
        setMasterOutputDir(tempAttribute != null ? tempAttribute.getValue() : "");

        try {
            cruiseProperties = (Properties) PropertiesHelper.loadRequiredProperties(CRUISE_PROPERTIES);
        } catch (RuntimeException e) {
            LOG.error(e.getMessage(), e);
            System.err.println(e.getMessage());
            throw new CruiseControlException(e.getMessage(), e);
        }
        rootDir = new File(cruiseProperties.getProperty(CRUISE_RUN_DIR));
        LOG.debug("CRUISE_RUN_DIR: " + rootDir);
        if (!rootDir.exists()
                // Don't think non-existant rootDir matters if agent/master log/output dirs are set
                && (getAgentLogDir() == null && getMasterLogDir() == null)
                && (getAgentOutputDir() == null && getMasterOutputDir() == null)
        ) {
            String message = "Could not get property " + CRUISE_RUN_DIR + " from " + CRUISE_PROPERTIES
                    + ", or run dir does not exist: " + rootDir;
            LOG.error(message);
            System.err.println(message);
            throw new CruiseControlException(message);
        }

        validate();
    }
View Full Code Here

        super.validate();
        final Element elmChildBuilder = getChildBuilderElement();
        if (elmChildBuilder == null) {
            String message = "A nested Builder is required for DistributedMasterBuilder";
            LOG.warn(message);
            throw new CruiseControlException(message);
        }

        // Add default/preconfigured props to builder element
        addMissingPluginDefaults(elmChildBuilder);

        /* @todo Should we call validate() on the child builder?
        // If so, figure out how to do in unit tests.
        // One problem is config file properties, like: "anthome="${env.ANT_HOME}" don't get expanded...
        final PluginXMLHelper pluginXMLHelper = PropertiesHelper.createPluginXMLHelper(overrideTarget);
        PluginRegistry plugins = PluginRegistry.createRegistry();
        Class pluginClass = plugins.getPluginClass(elmChildBuilder.getName());
        // this dies due to "anthome="${env.ANT_HOME}" in config file not being expanded...
        final Builder builder = (Builder) pluginXMLHelper.configure(elmChildBuilder, pluginClass, false);
        builder.validate();
        //*/

        if (module == null) {
            String message = "The 'module' attribute is required for DistributedMasterBuilder";
            LOG.warn(message);
            throw new CruiseControlException(message);
        }
    }
View Full Code Here

                    rootDirPath = rootDir.getCanonicalPath();
                } catch (IOException e) {
                    String message = "Error getting canonical path for: " + rootDir;
                    LOG.error(message);
                    System.err.println(message);
                    throw new CruiseControlException(message, e);
                }


                String masterDir;
                if (getMasterLogDir() == null || "".equals(getMasterLogDir())) {
                    masterDir = rootDirPath + File.separator + PropertiesHelper.RESULT_TYPE_LOGS;
                } else {
                    masterDir = getMasterLogDir();
                }
                getResultsFiles(agent, PropertiesHelper.RESULT_TYPE_LOGS, rootDirPath, masterDir);


                if (getMasterOutputDir() == null || "".equals(getMasterOutputDir())) {
                    masterDir = rootDirPath + File.separator + PropertiesHelper.RESULT_TYPE_OUTPUT;
                } else {
                    masterDir = getMasterOutputDir();
                }
                getResultsFiles(agent, PropertiesHelper.RESULT_TYPE_OUTPUT, rootDirPath, masterDir);

                agent.clearOutputFiles();
            } catch (RemoteException e) {
                String agentMachine = "unknown";
                try {
                    agentMachine = agent.getMachineName();
                } catch (RemoteException e1) {
                    ; // ignored
                }
                String message = "RemoteException from"
                        + "\nagent on: " + agentMachine
                        + "\nwhile building module: " + module;
                LOG.error(message, e);
                System.err.println(message + " - " + e.getMessage());
                try {
                    agent.clearOutputFiles();
                } catch (RemoteException re) {
                    LOG.error("Exception after prior exception while clearing agent output files (to set busy false).",
                            re);
                }
                throw new CruiseControlException(message, e);
            }
            return buildResults;
        } catch (RuntimeException e) {
            String message = "Distributed build runtime exception";
            LOG.error(message, e);
            System.err.println(message + " - " + e.getMessage());
            throw new CruiseControlException(message, e);
        }
    }
View Full Code Here

        while (agent == null) {
            final ServiceItem serviceItem;
            try {
                serviceItem = getDiscovery().findMatchingService();
            } catch (RemoteException e) {
                throw new CruiseControlException("Error finding matching agent.", e);
            }
            if (serviceItem != null) {
                agent = (BuildAgentService) serviceItem.service;
                try {
                    LOG.info("Found available agent on: " + agent.getMachineName());
                } catch (RemoteException e) {
                    throw new CruiseControlException("Error calling agent method.", e);
                }
            } else if (isFailFast()) {
                break;
            } else {
                // wait a bit and try again
View Full Code Here

    public void validate() throws CruiseControlException {
        super.validate();

        File ckFile = null;
        if (mavenScript == null) {
            throw new CruiseControlException("'mavenscript' is a required attribute on MavenBuilder");
        }
        ckFile = new File(mavenScript);
        if (!ckFile.exists()) {
            throw new CruiseControlException(
                "Script " + ckFile.getAbsolutePath() + " does not exist");
        }
        if (projectFile == null) {
            throw new CruiseControlException("'projectfile' is a required attribute on MavenBuilder");
        }
        ckFile = new File(projectFile);
        if (!ckFile.exists()) {
            throw new CruiseControlException(
                "Project descriptor " + ckFile.getAbsolutePath() + " does not exist");
        }
    }
View Full Code Here

            final String[] commandLineArgs =
                getCommandLineArgs(buildProperties, isWindows(), goalset);
            try {
                p = Runtime.getRuntime().exec(commandLineArgs, null, projDir);
            } catch (IOException e) {
                throw new CruiseControlException(
                    "Encountered an IO exception while attempting to execute Maven."
                        + " CruiseControl cannot continue.",
                    e);
            }
View Full Code Here

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

        LOG.info("executing command: " + command);

        try {
            Runtime.getRuntime().exec(command.getCommandline());
        } catch (IOException e) {
            throw new CruiseControlException(e);
        }
    }
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.