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.configuration;
029
030import org.opencms.main.CmsLog;
031
032import org.apache.commons.logging.Log;
033
034/**
035 * Abstract base implementation for xml configurations.<p>
036 *
037 * @since 6.0.0
038 */
039public abstract class A_CmsXmlConfiguration implements I_CmsXmlConfiguration {
040
041    /** The log object for this class. */
042    private static final Log LOG = CmsLog.getLog(A_CmsXmlConfiguration.class);
043
044    /** The name of the XML file used for this configuration. */
045    private String m_xmlFileName;
046
047    /**
048     * Constructor.<p>
049     */
050    public A_CmsXmlConfiguration() {
051
052        initMembers();
053    }
054
055    /**
056     * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#addConfigurationParameter(java.lang.String, java.lang.String)
057     */
058    public void addConfigurationParameter(String paramName, String paramValue) {
059
060        // simple default configuration does not support parameters
061        if (LOG.isDebugEnabled()) {
062            LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_CONFIG_PARAM_3, paramName, paramValue, this));
063        }
064    }
065
066    /**
067     * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#getConfiguration()
068     */
069    public CmsParameterConfiguration getConfiguration() {
070
071        // simple default configuration does not support parameters
072        if (LOG.isDebugEnabled()) {
073            LOG.debug(Messages.get().getBundle().key(Messages.LOG_GET_CONFIGURATION_1, this));
074        }
075        return null;
076    }
077
078    /**
079     * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdSystemLocation()
080     */
081    public String getDtdSystemLocation() {
082
083        return CmsConfigurationManager.DEFAULT_DTD_LOCATION;
084    }
085
086    /**
087     * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdUrlPrefix()
088     */
089    public String getDtdUrlPrefix() {
090
091        return CmsConfigurationManager.DEFAULT_DTD_PREFIX;
092    }
093
094    /**
095     * @see org.opencms.configuration.I_CmsXmlConfiguration#getXmlFileName()
096     */
097    public String getXmlFileName() {
098
099        return m_xmlFileName;
100    }
101
102    /**
103     * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#initConfiguration()
104     */
105    public void initConfiguration() {
106
107        // simple default configuration does not need to be initialized
108        if (LOG.isDebugEnabled()) {
109            LOG.debug(Messages.get().getBundle().key(Messages.LOG_INIT_CONFIGURATION_1, this));
110        }
111    }
112
113    /**
114     * Initializes member variables.<p>
115     */
116    protected abstract void initMembers();
117
118    /**
119     * Sets the file name of this XML configuration.<p>
120     *
121     * @param fileName the file name to set
122     */
123    protected void setXmlFileName(String fileName) {
124
125        m_xmlFileName = fileName;
126    }
127}