KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Connector > EEG > EEM > Actions > RMIC


1 /*
2  * RMIC.java
3  *
4  * Created on 2. duben 2002, 23:37
5  */

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 /**
13  *
14  * @author ghort
15  * @version
16  */

17 public class RMIC implements ActionInterface {
18
19     /** Creates new RMIC */
20    public RMIC(java.util.HashMap JavaDoc props) {
21    }
22
23     public String JavaDoc getName() {
24         return "rmic";
25     }
26      
27     public void perform(SOFA.Connector.Property[] params, String JavaDoc sourceDir, String JavaDoc sourcePackage, String JavaDoc destDir, String JavaDoc destPackage) throws ActionException {
28         String JavaDoc source;
29                 String JavaDoc 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 JavaDoc options="";
39         try {
40       options = "-classpath "+SOFA.Util.ConnGenPathInfo.getConnGenClassPath(iface)+" -d "+SOFA.Util.ConnGenPathInfo.getRMICOutDir()+" ";
41             Runtime JavaDoc runtime=Runtime.getRuntime();
42             Process JavaDoc process=runtime.exec("rmic "+options+destPackage+"."+source);
43             ret=process.waitFor();
44         } catch (Exception JavaDoc 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