1 package org.roller.ant; 2 3 import org.apache.tools.ant.BuildException; 4 import org.apache.tools.ant.Task; 5 import org.hsqldb.Server; 6 7 11 public class StartHsqldbTask extends Task 12 { 13 private String database = null; 14 private String port = null; 15 public void execute() throws BuildException 16 { 17 if (database != null) { 18 Thread server = new Thread () { 19 public void run() { 20 System.out.println("Starting HSQLDB"); 21 String [] args = { 22 "-database", database, 23 "-port", port, 24 "-no_system_exit", "true" }; 25 Server.main(args); 26 } 27 }; 28 server.start(); 29 } 30 try {Thread.sleep(2000);} catch (Exception ignored) {} 31 } 32 35 public String getDatabase() 36 { 37 return database; 38 } 39 42 public void setDatabase(String database) 43 { 44 this.database = database; 45 } 46 49 public String getPort() 50 { 51 return port; 52 } 53 56 public void setPort(String port) 57 { 58 this.port = port; 59 } 60 } 61 | Popular Tags |