01: /**********************************************************************************
02: *
03: * $Id: GradebookConfigurationSakai.java 9716 2006-05-19 23:48:36Z ray@media.berkeley.edu $
04: *
05: ***********************************************************************************
06: *
07: * Copyright (c) 2006 The Regents of the University of California, The MIT Corporation
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: **********************************************************************************/package org.sakaiproject.tool.gradebook.facades.sakai2impl;
22:
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25:
26: import org.sakaiproject.db.api.SqlService;
27:
28: import org.sakaiproject.service.gradebook.shared.GradebookConfiguration;
29:
30: /**
31: * Sakai-specific add-on to the vanilla configuration bean.
32: * The main addition is to handle automatic database upgrades which lie outside
33: * the scope of Hibernate's normal SchemaUpdate. In versions of Hibernate through
34: * at least 3.1.3, this includes any index definitions. (See Hibernate JIRA
35: * issue HHH-1012.)
36: */
37: public class GradebookConfigurationSakai extends GradebookConfiguration {
38: private static final Log log = LogFactory
39: .getLog(GradebookConfigurationSakai.class);
40:
41: private SqlService sqlService;
42: private boolean autoDdl;
43:
44: public void init() {
45: String sqlUpdateScriptName = "sakai_gradebook_post_schemaupdate";
46: if (autoDdl && (sqlService != null)) {
47: if (log.isInfoEnabled())
48: log.info("About to call sqlService.ddl with "
49: + sqlUpdateScriptName);
50: sqlService.ddl(this .getClass().getClassLoader(),
51: sqlUpdateScriptName);
52: }
53: super .init();
54: }
55:
56: public void setSqlService(SqlService sqlService) {
57: this .sqlService = sqlService;
58: }
59:
60: public void setAutoDdl(boolean autoDdl) {
61: this.autoDdl = autoDdl;
62: }
63: }
|