⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsvfsconfiguration.java

📁 cms是开源的框架
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*
 * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/configuration/CmsVfsConfiguration.java,v $
 * Date   : $Date: 2006/03/27 14:52:46 $
 * Version: $Revision: 1.40 $
 *
 * This library is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software GmbH, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.opencms.configuration;

import org.opencms.file.CmsProperty;
import org.opencms.file.collectors.I_CmsResourceCollector;
import org.opencms.file.types.I_CmsResourceType;
import org.opencms.loader.CmsResourceManager;
import org.opencms.loader.I_CmsResourceLoader;
import org.opencms.main.CmsLog;
import org.opencms.main.OpenCms;
import org.opencms.util.CmsResourceTranslator;
import org.opencms.widgets.I_CmsWidget;
import org.opencms.xml.CmsXmlContentTypeManager;
import org.opencms.xml.types.I_CmsXmlSchemaType;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.digester.Digester;

import org.dom4j.Element;

/**
 * VFS master configuration class.<p>
 * 
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.40 $
 * 
 * @since 6.0.0
 */
public class CmsVfsConfiguration extends A_CmsXmlConfiguration implements I_CmsXmlConfiguration {

    /** The widget attribute. */
    public static final String A_DEFAULTWIDGET = "defaultwidget";

    /** The source attribute name. */
    public static final String A_SOURCE = "source";

    /** The target attribute name. */
    public static final String A_TARGET = "target";

    /** The name of the DTD for this configuration. */
    public static final String CONFIGURATION_DTD_NAME = "opencms-vfs.dtd";

    /** The name of the default XML file for this configuration. */
    public static final String DEFAULT_XML_FILE_NAME = "opencms-vfs.xml";

    /** The collector node name. */
    public static final String N_COLLECTOR = "collector";

    /** The collectors node name. */
    public static final String N_COLLECTORS = "collectors";

    /** The copy-resource node name.*/
    public static final String N_COPY_RESOURCE = "copy-resource";

    /** The copy-resources node name.*/
    public static final String N_COPY_RESOURCES = "copy-resources";

    /** The defaultfile node name. */
    public static final String N_DEFAULTFILE = "defaultfile";

    /** The defaultfiles node name. */
    public static final String N_DEFAULTFILES = "defaultfiles";

    /** File translations node name. */
    public static final String N_FILETRANSLATIONS = "filetranslations";

    /** Folder translations node name. */
    public static final String N_FOLDERTRANSLATIONS = "foldertranslations";

    /** The node name of an individual resource loader. */
    public static final String N_LOADER = "loader";

    /** The mapping node name. */
    public static final String N_MAPPING = "mapping";

    /** The mappings node name. */
    public static final String N_MAPPINGS = "mappings";

    /** The properties node name. */
    public static final String N_PROPERTIES = "properties";

    /** The resource loaders node name. */
    public static final String N_RESOURCELOADERS = "resourceloaders";

    /** The main resource node name. */
    public static final String N_RESOURCES = "resources";

    /** The resource types node name. */
    public static final String N_RESOURCETYPES = "resourcetypes";

    /** The schematype node name. */
    public static final String N_SCHEMATYPE = "schematype";

    /** The schematypes node name. */
    public static final String N_SCHEMATYPES = "schematypes";

    /** Individual translation node name. */
    public static final String N_TRANSLATION = "translation";

    /** The translations master node name. */
    public static final String N_TRANSLATIONS = "translations";

    /** The node name of an individual resource type. */
    public static final String N_TYPE = "type";

    /** The node name for the version history. */
    public static final String N_VERSIONHISTORY = "versionhistory";

    /** The main vfs configuration node name. */
    public static final String N_VFS = "vfs";

    /** The widget node name. */
    public static final String N_WIDGET = "widget";

    /** The widgets node name. */
    public static final String N_WIDGETS = "widgets";

    /** The xmlcontent node name. */
    public static final String N_XMLCONTENT = "xmlcontent";

    /** The xmlcontents node name. */
    public static final String N_XMLCONTENTS = "xmlcontents";

    /** The configured XML content type manager. */
    CmsXmlContentTypeManager m_xmlContentTypeManager;

    /** The list of configured default files. */
    private List m_defaultFiles;

    /** Controls if file translation is enabled. */
    private boolean m_fileTranslationEnabled;

    /** The list of file translations. */
    private List m_fileTranslations;

    /** Controls if folder translation is enabled. */
    private boolean m_folderTranslationEnabled;

    /** The list of folder translations. */
    private List m_folderTranslations;

    /** The configured resource manager. */
    private CmsResourceManager m_resourceManager;

    /**
     * Public constructor, will be called by configuration manager.<p> 
     */
    public CmsVfsConfiguration() {

        setXmlFileName(DEFAULT_XML_FILE_NAME);
        m_fileTranslations = new ArrayList();
        m_folderTranslations = new ArrayList();
        m_defaultFiles = new ArrayList();
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_CONFIG_INIT_0));
        }
    }

    /**
     * Adds the resource type rules to the given digester.<p>
     * 
     * @param digester the digester to add the rules to
     */
    public static void addResourceTypeXmlRules(Digester digester) {

        // add rules for resource types
        digester.addFactoryCreate("*/" + N_RESOURCETYPES + "/" + N_TYPE, CmsDigesterResourceTypeCreationFactory.class);

        digester.addCallMethod(
            "*/" + N_RESOURCETYPES + "/" + N_TYPE,
            I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD,
            3);
        // please note: the resource types use a special version of the init method with 3 parameters 
        digester.addCallParam("*/" + N_RESOURCETYPES + "/" + N_TYPE, 0, A_NAME);
        digester.addCallParam("*/" + N_RESOURCETYPES + "/" + N_TYPE, 1, A_ID);
        digester.addCallParam("*/" + N_RESOURCETYPES + "/" + N_TYPE, 2, A_CLASS);

        digester.addSetNext("*/" + N_RESOURCETYPES + "/" + N_TYPE, I_CmsResourceType.ADD_RESOURCE_TYPE_METHOD);

        // add rules for default properties
        digester.addObjectCreate(
            "*/" + N_RESOURCETYPES + "/" + N_TYPE + "/" + N_PROPERTIES + "/" + N_PROPERTY,
            CmsProperty.class);
        digester.addCallMethod("*/"
            + N_RESOURCETYPES
            + "/"
            + N_TYPE
            + "/"
            + N_PROPERTIES
            + "/"
            + N_PROPERTY
            + "/"
            + N_NAME, "setName", 1);
        digester.addCallParam("*/"
            + N_RESOURCETYPES
            + "/"
            + N_TYPE
            + "/"
            + N_PROPERTIES
            + "/"
            + N_PROPERTY
            + "/"
            + N_NAME, 0);

        digester.addCallMethod("*/"
            + N_RESOURCETYPES
            + "/"
            + N_TYPE
            + "/"
            + N_PROPERTIES
            + "/"
            + N_PROPERTY
            + "/"
            + N_VALUE, "setValue", 2);
        digester.addCallParam("*/"
            + N_RESOURCETYPES
            + "/"
            + N_TYPE
            + "/"
            + N_PROPERTIES

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -