KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > dods > DodsThread


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.common.dods;
24
25 import org.enhydra.dods.xslt.*;
26
27 import java.io.*;
28
29
30 public class DodsThread extends Thread JavaDoc {
31
32     Generator gen = null;
33
34     public DodsThread(Generator g) {
35           gen = g;
36     }
37
38
39     public void run() {
40       try {
41
42       String JavaDoc javaPath = System.getProperty("javaPath");
43       String JavaDoc enhydraPath = System.getProperty("enhydraPath");
44       String JavaDoc s[] = new String JavaDoc[10];
45       s[0] = javaPath+"/bin/java";
46       s[1] = "-classpath";
47 /* vl 20.07.03
48       s[2] = ".;"+
49       enhydraPath+"/lib/xml-apis.jar;"+
50       enhydraPath+"/dods/lib/ejen.jar;"+
51       enhydraPath+"/lib/core.jar;"+
52       enhydraPath+"/lib/util.jar;"+
53       enhydraPath+"/lib/enhydra.jar;"+
54       enhydraPath+"/lib/gnu-regexp.jar;"+
55       enhydraPath+"/lib/xercesImpl.jar;"+
56       javaPath+"/jre/lib/rt.jar;"+
57       javaPath+"/lib/tools.jar;"+
58       enhydraPath+"/dods/lib/dods.jar;"+
59       enhydraPath+"/build/ant.jar;"+
60       enhydraPath+"/build/anttask.jar";
61 */

62       s[2] = ".;"+//SV enhydraPath+"/lib/tools/xalan/xalan.jar;"+
63
enhydraPath+"/dods/lib/ejen.jar;"+
64       //SV enhydraPath+"/lib/build/patches.jar;"+
65
enhydraPath+"/lib/core.jar;"+
66       enhydraPath+"/lib/util.jar;"+
67       enhydraPath+"/lib/enhydra.jar;"+
68       enhydraPath+"/lib/gnu-regexp.jar;"+
69       enhydraPath+"/lib/xercesImpl.jar;"+
70       enhydraPath+"/lib/xml-apis.jar;"+
71       javaPath+"/jre/lib/rt.jar;"+
72       javaPath+"/lib/tools.jar;"+
73       enhydraPath+"/dods/lib/dods.jar;"+
74       enhydraPath+"/build/ant.jar;"+
75       enhydraPath+"/build/anttask.jar";
76       s[3] = "-DEJEN_HOME="+enhydraPath;
77       s[4] = "-DPROJECT_ROOT="+System.getProperty("projectRoot");
78       s[5] = "-DDOML_FILE="+System.getProperty("domlFilePath");
79       s[6] = "org.apache.tools.ant.Main";
80       s[7] = "-f";
81       s[8] = "C:/enhydra5/dods/generate.xml";
82       s[9] = System.getProperty("dodsParameters");
83
84       Process JavaDoc process = Runtime.getRuntime().exec(s);
85
86       java.io.InputStream JavaDoc inputstream = process.getInputStream();
87       BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream));
88       java.io.InputStream JavaDoc inputstream1 = process.getErrorStream();
89       BufferedReader bufferedreader1 = new BufferedReader(new InputStreamReader(inputstream1));
90
91       String JavaDoc s1="";
92       String JavaDoc s2="";
93
94       while(((s1 = bufferedreader.readLine()) != null)||
95         ((s2 = bufferedreader1.readLine()) != null)) {
96     if (s1.indexOf("Processing") == -1)
97           if(!s1.equals(""))
98             gen.echo(s1);
99     if (s2.indexOf("Processing") == -1)
100           if(!s2.equals(""))
101             gen.echo(s2);
102       }
103
104       process.waitFor();
105       int k = process.exitValue();
106
107     } catch (Exception JavaDoc e) {
108       gen.echo("U threadu: error"+e);
109
110     }
111   }
112 }
Popular Tags