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

📄 abstractresourceconfigurationbuilder.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: AbstractResourceConfigurationBuilder.java 11322 2008-03-12 09:21:14Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.config.builders;import org.mule.api.MuleContext;import org.mule.api.config.ConfigurationBuilder;import org.mule.api.config.ConfigurationException;import org.mule.config.ConfigResource;import org.mule.config.i18n.CoreMessages;import org.mule.util.StringUtils;import java.io.IOException;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * Abstract {@link ConfigurationBuilder} implementation used for * ConfigurationBuider's that use one of more configuration resources of the same * type that are defined using strings or {@link ConfigResource} objects.  It is recommended that * {@link org.mule.config.ConfigResource} objects are used over strings since they can be more descriptive, but * Strings will be supported for quite some time. */public abstract class AbstractResourceConfigurationBuilder extends AbstractConfigurationBuilder{    protected static final Log logger = LogFactory.getLog(AutoConfigurationBuilder.class);    protected ConfigResource[] configResources;    /**     * @param configResources a comma separated list of configuration files to load,     *            this should be accessible on the classpath or filesystem     * @throws org.mule.api.config.ConfigurationException usually if the config resources cannot be loaded     */    public AbstractResourceConfigurationBuilder(String configResources) throws ConfigurationException    {        this.configResources = loadConfigResources(StringUtils.splitAndTrim(configResources, ",; "));    }    /**     * @param configResources an array of configuration files to load, this should be     *            accessible on the classpath or filesystem     * @throws org.mule.api.config.ConfigurationException usually if the config resources cannot be loaded     */    public AbstractResourceConfigurationBuilder(String[] configResources) throws ConfigurationException    {        this.configResources = loadConfigResources(configResources);    }    /**     * @param configResources an array Reader oject that provides acces to a configuration either locally or remotely     */    public AbstractResourceConfigurationBuilder(ConfigResource[] configResources)    {        this.configResources = configResources;    }    /**     * Override to check for existence of configResouce before invocation, and set     * resources n configuration afterwards.     */    public void configure(MuleContext muleContext) throws ConfigurationException    {        if (configResources == null)        {            throw new ConfigurationException(CoreMessages.objectIsNull("Configuration Resources"));        }        super.configure(muleContext);        logger.info(CoreMessages.configurationBuilderSuccess(this, createConfigResourcesString()));    }    protected ConfigResource[] loadConfigResources(String[] configs) throws ConfigurationException    {        try        {            configResources = new ConfigResource[configs.length];            for (int i = 0; i < configs.length; i++)            {                configResources[i] = new ConfigResource(configs[i]);            }            return configResources;        }        catch (IOException e)        {            throw new ConfigurationException(e);        }    }    protected String createConfigResourcesString()    {        StringBuffer configResourcesString = new StringBuffer();        configResourcesString.append("[");        for (int i = 0; i < configResources.length; i++)        {            configResourcesString.append(configResources[i]);            if (i < configResources.length - 1)            {                configResourcesString.append(", ");            }        }        configResourcesString.append("]");        return configResourcesString.toString();    }}

⌨️ 快捷键说明

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