KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * IDL.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 IDL implements ActionInterface {
18     protected String JavaDoc include;
19
20     /** Creates new IDL */
21    public IDL(java.util.HashMap JavaDoc props) {
22         include=(String JavaDoc)props.get("include");
23    }
24
25     public String JavaDoc getName() {
26         return "idl";
27     }
28      
29     public void perform(SOFA.Connector.Property[] params, String JavaDoc sourceDir, String JavaDoc sourcePackage, String JavaDoc destDir, String JavaDoc destPackage) throws ActionException {
30         String JavaDoc source;
31         if ((source=SOFA.Connector.Property.findFirst(params,"source"))==null) {
32             throw new ActionException("source param not specified");
33         }
34          
35         int ret;
36         try {
37             Runtime JavaDoc runtime=Runtime.getRuntime();
38             Process JavaDoc process=runtime.exec("idlj -td "+SOFA.Util.ConnGenPathInfo.getRMICOutDir()+" -fall "+(include!=null?"-i "+include+" ":"")+destDir+"/"+source);
39             ret=process.waitFor();
40         } catch (Exception JavaDoc e) {
41             throw new ActionException("Can't create classes from idl file "+destPackage+"/"+source+".",e);
42         }
43         if (ret!=0) {
44             throw new ActionException("Creating classes from IDL 'idlj -fall "+(include!=null?"-i "+include+" ":"")+destDir+"/"+source+"' returned error ("+ret+").");
45         }
46     }
47      
48 }
49
Popular Tags