[seam-commits] Seam SVN: r11378 - in branches/community/Seam_2_2_Drools5: examples and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Aug 13 14:18:28 EDT 2009


Author: tsurdilovic
Date: 2009-08-13 14:18:27 -0400 (Thu, 13 Aug 2009)
New Revision: 11378

Added:
   branches/community/Seam_2_2_Drools5/examples/drools/resources/test.drl
   branches/community/Seam_2_2_Drools5/examples/drools/resources/testbatch.xml
   branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Message.java
   branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
   branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
   branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/BatchExecution.java
Modified:
   branches/community/Seam_2_2_Drools5/build/core.pom.xml
   branches/community/Seam_2_2_Drools5/build/root.pom.xml
   branches/community/Seam_2_2_Drools5/examples/build.xml
   branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
   branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
   branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
Log:
Support for Drools5 (integration)

Modified: branches/community/Seam_2_2_Drools5/build/core.pom.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/build/core.pom.xml	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/build/core.pom.xml	2009-08-13 18:18:27 UTC (rev 11378)
@@ -272,7 +272,31 @@
      </dependency>
      
      <dependency>
-      	<groupId>xstream</groupId>
+        <groupId>org.drools</groupId>
+        <artifactId>drools-transformer-xstream</artifactId>
+        <optional>true</optional>
+        <exclusions>
+          <exclusion>
+            <groupId>org.drools</groupId>
+			<artifactId>drools-core</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.drools</groupId>
+			<artifactId>drools-compiler</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>xmlunit</groupId>
+			<artifactId>xmlunit</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+     
+     <dependency>
+      	<groupId>com.thoughtworks.xstream</groupId>
   		<artifactId>xstream</artifactId>      	
       </dependency>
       

Modified: branches/community/Seam_2_2_Drools5/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/build/root.pom.xml	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/build/root.pom.xml	2009-08-13 18:18:27 UTC (rev 11378)
@@ -803,6 +803,30 @@
       </dependency>
       
       <dependency>
+        <groupId>org.drools</groupId>
+        <artifactId>drools-transformer-xstream</artifactId>
+        <version>${version.drools}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.drools</groupId>
+			<artifactId>drools-core</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.drools</groupId>
+			<artifactId>drools-compiler</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>xmlunit</groupId>
+			<artifactId>xmlunit</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      
+      <dependency>
       	<groupId>org.drools</groupId>
         <artifactId>drools-templates</artifactId>
         <version>${version.drools}</version>
@@ -837,9 +861,9 @@
       </dependency>
       
       <dependency>
-      	<groupId>xstream</groupId>
+      	<groupId>com.thoughtworks.xstream</groupId>
   		<artifactId>xstream</artifactId>
-  		<version>1.1.3</version>      	
+  		<version>1.3.1</version>      	
       </dependency>
       
       <dependency>

Modified: branches/community/Seam_2_2_Drools5/examples/build.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/build.xml	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/examples/build.xml	2009-08-13 18:18:27 UTC (rev 11378)
@@ -327,6 +327,7 @@
 		<include name="drools-compiler.jar" if="drools.lib" />
 		<include name="drools-api.jar" if="drools.lib" />
 		<include name="drools-decisiontables.jar" if="drools.lib"/>
+		<include name="drools-transformer-xstream.jar" if="drools.lib"/>
 		<include name="drools-templates.jar" if="drools.lib"/>
 		<include name="xstream.jar" if="drools.lib"/>
 		<include name="xpp3_min.jar" if="drools.lib"/>

Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml	2009-08-13 18:18:27 UTC (rev 11378)
@@ -22,12 +22,31 @@
     	</drools:change-sets>
     </drools:knowledge-agent>
     
-    <drools:stateful-knowledge-session name="ksession" knowledge-base="#{kagent}" knowledge-session-config="ksessionconfig.properties">
+    <drools:stateful-knowledge-session name="ksession" knowledge-base="#{kbase}" knowledge-session-config="ksessionconfig.properties">
     	<drools:event-listeners>
     		<value>org.drools.event.rule.DebugAgendaEventListener</value>
     		<value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
     	</drools:event-listeners>
     </drools:stateful-knowledge-session>
