KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > ant > StartHsqldbTask


1 package org.jbpm.ant;
2
3 import org.apache.tools.ant.BuildException;
4 import org.apache.tools.ant.Task;
5
6 public class StartHsqldbTask extends Task {
7   
8   String JavaDoc lib;
9   String JavaDoc database;
10   String JavaDoc port;
11   
12   public StartHsqldbTask() {
13   }
14
15   public void execute() throws BuildException {
16     try {
17       // build the command string
18
String JavaDoc command = "java -cp "+ lib +
19                        " org.hsqldb.Server " +
20                        " -database " + database +
21                        " -port "+port;
22
23       // launch the command and wait till the END_MESSAGE appears
24
Thread JavaDoc launcher = new Launcher(this, command, "is online");
25       launcher.start();
26       launcher.join();
27       
28     } catch (Throwable JavaDoc t) {
29       t.printStackTrace();
30     }
31   }
32
33   public void setDatabase(String JavaDoc database) {
34     this.database = database;
35   }
36   public void setLib(String JavaDoc lib) {
37     this.lib = lib;
38   }
39   public void setPort(String JavaDoc port) {
40     this.port = port;
41   }
42 }
43
Popular Tags