001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: * Paul Mahar
021: *
022: */
023: package org.enhydra.kelp.common.dods;
024:
025: import org.enhydra.dods.xslt.*;
026:
027: import java.io.*;
028:
029: public class DodsThread extends Thread {
030:
031: Generator gen = null;
032:
033: public DodsThread(Generator g) {
034: gen = g;
035: }
036:
037: public void run() {
038: try {
039:
040: String javaPath = System.getProperty("javaPath");
041: String enhydraPath = System.getProperty("enhydraPath");
042: String s[] = new String[10];
043: s[0] = javaPath + "/bin/java";
044: s[1] = "-classpath";
045: /* vl 20.07.03
046: s[2] = ".;"+enhydraPath+"/lib/tools/xalan/xalan.jar;"+
047: enhydraPath+"/lib/tools/xalan/bin/xml-apis.jar;"+
048: enhydraPath+"/lib/build/ejen.jar;"+
049: enhydraPath+"/lib/build/patches.jar;"+
050: enhydraPath+"/lib/core.jar;"+
051: enhydraPath+"/lib/util.jar;"+
052: enhydraPath+"/lib/enhydra.jar;"+
053: enhydraPath+"/lib/gnu-regexp.jar;"+
054: enhydraPath+"/lib/xerces.jar;"+
055: javaPath+"/jre/lib/rt.jar;"+
056: javaPath+"/lib/tools.jar;"+
057: enhydraPath+"/lib/build/dods.jar;"+
058: enhydraPath+"/build/ant.jar;"+
059: enhydraPath+"/build/anttask.jar";
060: */
061: s[2] = ".;"
062: + //SV enhydraPath+"/lib/tools/xalan/xalan.jar;"+
063: enhydraPath
064: + "/dods/lib/ejen.jar;"
065: +
066: //SV enhydraPath+"/lib/build/patches.jar;"+
067: enhydraPath + "/lib/core.jar;" + enhydraPath
068: + "/lib/util.jar;" + enhydraPath
069: + "/lib/enhydra.jar;" + enhydraPath
070: + "/lib/gnu-regexp.jar;" + enhydraPath
071: + "/lib/xercesImpl.jar;" + enhydraPath
072: + "/lib/xml-apis.jar;" + javaPath
073: + "/jre/lib/rt.jar;" + javaPath + "/lib/tools.jar;"
074: + enhydraPath + "/dods/lib/dods.jar;" + enhydraPath
075: + "/build/ant.jar;" + enhydraPath
076: + "/build/anttask.jar";
077: // vl 20.07.03
078: s[3] = "-DEJEN_HOME=" + enhydraPath;
079: s[4] = "-DPROJECT_ROOT="
080: + System.getProperty("projectRoot");
081: s[5] = "-DDOML_FILE=" + System.getProperty("domlFilePath");
082: s[6] = "org.apache.tools.ant.Main";
083: s[7] = "-f";
084: s[8] = "C:/enhydra5/dods/generate.xml";
085: s[9] = System.getProperty("dodsParameters");
086:
087: Process process = Runtime.getRuntime().exec(s);
088:
089: java.io.InputStream inputstream = process.getInputStream();
090: BufferedReader bufferedreader = new BufferedReader(
091: new InputStreamReader(inputstream));
092: java.io.InputStream inputstream1 = process.getErrorStream();
093: BufferedReader bufferedreader1 = new BufferedReader(
094: new InputStreamReader(inputstream1));
095:
096: String s1 = "";
097: String s2 = "";
098:
099: while (((s1 = bufferedreader.readLine()) != null)
100: || ((s2 = bufferedreader1.readLine()) != null)) {
101: if (s1.indexOf("Processing") == -1)
102: if (!s1.equals(""))
103: gen.echo(s1);
104: if (s2.indexOf("Processing") == -1)
105: if (!s2.equals(""))
106: gen.echo(s2);
107: }
108:
109: process.waitFor();
110: int k = process.exitValue();
111:
112: } catch (Exception e) {
113: gen.echo("U threadu: error" + e);
114:
115: }
116: }
117: }
|