+    
+    
+    <drools:knowledge-base name="kbase2" knowledge-builder-config="kbuilderconfig.properties" knowledge-base-config="kbaseconfig.properties">
+    	<drools:rule-resources>
+    		<value>classpath:test.drl:DRL</value>
+    	</drools:rule-resources>	
+    </drools:knowledge-base>
+    
+    <drools:stateful-knowledge-session name="ksession2" 
+          knowledge-base="#{kbase2}" 
+          knowledge-session-config="ksessionconfig.properties">
+    	<drools:event-listeners>
+    		<value>org.drools.event.rule.DebugAgendaEventListener</value>
+    		<value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
+    	</drools:event-listeners>
+    </drools:stateful-knowledge-session>
+    
+    <drools:batch-execution name="batch1" ksession="#{ksession2}" 
+        batch-xml-config="testbatch.xml"/>
 	
     <!-- <drools:rule-base  name="ruleBase" rule-files="numberguess.drl"/>  -->
     <!-- use this in order to load from decision table instead -->        

Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/test.drl
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/test.drl	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/test.drl	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,14 @@
+package org.jboss.seam.example.numberguess
+
+import org.jboss.seam.example.numberguess.Message;
+
+rule simple
+no-loop true	
+   when 
+      $m : Message();
+   then 
+   	modify($m) { 
+      setMessage("Hello " + $m.getMessage());
+      }
+      
+end
\ No newline at end of file

Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/testbatch.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/testbatch.xml	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/testbatch.xml	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,8 @@
+<batch-execution>
+	<insert out-identifier="message">
+		<org.jboss.seam.example.numberguess.Message>
+			<message>Tihomir</message>
+		</org.jboss.seam.example.numberguess.Message>
+	</insert>
+	<fire-all-rules />
+</batch-execution>
\ No newline at end of file

Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Message.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Message.java	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Message.java	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,18 @@
+package org.jboss.seam.example.numberguess;
+
+public class Message
+{
+   private String message;
+
+   public String getMessage()
+   {
+      return message;
+   }
+
+   public void setMessage(String message)
+   {
+      this.message = message;
+   }
+   
+   
+}

Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,30 @@
+package org.jboss.seam.example.numberguess;
+
+import org.drools.runtime.ExecutionResults;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+ at Name("rulesTest")
+ at Scope(ScopeType.CONVERSATION)
+public class RulesTest
+{
+   @In(create=true) ExecutionResults batch1; 
+   private static final LogProvider log = Logging.getLogProvider(RulesTest.class);
+   private String result;
+
+   @Begin(join=true)
+   public String getResult()
+   {
+      return ((Message) batch1.getValue( "message" )).getMessage();
+   }
+
+   public void setResult(String result)
+   {
+      this.result = result;
+   }
+}

