Package org.jboss.fresh.shell

Examples of org.jboss.fresh.shell.ProcessInfo


          p.start(); // We have a problem with concurrent modification on job
        } else {
          preparedProcess.set(p);
        }
       
        ProcessInfo pinfo = new ProcessInfo();
        pinfo.procid = p.getID();
        pinfo.inbuf_maxsize = ib.getMaxSize();
        pinfo.outbuf_maxsize = ob.getMaxSize();
        return pinfo;
      } else {
        Process p = (Process) job.getFirst();
//    System.out.println("Putting the process in the procmap: " + p.getID() + " : " + p);

        InBuffer ib = p.getInputBuffer();
        OutBuffer ob = p.getOutputBuffer();

//log.debug("PRocess ib: " + ib);
//log.debug("PRocess ob: " + ob);

        if (active == null) {
          active = p;
        }
//      if(interactive) {
//        outreader.replacePrimaryBuffer(ob);
//      }

//      System.out.println("ACTIVE SET: " + active);

        procmap.put(p.getID(), p);
//log.debug("***\n***[execute] Created process " + p.getID() + "\n***");
        log.debug("Created process " + p.getID());

        p.setUserInitiated(ui);

        hi.setProcessID(p.getID());
        hi.getChildren().add(p);

        if (!prepareOnly) {
          p.start();
        } else {
          preparedProcess.set(p);
        }
       
//    System.out.println("Started the process.");

        ProcessInfo pinfo = new ProcessInfo();
        pinfo.procid = p.getID();
        pinfo.inbuf_maxsize = ib.getMaxSize();
        pinfo.outbuf_maxsize = ob.getMaxSize();
        return pinfo;
      }
View Full Code Here


    log.debug("Created process " + p.getID());
    p.setUserInitiated(false); // what does it mean again ?
    p.start();
    //log.debug("Started the process.");

    ProcessInfo pinfo = new ProcessInfo();
    pinfo.procid = p.getID();
    pinfo.inbuf_maxsize = exe.getStdIn().getMaxSize();
    pinfo.outbuf_maxsize = exe.getStdOut().getMaxSize();
    return pinfo;
  }
View Full Code Here

    // similar to above only this time we take results as Object and return
    // an object. The above is really a flavor of this and not vice versa.

    // start executable. set up nullbuffer on its stdi
    try {
      ProcessInfo pinfo = _execute(cmdline, input, false, true, ui, false); // NullInput In case no redirects specified of course

      // read one object from its std out
//      System.out.println(">>>BUFFER : " + getBuffer(pinfo.procid, 1));
      InBuffer buf = null;
      try {
View Full Code Here

                        } catch (Exception e) {
                        }
                    }
                }

                ProcessInfo pinf = null;
                cmd = "cat > " + file;
                log.debug(cmd);
                if (shell != null) {
                    pinf = shell.execute(cmd);
                    sos = new ShellOutputStream(shell, pinf.procid);
                } else {
                    pinf = rshell.execute(cmd);
                    sos = new ShellOutputStream(rshell, pinf.procid);
                }
                osw = new OutputStreamWriter(sos, "UTF-8");
                osw.write(content);
                log.log(NOTICE, "Created file " + file + ", processed " + content.length() + " characters.");
            } else if (sourceFile != null && sourceFile.length() > 0) {
                java.io.File f = new java.io.File(sourceFile);
                if (!f.exists()) {
                    log.error("File " + f.getAbsolutePath() + " does not exist! Will not create VFS file: " + file);
                    return;
                }
                if (!f.isFile()) {
                    log.error("Path " + f.getAbsolutePath() + " is not a file! Will not create VFS file: " + file);
                    return;
                }
                cmd = "cat > " + file + " &< " + f.getAbsolutePath();
                log.debug(cmd);
                if (shell != null) {
                    shell.execute(cmd);
                } else {
                    rshell.execute(cmd);
                }
                log.log(NOTICE, "Created file " + file + ", wrote " + f.length() + " bytes.");
            } else if (url != null) {
                InputStream is = null;
                try {
                    java.net.URLConnection uc = url.openConnection();
                    uc.setConnectTimeout(30 * 1000);
                    uc.setReadTimeout(60 * 1000);
                    is = uc.getInputStream();

                    ProcessInfo pinf = null;
                    cmd = "cat > " + file;
                    log.debug(cmd);
                    if (shell != null) {
                        pinf = shell.execute(cmd);
                        sos = new ShellOutputStream(shell, pinf.procid);
View Full Code Here

                    log.debug(exePath + " - Executing " + line);
                }

                ShellImpl sh = (ShellImpl) getShell();
                try {
                    ProcessInfo pinfo = sh.execute(line);

                    InBuffer buf = null;
                    try {
                        buf = sh.getBuffer(pinfo.procid, 1);
                    } catch (org.jboss.fresh.shell.NoSuchProcessException ex) {
View Full Code Here

TOP

Related Classes of org.jboss.fresh.shell.ProcessInfo

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.