到 Google 资讯主页   
EasyJF首页   资料   源码   软件    论坛   网站    
   使用帮助    
    该信息为本站MyRSS系统缓存内容,部分图片及附件有可能无法正常使用.easyjf.comwww.javaresearch.org无关,不对该信息负责.通过http://www.javaresearch.org/article/76383.htm访问该信息的原始内容.
页面功能  【加入收藏】 【推荐给朋友】 【字体:  】 【关闭】   
Java rule and drool
作者: 来源:www.javaresearch.org  发布时间:2007-10-12 13:19:46.61


Java rule

reason:
    1.business needs often change faster than development teams

objective:
   1.One technique that's gaining traction in the Java community is to separate the business decisions of your executives from the technical decisions of your developers, and to keep those business decisions in a central data store, where they can be managed and altered in real-time (that is, business-time). It's one strategy you might consider.
 

    Separate  the business decisions from  technical implementation

Benefit:

   1 .Business decisions is independent  from  technical implementation, so we can change the business decisions in accodrance in accordance with the business need ,without modifying the technical implementation.

   2.Maintaining complex Boolean logic can be a difficult task, and a rules engine can help you organize this logic. 

   3 Java rule  apply in  your business logic layer in a Java appliction

   4.When do you use a rules engine?
      1.  
The application code must be recompiled. 
The code is dropped in a test staging environment. 
The code is inspected by data-quality auditors. 
The change is approved by the hosting environment architects. 
The change is scheduled for deployment. 
 Even a simple change to one line of code can cost an organization thousands of dollars. If  you need to follow such strict rules and find yourself making frequent changes to your business  logic code, then it would make sense to consider a rules engine
2.
client has a tendency (and the financial and political resources) to add and change business logic requirements frequently during the development cycle and even after deployment.


java rule architecture
  

图4 Java规则引擎工作机制
    

java rule engine api(JSR-94 Rules )
   Architecture
     1.  the administrator API
     2.  The runtime client API
     The distinction between the runtime and admin packages allows a more fine grained control of the user population; for example, some users may be allowed to execute rules but not to administer them.
     3.Error Logging and Tracing
     4.Security
     5.Exceptions


The traits about drool
1.express your business logic rules in a declarative way. You can write rules in a Java/XML syntax
2..A very active community 
3.Easy to use 
4.Fast execution speed 
5.Gaining popularity among Java developers 
6.JSR 94-compliant (JSR 94 is the Java Rule Engine API) (see Resources) 
7.Free 


my project using drool
    1. Project summary
       There are some monkey, we assign some apples to them ,and how many apples assign to one monkey denpends on the value of the monkey.
    
   2.design and implementation 
     
      1.simple drool procedure figue



      
      
    










          Monkey :        monkey 
          Ruleengine :      rule engine that using drool deal with rules of the application
          Testruleengine :   use the ruleengine and rules deal with the monkey
          Rule :           drool rules
          New monkey :    the result of testruleengine
         




      2. Test procedure figue










               
             New monkey :    the result of testruleengine
             Test module :     verify the new monkey
             Result :          the result of the test



       3.analyse requirements
       4.compile document
       5 .create model
       6. Coding
          
       7. test






       


Reference:

1. drool
http://labs.jboss.com/drools/

2. Implement business logic with the Drools rules engine
http://www-128.ibm.com/developerworks/java/library/j-drools/#when

3. An introdution to the Drools Project
http://www.theserverside.com/tt/articles/content/Drools/article.html



Resources
Learn
    Drools Web site: Get more information about the Drools rules engine project.

    "The Logic of the Bottom Line: An Introduction to The Drools Project" (N. Alex Rupp, TheServerSide.com, May 2004): A good introduction to the Drools rules engine.

    "Getting Started With the Java Rule Engine API (JSR 94): Toward Rule-Based Applications" (Qusay H. Mahmoud, Sun Developer Network, July 2005): An introduction to the Java Rule Engine API.

    JSR 94: Java Rule Engine API: The official JSR 94 specification.

    Rete algorithm: An explanation of the Rete algorithm on the Drools site.

    Declarative programming: The Drools site's definition of declarative programming.

    The Java technology zone: Hundreds of articles about every aspect of Java programming.

Get products and technologies
    Drools: Download the latest Drools distribution.

    Eclipse: Download the latest version of the Eclipse IDE for the Java platform.



   附件:droolmonkey5.rar(8K) 

 
相关文章
 
页面功能  【加入收藏】 【推荐给朋友】 【字体:  】 【关闭】   


EasyJF.com 2006 隐私政策 使用EasyJF前必读