Added: branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,16 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+<head>
+<title>Simple test</title>
+</head>
+<body>
+<h1>Simple Test</h1>
+<f:view>
+	<h:form id="simples">
+		<h:outputLabel value="Rules Result" for="output" />
+	    <h:outputText id="output" value="#{rulesTest.result}"/>
+	</h:form>
+</f:view>
+</body>
+</html>

Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/BatchExecution.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/BatchExecution.java	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/BatchExecution.java	2009-08-13 18:18:27 UTC (rev 11378)
@@ -0,0 +1,166 @@
+package org.jboss.seam.drools;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.drools.runtime.ExecutionResults;
+import org.drools.runtime.help.BatchExecutionHelper;
+import org.drools.runtime.pipeline.Action;
+import org.drools.runtime.pipeline.KnowledgeRuntimeCommand;
+import org.drools.runtime.pipeline.Pipeline;
+import org.drools.runtime.pipeline.PipelineFactory;
+import org.drools.runtime.pipeline.ResultHandler;
+import org.drools.runtime.pipeline.Transformer;
+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;
+
+
+/**
+ * A conversation-scoped that performs batch execution for specified
+ * StatefulKnowledgeSession.
+ * 
+ * @author Tihomir Surdilovic
+ * 
+ */
+ at Scope(ScopeType.CONVERSATION)
+ at BypassInterceptors
+public class BatchExecution
+{
+   private static final LogProvider log = Logging.getLogProvider(BatchExecution.class);
+
+   
+   private ValueExpression<org.drools.runtime.StatefulKnowledgeSession> ksession;
+   private String batchXmlConfig;
+   private ValueExpression<java.lang.String> batchXml;
+   
+   private String outXml;
+   
+   @Create
+   public void createBatchExecution() throws Exception
+   {
+      String inXml = "";
+      if (batchXmlConfig != null)
+      {
+         InputStream stream = ResourceLoader.instance().getResourceAsStream(batchXmlConfig);
+         if (stream == null)
+         {
+            throw new IllegalStateException("could not locate knowledgeSession configuration: " + batchXmlConfig);
+         }
+         inXml = inputStreamAsString(stream);
+         ResultHandlerImpl resultsHandler = new ResultHandlerImpl();
+         getPipelineStateful(ksession.getValue()).insert(inXml, resultsHandler);
+         
+         outXml = (String) resultsHandler.getObject();
+      }
+      else if (batchXml != null)
+      {
+         inXml = batchXml.getValue();
+         ResultHandlerImpl resultsHandler = new ResultHandlerImpl();
+         getPipelineStateful(ksession.getValue()).insert(inXml, resultsHandler);
+         
+         outXml = (String) resultsHandler.getObject();
+      }
+      else
+      {
+         log.error("No valid batch xml input.");
+      }
+   }
+   
+   @Unwrap
+   public ExecutionResults getExecutionResults()
+   {
+      return (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML(outXml);
+   }
+   
+   private Pipeline getPipelineStateful(org.drools.runtime.StatefulKnowledgeSession ksession)
+   {
+      Action executeResultHandler = PipelineFactory.newExecuteResultHandler();
+      
+      Action assignResult = PipelineFactory.newAssignObjectAsResult();
+      assignResult.setReceiver(executeResultHandler);
+      
+      Transformer outTransformer = PipelineFactory.newXStreamToXmlTransformer(BatchExecutionHelper.newXStreamMarshaller());
+      outTransformer.setReceiver(assignResult);
+      
+      KnowledgeRuntimeCommand batchExecution = PipelineFactory.newCommandExecutor();
+      batchExecution.setReceiver(outTransformer);
+      
+      Transformer inTransformer = PipelineFactory.newXStreamFromXmlTransformer(BatchExecutionHelper.newXStreamMarshaller());
+      inTransformer.setReceiver(batchExecution);
+      
+      Pipeline pipeline = PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession);
+      pipeline.setReceiver(inTransformer);
+      
+      return pipeline;
+   }
+   
+   public String getBatchXmlConfig()
+   {
+      return batchXmlConfig;
+   }
+
+   public void setBatchXmlConfig(String batchXmlConfig)
+   {
+      this.batchXmlConfig = batchXmlConfig;
+   }
+
+   public ValueExpression<java.lang.String> getBatchXml()
+   {
+      return batchXml;
+   }
+
+   public void setBatchXml(ValueExpression<java.lang.String> batchXml)
+   {
+      this.batchXml = batchXml;
+   }
+
+   public ValueExpression<org.drools.runtime.StatefulKnowledgeSession> getKsession()
+   {
+      return ksession;
+   }
+   
+   public void setKsession(ValueExpression<org.drools.runtime.StatefulKnowledgeSession> ksession)
+   {
+      this.ksession = ksession;
+   }
+   
+   public static class ResultHandlerImpl implements ResultHandler
+   {
+      Object object;
+      
+      public void handleResult(Object object)
+      {
+         this.object = object;
+      }
+      
+      public Object getObject()
+      {
+         return this.object;
+      }
+      
+   }
+   
+   private String inputStreamAsString(InputStream stream) throws IOException
+   {
+      BufferedReader br = new BufferedReader(new InputStreamReader(stream));
+      StringBuilder sb = new StringBuilder();
+      String line = null;
+      
+      while ((line = br.readLine()) != null)
+      {
+         sb.append(line + "\n");
+      }
+      
+      br.close();
+      return sb.toString();
+   }
+}

Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java	2009-08-13 18:18:27 UTC (rev 11378)
@@ -3,7 +3,6 @@
 import java.io.InputStream;
 import java.io.Serializable;
 import java.util.Properties;
