001: /*
002: * This software is released under a licence similar to the Apache Software Licence.
003: * See org.logicalcobwebs.proxool.package.html for details.
004: * The latest version is available at http://proxool.sourceforge.net
005: */
006: package org.logicalcobwebs.dbscript;
007:
008: import java.util.List;
009: import java.util.Properties;
010: import java.util.Vector;
011:
012: /**
013: * Defines a set of {@link #getCommands commands} to run. And which
014: * {@link #getDriver driver} to use. And its {@link #getInfo configuration}.
015: *
016: * @version $Revision: 1.6 $, $Date: 2003/03/03 11:12:03 $
017: * @author Bill Horsman (bill@logicalcobwebs.co.uk)
018: * @author $Author: billhorsman $ (current maintainer)
019: * @since Proxool 0.5
020: */
021: class Script {
022:
023: private String name;
024:
025: private String driver;
026:
027: private String url;
028:
029: private Properties info = new Properties();
030:
031: private List commands = new Vector();
032:
033: /**
034: * Add a command to the script.
035: * @param command to add
036: */
037: protected void addCommand(Command command) {
038: commands.add(command);
039: }
040:
041: /**
042: * Get all the commands, in the order in which they were added
043: * @return list of commands
044: */
045: protected Command[] getCommands() {
046: return (Command[]) commands
047: .toArray(new Command[commands.size()]);
048: }
049:
050: /**
051: * So we can recognise this script in the logs
052: * @return name
053: */
054: protected String getName() {
055: return name;
056: }
057:
058: /**
059: * @see #getName
060: */
061: protected void setName(String name) {
062: this .name = name;
063: }
064:
065: /**
066: * The URL to pass to the Driver
067: */
068: protected String getUrl() {
069: return url;
070: }
071:
072: /**
073: * @see #getUrl
074: */
075: protected void setUrl(String url) {
076: this .url = url;
077: }
078:
079: /**
080: * The driver to use
081: * @return the driver
082: */
083: protected String getDriver() {
084: return driver;
085: }
086:
087: /**
088: * @see #getDriver
089: */
090: protected void setDriver(String driver) {
091: this .driver = driver;
092: }
093:
094: /**
095: * Configuration of the Driver
096: * @return properties
097: */
098: protected Properties getInfo() {
099: return info;
100: }
101:
102: /**
103: * Add a new property
104: * @param name name of property
105: * @param value value of property
106: */
107: protected void addProperty(String name, String value) {
108: info.setProperty(name, value);
109: }
110:
111: }
112:
113: /*
114: Revision history:
115: $Log: Script.java,v $
116: Revision 1.6 2003/03/03 11:12:03 billhorsman
117: fixed licence
118:
119: Revision 1.5 2003/02/19 15:14:21 billhorsman
120: fixed copyright (copy and paste error,
121: not copyright change)
122:
123: Revision 1.4 2002/11/09 15:59:52 billhorsman
124: fix doc
125:
126: Revision 1.3 2002/11/02 14:22:16 billhorsman
127: Documentation
128:
129: Revision 1.2 2002/11/02 13:57:34 billhorsman
130: checkstyle
131:
132: Revision 1.1 2002/11/02 11:29:53 billhorsman
133: new script runner for testing
134:
135: */
|