KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > Tools > CallConGen


1 /* $Id: CallConGen.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.Tools;
3 import java.io.File JavaDoc;
4
5 import SOFA.SOFAnode.Run.SpecFile;
6
7 /** Call connector generator with correct arguments.
8   *
9   * @author Petr Hnetynka
10   */

11 public class CallConGen {
12   
13   
14   /** Argument is depldescr form of component.
15     * Java properties:
16     * <ul>
17     * <li>file.root - from which directory (inserted) files will be searched
18     * <li>sofa.tr.dir - directory with TR
19     * <li>..and all properties for connector generator
20     * </ul>
21     */

22   public static void main(String JavaDoc[] argv) {
23     if (argv.length < 1) {
24       System.out.println("too few arguments");
25       System.exit(1);
26     }
27
28     String JavaDoc trDir = System.getProperty("sofa.tr.dir", null);
29     if (trDir == null) {
30       System.out.println("Specify TR directrory (java property \"sofa.tr.dir\")");
31       System.exit(1);
32     }
33
34     SpecFile specFile = null;
35     try {
36       specFile = SpecFile.getSpecFileFromFile(argv[0]);
37     } catch (java.io.IOException JavaDoc e) {
38       System.out.println("IOException: "+e.getMessage());
39       System.exit(1);
40     } catch (javax.xml.parsers.ParserConfigurationException JavaDoc e) {
41       System.out.println("ParserConfigurationException: "+e.getMessage() );
42       System.exit(1);
43     } catch (org.xml.sax.SAXException JavaDoc e) {
44       System.out.println("SAXException: "+e.getMessage() );
45       System.exit(1);
46     }
47
48     String JavaDoc arch = specFile.getFullArchName();
49     arch = arch.substring(0, arch.indexOf('?'));
50     String JavaDoc version = specFile.getImplVersion();
51     String JavaDoc sdir = trDir+File.separator+"impl"+File.separator+InstallToTR.fullNameToFileName(arch)+File.separator+version+File.separator;
52 // System.out.println(sdir);
53
String JavaDoc inArgv[] = new String JavaDoc [2];
54     inArgv[0] = sdir + "run.dc";
55     inArgv[1] = sdir + "run.dd";
56
57     try {
58       SOFA.Connector.ECG.test.main(inArgv);
59     } catch (Exception JavaDoc e) {
60       e.printStackTrace();
61       System.exit(1);
62     }
63     
64   }
65 }
66
Popular Tags