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 org.apache.log4j.Logger;
24 import org.apache.tools.ant.BuildException;
25 import org.enableit.db.darrt.SchemaHandler;
26
27
28 /***
29 * Creates the schema with the definitions held
30 * in the schema definition XML.
31 * <p>
32 * The target database can be defined directly using attributes of this task,
33 * or within the target schema XML (The task checks in that order).
34 */
35 public class SchemaImporterTask
36 extends org.enableit.db.darrt.ant.AbstractSchemaTask {
37 /*
38 * Properties
39 */
40
41 /***
42 * The Log4J <code>Logger</code> doing the logging.
43 */
44 protected static Logger logger = Logger.getLogger(SchemaImporterTask.class);
45
46 /***
47 * CVS info ABOUT this class and its current version
48 */
49 public static final String ABOUT = "$Id: SchemaImporterTask.java,v 1.8 2004/03/20 05:22:18 tim Exp $";
50
51 /*
52 * Constructors
53 */
54
55 /***
56 * Default Constructor.
57 */
58 public SchemaImporterTask() {
59 super();
60 }
61
62 /*
63 * Methods
64 */
65
66 /***
67 * Creates the schema.
68 */
69 public void execute()
70 throws BuildException {
71 checkInputs();
72
73 try {
74 log("Installing schema... ");
75
76 SchemaHandler schemaHandler = getSchemaHandler();
77
78 log("This may take several minutes....");
79 schemaHandler.addListeners(getReportListeners());
80 schemaHandler.createSchema();
81 } catch (org.enableit.db.darrt.SchemaHandlingException e) {
82 e.printStackTrace();
83 logger.error(e.getClass().getName() + ":" + e.getMessage());
84 throw new BuildException(e.getMessage());
85 } catch (BuildException e) {
86 throw e;
87 } catch (Exception e) {
88 logger.error(e.getClass().getName() + ":" + e.getMessage());
89 throw new BuildException(e.getMessage());
90 }
91 }
92 }
This page was automatically generated by Maven