01: /*
02: * File : $Source: /usr/local/cvs/opencms/src-setup/org/opencms/setup/update6to7/oracle/CmsUpdateDBHistoryPrincipals.java,v $
03: * Date : $Date: 2008-02-27 12:05:48 $
04: * Version: $Revision: 1.2 $
05: *
06: * This library is part of OpenCms -
07: * the Open Source Content Management System
08: *
09: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
10: *
11: * This library is free software; you can redistribute it and/or
12: * modify it under the terms of the GNU Lesser General Public
13: * License as published by the Free Software Foundation; either
14: * version 2.1 of the License, or (at your option) any later version.
15: *
16: * This library is distributed in the hope that it will be useful,
17: * but WITHOUT ANY WARRANTY; without even the implied warranty of
18: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19: * Lesser General Public License for more details.
20: *
21: * For further information about Alkacon Software GmbH, please see the
22: * company website: http://www.alkacon.com
23: *
24: * For further information about OpenCms, please see the
25: * project website: http://www.opencms.org
26: *
27: * You should have received a copy of the GNU Lesser General Public
28: * License along with this library; if not, write to the Free Software
29: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30: */
31:
32: package org.opencms.setup.update6to7.oracle;
33:
34: import org.opencms.setup.CmsSetupDb;
35:
36: import java.io.IOException;
37: import java.sql.SQLException;
38: import java.util.HashMap;
39:
40: /**
41: * Oracle implementation to create the history principals table and contents.<p>
42: *
43: * @author Roland Metzler
44: * @author Peter Bonrad
45: *
46: * @version $Revision: 1.2 $
47: *
48: * @since 7.0.0
49: */
50: public class CmsUpdateDBHistoryPrincipals
51: extends
52: org.opencms.setup.update6to7.generic.CmsUpdateDBHistoryPrincipals {
53:
54: /** Constant for the SQL query properties.<p> */
55: private static final String QUERY_PROPERTY_FILE = "oracle/cms_history_principals_queries.properties";
56:
57: /** Constant for the replacement in the sql query. */
58: private static final String REPLACEMENT_TABLEINDEX_SPACE = "${indexTablespace}";
59:
60: /**
61: * Constructor.<p>
62: *
63: * @throws IOException if the sql queries properties file could not be read
64: */
65: public CmsUpdateDBHistoryPrincipals() throws IOException {
66:
67: super ();
68: loadQueryProperties(QUERY_PROPERTIES_PREFIX
69: + QUERY_PROPERTY_FILE);
70: }
71:
72: /**
73: * @see org.opencms.setup.update6to7.generic.CmsUpdateDBHistoryPrincipals#createHistPrincipalsTable(org.opencms.setup.CmsSetupDb)
74: */
75: protected void createHistPrincipalsTable(CmsSetupDb dbCon)
76: throws SQLException {
77:
78: String indexTablespace = (String) m_poolData
79: .get("indexTablespace");
80:
81: System.out.println(new Exception().getStackTrace()[0]
82: .toString());
83: if (!dbCon.hasTableOrColumn(TABLE_CMS_HISTORY_PRINCIPALS, null)) {
84: String createStatement = readQuery(QUERY_HISTORY_PRINCIPALS_CREATE_TABLE);
85:
86: HashMap replacer = new HashMap();
87: replacer.put(REPLACEMENT_TABLEINDEX_SPACE, indexTablespace);
88:
89: dbCon.updateSqlStatement(createStatement, replacer, null);
90: } else {
91: System.out.println("table " + TABLE_CMS_HISTORY_PRINCIPALS
92: + " already exists");
93: }
94: }
95: }
|