Examples of Execute


Examples of org.apache.tools.ant.taskdefs.Execute

        m_serverPath = serverPath;
    }

    protected int run(Commandline cmd) {
        try {
            Execute exe = new Execute(new LogStreamHandler(this,
                                                           Project.MSG_INFO,
                                                           Project.MSG_WARN));

            // If location of ss.ini is specified we need to set the
            // environment-variable SSDIR to this value
            if (m_serverPath != null) {
                String[] env = exe.getEnvironment();
                if (env == null) {
                    env = new String[0];
                }
                String[] newEnv = new String[env.length + 1];
                for (int i = 0; i < env.length ; i++) {
                    newEnv[i] = env[i];
                }
                newEnv[env.length] = "SSDIR=" + m_serverPath;

                exe.setEnvironment(newEnv);
            }
           
            exe.setAntRun(project);
            exe.setWorkingDirectory(project.getBaseDir());
            exe.setCommandline(cmd.getCommandline());
            return exe.execute();
        } catch (java.io.IOException e) {
            throw new BuildException(e, location);
        }
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Execute

    protected abstract ExecuteStreamHandler createStreamHandler();


    /** execute the process with a specific handler */
    protected void execute0(ExecuteStreamHandler handler) throws BuildException {
        final Execute process = new Execute(handler);
        log(cmdl.describeCommand(), Project.MSG_VERBOSE);
        process.setCommandline(cmdl.getCommandline());
        try {
            if (process.execute() != 0) {
                throw new BuildException("Metamata task failed.");
            }
        } catch (IOException e) {
            throw new BuildException("Failed to launch Metamata task", e);
        }
View Full Code Here

Examples of org.apache.uima.collection.impl.cpm.utils.Execute

                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
        }
        executable = rip.getExecutable().getExecutable();
        List envList = rip.getExecutable().getEnvs();

        exec = new Execute();

        Properties sysEnv = null;
        try {
          sysEnv = SystemEnvReader.getEnvVars();
          if (System.getProperty("DEBUG") != null) {
View Full Code Here

Examples of org.apache.uima.collection.impl.cpm.utils.Execute

   */
  private void launchLocalService(ProcessingContainer aProcessingContainer,
          CasProcessorConfiguration casProcessorConfig, boolean redeploy, int howMany)
          throws CasProcessorDeploymentException {
    try {
      Execute exec = casProcessorConfig.getExecSpec();
      String cmd[] = exec.getCmdLine();

      String[] execCommand = new String[3];
      if (System.getProperty("os.name").equalsIgnoreCase("linux")) {
        execCommand[0] = "/bin/ksh";
        execCommand[1] = "-c";
      }
      StringBuffer sb = new StringBuffer();
      // The command line has been established, now make sure that we tell the Cas Processor about
      // the
      // VNS port in use. In this logic the VNS is querried for its port number and this will the
      // port
      // provided to the Cas Processor. The Cas Processor must read this argument during its start
      // up
      // to ensure connection to the correct VNS.
      for (int i = 0; i < cmd.length; i++) {
        if (cmd[i] != null && cmd[i].indexOf("-DVNS_PORT") > -1) {
          int vnsPort = vns.getVNSPort();
          cmd[i] = "-DVNS_PORT=" + vnsPort;
        }
        sb.append(" " + cmd[i]);
      }
      String logDir = "";
      if (System.getProperty("LOG_DIR") != null) {
        logDir = System.getProperty("LOG_DIR");
        if (!logDir.endsWith("/") && !logDir.endsWith("\\")) {
          // Append OS specific seperator
          logDir += System.getProperty("file.separator");
        }
      }
      sb.append(" >> " + logDir + "\"" + casProcessorConfig.getName() + System.currentTimeMillis()
              + ".log\"" + " 2>&1");
      execCommand[2] = sb.toString();

      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
                "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_vns_started__FINEST",
                new Object[] { Thread.currentThread().getName(), casProcessorConfig.getName() });

      }
      int serviceCount = howMany;
      // Spawn off as many processes as defined in CPE descriptor. The exact number of instances is
      // equal to
      // procesingUnitThreadCount attribute.
      while (serviceCount-- > 0) {

        for (int i = 0; cmd != null && i < cmd.length; i++) {
          if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
            UIMAFramework.getLogger(this.getClass()).logrb(
                    Level.FINEST,
                    this.getClass().getName(),
                    "initialize",
                    CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                    "UIMA_CPM_launching_with_service_cmd__FINEST",
                    new Object[] { Thread.currentThread().getName(), casProcessorConfig.getName(),
                        String.valueOf(i), cmd[i] });
          }
        }

        String[] env;
        if ((env = exec.getEnvironment()) != null && env.length > 0) {
          for (int i = 0; i < env.length; i++) {
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              UIMAFramework.getLogger(this.getClass()).logrb(
                      Level.FINEST,
                      this.getClass().getName(),
View Full Code Here

Examples of org.neo4j.cypherdsl.grammar.Execute

            john = ((Node) stringObjectMap.get( "john" ));
        }
        System.out.println( result.toString() );

        {
            Execute q = start( nodeById( "john", john ) )
                    .match( node( "john" ).out( "friend" )
                            .node()
                            .out( "friend" )
                            .node( "fof" ) )
                    .returns( identifier( "john" ).property( "name" ), identifier( "fof" )
                            .property( "name" ) );

            System.out.println( q );
            System.out.println( engine.execute( q.toString() ).toString() );
        }

        {
            Projection<Friend> projection = new Projection<Friend>( Friend.class );
            Iterable<Friend> friends = projection.iterable( engine.execute( start( nodeById( "john", john ) )
View Full Code Here

Examples of org.springframework.util.exec.Execute

      logger.info("Rabbit Process not running but status is ready.  Restarting.");
      stopNode();
    }

    logger.info("Starting RabbitMQ node by shelling out command line.");
    final Execute execute = new Execute();

    String rabbitStartScript = null;
    String hint = "";
    if (Os.isFamily("windows") || Os.isFamily("dos")) {
      rabbitStartScript = "sbin/rabbitmq-server.bat";
    } else if (Os.isFamily("unix") || Os.isFamily("mac")) {
      rabbitStartScript = "bin/rabbitmq-server";
      hint = "Depending on your platform it might help to set RABBITMQ_LOG_BASE and RABBITMQ_MNESIA_BASE System properties to an empty directory.";
    }
    Assert.notNull(rabbitStartScript, "unsupported OS family");

    String rabbitHome = System.getProperty("RABBITMQ_HOME", System.getenv("RABBITMQ_HOME"));
    if (rabbitHome == null) {
      if (Os.isFamily("windows") || Os.isFamily("dos")) {
        rabbitHome = findDirectoryName("c:/Program Files", "rabbitmq");
      } else if (Os.isFamily("unix") || Os.isFamily("mac")) {
        rabbitHome = "/usr/lib/rabbitmq";
      }
    }
    Assert.notNull(rabbitHome, "RABBITMQ_HOME system property (or environment variable) not set.");

    rabbitHome = StringUtils.cleanPath(rabbitHome);
    String rabbitStartCommand = rabbitHome + "/" + rabbitStartScript;
    String[] commandline = new String[] { rabbitStartCommand };

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

    if (rabbitLogBaseDirectory != null) {
      env.add("RABBITMQ_LOG_BASE=" + rabbitLogBaseDirectory);
    } else {
      addEnvironment(env, "RABBITMQ_LOG_BASE");
    }
    if (rabbitMnesiaBaseDirectory != null) {
      env.add("RABBITMQ_MNESIA_BASE=" + rabbitMnesiaBaseDirectory);
    } else {
      addEnvironment(env, "RABBITMQ_MNESIA_BASE");
    }
    addEnvironment(env, "ERLANG_HOME");

    // Make the nodename explicitly the same so the erl process knows who we are
    env.add("RABBITMQ_NODENAME=" + nodeName);

    // Set the port number for the new process
    env.add("RABBITMQ_NODE_PORT=" + port);

    // Ask for a detached erl process so stdout doesn't get diverted to a black hole when the JVM dies (without this
    // you can start the Rabbit broker form Java but if you forget to stop it, the erl process is hosed).
    env.add("RABBITMQ_SERVER_ERL_ARGS=-detached");

    execute.setCommandline(commandline);
    execute.setEnvironment(env.toArray(new String[0]));

    final CountDownLatch running = new CountDownLatch(1);
    final AtomicBoolean finished = new AtomicBoolean(false);
    final String errorHint = hint;

    executor.execute(new Runnable() {
      public void run() {
        try {
          running.countDown();
          int exit = execute.execute();
          finished.set(true);
          logger.info("Finished broker launcher process with exit code=" + exit);
          if (exit != 0) {
            throw new IllegalStateException("Could not start process." + errorHint);
          }
View Full Code Here

Examples of org.switchyard.component.rules.annotation.Execute

            Input[] inputMappingAnnotations = null;
            Output[] outputMappingAnnotations = null;
            Fault[] faultMappingAnnotations = null;
            if (EXECUTE_FILTER.matches(method)) {
                operationType = RulesOperationType.EXECUTE;
                Execute executeAnnotation = method.getAnnotation(Execute.class);
                globalMappingAnnotations = executeAnnotation.globals();
                inputMappingAnnotations = executeAnnotation.inputs();
                outputMappingAnnotations = executeAnnotation.outputs();
                faultMappingAnnotations = executeAnnotation.faults();
            } else if (INSERT_FILTER.matches(method)) {
                operationType = RulesOperationType.INSERT;
                Insert insertAnnotation = method.getAnnotation(Insert.class);
                globalMappingAnnotations = insertAnnotation.globals();
                inputMappingAnnotations = insertAnnotation.inputs();
View Full Code Here

Examples of org.xmlBlaster.util.Execute

            // if (Execute.isWindows()) cmd = "cmd " + cmd;
            if (closeCmd != null) {
               String tmpFilename = dumperFilename + format.format(count);
               String cmd = closeCmd + " " + tmpFilename;
               String[] args = ReplaceVariable.toArray(cmd, " ");
               Execute execute = new Execute(args, null, 10L);
               execute.run(); // blocks until finished
               if (execute.getExitValue() != 0) {
                  throw new Exception("Exception occured on executing '" + cmd + "");
               }
            }
            // make a backup
            // copyFile(dumperFilename, dumperFilename + ".bak");
View Full Code Here

Examples of org.xmlBlaster.util.Execute

   private void osExecute(String[] slaveNames, String cmd, ConnectionInfo connInfo) throws Exception {
      try {
         // if (Execute.isWindows()) cmd = "cmd " + cmd;
         String[] args = ReplaceVariable.toArray(cmd, " ");
         log.info("running for '" + SpecificDefault.toString(slaveNames) + "' for cmd '" + cmd + "'");
         Execute execute = new Execute(args, null, this.initialCmdSleepDelay);
         synchronized (this) {
            if (slaveNames != null) {
               for (int i=0; i < slaveNames.length; i++) {
                  String slaveName = slaveNames[i];
                  if (slaveName != null) {
                     Execute oldExecute = (Execute)this.runningExecutes.remove(slaveName);
                     if (oldExecute != null) {
                        log.warning("A new request for an initial update has come for '" + slaveName + "' but there is one already running. Will shut down the running one first");
                        oldExecute.stop();
                        log.info("old initial request for '" + slaveName + "' has been shut down");
                        this.runningExecutes.put(slaveName, execute);
                     }
                  }
               }
View Full Code Here

Examples of org.xmlBlaster.util.Execute

   }
  
   public void cancelUpdate(String slaveName) {
      this.dbSpecific.cancelUpdate(slaveName);
      synchronized (this) {
         Execute exec = (Execute)this.runningExecutes.remove(slaveName);
         if (exec != null)
            exec.stop();
      }
   }
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.