View Javadoc
1 /* 2 * PROJECT : DAR Runtime and Tools 3 * COPYRIGHT : Copyright (C) 1999-2004 tim.stephenson@enableit.org 4 * LICENSE : GNU LESSER GENERAL PUBLIC LICENSE 5 * Version 2.1, February 1999 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 package org.enableit.db.darrt.ant; 22 23 import java.io.File; 24 25 import org.apache.tools.ant.BuildException; 26 import org.enableit.db.darrt.DarHandler; 27 28 /*** 29 * Expose DarHandler as Ant task. 30 * @author Tim Stephenson 31 */ 32 public class DarHandlerTask extends org.apache.tools.ant.Task { 33 /*** 34 * CVS info ABOUT this class and its current version 35 */ 36 public static final String ABOUT = "$Revision $"; 37 38 /*** 39 * Debug flag 40 */ 41 private boolean debug = false; 42 43 /*** 44 * The dar file being installed. 45 */ 46 private String darFile; 47 48 /*** 49 * Default constructor. 50 */ 51 public DarHandlerTask() { 52 } 53 54 /*** 55 * Sets the dar file name. 56 * @param darFile Name of DAR archive to be installed in database. 57 */ 58 public void setDarFile(String darFile) { 59 this.darFile = darFile; 60 } 61 62 /*** 63 * @param debug Whether to issue extra debug information. 64 */ 65 public void setDebug(boolean debug) { 66 this.debug = debug; 67 } 68 69 /*** 70 * Installs the dar file. 71 * @throws BuildException If for any reason the installation cannot 72 * proceed. 73 */ 74 public void execute() 75 throws BuildException { 76 try { 77 DarHandler dh = new DarHandler(); 78 79 dh.setDebug(debug); 80 81 File dar = new File(darFile); 82 83 dh.install(dar.toURL()); 84 } catch (java.net.MalformedURLException e) { 85 throw new BuildException(e.getMessage()); 86 } catch (org.enableit.db.DBException e) { 87 throw new BuildException(e.getMessage()); 88 } 89 } 90 }

This page was automatically generated by Maven