org.webframe.support.driver
Class ModulePluginUtils

java.lang.Object
  extended by org.webframe.support.driver.ModulePluginUtils
Direct Known Subclasses:
SpringContextUtils

public abstract class ModulePluginUtils
extends Object

提供框架的模块插件驱动信息获取方法

Version:
$Id: codetemplates.xml,v 1.1 2009/09/07 08:48:12 Exp $ Create: 2011-4-5 下午04:21:54
Author:
黄国庆

Field Summary
private static Map<String,ModulePluginDriverInfo> cacheDriverInfoMap
           
private static String CONFIG_FILE_NAME
           
static String DELIMITERS
           
private static List<ModulePluginDriverInfo> needUpdateDriverInfos
           
protected static String PREFIX_CLASSPATH
           
 
Constructor Summary
ModulePluginUtils()
           
 
Method Summary
static void cacheModulePluginConfig(String realConfigDirectory)
          缓存已加载的模块插件配置信息到物理文件
static ModulePluginDriverInfo getDriverInfo(String driverClassName)
          根据模块驱动类名称,获取模块驱动类详细信息
static Enumeration<ModulePluginDriverInfo> getDriverInfos()
           
static Enumeration<ModulePluginDriverInfo> getDriverInfos(Class<? extends ModulePluginDriver> clazz)
          获取指定驱动接口的驱动类集合
static
<X> Enumeration<X>
getDrivers(Class<X> clazz)
           
protected static List<ModulePluginDriverInfo> getNeedUpdateDriverInfos()
           
protected static org.springframework.core.io.Resource[] getResources(ModulePluginDriverInfo driverInfo, String pattern)
          根据ClassRelativeResourceLoader加载符合pattern的资源
protected static String resolvePath(Class<? extends ModulePluginDriver> loaderClass, String path)
          根据指定class处理path,如果path为null,则返回null;如果path以"/"Begin,则直接返回path; 如果path不以"/"开始,那么返回loaderClass所在包的路径再加上path路径。
private static void serializeDriverInfos(File file, boolean create)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIMITERS

public static final String DELIMITERS
See Also:
Constant Field Values

PREFIX_CLASSPATH

protected static final String PREFIX_CLASSPATH
See Also:
Constant Field Values

CONFIG_FILE_NAME

private static final String CONFIG_FILE_NAME
See Also:
Constant Field Values

cacheDriverInfoMap

private static Map<String,ModulePluginDriverInfo> cacheDriverInfoMap

needUpdateDriverInfos

private static List<ModulePluginDriverInfo> needUpdateDriverInfos
Constructor Detail

ModulePluginUtils

public ModulePluginUtils()
Method Detail

cacheModulePluginConfig

public static void cacheModulePluginConfig(String realConfigDirectory)
缓存已加载的模块插件配置信息到物理文件

Parameters:
realConfigDirectory - 模块插件配置信息缓存文件夹路径,绝对路径

getNeedUpdateDriverInfos

protected static List<ModulePluginDriverInfo> getNeedUpdateDriverInfos()

getDriverInfos

public static Enumeration<ModulePluginDriverInfo> getDriverInfos()

getDriverInfos

public static Enumeration<ModulePluginDriverInfo> getDriverInfos(Class<? extends ModulePluginDriver> clazz)
获取指定驱动接口的驱动类集合

Parameters:
clazz - 继承ModulePluginDriver接口的子接口
Returns:

getDriverInfo

public static ModulePluginDriverInfo getDriverInfo(String driverClassName)
                                            throws DriverNotExistException
根据模块驱动类名称,获取模块驱动类详细信息

Parameters:
driverClassName - 模块驱动类名称,字符串(包括包路径)
Returns:
如果不存在抛出异常
Throws:
DriverNotExistException

getDrivers

public static <X> Enumeration<X> getDrivers(Class<X> clazz)

getResources

protected static org.springframework.core.io.Resource[] getResources(ModulePluginDriverInfo driverInfo,
                                                                     String pattern)
根据ClassRelativeResourceLoader加载符合pattern的资源

Parameters:
loaderClass - 定位class
pattern - 匹配符
Returns:
可能为null

resolvePath

protected static String resolvePath(Class<? extends ModulePluginDriver> loaderClass,
                                    String path)
根据指定class处理path,如果path为null,则返回null;如果path以"/"Begin,则直接返回path; 如果path不以"/"开始,那么返回loaderClass所在包的路径再加上path路径。

Parameters:
loaderClass - 指定class,根据该clas所在的包来定位path的最终路径
path - 包的相对路径,或者是相对于loaderClass的相对路径
Returns:
可能为null

serializeDriverInfos

private static void serializeDriverInfos(File file,
                                         boolean create)
                                  throws IOException,
                                         FileNotFoundException
Throws:
IOException
FileNotFoundException


Copyright © 2012. All Rights Reserved.