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.file.types;
029
030import org.opencms.configuration.CmsConfigurationException;
031import org.opencms.loader.CmsDumpLoader;
032import org.opencms.main.CmsLog;
033
034import org.apache.commons.logging.Log;
035
036/**
037 * Resource type descriptor used in case the given resource type class in the XML configuration could
038 * not be instantiated.<p>
039 *
040 * Using this class usually indicates that the class name given in the XML configuration is unavailable.
041 * This can be the case if a module with a new resource type is imported, where the resource type class
042 * comes as part of the module and OpenCms must be restarted after the module import.<p>
043 *
044 * @since 6.0.0
045 */
046public class CmsResourceTypeUnknown extends A_CmsResourceType {
047
048    /** The log object for this class. */
049    private static final Log LOG = CmsLog.getLog(CmsResourceTypeUnknown.class);
050
051    /** The serial version id. */
052    private static final long serialVersionUID = -7084002492077515553L;
053
054    /**
055     * Default constructor, used to initialize member variables.<p>
056     */
057    public CmsResourceTypeUnknown() {
058
059        super();
060    }
061
062    /**
063     * Unknown resource types are always loaded with the <code>{@link CmsDumpLoader}</code>.<p>
064     *
065     * @see org.opencms.file.types.I_CmsResourceType#getLoaderId()
066     */
067    @Override
068    public int getLoaderId() {
069
070        return CmsDumpLoader.RESOURCE_LOADER_ID;
071    }
072
073    /**
074     * @see org.opencms.file.types.A_CmsResourceType#initConfiguration(java.lang.String, java.lang.String, String)
075     */
076    @Override
077    public void initConfiguration(String name, String id, String className) throws CmsConfigurationException {
078
079        // if this class is used this is usually a configuration error
080        LOG.error(
081            Messages.get().getBundle().key(
082                Messages.ERR_UNKNOWN_RESTYPE_CLASS_4,
083                new Object[] {className, name, id, this.getClass().getName()}));
084
085        // use super initilizer to configure the unknown resource type
086        super.initConfiguration(name, id, className);
087    }
088}