001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.setup.db.update6to7.oracle; 029 030import org.opencms.setup.CmsSetupDb; 031 032import java.io.IOException; 033import java.sql.SQLException; 034import java.util.HashMap; 035import java.util.Map; 036 037/** 038 * Oracle implementation to create the history principals table and contents.<p> 039 * 040 * @since 7.0.0 041 */ 042public class CmsUpdateDBHistoryPrincipals extends org.opencms.setup.db.update6to7.CmsUpdateDBHistoryPrincipals { 043 044 /** Constant for the SQL query properties.<p> */ 045 private static final String QUERY_PROPERTY_FILE = "cms_history_principals_queries.properties"; 046 047 /** Constant for the replacement in the sql query. */ 048 private static final String REPLACEMENT_TABLEINDEX_SPACE = "${indexTablespace}"; 049 050 /** 051 * Constructor.<p> 052 * 053 * @throws IOException if the sql queries properties file could not be read 054 */ 055 public CmsUpdateDBHistoryPrincipals() 056 throws IOException { 057 058 super(); 059 loadQueryProperties(getPropertyFileLocation() + QUERY_PROPERTY_FILE); 060 } 061 062 /** 063 * @see org.opencms.setup.db.update6to7.CmsUpdateDBHistoryPrincipals#createHistPrincipalsTable(org.opencms.setup.CmsSetupDb) 064 */ 065 @Override 066 protected void createHistPrincipalsTable(CmsSetupDb dbCon) throws SQLException { 067 068 String indexTablespace = m_poolData.get("indexTablespace"); 069 070 System.out.println(new Exception().getStackTrace()[0].toString()); 071 if (!dbCon.hasTableOrColumn(TABLE_CMS_HISTORY_PRINCIPALS, null)) { 072 String createStatement = readQuery(QUERY_HISTORY_PRINCIPALS_CREATE_TABLE); 073 074 Map<String, String> replacer = new HashMap<String, String>(); 075 replacer.put(REPLACEMENT_TABLEINDEX_SPACE, indexTablespace); 076 077 dbCon.updateSqlStatement(createStatement, replacer, null); 078 } else { 079 System.out.println("table " + TABLE_CMS_HISTORY_PRINCIPALS + " already exists"); 080 } 081 } 082}