[jboss-cvs] jboss-seam/src/main/org/jboss/seam/drools ...

Gavin King gavin.king at jboss.com
Tue Jan 30 23:09:41 EST 2007


  User: gavin   
  Date: 07/01/30 23:09:41

  Modified:    src/main/org/jboss/seam/drools   ManagedWorkingMemory.java
                        RuleBase.java
  Log:
  fix config
  
  Revision  Changes    Path
  1.9       +4 -0      jboss-seam/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ManagedWorkingMemory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ManagedWorkingMemory.java	21 Dec 2006 02:38:26 -0000	1.8
  +++ ManagedWorkingMemory.java	31 Jan 2007 04:09:41 -0000	1.9
  @@ -1,6 +1,9 @@
   package org.jboss.seam.drools;
  +
   import static org.jboss.seam.InterceptionType.NEVER;
  +
   import java.io.Serializable;
  +
   import org.drools.RuleBase;
   import org.drools.WorkingMemory;
   import org.jboss.seam.Component;
  @@ -11,6 +14,7 @@
   import org.jboss.seam.annotations.Unwrap;
   import org.jboss.seam.core.Mutable;
   import org.jboss.seam.core.Expressions.ValueBinding;
  +
   /**
    * A conversation-scoped Drools WorkingMemory for a named RuleBase
    * 
  
  
  
  1.6       +21 -4     jboss-seam/src/main/org/jboss/seam/drools/RuleBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RuleBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/drools/RuleBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- RuleBase.java	25 Jan 2007 13:21:37 -0000	1.5
  +++ RuleBase.java	31 Jan 2007 04:09:41 -0000	1.6
  @@ -1,7 +1,12 @@
   package org.jboss.seam.drools;
  +
   import static org.jboss.seam.InterceptionType.NEVER;
  +
  +import java.io.InputStream;
   import java.io.InputStreamReader;
   import java.io.Reader;
  +import java.util.List;
  +
   import org.drools.RuleBaseFactory;
   import org.drools.compiler.DrlParser;
   import org.drools.compiler.PackageBuilder;
  @@ -13,11 +18,18 @@
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Unwrap;
   import org.jboss.seam.util.Resources;
  +
  +/**
  + * Manager component for a Drools RuleBase
  + * 
  + * @author Gavin King
  + *
  + */
   @Scope(ScopeType.APPLICATION)
   @Intercept(NEVER)
   public class RuleBase
   {
  -   private String[] ruleFiles;
  +   private List<String> ruleFiles;
      private String dslFile;
      private org.drools.RuleBase ruleBase;
      
  @@ -32,8 +44,13 @@
         {
            for (String ruleFile: ruleFiles)
            {
  +            InputStream stream = Resources.getResourceAsStream(ruleFile);
  +            if (stream==null)
  +            {
  +               throw new IllegalStateException("could not locate rule file: " + ruleFile);
  +            }
               // read in the source
  -            Reader drlReader = new InputStreamReader( Resources.getResourceAsStream(ruleFile) );
  +            Reader drlReader = new InputStreamReader(stream);
               PackageDescr packageDescr;
               if (dslFile==null)
               {
  @@ -59,11 +76,11 @@
      {
         return ruleBase;
      }
  -   public String[] getRuleFiles()
  +   public List<String> getRuleFiles()
      {
         return ruleFiles;
      }
  -   public void setRuleFiles(String[] ruleFiles)
  +   public void setRuleFiles( List<String> ruleFiles)
      {
         this.ruleFiles = ruleFiles;
      }
  
  
  



More information about the jboss-cvs-commits mailing list