[seam-commits] Seam SVN: r11114 - in branches/community/Seam_2_1: doc/Seam_Reference_Guide/en-US and 7 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 10 21:00:54 EDT 2009


Author: tsurdilovic
Date: 2009-06-10 21:00:54 -0400 (Wed, 10 Jun 2009)
New Revision: 11114

Removed:
   branches/community/Seam_2_1/examples/drools/resources/numberguess.xls
   branches/community/Seam_2_1/examples/drools/src/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java
Modified:
   branches/community/Seam_2_1/build/root.pom.xml
   branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Drools.xml
   branches/community/Seam_2_1/examples/build.xml
   branches/community/Seam_2_1/examples/drools/resources/WEB-INF/components.xml
   branches/community/Seam_2_1/seam-gen/ivy/ivy.xml
   branches/community/Seam_2_1/src/main/org/jboss/seam/drools-2.1.xsd
   branches/community/Seam_2_1/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java
   branches/community/Seam_2_1/src/main/org/jboss/seam/drools/RuleBase.java
Log:
Reverting changed for JBSEAM-4049,JBSEAM-4188, and JBSEAM-4225	as they should be in the 2.2 branch.

Modified: branches/community/Seam_2_1/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_1/build/root.pom.xml	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/build/root.pom.xml	2009-06-11 01:00:54 UTC (rev 11114)
@@ -785,18 +785,6 @@
           </exclusion>
         </exclusions>
       </dependency>
-      
-      <dependency>
-        <groupId>org.drools</groupId>
-        <artifactId>drools-decisiontables</artifactId>
-        <version>${version.drools}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>jexcelapi</groupId>
-      		<artifactId>jxl</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
 
       <dependency>
         <groupId>org.drools</groupId>

Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Drools.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Drools.xml	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Drools.xml	2009-06-11 01:00:54 UTC (rev 11114)
@@ -26,7 +26,7 @@
 </drools:rule-base>]]></programlisting>
 
          <para>
-             This component compiles rules from a set of DRL (<literal>.drl</literal>) or decision table (<literal>.xls</literal>)
+             This component compiles rules from a set of <literal>.drl</literal>
              files and caches an instance of <literal>org.drools.RuleBase</literal>
              in the Seam <literal>APPLICATION</literal> context. Note that it is 
              quite likely that you will need to install multiple rule bases in a 
@@ -34,7 +34,7 @@
          </para>
          
          <para>
-             If you want to use a Drools DSL, you also need to specify the DSL
+             If you want to use a Drools DSL, you alse need to specify the DSL
              definition:
          </para>
          
@@ -44,40 +44,6 @@
     </drools:rule-files>
 </drools:rule-base>]]></programlisting>
 
-         <para>
-             If you want to register a custom consequence exception handler through the RuleBaseConfiguration, you need to 
-             write the handler, for example: 
-         </para>
-         
-        <programlisting role="JAVA"><![CDATA[@Scope(ScopeType.APPLICATION)
- at Startup
- at Name("myConsequenceExceptionHandler")
-public class MyConsequenceExceptionHandler implements ConsequenceExceptionHandler, Externalizable {
-
-   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-   }
-
-   public void writeExternal(ObjectOutput out) throws IOException {
-   }
-
-   public void handleException(Activation activation,
-                               WorkingMemory workingMemory,
-                               Exception exception) {
-       throw new ConsequenceException( exception,
-                                       activation.getRule() );
-   }
-
-}]]></programlisting>
-
-		<para>
-		and register it:
-		</para>
-		<programlisting role="XML"><![CDATA[<drools:rule-base name="policyPricingRules" dsl-file="policyPricing.dsl" consequence-exception-handler="#{myConsequenceExceptionHandler}">
-    <drools:rule-files>
-        <value>policyPricingRules.drl</value>
-    </drools:rule-files>
-</drools:rule-base>]]></programlisting>
-
         <para>
         In most rules-driven applications,
             rules need to be dynamically deployable, so a production application will want to use a
@@ -121,18 +87,6 @@
              configuration property.
          </para>
          
-         <para>
-         	We can also add means to be notified of rule engine events, including rules firing, objects being asserted, etc. 
-         	by adding event listeners to WorkingMemory.
-         </para>
-         
-         <programlisting role="XML"><![CDATA[<drools:managed-working-memory name="policyPricingWorkingMemory" auto-create="true" rule-base="#{policyPricingRules}">
-	<drools:event-listeners>
-    	<value>org.drools.event.DebugWorkingMemoryEventListener</value>
-        <value>org.drools.event.DebugAgendaEventListener</value>
-	</drools:event-listeners>
-</drools:managed-working-memory>]]></programlisting>
-         
      </section>
      
      <section>

