Package org.jboss.fresh.vfs.impl

Examples of org.jboss.fresh.vfs.impl.SecureVFS


          } else {
            FileName fname = new FileName(cmdl.getStdInRedir());
            if (fname.isRelative()) {
              fname = new FileName(getEnvProperty("PWD")).absolutize(fname);
            }
            InputStreamBuffer bin = new InputStreamBuffer(new VFSInputStream(new SecureVFS(vfs, uctx), fname.toString()), cmdl.isInObjMode());
            bin.setProperties(env);
            in = bin;
          }

        } catch (IOException ex) {
          throw new ShellException("Exception occured while initializing input buffer: " + ex.toString());
        }

      }


      if (in == null) {
//log.debug("No output redirect setup...");
        if (hasin) {
          if (!"SINGLE".equals(getEnvProperty("TMODE"))) {
            in = new BufferImpl();
          } else {
            in = new MemFileBufferImpl();
          }
          // here we set whatever is maxsize for inputbuffer for this executable - we have this set
          // as attribute on the file or something ...
          // FIXME
          List input = cmdl.getStdInput();
          if(input != null) {
            in.setMaxSize(input.size());
            try {
              ((Buffer)in).putBuffer(new LinkedList(input), 1000);
              in.close();
            } catch (IOException ex) {
              throw new ShellException("Exception occured while initializing input buffer: " + ex.toString());
            }
          }
          in.setMaxSize(inbufmax); // should be a variable

        } else {
          in = new NullBuffer();
        }
      }

    } else {
//log.debug("Piping in previous out...");
      Object o_in = ((Process) joblist.getLast()).getOutputBuffer();
      if (!(o_in instanceof InBuffer)) {
        throw new ShellException("Invalid pipe chain. Trying to read from write-only buffer.");
      }
      in = (InBuffer) o_in;
    }

//log.debug("\n\nin = " + in);

    OutBuffer out = null;

    if (cmdl.size() == joblist.size() + 1) {

      if (cmdl.getSLStdOutRedir() != null) {
        try {
          OutputStreamBuffer bout = new OutputStreamBuffer(new FileOutputStream(cmdl.getSLStdOutRedir(), cmdl.getSLAppend()), cmdl.isSLOutObjMode());
          bout.setProperties(env);
          out = bout;
          p.setRedirected(true);
        } catch (IOException ex) {
          throw new ShellException("Exception occured while initializing output buffer: " + ex.toString());
        }

      } else if (cmdl.getStdOutRedir() != null) {
        try {
          ////out=new OutputStreamBuffer(new VFSOutputStream(new SecureVFS(vfs, uctx), cmdl.getStdOutRedir(), cmdl.getAppend()), cmdl.isOutObjMode());

          //if(TxSupport.isActive()) throw new ShellException("Illegal state - inside transaction.");
          //TxSupport.begin();
          try {
            FileName fname = new FileName(cmdl.getStdOutRedir());
            if (fname.isRelative()) {
              fname = new FileName(getEnvProperty("PWD")).absolutize(fname);
            }
            OutputStreamBuffer bout = new OutputStreamBuffer(new LazyVFSOutputStream(new SecureVFS(vfs, uctx), fname.toString(), cmdl.getAppend()), cmdl.isOutObjMode());
            bout.setProperties(env);
            out = bout;
            p.setRedirected(true);
            //TxSupport.commit();
          } catch (Exception ex) {
View Full Code Here


                if (path.isRelative())
                    path = pwd.absolutize(path);

                path = vfs.resolve(shell.getUserCtx(), path, false);

                ins = new VFSInputStream(new SecureVFS(vfs, shell.getUserCtx()), path.toString());
            }

            if (enc == null || enc.trim().length() == 0) {
                reader = new BufferedReader(new InputStreamReader(ins));
            } else {
View Full Code Here

                    FileName fname = new FileName(tmp);
                    if (fname.isRelative())
                        fname = new FileName(getShell().getEnvProperty("PWD")).absolutize(fname);

                    in = new BufferedReader(new InputStreamReader(new VFSInputStream(
                            new SecureVFS(getShell().getVFS(), getShell().getUserCtx()),
                            fname.toString())));
                    break;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.fresh.vfs.impl.SecureVFS

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.