KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > dbscript > Script


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.dbscript;
7
8 import java.util.List JavaDoc;
9 import java.util.Properties JavaDoc;
10 import java.util.Vector JavaDoc;
11
12 /**
13  * Defines a set of {@link #getCommands commands} to run. And which
14  * {@link #getDriver driver} to use. And its {@link #getInfo configuration}.
15  *
16  * @version $Revision: 1.6 $, $Date: 2003/03/03 11:12:03 $
17  * @author Bill Horsman (bill@logicalcobwebs.co.uk)
18  * @author $Author: billhorsman $ (current maintainer)
19  * @since Proxool 0.5
20  */

21 class Script {
22
23     private String JavaDoc name;
24
25     private String JavaDoc driver;
26
27     private String JavaDoc url;
28
29     private Properties JavaDoc info = new Properties JavaDoc();
30
31     private List JavaDoc commands = new Vector JavaDoc();
32
33     /**
34      * Add a command to the script.
35      * @param command to add
36      */

37     protected void addCommand(Command command) {
38         commands.add(command);
39     }
40
41     /**
42      * Get all the commands, in the order in which they were added
43      * @return list of commands
44      */

45     protected Command[] getCommands() {
46         return (Command[]) commands.toArray(new Command[commands.size()]);
47     }
48
49     /**
50      * So we can recognise this script in the logs
51      * @return name
52      */

53     protected String JavaDoc getName() {
54         return name;
55     }
56
57     /**
58      * @see #getName
59      */

60     protected void setName(String JavaDoc name) {
61         this.name = name;
62     }
63
64     /**
65      * The URL to pass to the Driver
66      */

67     protected String JavaDoc getUrl() {
68         return url;
69     }
70
71     /**
72      * @see #getUrl
73      */

74     protected void setUrl(String JavaDoc url) {
75         this.url = url;
76     }
77
78     /**
79      * The driver to use
80      * @return the driver
81      */

82     protected String JavaDoc getDriver() {
83         return driver;
84     }
85
86     /**
87      * @see #getDriver
88      */

89     protected void setDriver(String JavaDoc driver) {
90         this.driver = driver;
91     }
92
93     /**
94      * Configuration of the Driver
95      * @return properties
96      */

97     protected Properties JavaDoc getInfo() {
98         return info;
99     }
100
101     /**
102      * Add a new property
103      * @param name name of property
104      * @param value value of property
105      */

106     protected void addProperty(String JavaDoc name, String JavaDoc value) {
107         info.setProperty(name, value);
108     }
109
110 }
111
112 /*
113  Revision history:
114  $Log: Script.java,v $
115  Revision 1.6 2003/03/03 11:12:03 billhorsman
116  fixed licence
117
118  Revision 1.5 2003/02/19 15:14:21 billhorsman
119  fixed copyright (copy and paste error,
120  not copyright change)
121
122  Revision 1.4 2002/11/09 15:59:52 billhorsman
123  fix doc
124
125  Revision 1.3 2002/11/02 14:22:16 billhorsman
126  Documentation
127
128  Revision 1.2 2002/11/02 13:57:34 billhorsman
129  checkstyle
130
131  Revision 1.1 2002/11/02 11:29:53 billhorsman
132  new script runner for testing
133
134 */

135
Popular Tags