Examples of Cmd


Examples of org.encog.app.analyst.commands.Cmd

      } else {
        command = line2.toUpperCase();
        args = "";
      }

      final Cmd cmd = this.commands.get(command);

      if (cmd != null) {
        canceled = cmd.executeCommand(args);
      } else {
        throw new AnalystError("Unknown Command: " + line);
      }

      reportCommandEnd(canceled);
View Full Code Here

Examples of org.encog.app.analyst.commands.Cmd

      } else {
        command = line2.toUpperCase();
        args = "";
      }

      final Cmd cmd = this.commands.get(command);

      if (cmd != null) {
        canceled = cmd.executeCommand(args);
      } else {
        throw new AnalystError("Unknown Command: " + line);
      }

      reportCommandEnd(canceled);
View Full Code Here

Examples of org.jboss.as.test.integration.ejb.mdb.dynamic.impl.Cmd

        // Get Commands
        final Method[] methods = beanClass.getMethods();
        for (Method method : methods) {
            if (method.isAnnotationPresent(Command.class)) {
                final Command command = method.getAnnotation(Command.class);
                cmds.add(new Cmd(command.value(), method));
            }
        }

        // Validate
        if (this.prompt == null || this.prompt.length() == 0) {
View Full Code Here

Examples of org.jboss.fresh.shell.parser.Cmd

      cmdLines.setStdInLines(lines[1]);
      cmdLines.setStdInput(input);
     
      Iterator it = cmdLines.iterator();
      while (it.hasNext()) {
        Cmd cmd = (Cmd) it.next();
        makeProcess(cmdLines, cmd, job, hasin, hasout, ui);
      }

      if (job.size() > 1) {
        ProcessGroup p = sshell.createProcessGroup(job);
View Full Code Here

Examples of org.jboss.fresh.shell.parser.Cmd

    LinkedList cmdsl = new LinkedList();

    Iterator it = cmds.iterator();
    while (it.hasNext()) {
      Cmd cmd = (Cmd) it.next();
      String scmd = cmd.getExec();
      // we leave cmd as it is.

      String[] params = cmd.getParams();
      LinkedList ops = new LinkedList();
      // we process each one - look for $ then look for eof or space.
      // we try resolve $ if can't then leave it as it is.
//log.debug("cmdline parameters: ");
      for (int i = 0; i < params.length; i++) {

        String c = params[i];
//log.debug("*** " + c);

// in here we do several things. We resolve env vars only if " or without
// we do pathname expansion if not " or ' and *, ? or [ is present



/*
        if(c.startsWith("'")) {
          if(c.endsWith("'")) {
            ops.add(c.substring(1, c.length()-1));
            continue;
          } else {
            ops.add(c.substring(1, c.length()));
            continue;
          }
        }

        if(c.endsWith("'")) {
          ops.add(c.substring(0, c.length()-1));
          continue;
        }
*/

// if starts with " and ends with " then we need to remove that
// if it does not end with " then we treat it as if it is not within quotes

        if (c.startsWith("'") && c.endsWith("'") && c.length() > 1) {
          ops.add(c.substring(1, c.length() - 1));
          continue;
        }

        StringBuffer outc = new StringBuffer();
        StringTokenizer st = new StringTokenizer(c, "$ ", true);
        boolean isVar = false;
        while (st.hasMoreTokens()) {
          String t = st.nextToken();
//log.debug("[SSH] : t: " + t);
          if (t.equals("$")) {
            isVar = true;
//log.debug("[SSH] : found $");
          } else {
            if (isVar) {
              // lookup t
              String p = null;
              int j = 0;
              StringBuffer psmp = new StringBuffer();
//log.debug("[SSH] : init psmp: " + psmp);
              for (j = 0; j < t.length() && p == null; j++) {
//log.debug("[SSH] : trying " + psmp);
                psmp.append(t.charAt(j));
                p = getEnvProperty(cmd, psmp.toString());
              }

              if (p == null) {
//log.debug("[SSH] : no property for this name");
                outc.append("$").append(t);
              } else {
//log.debug("[SSH] : found property: " + p);
                outc.append(p);
                if (j < t.length()) {
//log.debug("[SSH] : appending a remnant: " + t.substring(j, t.length()));
                  outc.append(t.substring(j, t.length()));
                }
              }

              isVar = false;
            } else {
              outc.append(t);
            }
          }
        }
        c = outc.toString();


        if (c.startsWith("\"") && c.endsWith("\"") && c.length() > 1) {
          ops.add(c.substring(1, c.length() - 1));
          continue;
        }

        if (c.indexOf("?") != -1 || c.indexOf("*") != -1 || (c.indexOf("[") != -1 && c.indexOf("]") != -1)) {
//          System.out.println("It's a pattern! : " + c);
          try {
            FPExpand fpe = new FPExpand(this);
            fpe.expand(c);
            Vector vx = fpe.getMatches();
            Iterator itx = vx.iterator();
            while (itx.hasNext()) {
              ops.add(((FileInfo) itx.next()).getFileName().toString());
            }
          } catch (Exception ex) {
            log.error("Could not expand", ex);
          }

          continue;
        }


        ops.add(c);
      }

      String[] pout = new String[ops.size()];
      Iterator it2 = ops.iterator();
      for (int i = 0; it2.hasNext(); i++) {
        pout[i] = (String) it2.next();
      }

      //cmdsl.add(new Cmd(scmd, pout, null, null));
      cmd.setParams(pout);
      cmdsl.add(cmd);
    }

    cmds.setCmds(cmdsl);
    return cmds;
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.