1 2 29 30 package com.jcraft.jsch; 31 32 public class ChannelSubsystem extends ChannelSession{ 33 boolean xforwading=false; 34 boolean pty=false; 35 boolean want_reply=true; 36 String subsystem=""; 37 public void setXForwarding(boolean foo){ xforwading=true; } 38 public void setPty(boolean foo){ pty=foo; } 39 public void setWantReply(boolean foo){ want_reply=foo; } 40 public void setSubsystem(String foo){ subsystem=foo; } 41 public void start() throws JSchException{ 42 try{ 43 Request request; 44 if(xforwading){ 45 request=new RequestX11(); 46 request.request(session, this); 47 } 48 if(pty){ 49 request=new RequestPtyReq(); 50 request.request(session, this); 51 } 52 request=new RequestSubsystem(); 53 ((RequestSubsystem)request).request(session, this, subsystem, want_reply); 54 } 55 catch(Exception e){ 56 if(e instanceof JSchException){ throw (JSchException)e; } 57 if(e instanceof Throwable ) 58 throw new JSchException("ChannelSubsystem", (Throwable )e); 59 throw new JSchException("ChannelSubsystem"); 60 } 61 if(io.in!=null){ 62 thread=new Thread (this); 63 thread.setName("Subsystem for "+session.host); 64 if(session.daemon_thread){ 65 thread.setDaemon(session.daemon_thread); 66 } 67 thread.start(); 68 } 69 } 70 public void init(){ 72 io.setInputStream(session.in); 73 io.setOutputStream(session.out); 74 } 75 public void setErrStream(java.io.OutputStream out){ 76 setExtOutputStream(out); 77 } 78 public java.io.InputStream getErrStream() throws java.io.IOException { 79 return getExtInputStream(); 80 } 81 } 82 | Popular Tags |