01: /*
02: * File : $Source: /usr/local/cvs/alkacon/com.alkacon.opencms.formgenerator/src/com/alkacon/opencms/formgenerator/database/CmsFormDatabaseModuleAction.java,v $
03: * Date : $Date: 2008-02-07 11:52:02 $
04: * Version: $Revision: 1.2 $
05: *
06: * This file is part of the Alkacon OpenCms Add-On Module Package
07: *
08: * Copyright (c) 2007 Alkacon Software GmbH (http://www.alkacon.com)
09: *
10: * The Alkacon OpenCms Add-On Module Package is free software:
11: * you can redistribute it and/or modify
12: * it under the terms of the GNU General Public License as published by
13: * the Free Software Foundation, either version 3 of the License, or
14: * (at your option) any later version.
15: *
16: * The Alkacon OpenCms Add-On Module Package is distributed
17: * in the hope that it will be useful,
18: * but WITHOUT ANY WARRANTY; without even the implied warranty of
19: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: * GNU General Public License for more details.
21: *
22: * You should have received a copy of the GNU General Public License
23: * along with the Alkacon OpenCms Add-On Module Package.
24: * If not, see http://www.gnu.org/licenses/.
25: *
26: * For further information about Alkacon Software GmbH, please see the
27: * company website: http://www.alkacon.com.
28: *
29: * For further information about OpenCms, please see the
30: * project website: http://www.opencms.org.
31: */
32:
33: package com.alkacon.opencms.formgenerator.database;
34:
35: import org.opencms.configuration.CmsConfigurationManager;
36: import org.opencms.file.CmsObject;
37: import org.opencms.main.CmsException;
38: import org.opencms.main.CmsLog;
39: import org.opencms.module.A_CmsModuleAction;
40: import org.opencms.module.CmsModule;
41:
42: import java.sql.SQLException;
43:
44: import org.apache.commons.logging.Log;
45:
46: /**
47: * Module action class used to ensure that the required database tables for form data are there. <p>
48: *
49: * @author Achim Westermann
50: *
51: * @version $Revision: 1.2 $
52: *
53: * @since 7.0.4
54: *
55: */
56: public class CmsFormDatabaseModuleAction extends A_CmsModuleAction {
57:
58: /** The log object for this class. */
59: private static final Log LOG = CmsLog
60: .getLog(CmsFormDatabaseModuleAction.class);
61:
62: /**
63: * Defcon.<p>
64: */
65: public CmsFormDatabaseModuleAction() {
66:
67: // nop
68: }
69:
70: /**
71: * @see org.opencms.module.A_CmsModuleAction#initialize(org.opencms.file.CmsObject, org.opencms.configuration.CmsConfigurationManager, org.opencms.module.CmsModule)
72: */
73: public void initialize(CmsObject adminCms,
74: CmsConfigurationManager configurationManager,
75: CmsModule module) {
76:
77: super .initialize(adminCms, configurationManager, module);
78: try {
79: CmsFormDataAccess.getInstance().ensureDBTablesExistance();
80: } catch (SQLException sqlex) {
81: LOG.error(CmsException.getStackTraceAsString(sqlex));
82: throw new RuntimeException(
83: "This module cannot be initialized!", sqlex);
84: }
85: }
86: }
|