net.ymate.platform.plugin.impl.DefaultPluginConfig Maven / Gradle / Ivy
/*
* Copyright 2007-2107 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.ymate.platform.plugin.impl;
import net.ymate.platform.plugin.IPluginConfig;
import net.ymate.platform.plugin.IPluginExtraParser;
import net.ymate.platform.plugin.IPluginFactory;
import net.ymate.platform.plugin.IPluginParser;
import org.apache.commons.lang.StringUtils;
/**
*
* DefaultPluginConfig
*
*
* 默认插件初始化配置接口实现类;
*
*
* @author 刘镇([email protected])
* @version 0.0.0
*
*
* 版本号 动作 修改人 修改时间
*
*
*
* 0.0.0
* 创建类
* 刘镇
* 2012-12-2下午4:33:37
*
*
*/
public final class DefaultPluginConfig implements IPluginConfig {
private static final String PLUGIN_MAINIFEST_FILE = "ymate_plugin.xml";
private IPluginFactory __pluginFactoryImpl;
private IPluginParser __pluginParserImpl;
private IPluginExtraParser __extraParserImpl;
private boolean __includeClassPath;
private boolean __allowAutomatic;
private String __pluginHome;
private String __manifestFile;
/**
* 构造器
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(boolean includeClassPath, boolean allowAutomatic) {
this(new DefaultPluginFactory(), new DefaultPluginParser(), null, null, null, includeClassPath, allowAutomatic);
}
/**
* 构造器
* @param extraParser
* @param pluginHome
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(IPluginExtraParser extraParser, String pluginHome, boolean includeClassPath, boolean allowAutomatic) {
this(new DefaultPluginFactory(), new DefaultPluginParser(), extraParser, pluginHome, null, includeClassPath, allowAutomatic);
}
/**
* 构造器
* @param extraParser
* @param pluginHome
* @param manifestFile
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(IPluginExtraParser extraParser, String pluginHome, String manifestFile, boolean includeClassPath, boolean allowAutomatic) {
this(new DefaultPluginFactory(), new DefaultPluginParser(), extraParser, pluginHome, manifestFile, includeClassPath, allowAutomatic);
}
/**
* 构造器
* @param pluginHome
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(String pluginHome, boolean includeClassPath, boolean allowAutomatic) {
this(null, pluginHome, null, includeClassPath, allowAutomatic);
}
/**
* 构造器
* @param pluginHome
* @param manifestFile
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(String pluginHome, String manifestFile, boolean includeClassPath, boolean allowAutomatic) {
this(null, pluginHome, manifestFile, includeClassPath, allowAutomatic);
}
/**
* 构造器
* @param factory
* @param parser
* @param extraParser
* @param pluginHome
* @param manifestFile
* @param includeClassPath
* @param allowAutomatic
*/
public DefaultPluginConfig(IPluginFactory factory, IPluginParser parser, IPluginExtraParser extraParser, String pluginHome, String manifestFile, boolean includeClassPath, boolean allowAutomatic) {
__pluginFactoryImpl = factory;
__pluginParserImpl = parser;
__extraParserImpl = extraParser;
__includeClassPath = includeClassPath;
__allowAutomatic = allowAutomatic;
__pluginHome = pluginHome;
__manifestFile = StringUtils.defaultIfEmpty(manifestFile, PLUGIN_MAINIFEST_FILE);
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#getPluginFactoryClassImpl()
*/
public IPluginFactory getPluginFactoryClassImpl() {
return __pluginFactoryImpl;
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#getPluginParserClassImpl()
*/
public IPluginParser getPluginParserClassImpl() {
return __pluginParserImpl;
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#getPluginExtraParserClassImpl()
*/
public IPluginExtraParser getPluginExtraParserClassImpl() {
return __extraParserImpl;
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#isIncludeClassPath()
*/
public boolean isIncludeClassPath() {
return __includeClassPath;
}
public boolean isAllowAutomatic() {
return __allowAutomatic;
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#getPluginHomePath()
*/
public String getPluginHomePath() {
return __pluginHome;
}
/* (non-Javadoc)
* @see net.ymate.platform.plugin.IPluginConfig#getPluginManifestFile()
*/
public String getPluginManifestFile() {
return __manifestFile;
}
}