org.enhydra.shark.Shark
在启动Shark引擎前,要对它进行配置,配置要做的操作就是Shark.configure("shark.conf"),下面按先后顺序说明;
1) 整个系统只用配置一次,如果已经配置过,将不会再配置而直接返回,如下:
if (isConfigured) {
SharkEngineManager.getInstance().getCallbackUtilities().info(
"Trying to configure shark instance that is already configured !!!");
return;
}
2)如果没有为配置文件给绝对路径,系统会自动进行获取:
if (!configFile.isAbsolute()) {
configFile=configFile.getAbsoluteFile();
}
3)然后就是获取properties,进行配置,并将isConfigured设置为true:
try {
fis=new FileInputStream(configFile);
Properties props=new Properties();
props.load(fis);
fis.close();
adjustSharkProperties(props);
} catch (Exception ex) {
throw new Error ("Something went wrong during reading of configuration from the file");
}
isConfigured=true;
4)然后对SharkEngineManager进行配置,它利用回调函数,对该管理器的各子管理器和工厂进行初始化和配置,以后可以直接调用:
try {
callbackUtilities=(CallbackUtil)cl.loadClass(cbuClassName).newInstance();
callbackUtilities.setProperties(properties);
objectFactory =(SharkObjectFactory)cl.loadClass(objectFactoryClassName).newInstance();
toolAgentManager = (ToolAgentManager) cl.loadClass(tamClassName).newInstance();
xmlInterface=new XMLInterfaceForJDK13();
} catch (Throwable ex) {
throw new Error("Problems instantiating core managers");
}
5)最后,对系统的缓存和LimitManager进行配置:
shark.initCaches();
shark.reevaluateAssignments();
shark.initLimitManager();
hongbo781202,又名HongSoft,职业程序员,研究领域:1)基于工作流的BPM系统研究2)基于JAVA的信息安全
技术.欢迎和大家讨论JAVA相关各方面技术和市场问题 [email protected]
本文地址:http://com.8s8s.com/it/it16400.htm