1 31 package org.objectweb.proactive.core.process.lsf; 32 33 import org.objectweb.proactive.core.process.SimpleExternalProcess; 34 import org.objectweb.proactive.core.process.AbstractExternalProcessDecorator; 35 import org.objectweb.proactive.core.process.ExternalProcess; 36 37 55 56 public class RLoginProcess extends AbstractExternalProcessDecorator { 57 58 private boolean exitAfterCommand; 59 63 67 public RLoginProcess() { 68 super(); 69 setCompositionType(SEND_TO_OUTPUT_STREAM_COMPOSITION); 70 } 71 72 77 public RLoginProcess(ExternalProcess targetProcess) { 78 this(targetProcess, false); 79 } 80 81 82 88 public RLoginProcess(ExternalProcess targetProcess, boolean exitAfterCommand) { 89 super(targetProcess, SEND_TO_OUTPUT_STREAM_COMPOSITION); 90 this.exitAfterCommand = exitAfterCommand; 91 } 92 93 94 95 102 public void setExitAfterCommand(boolean b) { 103 exitAfterCommand = b; 104 } 105 106 107 112 public boolean getExitAfterCommand() { 113 return exitAfterCommand; 114 } 115 116 public static void main(String [] args) { 117 try { 118 LSFBSubProcess lsf = new LSFBSubProcess(new SimpleExternalProcess("ls -lsa")); 119 RLoginProcess p = new RLoginProcess(lsf, false); 120 p.setHostname("galere1"); 121 p.startProcess(); 122 } catch (Exception e) { 123 e.printStackTrace(); 124 } 125 } 126 127 128 132 protected String internalBuildCommand() { 133 return buildEnvironmentCommand()+buildRLoginCommand(); 134 } 135 136 137 protected String buildRLoginCommand() { 138 return "rlogin "+hostname+" "; 139 } 140 141 142 protected void internalStartProcess(String command) throws java.io.IOException { 143 144 super.internalStartProcess(command); 145 if (exitAfterCommand) { 146 outputMessageSink.setMessage(null); 147 } 148 } 149 150 151 155 } 156 | Popular Tags |