shark工作流源代码学习(二)

来源:互联网 发布:穿越知乎 编辑:程序博客网 时间:2024/05/28 06:05
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

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相关各方面技术和市场问题 hongbosoftware@163.com

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>