Modified: branches/community/Seam_2_1/examples/build.xml
===================================================================
--- branches/community/Seam_2_1/examples/build.xml	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/examples/build.xml	2009-06-11 01:00:54 UTC (rev 11114)
@@ -325,8 +325,6 @@
 		<include name="mvel14.jar" if="drools.lib" />
 		<include name="drools-core.jar" if="drools.lib" />
 		<include name="drools-compiler.jar" if="drools.lib" />
-		<include name="drools-decisiontables.jar" if="drools.lib"/>
-		<include name="jxl.jar" if="drools.lib"/>
 	</fileset>
 
 	<!-- Dependencies for using Spring with Cglib -->
@@ -472,11 +470,6 @@
 		<include name="*.jpdl.xml" />
 		<exclude name=".gpd*" />
 	</fileset>
-	
-	<!-- binary resources to go in the jar -->
-	<fileset id="jar.binary.resources" dir="${resources.dir}">
-		<include name="*.xls" />
-	</fileset>
 
 	<!-- resources to go in the jar for tomcat  -->
 	<fileset id="tomcat.jar.resources" dir="${resources.dir}">
@@ -659,11 +652,6 @@
 				<filter token="distributable" value="${distributable}" />
 			</filterset>
 		</copy>
-		<!-- copy decision tables (binary) without the filter definitions
-		     so that they won't get corrupted -->
-		<copy todir="${jar.dir}">
-			<fileset refid="jar.binary.resources" />
-	   </copy>
 	</target>
 	
 	<target name="init.war">

Modified: branches/community/Seam_2_1/examples/drools/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_1/examples/drools/resources/WEB-INF/components.xml	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/examples/drools/resources/WEB-INF/components.xml	2009-06-11 01:00:54 UTC (rev 11114)
@@ -10,17 +10,7 @@
                  http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd">
             
     <drools:rule-base name="ruleBase" rule-files="numberguess.drl"/>
-    <!-- use this in order to load from decision table instead -->        
-    <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.xls"/>  -->
-    <!--  use this if you want to register a custom consequence exception handler -->
-    <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.drl" consequence-exception-handler="#{gameConsequenceExceptionHandler}"/>  -->
-    <drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}">
-    	<!--  add WM event listeners -->
-    	<!-- <drools:event-listeners>
-           <value>org.drools.event.DebugWorkingMemoryEventListener</value>
-           <value>org.drools.event.DebugAgendaEventListener</value>
-        </drools:event-listeners> -->
-    </drools:managed-working-memory>
+    <drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}"/>
 
     <bpm:jbpm>
         <bpm:pageflow-definitions>

Deleted: branches/community/Seam_2_1/examples/drools/resources/numberguess.xls
===================================================================
(Binary files differ)

Deleted: branches/community/Seam_2_1/examples/drools/src/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java
===================================================================
--- branches/community/Seam_2_1/examples/drools/src/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/examples/drools/src/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java	2009-06-11 01:00:54 UTC (rev 11114)
@@ -1,36 +0,0 @@
-package org.jboss.seam.example.numberguess;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import org.drools.WorkingMemory;
-import org.drools.spi.Activation;
-import org.drools.spi.ConsequenceException;
-import org.drools.spi.ConsequenceExceptionHandler;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-
- at Scope(ScopeType.APPLICATION)
- at Startup
- at Name("gameConsequenceExceptionHandler")
-public class GameConsequenceExceptionHandler implements ConsequenceExceptionHandler, Externalizable {
-
-   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-   }
-
-   public void writeExternal(ObjectOutput out) throws IOException {
-   }
-
-   public void handleException(Activation activation,
-                               WorkingMemory workingMemory,
-                               Exception exception) {
-       throw new ConsequenceException( exception,
-                                       activation.getRule() );
-   }
-
-}
-

Modified: branches/community/Seam_2_1/seam-gen/ivy/ivy.xml
===================================================================
--- branches/community/Seam_2_1/seam-gen/ivy/ivy.xml	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/seam-gen/ivy/ivy.xml	2009-06-11 01:00:54 UTC (rev 11114)
@@ -56,9 +56,6 @@
 		<dependency org="org.drools" name="drools-core" rev="4.0.4">
 			<artifact name="drools-core" type="jar"/>
 		</dependency>
-		<dependency org="org.drools" name="drools-decisiontables" rev="4.0.4">
-                        <artifact name="drools-decisiontables" type="jar"/>
-                </dependency>
 		<dependency org="org.eclipse.jdt" name="core" rev="3.2.3.v_686_R32x">
 			<artifact name="core" type="jar"/>
 		</dependency>

Modified: branches/community/Seam_2_1/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java
===================================================================
--- branches/community/Seam_2_1/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/src/main/org/jboss/seam/drools/ManagedWorkingMemory.java	2009-06-11 01:00:54 UTC (rev 11114)
@@ -4,9 +4,6 @@
 
 import org.drools.RuleBase;
 import org.drools.StatefulSession;
