01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/course-management/tags/sakai_2-4-1/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/IndexGenerator.java $
03: * $Id: IndexGenerator.java 22560 2007-03-13 19:46:27Z jholtzman@berkeley.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.coursemanagement.impl;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24: import org.sakaiproject.component.api.ServerConfigurationService;
25: import org.sakaiproject.db.api.SqlService;
26:
27: /**
28: * Hibernate doesn't generate all of the indexes we need, so we'll have to add them
29: * manually here.
30: *
31: * @author <a href="mailto:jholtzman@berkeley.edu">jholtzman@berkeley.edu</a>
32: *
33: */
34: public abstract class IndexGenerator {
35: private static final Log log = LogFactory
36: .getLog(IndexGenerator.class);
37:
38: public abstract SqlService sqlService();
39:
40: public abstract ServerConfigurationService scs();
41:
42: public void init() {
43: if (log.isInfoEnabled())
44: log.info("init()");
45: if (scs().getBoolean("auto.ddl", true)) {
46: sqlService().ddl(this .getClass().getClassLoader(),
47: "sakai_cm_index");
48: }
49: }
50:
51: public void destroy() {
52: if (log.isInfoEnabled())
53: log.info("destroy()");
54: }
55: }
|