-import java.util.regex.Pattern;
 
 import org.drools.KnowledgeBaseFactory;
 import org.drools.runtime.KnowledgeSessionConfiguration;
@@ -16,7 +15,6 @@
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.Unwrap;
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.core.Expressions;
 import org.jboss.seam.core.Mutable;
 import org.jboss.seam.core.ResourceLoader;
 import org.jboss.seam.core.Expressions.ValueExpression;
@@ -34,13 +32,8 @@
 public class StatefulKnowledgeSession implements Mutable, Serializable
 {
    private static final LogProvider log = Logging.getLogProvider(org.jboss.seam.drools.StatefulKnowledgeSession.class);
-   private static final Pattern COLON = Pattern.compile(":");
-   private static final int GLOBAL_NAME = 0;
-   private static final int GLOBAL_OBJ = 1;
-   private static final int GLOBAL_TYPE = 2;
-   
+
    private ValueExpression<org.drools.KnowledgeBase> knowledgeBase;
-   private String[] globals;
    private String[] eventListeners;
    private String knowledgeSessionConfig;
    
@@ -73,23 +66,6 @@
                setEventListener(ksession, eventListener);
             }
          }
-         
-         if(globals != null) {
-            for(String nextGlobal : globals) {
-               String[] globalParts = COLON.split(nextGlobal.trim());
-               if(globalParts.length == 3) {
-                  log.info("setting global: " + globalParts[GLOBAL_NAME] + " - " + globalParts[GLOBAL_OBJ]);
-                  try {
-                     Class ctype = Class.forName(globalParts[GLOBAL_TYPE]);
-                     ksession.setGlobal(globalParts[GLOBAL_NAME],  Expressions.instance().createValueExpression(globalParts[GLOBAL_OBJ], ctype).getValue());
-                  } catch (Exception e) {
-                     log.error("Error setting global: " + globalParts[GLOBAL_NAME] + " - " + globalParts[GLOBAL_OBJ] + " Exception : " + e.getMessage());                    
-                  }
-               } else {
-                  log.warn("Invalid global entry: " + nextGlobal);
-               }
-            }
-         }
       }
 
       return ksession;
@@ -142,16 +118,6 @@
       this.knowledgeBase = knowledgeBase;
    }
 