-import org.drools.event.AgendaEventListener;
-import org.drools.event.RuleFlowEventListener;
-import org.drools.event.WorkingMemoryEventListener;
 import org.drools.spi.GlobalResolver;
 import org.jboss.seam.Component;
 import org.jboss.seam.ScopeType;
@@ -16,8 +13,6 @@
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
 import org.jboss.seam.core.Mutable;
 import org.jboss.seam.core.Expressions.ValueExpression;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
 
 /**
  * A conversation-scoped Drools WorkingMemory for a named RuleBase
@@ -31,10 +26,7 @@
 {
    private static final long serialVersionUID = -1746942080571374743L;
    
-   private static final LogProvider log = Logging.getLogProvider(ManagedWorkingMemory.class);
-   
    private String ruleBaseName;
-   private String[] eventListeners;
    private StatefulSession statefulSession;
    private ValueExpression<RuleBase> ruleBase;
    
@@ -74,44 +66,9 @@
       {
          statefulSession = getRuleBaseFromValueBinding().newStatefulSession();
          statefulSession.setGlobalResolver( createGlobalResolver( statefulSession.getGlobalResolver() ) );
-         if(eventListeners != null) {
-            setEventListeners(statefulSession);
-         }
       }
       return statefulSession;
    }
-   
-   private void setEventListeners(StatefulSession statefulSession) {
-      if(eventListeners != null) {
-         for(String eventListener : eventListeners) {
-            log.debug("adding eventListener: " + eventListener);
-            try
-            {
-               Class eventListenerClass = Class.forName(eventListener);
-               Object eventListenerObject = eventListenerClass.newInstance();
-               if(eventListenerObject instanceof WorkingMemoryEventListener) 
-               {
-                  statefulSession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
-               } 
-               else if(eventListenerObject instanceof AgendaEventListener) 
-               {
-                  statefulSession.addEventListener((AgendaEventListener) eventListenerObject);
-               } 
-               else if(eventListenerObject instanceof RuleFlowEventListener) 
-               {
-                  statefulSession.addEventListener((RuleFlowEventListener) eventListenerObject);
-               } 
-               else {
-                  log.debug("event Listener is not of valid type - bypassing.");
-               }
-            }
-            catch (Exception e)
-            {
-               log.error("error adding event listener " + eventListener + " - bypassing.");
-            }
-         }
-      }
-   }
 
    protected RuleBase getRuleBaseFromValueBinding()
    {
@@ -157,17 +114,5 @@
    {
       this.ruleBase = ruleBase;
    }
-
-   public String[] getEventListeners()
-   {
-      return eventListeners;
-   }
-
-   public void setEventListeners(String[] eventListeners)
-   {
-      this.eventListeners = eventListeners;
-   }
    
-   
-   
 }

Modified: branches/community/Seam_2_1/src/main/org/jboss/seam/drools/RuleBase.java
===================================================================
--- branches/community/Seam_2_1/src/main/org/jboss/seam/drools/RuleBase.java	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/src/main/org/jboss/seam/drools/RuleBase.java	2009-06-11 01:00:54 UTC (rev 11114)
@@ -1,26 +1,20 @@
 package org.jboss.seam.drools;
 
-import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 
-import org.drools.RuleBaseConfiguration;
 import org.drools.RuleBaseFactory;
 import org.drools.compiler.DroolsError;
 import org.drools.compiler.PackageBuilder;
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.compiler.RuleError;
-import org.drools.decisiontable.InputType;
-import org.drools.decisiontable.SpreadsheetCompiler;
-import org.drools.spi.ConsequenceExceptionHandler;
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.Create;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.Unwrap;
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
 import org.jboss.seam.core.ResourceLoader;
-import org.jboss.seam.core.Expressions.ValueExpression;
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 
@@ -38,7 +32,6 @@
    
    private String[] ruleFiles;
    private String dslFile;
-   private ValueExpression<ConsequenceExceptionHandler> consequenceExceptionHandler;
    private org.drools.RuleBase ruleBase;
    
    @Create
@@ -57,32 +50,18 @@
             {
                throw new IllegalStateException("could not locate rule file: " + ruleFile);
             }
-            
-            if(isDecisionTable(ruleFile)) 
+            // read in the source
+            Reader drlReader = new InputStreamReader(stream);
+                                  
+            if (dslFile==null)
             {
-               log.debug("compiling decision table");
-               SpreadsheetCompiler compiler = new SpreadsheetCompiler();
-               String drl = compiler.compile(stream, InputType.XLS);
-               
-               log.debug("creating source");               
-               byte currentXMLBytes[] = drl.getBytes();
-               InputStreamReader source = new InputStreamReader(new ByteArrayInputStream(currentXMLBytes)); 
-               
-               builder.addPackageFromDrl(source);
-            } else {             
-               // read in the source
-               Reader drlReader = new InputStreamReader(stream);
-               
-               if (dslFile==null)
-               {
-                  builder.addPackageFromDrl(drlReader);               
-               }
-               else
-               {
-                  Reader dslReader = new InputStreamReader( ResourceLoader.instance().getResourceAsStream(dslFile) );
-                  builder.addPackageFromDrl(drlReader, dslReader);
-               }
+               builder.addPackageFromDrl(drlReader);               
             }
+            else
+            {
+               Reader dslReader = new InputStreamReader( ResourceLoader.instance().getResourceAsStream(dslFile) );
+               builder.addPackageFromDrl(drlReader, dslReader);
+            }
             
             if ( builder.hasErrors() )
             {
@@ -103,19 +82,8 @@
          }
       }
       
-      
-      if(consequenceExceptionHandler != null) 
-      {
-         log.info("adding consequence exception handler: " + consequenceExceptionHandler.getExpressionString());
-         RuleBaseConfiguration rbconf = new RuleBaseConfiguration();
-         rbconf.setConsequenceExceptionHandler(consequenceExceptionHandler.getValue());
-         ruleBase = RuleBaseFactory.newRuleBase( rbconf );
-      }
-      else 
-      {
-         ruleBase = RuleBaseFactory.newRuleBase();
-      }
-      
+      // add the package to a rulebase
+      ruleBase = RuleBaseFactory.newRuleBase();
       ruleBase.addPackage( builder.getPackage() );
    }
    
@@ -145,18 +113,4 @@
       this.dslFile = dslFile;
    }
    
-   public ValueExpression<ConsequenceExceptionHandler> getConsequenceExceptionHandler()
-   {
-      return consequenceExceptionHandler;
-   }
-
-   public void setConsequenceExceptionHandler(ValueExpression<ConsequenceExceptionHandler> consequenceExceptionHandler)
-   {
-      this.consequenceExceptionHandler = consequenceExceptionHandler;
-   }
-
-   private boolean isDecisionTable(String fileName) 
-   {
-      return fileName != null && fileName.length() > 0 && fileName.endsWith(".xls");
-   }
 }

Modified: branches/community/Seam_2_1/src/main/org/jboss/seam/drools-2.1.xsd
===================================================================
--- branches/community/Seam_2_1/src/main/org/jboss/seam/drools-2.1.xsd	2009-06-10 22:48:55 UTC (rev 11113)
+++ branches/community/Seam_2_1/src/main/org/jboss/seam/drools-2.1.xsd	2009-06-11 01:00:54 UTC (rev 11114)
@@ -11,8 +11,8 @@
         </xs:annotation>
         <xs:complexType mixed="true">
             <xs:choice minOccurs="0" maxOccurs="unbounded">
-                <xs:element minOccurs="0" maxOccurs="1" ref="drools:rule-files"/>                
-            </xs:choice>            
+                <xs:element minOccurs="0" maxOccurs="1" ref="drools:rule-files"/>
+            </xs:choice>
             <xs:attributeGroup ref="components:attlist.component"/>
             <xs:attributeGroup ref="drools:attlist.RuleBase"/>
         </xs:complexType>
@@ -20,10 +20,8 @@
     <xs:element name="rule-files" type="components:multiValuedProperty"/>
     <xs:attributeGroup name="attlist.RuleBase">
         <xs:attribute name="dsl-file" type="components:string"/>
-        <xs:attribute name="rule-files" type="components:string"/>
-        <xs:attribute name="consequence-exception-handler" type="components:expressionType"/>        
+        <xs:attribute name="rule-files" type="components:string"/>        
     </xs:attributeGroup>
-    
 
     <xs:element name="rule-agent">
         <xs:annotation>
@@ -49,9 +47,6 @@
             <xs:documentation>A working memory for rules calculations</xs:documentation>
         </xs:annotation>
         <xs:complexType mixed="true">
-        	<xs:choice minOccurs="0" maxOccurs="unbounded">
-                <xs:element minOccurs="0" maxOccurs="1" ref="drools:event-listeners"/>
-            </xs:choice>
             <xs:attributeGroup ref="components:attlist.component"/>
             <xs:attributeGroup ref="drools:attlist.ManagedWorkingMemory"/>
         </xs:complexType>
@@ -59,6 +54,5 @@
     <xs:attributeGroup name="attlist.ManagedWorkingMemory">
         <xs:attribute name="rule-base" type="components:expressionType"/>
     </xs:attributeGroup>
-    <xs:element name="event-listeners" type="components:multiValuedProperty"/>
 
 </xs:schema>




More information about the seam-commits mailing list