Examples of CommandLine


Examples of org.apache.commons.cli2.CommandLine

    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      String outputPath = (String) cmdLine.getValue(outputOpt);
      TrainMaxent trainer = new TrainMaxent();
      trainer.train(inputPath, outputPath);
    }
    catch (OptionException e) {
      log.error("Error while parsing options", e);
View Full Code Here

Examples of org.apache.commons.exec.CommandLine

public class ExecWorkItemHandler implements WorkItemHandler {

  public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
    String command = (String) workItem.getParameter("Command");
    CommandLine commandLine = CommandLine.parse(command);
    DefaultExecutor executor = new DefaultExecutor();
    try {
      executor.execute(commandLine);
      manager.completeWorkItem(workItem.getId(), null);
    } catch (Throwable t) {
View Full Code Here

Examples of org.apache.commons.exec.CommandLine

            }
        };

        final String vmOptions = config.getProperty(PROP_VM_OPTIONS);
        executor = new DefaultExecutor();
        final CommandLine cl = new CommandLine(jvmFullPath);
        if (vmOptions != null && vmOptions.length() > 0) {
            cl.addArguments(vmOptions);
        }
        cl.addArgument("-jar");
        cl.addArgument(jarToExecute.getAbsolutePath());

        // Additional options for the jar that's executed.
        // $JAREXEC_SERVER_PORT$ is replaced our serverPort value
        String jarOptions = config.getProperty(PROP_JAR_OPTIONS);
        if(jarOptions != null && jarOptions.length() > 0) {
            jarOptions = jarOptions.replaceAll("\\$JAREXEC_SERVER_PORT\\$", String.valueOf(serverPort));
            log.info("Executable jar options: {}", jarOptions);
            cl.addArguments(jarOptions);
        }

        final String workFolderOption = config.getProperty(PROP_WORK_FOLDER);
        if(workFolderOption != null && workFolderOption.length() > 0) {
            final File workFolder = new File(workFolderOption);
View Full Code Here

Examples of org.apache.felix.sigil.common.runtime.cli.CommandLine

        FrameworkFactory factory = getFrameworkFactory();

        try
        {
            Parser parser = new PosixParser();
            CommandLine cl = parser.parse(options, args);

            if (cl.hasOption('?'))
            {
                printHelp();
            }
            else
            {
                verbose = cl.hasOption('v');

                Map<String, String> config = buildConfig(cl);

                framework = factory.newFramework(config);
                framework.init();
View Full Code Here

Examples of org.apache.geronimo.gshell.CommandLine

         try {
             final ExecutingVisitor visitor = new ExecutingVisitor(executor, environment);
             final ASTCommandLine root = parse(commandLine);

             return new CommandLine() {
                 public Object execute() throws Exception {
                     return root.jjtAccept(visitor, null);
                 }
             };
         }
View Full Code Here

Examples of org.apache.ivy.util.cli.CommandLine

    public void testExtraParams1() throws Exception {
        String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
                "default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "foo1",
                "foo2"};
        CommandLine line = Main.getParser().parse(params);
        String[] leftOver = line.getLeftOverArgs();
        assertNotNull(leftOver);
        assertEquals(2, leftOver.length);
        assertEquals("foo1", leftOver[0]);
        assertEquals("foo2", leftOver[1]);
    }
View Full Code Here

Examples of org.apache.jackrabbit.standalone.cli.CommandLine

        Iterator iter = descriptors.iterator();

        // Tab position
        int tabPos = 20;
        while (iter.hasNext()) {
            CommandLine desc = (CommandLine) iter.next();
            if (desc.getName().length() > tabPos) {
                tabPos = desc.getName().length() + 1;
            }
        }

        iter = descriptors.iterator();
        while (iter.hasNext()) {
            CommandLine desc = (CommandLine) iter.next();
            StringBuffer buf = new StringBuffer(desc.getName());
            buf.setLength(tabPos);
            for (int i = desc.getName().length(); i < buf.length(); i++) {
                buf.setCharAt(i, ' ');
            }
            buf.append(desc.getLocalizedDescription());
            hf.printWrapped(out, 70, tabPos, buf.toString());
        }
    }
View Full Code Here

Examples of org.apache.maven.it.cli.Commandline

        int ret;

        try
        {
            Commandline cli = new Commandline();

            cli.setWorkingDirectory( basedir );

            String executable;
            if ( mavenHome != null )
            {
                executable = mavenHome + "/bin/mvn";
            }
            else
            {
                executable = "mvn";
            }

            cli.setExecutable( executable );

            for ( Iterator it = cliOptions.iterator(); it.hasNext(); )
            {
                String key = (String) it.next();

                String resolvedArg = resolveCommandLineArg( key );

                cli.createArgument().setLine( resolvedArg );
            }

            cli.createArgument().setValue( "-e" );

            cli.createArgument().setValue( "--no-plugin-registry" );

            cli.createArgument().setValue( "--batch-mode" );

            for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
            {
                String key = (String) i.next();
                cli.createArgument().setLine( "-D" + key + "=" + properties.getProperty( key ) );
            }

            boolean useMavenRepoLocal = Boolean.valueOf(
                controlProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
            if ( useMavenRepoLocal )
            {
                // Note: Make sure that the repo is surrounded by quotes as it can possibly have
                // spaces in its path.
                cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + localRepo + "\"" );
            }

            for ( Iterator i = allGoals.iterator(); i.hasNext(); )
            {
                cli.createArgument().setValue( (String) i.next() );
            }

            Writer logWriter = new FileWriter( new File( basedir, LOG_FILENAME ) );

            StreamConsumer out = new WriterStreamConsumer( logWriter );

            StreamConsumer err = new WriterStreamConsumer( logWriter );

            System.out.println( "Command: " + Commandline.toString( cli.getCommandline() ) );

            ret = CommandLineUtils.executeCommandLine( cli, out, err );

            logWriter.close();
        }
View Full Code Here

Examples of org.apache.maven.it.util.cli.Commandline

    public static void launchSubversion( String line, String basedir )
        throws VerificationException
    {
        try
        {
            Commandline cli = new Commandline( line );

            cli.setWorkingDirectory( basedir );

            Writer logWriter = new FileWriter( new File( basedir, LOG_FILENAME ) );

            StreamConsumer out = new WriterStreamConsumer( logWriter );

            StreamConsumer err = new WriterStreamConsumer( logWriter );

            System.out.println( "Command: " + Commandline.toString( cli.getCommandline() ) );

            int ret = CommandLineUtils.executeCommandLine( cli, out, err );

            logWriter.close();
View Full Code Here

Examples of org.apache.maven.shared.utils.cli.Commandline

    public static void launchSubversion( String line, String basedir )
        throws VerificationException
    {
        try
        {
            Commandline cli = new Commandline( line );

            cli.setWorkingDirectory( basedir );

            Writer logWriter = new FileWriter( new File( basedir, LOG_FILENAME ) );

            StreamConsumer out = new WriterStreamConsumer( logWriter );

            StreamConsumer err = new WriterStreamConsumer( logWriter );

            System.out.println( "Command: " + CommandLineUtils.toString( cli.getCommandline() ) );

            int ret = CommandLineUtils.executeCommandLine( cli, out, err );

            logWriter.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.