Package org.jboss.fresh.shell.impl

Examples of org.jboss.fresh.shell.impl.SystemShellImpl


      error(sb.toString());
      return;
    }

    if (outproc != null) {
      SystemShellImpl ss = (SystemShellImpl) ((ShellImpl) getShell()).getSystemShell();
      Process proc = ss.findProcess(outproc);
      if (proc == null) {
        Map m = ss.getShellMap();
        Iterator it = m.entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry ent = (Map.Entry) it.next();
          ShellImpl shel = (ShellImpl) ent.getValue();
          Map procs = shel.getProcesses();
View Full Code Here


            PrintWriter2 pout = new PrintWriter2(new BufferedOutputStream(new BufferOutputStream(getStdOut())));
      Properties p = null;
      if(procid == null) {
        p = getProcess().getEnv().getEnvProperties();
      } else {
        SystemShellImpl ss = (SystemShellImpl) ((ShellImpl) getShell()).getSystemShell();
        Process proc = ss.findProcess(procid);
        if (proc == null) {
          Map m = ss.getShellMap();
          ShellImpl shel = (ShellImpl) m.get(procid);
          if(shel == null) {
            error("No process / shell found for id: " + procid);
            return;
          }
          p = shell.getEnv().getEnvProperties();
        } else {
          if(proc.getEnv() != null) {
            error("Process has no environment - it means it exited but wasn't yet evicted");
            return;
          }
          p = proc.getEnv().getEnvProperties();
        }
       
      }
      HashMap map = new HashMap();
      Enumeration enu = p.propertyNames();
      while (enu.hasMoreElements()) {
        String nm = (String) enu.nextElement();
        map.put(nm, p.getProperty(nm));
      }

      TreeMap sm = new TreeMap(map);
      Iterator it = sm.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry ent = (Map.Entry) it.next();
        pout.println(ent.getKey() + "=" + ent.getValue());
      }

      pout.close();
      log.debug("done");
      return;
    }

        if(procid == null) {
          if(key == null) {
              error("Nothing to do");
              return;
          }
 
          if(key.length() == 0) {
              error("ENV variable name not specified");
              return;
          }
        }

    if(!eq) {
            // just display the value
      if(procid == null) {
        val = getProcess().getEnv().getEnvProperty(key);
      } else {
        SystemShellImpl ss = (SystemShellImpl) ((ShellImpl) getShell()).getSystemShell();
        Process proc = ss.findProcess(procid);
        if (proc == null) {
          Map m = ss.getShellMap();
          ShellImpl shel = (ShellImpl) m.get(procid);
          if(shel == null) {
            error("No process / shell found for id: " + procid);
            return;
          }
View Full Code Here

TOP

Related Classes of org.jboss.fresh.shell.impl.SystemShellImpl

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.