-   public String[] getGlobals()
-   {
-      return globals;
-   }
-
-   public void setGlobals(String[] globals)
-   {
-      this.globals = globals;
-   }
-
    public String[] getEventListeners()
    {
       return eventListeners;

Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd	2009-08-13 17:24:13 UTC (rev 11377)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd	2009-08-13 18:18:27 UTC (rev 11378)
@@ -1,125 +1,144 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
-    targetNamespace="http://jboss.com/products/seam/drools" xmlns:drools="http://jboss.com/products/seam/drools"
-    xmlns:components="http://jboss.com/products/seam/components" attributeFormDefault="unqualified">
-    
-    <xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.2.xsd"/>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	elementFormDefault="qualified" targetNamespace="http://jboss.com/products/seam/drools"
+	xmlns:drools="http://jboss.com/products/seam/drools" xmlns:components="http://jboss.com/products/seam/components"
+	attributeFormDefault="unqualified">
 
-    <xs:element name="rule-base">
-        <xs:annotation>
-            <xs:documentation>A drools rule base</xs:documentation>
-        </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:attributeGroup ref="components:attlist.component"/>
-            <xs:attributeGroup ref="drools:attlist.RuleBase"/>
-        </xs:complexType>
-    </xs:element>
-    <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:attributeGroup>
+	<xs:import namespace="http://jboss.com/products/seam/components"
+		schemaLocation="components-2.2.xsd" />
 
-    <xs:element name="rule-agent">
-        <xs:annotation>
-            <xs:documentation>A drools BRMS configuration</xs:documentation>
-        </xs:annotation>
-        <xs:complexType mixed="true">    		
-    		<xs:attributeGroup ref="components:attlist.component" />
-    		<xs:attributeGroup ref="drools:attlist.RuleAgent" />
-    	</xs:complexType>
-    </xs:element>
-    <xs:attributeGroup name="attlist.RuleAgent">
-        <xs:attribute name="configuration-file" type="components:string" />
-        <xs:attribute name="config-name" type="components:string" />
-        <xs:attribute name="new-instance" type="components:string" />
-        <xs:attribute name="files" type="components:string" />
-        <xs:attribute name="url" type="components:string" />
-        <xs:attribute name="local-cache-dir" type="components:string" />
-        <xs:attribute name="poll" type="components:string" />        
-    </xs:attributeGroup>
+	<xs:element name="rule-base">
+		<xs:annotation>
+			<xs:documentation>A drools rule base</xs:documentation>
+		</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:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.RuleBase" />
+		</xs:complexType>
+	</xs:element>
+	<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:attributeGroup>
 
-    <xs:element name="managed-working-memory">
-        <xs:annotation>
-            <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>
-    </xs:element>
-    <xs:attributeGroup name="attlist.ManagedWorkingMemory">
-        <xs:attribute name="rule-base" type="components:expressionType"/>
-    </xs:attributeGroup>
-    <xs:element name="event-listeners" type="components:multiValuedProperty"/>
-    
-    <xs:element name="knowledge-base">
-        <xs:annotation>
-            <xs:documentation>Drools KnowledgeBase</xs:documentation>
-        </xs:annotation>
-        <xs:complexType mixed="true">
-            <xs:choice minOccurs="0" maxOccurs="unbounded">
-                <xs:element minOccurs="0" maxOccurs="1" ref="drools:rule-resources"/>
-            </xs:choice>
-            <xs:attributeGroup ref="components:attlist.component"/>
-            <xs:attributeGroup ref="drools:attlist.KnowledgeBase"/>
-        </xs:complexType>
-    </xs:element>
-    <xs:element name="rule-resources" type="components:multiValuedProperty"/>
-   	<xs:attributeGroup name="attlist.KnowledgeBase">
-        <xs:attribute name="knowledge-builder-config" type="components:string"/>
-        <xs:attribute name="knowledge-base-config" type="components:string"/>              
-    </xs:attributeGroup>
-    
-    <xs:element name="stateful-knowledge-session">
-        <xs:annotation>
-            <xs:documentation>Drools StatefulKnowledgeSession</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:element minOccurs="0" maxOccurs="1" ref="drools:globals"/>
-            </xs:choice>
-            <xs:attributeGroup ref="components:attlist.component"/>
-            <xs:attributeGroup ref="drools:attlist.StatefulKnowledgeSession"/>
-        </xs:complexType>
-    </xs:element>
-    <xs:attributeGroup name="attlist.StatefulKnowledgeSession">
-        <xs:attribute name="knowledge-base" type="components:expressionType"/>
-        <xs:attribute name="globals" type="components:string"/>
-        <xs:attribute name="event-listeners" type="components:string"/>
-        <xs:attribute name="knowledge-session-config" type="components:string"/>
-    </xs:attributeGroup>
-    <xs:element name="globals" type="components:multiValuedProperty"/>
-    
-    <xs:element name="knowledge-agent">
-        <xs:annotation>
-            <xs:documentation>Drools KnowledgeAgent</xs:documentation>
-        </xs:annotation>
-        <xs:complexType mixed="true">
-        	<xs:choice minOccurs="0" maxOccurs="unbounded">
-                <xs:element minOccurs="0" maxOccurs="1" ref="drools:change-sets"/>
-            </xs:choice>
-            <xs:attributeGroup ref="components:attlist.component"/>
-            <xs:attributeGroup ref="drools:attlist.KnowledgeAgent"/>
-        </xs:complexType>
-    </xs:element>
-    <xs:attributeGroup name="attlist.KnowledgeAgent">
-        <xs:attribute name="knowledge-base" type="components:expressionType"/>
-        <xs:attribute name="agent-name" type="components:string"/>
-        <xs:attribute name="scan-resources" type="components:string"/>
-        <xs:attribute name="scan-directories" type="components:string"/>
-        <xs:attribute name="new-instance" type="components:string"/>
-        <xs:attribute name="monitor-change-set-events" type="components:string"/>
-        <xs:attribute name="knowledge-agent-config" type="components:string"/>
-        <xs:attribute name="scan-interval" type="components:string"/>
-    </xs:attributeGroup>
-	<xs:element name="change-sets" type="components:multiValuedProperty"/>
+	<xs:element name="rule-agent">
+		<xs:annotation>
+			<xs:documentation>A drools BRMS configuration</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.RuleAgent" />
+		</xs:complexType>
+	</xs:element>
+	<xs:attributeGroup name="attlist.RuleAgent">
+		<xs:attribute name="configuration-file" type="components:string" />
+		<xs:attribute name="config-name" type="components:string" />
+		<xs:attribute name="new-instance" type="components:string" />
+		<xs:attribute name="files" type="components:string" />
+		<xs:attribute name="url" type="components:string" />
+		<xs:attribute name="local-cache-dir" type="components:string" />
+		<xs:attribute name="poll" type="components:string" />
+	</xs:attributeGroup>
+
+	<xs:element name="managed-working-memory">
+		<xs:annotation>
+			<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>
+	</xs:element>
+	<xs:attributeGroup name="attlist.ManagedWorkingMemory">
+		<xs:attribute name="rule-base" type="components:expressionType" />
+	</xs:attributeGroup>
+	<xs:element name="event-listeners" type="components:multiValuedProperty" />
+
+	<xs:element name="knowledge-base">
+		<xs:annotation>
+			<xs:documentation>Drools KnowledgeBase</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:choice minOccurs="0" maxOccurs="unbounded">
+				<xs:element minOccurs="0" maxOccurs="1"
+					ref="drools:rule-resources" />
+			</xs:choice>
+			<xs:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.KnowledgeBase" />
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="rule-resources" type="components:multiValuedProperty" />
+	<xs:attributeGroup name="attlist.KnowledgeBase">
+		<xs:attribute name="knowledge-builder-config" type="components:string" />
+		<xs:attribute name="knowledge-base-config" type="components:string" />
+	</xs:attributeGroup>
+
+	<xs:element name="stateful-knowledge-session">
+		<xs:annotation>
+			<xs:documentation>Drools StatefulKnowledgeSession</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.StatefulKnowledgeSession" />
+		</xs:complexType>
+	</xs:element>
+	<xs:attributeGroup name="attlist.StatefulKnowledgeSession">
+		<xs:attribute name="knowledge-base" type="components:expressionType" />
+		<xs:attribute name="event-listeners" type="components:string" />
+		<xs:attribute name="knowledge-session-config" type="components:string" />
+	</xs:attributeGroup>
+	<xs:element name="globals" type="components:multiValuedProperty" />
+
+	<xs:element name="knowledge-agent">
+		<xs:annotation>
+			<xs:documentation>Drools KnowledgeAgent</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:choice minOccurs="0" maxOccurs="unbounded">
+				<xs:element minOccurs="0" maxOccurs="1" ref="drools:change-sets" />
+			</xs:choice>
+			<xs:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.KnowledgeAgent" />
+		</xs:complexType>
+	</xs:element>
+	<xs:attributeGroup name="attlist.KnowledgeAgent">
+		<xs:attribute name="knowledge-base" type="components:expressionType" />
+		<xs:attribute name="agent-name" type="components:string" />
+		<xs:attribute name="scan-resources" type="components:string" />
+		<xs:attribute name="scan-directories" type="components:string" />
+		<xs:attribute name="new-instance" type="components:string" />
+		<xs:attribute name="monitor-change-set-events" type="components:string" />
+		<xs:attribute name="knowledge-agent-config" type="components:string" />
+		<xs:attribute name="scan-interval" type="components:string" />
+	</xs:attributeGroup>
+	<xs:element name="change-sets" type="components:multiValuedProperty" />
+
+	<xs:element name="batch-execution">
+		<xs:annotation>
+			<xs:documentation>Batch Execution Component</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.BatchExecution" />
+		</xs:complexType>
+	</xs:element>
+	<xs:attributeGroup name="attlist.BatchExecution">
+		<xs:attribute name="ksession" type="components:expressionType" />
+		<xs:attribute name="batch-xml" type="components:expressionType" />
+		<xs:attribute name="batch-xml-config" type="components:string" />
+	</xs:attributeGroup>
 </xs:schema>



More information about the seam-commits mailing list