[seam-commits] Seam SVN: r11412 - in branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam: drools and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Aug 20 20:18:44 EDT 2009


Author: tsurdilovic
Date: 2009-08-20 20:18:43 -0400 (Thu, 20 Aug 2009)
New Revision: 11412

Added:
   branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/WorkingMemoryEntryPoint.java
Modified:
   branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
Log:
Drools5 Integration CEP WM entry point.

Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/WorkingMemoryEntryPoint.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/WorkingMemoryEntryPoint.java	                        (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/WorkingMemoryEntryPoint.java	2009-08-21 00:18:43 UTC (rev 11412)
@@ -0,0 +1,53 @@
+package org.jboss.seam.drools;
+
+import org.jboss.seam.ScopeType;
+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.ValueExpression;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * A conversation-scoped Drools WorkingMemoryEntryPoint for a named StatefulKnowledgeSession
+ * 
+ * @author Tihomir Surdilovic
+ *
+ */
+ at Scope(ScopeType.CONVERSATION)
+ at BypassInterceptors
+public class WorkingMemoryEntryPoint
+{
+   private static final LogProvider log = Logging.getLogProvider(WorkingMemoryEntryPoint.class);
+   
+   private ValueExpression<org.drools.runtime.StatefulKnowledgeSession> ksession;
+   private String entryPointName;
+   
+   @Unwrap
+   public org.drools.runtime.rule.WorkingMemoryEntryPoint getEntryPoint() throws Exception
+   {
+      if(ksession != null) {
+         log.info("Getting entry point: " + entryPointName);
+         return ksession.getValue().getWorkingMemoryEntryPoint(entryPointName);
+      } else {
+         throw new IllegalAccessException("Knowledge Session is null");
+      }
+   }
+   
+   public ValueExpression<org.drools.runtime.StatefulKnowledgeSession> getKsession()
+   {
+      return ksession;
+   }
+   public void setKsession(ValueExpression<org.drools.runtime.StatefulKnowledgeSession> ksession)
+   {
+      this.ksession = ksession;
+   }
+   public String getEntryPointName()
+   {
+      return entryPointName;
+   }
+   public void setEntryPointName(String entryPointName)
+   {
+      this.entryPointName = entryPointName;
+   }  
+}

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-20 17:16:26 UTC (rev 11411)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd	2009-08-21 00:18:43 UTC (rev 11412)
@@ -131,6 +131,20 @@
 	</xs:attributeGroup>
 	<xs:element name="change-sets" type="components:multiValuedProperty" />
 
+	<xs:element name="Working-memory-entry-point">
+		<xs:annotation>
+			<xs:documentation>WorkingMemory Entry Point Component</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:attributeGroup ref="components:attlist.component" />
+			<xs:attributeGroup ref="drools:attlist.WorkingMemoryEntryPoint" />
+		</xs:complexType>
+	</xs:element>
+	<xs:attributeGroup name="attlist.WorkingMemoryEntryPoint">
+		<xs:attribute name="ksession" type="components:expressionType" />
+		<xs:attribute name="entry-point-name" type="components:expressionType" />
+	</xs:attributeGroup>
+
 	<xs:element name="batch-execution">
 		<xs:annotation>
 			<xs:documentation>Batch Execution Component</xs:documentation>



More information about the seam-commits mailing list