1 18 package org.apache.roller.ant; 19 20 import java.sql.Connection ; 21 import java.sql.DriverManager ; 22 import java.sql.SQLException ; 23 24 import org.apache.tools.ant.BuildException; 25 import org.apache.tools.ant.Task; 26 27 31 public class StopHsqldbTask extends Task 32 { 33 private String port = null; 34 public void execute() throws BuildException 35 { 36 try 37 { 38 if (port==null) 39 { 40 throw new BuildException("missing port attribute"); 41 } 42 System.out.println("Stopping HSQLDB at port " + port); 43 final Connection con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:"+port); 44 con.createStatement().execute("SHUTDOWN"); 45 } 46 catch (SQLException e) 47 { 48 throw new BuildException(e.getMessage()); 49 } 50 } 51 54 public String getPort() 55 { 56 return port; 57 } 58 61 public void setPort(String port) 62 { 63 this.port = port; 64 } 65 } 66 | Popular Tags |