1 6 7 package SOFA.Connector.EEG.EEM.Actions; 8 9 import SOFA.Connector.EEG.EEM.ActionException; 10 import SOFA.Connector.EEG.EEM.ActionInterface; 11 12 17 public class RMIC implements ActionInterface { 18 19 20 public RMIC(java.util.HashMap props) { 21 } 22 23 public String getName() { 24 return "rmic"; 25 } 26 27 public void perform(SOFA.Connector.Property[] params, String sourceDir, String sourcePackage, String destDir, String destPackage) throws ActionException { 28 String source; 29 String iface; 30 if ((source=SOFA.Connector.Property.findFirst(params,"class"))==null) { 31 throw new ActionException("class param not specified"); 32 } 33 if ((iface=SOFA.Connector.Property.findFirst(params,"iface"))==null) { 34 throw new ActionException("iface param not specified"); 35 } 36 37 int ret; 38 String options=""; 39 try { 40 options = "-classpath "+SOFA.Util.ConnGenPathInfo.getConnGenClassPath(iface)+" -d "+SOFA.Util.ConnGenPathInfo.getRMICOutDir()+" "; 41 Runtime runtime=Runtime.getRuntime(); 42 Process process=runtime.exec("rmic "+options+destPackage+"."+source); 43 ret=process.waitFor(); 44 } catch (Exception e) { 45 throw new ActionException("Can't create RMI skeleton for class "+destPackage+"."+source+".",e); 46 } 47 if (ret!=0) { 48 throw new ActionException("Creating RMI skeleton 'rmic "+options+destPackage+"."+source+"' returned error ("+ret+")."); 49 } 50 } 51 52 } 53 | Popular Tags |