Examples of CommandRunner


Examples of org.apache.nutch.util.CommandRunner

      }

      ByteArrayOutputStream os = new ByteArrayOutputStream(BUFFER_SIZE);
      ByteArrayOutputStream es = new ByteArrayOutputStream(BUFFER_SIZE/4);

      CommandRunner cr = new CommandRunner();

      cr.setCommand(command+ " " +contentType);
      cr.setInputStream(new ByteArrayInputStream(raw));
      cr.setStdOutputStream(os);
      cr.setStdErrorStream(es);

      cr.setTimeout(timeout);

      cr.evaluate();

      if (cr.getExitValue() != 0)
        return new ParseStatus(ParseStatus.FAILED,
                        "External command " + command
                        + " failed with error: " + es.toString()).getEmptyParseResult(content.getUrl(), getConf());

      text = os.toString(encoding);
View Full Code Here

Examples of org.apache.nutch.util.CommandRunner

      }

      ByteArrayOutputStream os = new ByteArrayOutputStream(BUFFER_SIZE);
      ByteArrayOutputStream es = new ByteArrayOutputStream(BUFFER_SIZE/4);

      CommandRunner cr = new CommandRunner();

      cr.setCommand(command+ " " +contentType);
      cr.setInputStream(new ByteArrayInputStream(raw));
      cr.setStdOutputStream(os);
      cr.setStdErrorStream(es);

      cr.setTimeout(timeout);

      cr.evaluate();

      if (cr.getExitValue() != 0)
        return new ParseStatus(ParseStatus.FAILED,
                        "External command " + command
                        + " failed with error: " + es.toString()).getEmptyParseResult(content.getUrl(), getConf());

      text = os.toString(encoding);
View Full Code Here

Examples of org.bladerunnerjs.runner.CommandRunner

  private PrintStream oldSysOut;
 
  @Before
  public void setUp() throws IOException, InvalidSdkDirectoryException {
    StaticLoggerBinder.getSingleton().getLoggerFactory().setOutputStreams(new PrintStream(outputStream), new PrintStream(errorStream));
    commandRunner = new CommandRunner();
   
    tempDir = FileUtility.createTemporaryDirectory( getClass() );
    ThreadSafeStaticBRJSAccessor.destroy();
    oldSysOut = System.out;
    System.setOut( new PrintStream(systemOutputStream) );
View Full Code Here

Examples of org.eclipse.ui.internal.cheatsheets.CommandRunner

  public boolean isCheatSheetManagerUsed() {
    return true;
  }

  public IStatus execute(CheatSheetManager csm) {
    return new CommandRunner().executeCommand(this, csm);
  }
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

    }


    private void createCommandGetMethod(String commandName,
            String commandMethod, BufferedWriter out) throws IOException {
        CommandRunner cr = RestService.getHabitat().getComponent(CommandRunner.class);
        CommandModel cm = null;
        try {
            cm = cr.getModel(commandName, RestService.logger);
        } catch (Exception e) {
            System.out.println("Error - Command Unknown: " + commandName);
            return;
        }
        if (cm == null) {
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

     * @param logger the logger to use
     * @return ActionReport object with command execute status details.
     */
    public ActionReport runCommand(String commandName,
            HashMap<String, String> parameters, Habitat habitat) {
        CommandRunner cr = habitat.getComponent(CommandRunner.class);
        ActionReport ar = habitat.getComponent(ActionReport.class);
        ParameterMap p = new ParameterMap();
        for (Map.Entry<String,String> entry : parameters.entrySet())
            p.set(entry.getKey(), entry.getValue());

        cr.getCommandInvocation(commandName, ar).parameters(p).execute();
        return ar;
    }
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

    * @param logger the logger to use
    * @return ActionReport object with command execute status details.
    */
    public ActionReport runCommand(String commandName,
           Properties parameters, Habitat habitat) {
       CommandRunner cr = habitat.getComponent(CommandRunner.class);
       ActionReport ar = habitat.getComponent(ActionReport.class);
        ParameterMap p = new ParameterMap();
        for (String prop : parameters.stringPropertyNames())
            p.set(prop, parameters.getProperty(prop));

       cr.getCommandInvocation(commandName, ar).parameters(p).execute();
       return ar;
    }
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

     * @param logger the logger to use
     * @return Collection the meta-data for the parameter of the resource method.
     */
    public Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, Habitat habitat, Logger logger) {
        CommandRunner cr = habitat.getComponent(CommandRunner.class);
        CommandModel cm = cr.getModel(commandName, logger);
        Collection<CommandModel.ParamModel> params = cm.getParameters();
        //print(params);
        return params;
    }
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

     * @return Collection the meta-data for the parameter of the resource method.
     */
    public Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, Collection<String> commandParamsToSkip,
                Habitat habitat, Logger logger) {
        CommandRunner cr = habitat.getComponent(CommandRunner.class);
        CommandModel cm = cr.getModel(commandName, logger);
        Collection<String> parameterNames = cm.getParametersNames();

        ArrayList<CommandModel.ParamModel> metaData =
            new ArrayList<CommandModel.ParamModel>();
        CommandModel.ParamModel paramModel;
View Full Code Here

Examples of org.glassfish.api.admin.CommandRunner

     */
    public static RestActionReporter runCommand(String commandName,
                                                ParameterMap parameters,
                                                Subject subject,
                                                boolean managedJob) {
        CommandRunner cr = Globals.getDefaultHabitat().getService(CommandRunner.class);
        RestActionReporter ar = new RestActionReporter();
        final CommandInvocation commandInvocation =
                cr.getCommandInvocation(commandName, ar, subject);
        if (managedJob) {
            commandInvocation.managedJob();
        }
        commandInvocation.parameters(parameters).execute();
        addCommandLog(ar, commandName, parameters);
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.