Package net.sourceforge.cruisecontrol.util

Examples of net.sourceforge.cruisecontrol.util.Commandline


    /**
     * p4 -s [-c client] [-p port] [-u user] users
     */
    public Commandline buildUsersCommand() {
        Commandline commandLine = buildBaseP4Command();

        commandLine.createArgument().setValue("users");

        return commandLine;       
    }
View Full Code Here


        return commandLine;       
    }

    private Commandline buildBaseP4Command() {
        Commandline commandLine = new Commandline();
        commandLine.setExecutable("p4");
        commandLine.createArgument().setValue("-s");

        if (p4Client != null) {
            commandLine.createArgument().setValue("-c");
            commandLine.createArgument().setValue(p4Client);
        }

        if (p4Port != null) {
            commandLine.createArgument().setValue("-p");
            commandLine.createArgument().setValue(p4Port);
        }

        if (p4User != null) {
            commandLine.createArgument().setValue("-u");
            commandLine.createArgument().setValue(p4User);
        }
        return commandLine;
    }
View Full Code Here

    }

    public void publish(Element cruisecontrolLog)
        throws CruiseControlException {

        Commandline command = new Commandline(commandString);
        LOG.info("executing command: " + command);

        try {
            Runtime.getRuntime().exec(command.getCommandline());
        } catch (IOException e) {
            throw new CruiseControlException(e);
        }
    }
View Full Code Here

            XMLLogHelper helper = new XMLLogHelper(cruisecontrolLog);
            file = helper.getLogFileName();
            LOG.debug(file);
        }

        Commandline command = createCommandline(file);
        LOG.info("executing command: " + command);
        try {
            Process p = Runtime.getRuntime().exec(command.getCommandline());
            LOG.debug("Runtime after.");
            p.waitFor();
            LOG.debug("waitfor() ended with exit code " + p.exitValue());

            try {
View Full Code Here

    public Commandline createCommandline(String file) {
        String sourcefile = sourceSeparator + file;
        String targetfile = targetSeparator;

        Commandline command = new Commandline();
        command.setExecutable("scp");
        command.createArgument().setLine(options);
        command.createArgument().setValue("-S");
        command.createArgument().setValue(ssh);

        createFileArgument(
            command.createArgument(),
            sourceUser,
            sourceHost,
            sourceDir,
            sourcefile);

        createFileArgument(
            command.createArgument(),
            targetUser,
            targetHost,
            targetDir,
            targetfile);
View Full Code Here

     * construct the command that we're going to execute.
     *
     * @return Commandline holding command to be executed
     */
    public Commandline buildCommandline() {
        Commandline cmdLine = getCommandLine();

        cmdLine.setExecutable("NAnt.exe");
        if (useLogger) {
            cmdLine.createArgument().setValue("-logger:" + getLoggerClassName());
            cmdLine.createArgument().setValue("-logfile:" + tempFileName);
        } else {
            cmdLine.createArgument().setValue("-listener:" + getLoggerClassName());
            cmdLine.createArgument().setValue("-D:XmlLogger.file=" + tempFileName);
        }
        /*
        if (useVerbose) {
            cmdLine.createArgument().setValue("-verbose");
        }
        */
        if (useDebug) {
            cmdLine.createArgument().setValue("-debug+");
        } else if (useQuiet) {
            cmdLine.createArgument().setValue("-quiet+");
        }
        if (targetFramework != null) {
            cmdLine.createArgument().setValue("-t:" + targetFramework);
        }

        for (Iterator propertiesIter = buildProperties.entrySet().iterator(); propertiesIter.hasNext();) {
            Map.Entry property = (Map.Entry) propertiesIter.next();
            String value = (String) property.getValue();
            if (!"".equals(value)) {
                cmdLine.createArgument().setValue("-D:" + property.getKey() + "=" + value);
            }
        }
        for (Iterator nantPropertiesIterator = nantProperties.iterator(); nantPropertiesIterator.hasNext(); ) {
            Property property = (Property) nantPropertiesIterator.next();
            cmdLine.createArgument().setValue("-D:" + property.getName() + "=" + property.getValue());
        }

        cmdLine.createArgument().setValue("-buildfile:" + buildFile);

        StringTokenizer targets = new StringTokenizer(target);
        while (targets.hasMoreTokens()) {
            cmdLine.createArgument().setValue(targets.nextToken());
        }
        return cmdLine;
    }
View Full Code Here

    }

    private List describeAllChangelistsAndBuildOutput(String[] changelistNumbers, Hashtable mailAliases)
        throws IOException, InterruptedException {

        Commandline command = buildDescribeCommand(changelistNumbers);
        LOG.info(command.toString());
        Process p = Runtime.getRuntime().exec(command.getCommandline());

        logErrorStream(p.getErrorStream());
        InputStream p4Stream = p.getInputStream();
        List mods = parseChangeDescriptions(p4Stream, mailAliases);
        getRidOfLeftoverData(p4Stream);
View Full Code Here

    }

    private String[] collectChangelistSinceLastBuild(Date lastBuild, Date now)
        throws IOException, InterruptedException {

        Commandline command = buildChangesCommand(lastBuild, now);
        LOG.debug("Executing: " + command.toString());
        Process p = Runtime.getRuntime().exec(command.getCommandline());

        logErrorStream(p.getErrorStream());
        InputStream p4Stream = p.getInputStream();

        String[] changelistNumbers = parseChangelistNumbers(p4Stream);
View Full Code Here

    }


    private Hashtable getMailAliases()
        throws IOException, InterruptedException {
        Commandline command = buildUsersCommand();

        LOG.debug("Executing: " + command.toString());
        Process p = Runtime.getRuntime().exec(command.getCommandline());

        logErrorStream(p.getErrorStream());
        InputStream p4Stream = p.getInputStream();

        Hashtable users = parseUsers(p4Stream);
View Full Code Here

        return cmdLine;
    }

    // factory method for mock...
    protected Commandline getCommandLine() {
        return new Commandline();
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.util.Commandline

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.