View Javadoc

1   /*$Id: SqlCommandsFromConfig.java,v 1.5 2004/07/01 21:15:00 nw Exp $
2    * Created on 12-Feb-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
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  $Log: SqlCommandsFromConfig.java,v $
70  Revision 1.5  2004/07/01 21:15:00  nw
71  added results-listener interface to jes
72  
73  Revision 1.4  2004/03/15 23:45:07  nw
74  improved javadoc
75  
76  Revision 1.3  2004/03/15 01:30:06  nw
77  factored component descriptor out into separate package
78  
79  Revision 1.2  2004/03/07 21:04:38  nw
80  merged in nww-itn05-pico - adds picocontainer
81  
82  Revision 1.1.2.1  2004/03/07 20:39:26  nw
83  added implementation of a self-configuring production set of component
84  
85  Revision 1.4  2004/03/05 16:16:23  nw
86  worked now object model through jes.
87  implemented basic scheduling policy
88  removed internal facade
89  
90  Revision 1.3  2004/03/03 01:13:41  nw
91  updated jes to work with regenerated workflow object model
92  
93  Revision 1.2  2004/02/27 00:46:03  nw
94  merged branch nww-itn05-bz#91
95  
96  Revision 1.1.2.2  2004/02/17 12:25:38  nw
97  improved javadocs for classes
98  
99  Revision 1.1.2.1  2004/02/12 12:54:47  nw
100 worked in inversion of control pattern - basically means that
101 components have to be assembled, rather than self-configuring
102 from properties in config files. so easier to test each component in isolation
103  
104 */