From: <jbo...@li...> - 2006-05-23 06:13:32
|
Author: mic...@jb... Date: 2006-05-23 02:13:23 -0400 (Tue, 23 May 2006) New Revision: 4364 Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PricingRuleLauncher.java Log: lab 4 Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PricingRuleLauncher.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PricingRuleLauncher.java 2006-05-23 06:00:27 UTC (rev 4363) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PricingRuleLauncher.java 2006-05-23 06:13:23 UTC (rev 4364) @@ -57,6 +57,7 @@ } + /** Build the rule base from the generated DRL */ private RuleBase buildRuleBase(String drl) throws DroolsParserException, IOException, Exception { //now we build the rule package and rulebase, as if they are normal rules PackageBuilder builder = new PackageBuilder(); @@ -82,56 +83,6 @@ } - /** - * Please note that this is the "low level" rule assembly API. - */ - private static RuleBase readRule() throws Exception { - - //read in the source - Reader source = new InputStreamReader( PricingRuleLauncher.class.getResourceAsStream( "/Sample.drl" ) ); - - - PackageBuilder builder = new PackageBuilder(); - //this wil parse and compile in one step - //NOTE: There are 2 methods here, the one argument one is for normal DRL. - builder.addPackageFromDrl( source ); - - //Use the following instead of above if you are using a DSL: - //builder.addPackageFromDrl( source, dsl ); - - //get the compiled package (which is serializable) - Package pkg = builder.getPackage(); - - //add the package to a rulebase (deploy the rule package). - RuleBase ruleBase = RuleBaseFactory.newRuleBase(); - ruleBase.addPackage( pkg ); - return ruleBase; - } - - public static class Message { - public static final int HELLO = 0; - public static final int GOODBYE = 1; - - private String message; - - private int status; - - public String getMessage() { - return this.message; - } - - public void setMessage(String message) { - this.message = message; - } - - public int getStatus() { - return this.status; - } - - public void setStatus( int status ) { - this.status = status; - } - } } |