1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.jes.component.production;
12
13 import org.astrogrid.component.descriptor.ComponentDescriptor;
14 import org.astrogrid.config.Config;
15 import org.astrogrid.jes.impl.workflow.DefaultSqlCommands;
16 import org.astrogrid.jes.impl.workflow.SqlCommands;
17
18 import junit.framework.Test;
19
20 /***
21 * Implementation of SqlCommands that loads sql commands to execute from a configuration
22 * Used to configure a {@link org.astrogrid.jes.impl.workflow.DBJobFactoryImpl}
23 * @author Noel Winstanley nw@jb.man.ac.uk 17-Feb-2004
24 *
25 */
26 public class SqlCommandsFromConfig extends DefaultSqlCommands implements SqlCommands, ComponentDescriptor {
27 public final static String DELETE_SQL = "sql.command.delete";
28 public final static String UPDATE_SQL = "sql.command.updatel";
29 public final static String RETRIEVE_SQL = "sql.command.retrievel";
30 public final static String INSERT_SQL = "sql.command.insert";
31 public final static String LIST_SQL="sql.command.list";
32 /***
33 * Construct a new ConfigSqlCommands
34 * @param conf confuguration object to look up sql commands in.
35 */
36 public SqlCommandsFromConfig(Config conf) {
37 insertSQL = conf.getString(SqlCommandsFromConfig.INSERT_SQL,SqlCommandsFromConfig.INSERT_SQL_DEFAULT);
38 retrieveSQL = conf.getString(SqlCommandsFromConfig.RETRIEVE_SQL,SqlCommandsFromConfig.RETRIEVE_SQL_DEFAULT);
39 updateSQL = conf.getString(SqlCommandsFromConfig.UPDATE_SQL,SqlCommandsFromConfig.UPDATE_SQL_DEFAULT);
40 deleteSQL = conf.getString(SqlCommandsFromConfig.DELETE_SQL,SqlCommandsFromConfig.DELETE_SQL_DEFAULT);
41 listSQL = conf.getString(SqlCommandsFromConfig.LIST_SQL,SqlCommandsFromConfig.LIST_SQL_DEFAULT);
42 }
43 /***
44 * @see org.astrogrid.jes.component.ComponentDescriptor#getName()
45 */
46 public String getName() {
47 return "DBJobFactory - sql command configuration";
48 }
49 /***
50 * @see org.astrogrid.jes.component.ComponentDescriptor#getDescription()
51 */
52 public String getDescription() {
53 return "SQL Commands read from configuration file\n"
54 + LIST_SQL + " : " + getListSQL() + "\n"
55 + DELETE_SQL + " : " + getDeleteSQL() + "\n"
56 + INSERT_SQL + " : " + getInsertSQL() + "\n"
57 + RETRIEVE_SQL + " : " + getRetrieveSQL() + "\n"
58 + UPDATE_SQL + " : " + getUpdateSQL() ;
59 }
60 /***
61 * @see org.astrogrid.jes.component.ComponentDescriptor#getInstallationTest()
62 */
63 public Test getInstallationTest() {
64 return null;
65 }
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104