`
hongsoft
  • 浏览: 292367 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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

阅读更多

org.enhydra.shark.Shark<!----><o:p></o:p>

<o:p> </o:p>

在启动Shark引擎前,要对它进行配置,配置要做的操作就是Shark.configure("shark.conf"),下面按先后顺序说明;<o:p></o:p>

<o:p> </o:p>

1) 整个系统只用配置一次,如果已经配置过,将不会再配置而直接返回,如下:<o:p></o:p>

if (isConfigured) {<o:p></o:p>

     SharkEngineManager.getInstance().getCallbackUtilities().info(<o:p></o:p>

            "Trying to configure shark instance that is already configured !!!");<o:p></o:p>

         return;<o:p></o:p>

      }<o:p></o:p>

<o:p> </o:p>

2)如果没有为配置文件给绝对路径,系统会自动进行获取:<o:p></o:p>

if (!configFile.isAbsolute()) {<o:p></o:p>

         configFile=configFile.getAbsoluteFile();<o:p></o:p>

      }<o:p></o:p>

<o:p> </o:p>

3)然后就是获取properties,进行配置,并将isConfigured设置为true:<o:p></o:p>

try {<o:p></o:p>

            fis=new FileInputStream(configFile);<o:p></o:p>

            Properties props=new Properties();<o:p></o:p>

            props.load(fis);<o:p></o:p>

            fis.close();<o:p></o:p>

            adjustSharkProperties(props);<o:p></o:p>

         } catch (Exception ex) {<o:p></o:p>

            throw new Error ("Something went wrong during reading of configuration from the file");<o:p></o:p>

         }<o:p></o:p>

isConfigured=true;<o:p></o:p>

<o:p> </o:p>

4)然后对SharkEngineManager进行配置,它利用回调函数,对该管理器的各子管理器和工厂进行初始化和配置,以后可以直接调用:<o:p></o:p>

try {<o:p></o:p>

         callbackUtilities=(CallbackUtil)cl.loadClass(cbuClassName).newInstance();<o:p></o:p>

         callbackUtilities.setProperties(properties);<o:p></o:p>

         objectFactory =(SharkObjectFactory)cl.loadClass(objectFactoryClassName).newInstance();<o:p></o:p>

         toolAgentManager = (ToolAgentManager) cl.loadClass(tamClassName).newInstance();<o:p></o:p>

         xmlInterface=new XMLInterfaceForJDK13();<o:p></o:p>

      } catch (Throwable ex) {<o:p></o:p>

         throw new Error("Problems instantiating core managers");<o:p></o:p>

      }<o:p></o:p>

<o:p> </o:p>

5)最后,对系统的缓存和LimitManager进行配置:<o:p></o:p>

shark.initCaches();<o:p></o:p>

shark.reevaluateAssignments();<o:p></o:p>

shark.initLimitManager();<o:p></o:p>

<o:p> </o:p>

hongbo781202,又名HongSoft,职业程序员,研究领域:1)基于工作流的BPM系统研究2)基于JAVA的信息安全<o:p></o:p>

技术.欢迎和大家讨论JAVA相关各方面技术和市场问题 hongbosoftware@163.com<o:p></o:p>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics