[seam-commits] Seam SVN: r12409 - in modules/drools/trunk: impl and 35 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Apr 6 23:19:00 EDT 2010
Author: tsurdilovic
Date: 2010-04-06 23:18:58 -0400 (Tue, 06 Apr 2010)
New Revision: 12409
Added:
modules/drools/trunk/impl/
modules/drools/trunk/impl/pom.xml
modules/drools/trunk/impl/src/
modules/drools/trunk/impl/src/main/
modules/drools/trunk/impl/src/main/java/
modules/drools/trunk/impl/src/main/java/META-INF/
modules/drools/trunk/impl/src/main/java/META-INF/MANIFEST.MF
modules/drools/trunk/impl/src/main/java/org/
modules/drools/trunk/impl/src/main/java/org/jboss/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExcecutionResultsProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotation/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/InsertFact.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeSessionConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeBuilderErrorsEvent.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/RuleResourceAddedEvent.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/flow/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/FactProvider.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/TemplateDataProvider.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KAgentProduced.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KSession.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils/ConfigUtils.java
modules/drools/trunk/impl/src/main/resources/
modules/drools/trunk/impl/src/main/resources/META-INF/
modules/drools/trunk/impl/src/main/resources/META-INF/javax.enterprise.inject.spi.Extension
modules/drools/trunk/impl/src/test/
modules/drools/trunk/impl/src/test/java/
modules/drools/trunk/impl/src/test/java/org/
modules/drools/trunk/impl/src/test/java/org/jboss/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
modules/drools/trunk/impl/src/test/resources/
modules/drools/trunk/impl/src/test/resources/META-INF/
modules/drools/trunk/impl/src/test/resources/org/
modules/drools/trunk/impl/src/test/resources/org/jboss/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/InsertInterceptorTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbaseconfig.properties
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties
Modified:
modules/drools/trunk/pom.xml
modules/drools/trunk/readme.txt
Log:
Module Anatomy
Added: modules/drools/trunk/impl/pom.xml
===================================================================
--- modules/drools/trunk/impl/pom.xml (rev 0)
+++ modules/drools/trunk/impl/pom.xml 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,122 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.seam.drools</groupId>
+ <artifactId>seam-drools-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.jboss.seam.drools</groupId>
+ <artifactId>seam-drools-impl</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Seam Drools Module Core Implementation</name>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>apache.org-snapshots</id>
+ <name>Apache Snapshots Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-templates</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-decisiontables</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-workitems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.xml</groupId>
+ <artifactId>seam-xml-bean-config</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>seam-drools-api</artifactId>
+ <groupId>org.jboss.seam.drools</groupId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.6.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: modules/drools/trunk/impl/src/main/java/META-INF/MANIFEST.MF
===================================================================
--- modules/drools/trunk/impl/src/main/java/META-INF/MANIFEST.MF (rev 0)
+++ modules/drools/trunk/impl/src/main/java/META-INF/MANIFEST.MF 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path:
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExcecutionResultsProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExcecutionResultsProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExcecutionResultsProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,6 @@
+package org.jboss.seam.drools;
+
+public class ExcecutionResultsProducer
+{
+
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,18 @@
+package org.jboss.seam.drools;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeAgentProducer
+{
+ private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseProducer.class);
+
+ @Inject BeanManager manager;
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,163 @@
+package org.jboss.seam.drools;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseConfiguration;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderConfiguration;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.event.knowledgebase.KnowledgeBaseEventListener;
+import org.drools.io.ResourceFactory;
+import org.jboss.seam.drools.config.KnowledgeBaseConfig;
+import org.jboss.seam.drools.events.KnowledgeBuilderErrorsEvent;
+import org.jboss.seam.drools.events.RuleResourceAddedEvent;
+import org.jboss.seam.drools.utils.ConfigUtils;
+import org.jboss.weld.extensions.resources.ResourceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeBaseProducer
+{
+ private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseProducer.class);
+
+ @Inject BeanManager manager;
+ @Inject ResourceProvider resourceProvider;
+
+ @Produces public KnowledgeBase produceKBase(KnowledgeBaseConfig kbaseConfig) throws Exception
+ {
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(getKnowledgeBuilderConfiguration(kbaseConfig));
+
+ for (String nextResource : kbaseConfig.getRuleResources())
+ {
+ addResource(kbuilder, nextResource);
+ }
+
+ KnowledgeBuilderErrors kbuildererrors = kbuilder.getErrors();
+ if (kbuildererrors.size() > 0)
+ {
+ for (KnowledgeBuilderError kbuildererror : kbuildererrors)
+ {
+ log.error(kbuildererror.getMessage());
+ }
+ manager.fireEvent(new KnowledgeBuilderErrorsEvent(kbuildererrors));
+ }
+
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(getKnowledgeBaseConfiguration(kbaseConfig));
+ kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+
+ if (kbaseConfig.getEventListeners() != null)
+ {
+ for (String eventListener : kbaseConfig.getEventListeners())
+ {
+ addEventListener(kbase, eventListener);
+ }
+ }
+ return kbase;
+ }
+
+ public void disposeKBase(@Disposes @Any KnowledgeBase kbase) {
+ log.info("Disposing Knowledge Base");
+ kbase = null;
+ }
+
+ private KnowledgeBuilderConfiguration getKnowledgeBuilderConfiguration(KnowledgeBaseConfig kbaseConfig) throws Exception
+ {
+ KnowledgeBuilderConfiguration droolsKbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
+ if (kbaseConfig.getKnowledgeBuilderConfig() != null && kbaseConfig.getKnowledgeBuilderConfig().endsWith(".properties"))
+ {
+ Properties kbuilderProp = new Properties();
+ InputStream in = resourceProvider.loadResourceStream(kbaseConfig.getKnowledgeBuilderConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeBuilderConfig: " + kbaseConfig.getKnowledgeBuilderConfig());
+ }
+ kbuilderProp.load(in);
+ in.close();
+ droolsKbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbuilderProp, null);
+ log.debug("KnowledgeBuilderConfiguration loaded: " + kbaseConfig.getKnowledgeBuilderConfig());
+ } else {
+ log.warn("Invalid config type: " + kbaseConfig.getKnowledgeBuilderConfig());
+ }
+ return droolsKbuilderConfig;
+ }
+
+ public KnowledgeBaseConfiguration getKnowledgeBaseConfiguration(KnowledgeBaseConfig kbaseConfig) throws Exception
+ {
+ KnowledgeBaseConfiguration droolsKbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
+ if (kbaseConfig.getKnowledgeBaseConfig() != null && kbaseConfig.getKnowledgeBaseConfig().endsWith(".properties"))
+ {
+ Properties kbaseProp = new Properties();
+ InputStream in = resourceProvider.loadResourceStream(kbaseConfig.getKnowledgeBaseConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeBaseConfig: " + kbaseConfig.getKnowledgeBaseConfig());
+ }
+ kbaseProp.load(in);
+ in.close();
+ droolsKbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(kbaseProp, null);
+ log.debug("KnowledgeBaseConfiguration loaded: " + kbaseConfig.getKnowledgeBaseConfig());
+ }
+ return droolsKbaseConfig;
+ }
+
+ private void addResource(KnowledgeBuilder kbuilder, String resource) throws Exception
+ {
+ //TODO add support for drools templates definition!
+ ResourceType resourceType = ResourceType.getResourceType(ConfigUtils.getResourceType(resource));
+ if(ConfigUtils.isValidResource(resource)) {
+ if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_URL))
+ {
+ kbuilder.add(ResourceFactory.newUrlResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
+ }
+ else if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_FILE))
+ {
+ kbuilder.add(ResourceFactory.newFileResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
+ }
+ else if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_CLASSPATH))
+ {
+ kbuilder.add(ResourceFactory.newClassPathResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
+ }
+ else
+ {
+ log.error("Invalid resource path: " + ConfigUtils .getResourcePath(resource));
+ }
+ } else {
+ log.error("Invalid resource definition: " + resource);
+ }
+ }
+
+ private void addEventListener(org.drools.KnowledgeBase kbase, String eventListener) {
+ try {
+ @SuppressWarnings("unchecked")
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof KnowledgeBaseEventListener) {
+ kbase.addEventListener((KnowledgeBaseEventListener) eventListenerObject);
+ } else {
+ log.debug("Event Listener " + eventListener + " is not of type KnowledgeBaseEventListener");
+ }
+ } catch(Exception e) {
+ log.error("Error adding event listener " + e.getMessage());
+ }
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,56 @@
+package org.jboss.seam.drools;
+
+import java.util.Map;
+
+import java.lang.annotation.Annotation;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.drools.event.KnowledgeRuntimeEventManager;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeLoggerProducer
+{
+ private static final String fileLoggerType = "file";
+ private static final String consoleLoggerType = "console";
+ private static final String threadedLoggerType = "threaded";
+ private static final String loggerType = "type";
+ private static final String loggerPath = "path";
+ private static final String loggerInterval = "interval";
+
+ private static final Logger log = LoggerFactory.getLogger(KnowledgeLoggerProducer.class);
+
+
+ @Produces public KnowledgeRuntimeLogger produceKnowledgeLogger(InjectionPoint ip, Instance<KnowledgeRuntimeEventManager> ksessionInstance, Instance<Map<String, String>> loggerInfoInstance) {
+ KnowledgeRuntimeLogger krLogger = null;
+ KnowledgeRuntimeEventManager ksession = ksessionInstance.select(ip.getQualifiers().toArray(new Annotation[0])).get();
+ Map<String, String> loggerInfo = loggerInfoInstance.select(ip.getQualifiers().toArray(new Annotation[0])).get();
+ if(loggerInfo.get(loggerType).equalsIgnoreCase(fileLoggerType)) {
+ String logName = loggerInfo.get(loggerPath) + System.currentTimeMillis();
+ krLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, logName);
+ } else if(loggerInfo.get(loggerType).equalsIgnoreCase(consoleLoggerType)) {
+ krLogger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
+ } else if(loggerInfo.get(loggerType).equalsIgnoreCase(threadedLoggerType)) {
+ String logName = loggerInfo.get(loggerPath) + System.currentTimeMillis();
+ krLogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, logName, Integer.parseInt(loggerInfo.get(loggerInterval)));
+ } else {
+ log.error("Invalid logger specified: type: " + loggerInfo.get(loggerType) + " path: " + loggerInfo.get(loggerPath) + " loggerInfo.get(loggerInterval): " + loggerInfo.get(loggerInterval));
+ }
+ return krLogger;
+ }
+
+ public void disposeKnowledgeLogger(@Disposes KnowledgeRuntimeLogger logger) {
+ logger.close();
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,118 @@
+package org.jboss.seam.drools;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.event.KnowledgeRuntimeEventManager;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.rule.AgendaEventListener;
+import org.drools.event.rule.WorkingMemoryEventListener;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.StatelessKnowledgeSession;
+import org.drools.runtime.process.WorkItemHandler;
+import org.jboss.seam.drools.config.KnowledgeSessionConfig;
+import org.jboss.seam.drools.utils.ConfigUtils;
+import org.jboss.weld.extensions.resources.ResourceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeSessionProducer
+{
+ private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionProducer.class);
+
+ @Inject BeanManager manager;
+ @Inject ResourceProvider resourceProvider;
+
+ @Produces public StatefulKnowledgeSession produceStatefulSession(@Any KnowledgeBase kbase, KnowledgeSessionConfig ksessionConfig) throws Exception {
+ StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getConfig(ksessionConfig), null);
+ addEventListeners(ksession, ksessionConfig);
+ addWorkItemHandlers(ksession, ksessionConfig);
+
+ return ksession;
+ }
+
+ @Produces public StatelessKnowledgeSession produceStatelessSession(@Any KnowledgeBase kbase, KnowledgeSessionConfig ksessionConfig) throws Exception {
+ StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getConfig(ksessionConfig));
+ addEventListeners(ksession, ksessionConfig);
+
+ return ksession;
+ }
+
+ void disposeStatefulSession(@Disposes StatefulKnowledgeSession session) {
+ session.dispose();
+ }
+
+ void disposeStatelessSession(@Disposes StatelessKnowledgeSession session) {
+ session = null;
+ }
+
+ private KnowledgeSessionConfiguration getConfig(KnowledgeSessionConfig ksessionConfig) throws Exception{
+ KnowledgeSessionConfiguration droolsKsessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+ if (ksessionConfig.getKnowledgeSessionConfig() != null && ksessionConfig.getKnowledgeSessionConfig().endsWith(".properties"))
+ {
+ Properties ksessionProp = new Properties();
+ //InputStream in = this.getClass().getClassLoader().getResourceAsStream(ksessionManagerConfig.getKnowledgeSessionConfig());
+ InputStream in = resourceProvider.loadResourceStream(ksessionConfig.getKnowledgeSessionConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeSessionrConfig: " + ksessionConfig.getKnowledgeSessionConfig());
+ }
+ ksessionProp.load(in);
+ in.close();
+ droolsKsessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(ksessionProp);
+ log.debug("KnowledgeSessionConfiguration loaded: " + ksessionConfig.getKnowledgeSessionConfig());
+ } else {
+
+ }
+ return droolsKsessionConfig;
+ }
+
+ private void addEventListeners(KnowledgeRuntimeEventManager ksession, KnowledgeSessionConfig ksessionConfig) throws Exception {
+ if(ksessionConfig.getEventListeners() != null) {
+ for(String eventListener : ksessionConfig.getEventListeners()) {
+ @SuppressWarnings("unchecked")
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+ if(eventListenerObject instanceof WorkingMemoryEventListener) {
+ ksession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof AgendaEventListener) {
+ ksession.addEventListener((AgendaEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof ProcessEventListener) {
+ ksession.addEventListener((ProcessEventListener) eventListenerObject);
+ } else {
+ log.debug("Invalid Event Listener: " + eventListener);
+ }
+ }
+ }
+ }
+
+ private void addWorkItemHandlers(StatefulKnowledgeSession ksession, KnowledgeSessionConfig ksessionConfig) {
+ if(ksessionConfig.getWorkItemHandlers() != null) {
+ for(String workItemHandlerStr : ksessionConfig.getWorkItemHandlers()) {
+ if(ConfigUtils.isValidWorkItemHandler(workItemHandlerStr)) {
+ @SuppressWarnings("unchecked")
+ Bean<WorkItemHandler> workItemHandlerBean = (Bean<WorkItemHandler>) manager.getBeans(ConfigUtils.getWorkItemHandlerType(workItemHandlerStr)).iterator().next();
+ WorkItemHandler handler = (WorkItemHandler) manager.getReference(workItemHandlerBean, WorkItemHandler.class, manager.createCreationalContext(workItemHandlerBean));
+ log.debug("Registering new WorkItemHandler: " + ConfigUtils.getWorkItemHandlerName(workItemHandlerStr));
+ ksession.getWorkItemManager().registerWorkItemHandler(ConfigUtils.getWorkItemHandlerName(workItemHandlerStr), handler);
+ } else {
+ log.warn("Invalid workitem handler configuration for: " + workItemHandlerStr);
+ }
+ }
+ }
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,20 @@
+package org.jboss.seam.drools;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.resources.ResourceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class QueryResultsProducer
+{
+ private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseProducer.class);
+
+ @Inject BeanManager manager;
+ @Inject ResourceProvider resourceProvider;
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/InsertFact.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/InsertFact.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/InsertFact.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,32 @@
+package org.jboss.seam.drools.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * Insert fact into WM or EntryPoint. Also determine firing rules decisions.
+ *
+ * @author Tihomir Surdilovic
+ */
+ at InterceptorBinding
+ at Target({TYPE, METHOD})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface InsertFact
+{
+ @Nonbinding int ksessionId() default -1;
+ @Nonbinding boolean fireAllRules() default false;
+ @Nonbinding int fireCount() default -1;
+ @Nonbinding boolean fireUntilHalt() default false;
+ @Nonbinding String entryPointName() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.annotations.flow;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * Abort the process instace.
+ *
+ * @author Tihomir Surdilovic
+ */
+ at InterceptorBinding
+ at Target({TYPE, METHOD})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface Abort
+{
+ @Nonbinding long processid();
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,31 @@
+package org.jboss.seam.drools.annotations.flow;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * Event to be signalled to the process instance or process engine directly.
+ *
+ * @author Tihomir Surdilovic
+ */
+ at InterceptorBinding
+ at Target({TYPE, METHOD})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface SignalEvent
+{
+ @Nonbinding String type() default "";
+ @Nonbinding String event() default "";
+ @Nonbinding String processId() default "";
+ @Nonbinding String sessionId() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,27 @@
+package org.jboss.seam.drools.annotations.flow;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * Starts a Rule Flow process.
+ *
+ * @author Tihomir Surdilovic
+ */
+ at InterceptorBinding
+ at Target({TYPE, METHOD})
+ at Documented
+ at Retention(RUNTIME)
+public @interface StartProcess
+{
+ @Nonbinding String processId() default "";
+ @Nonbinding String sessionId() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,77 @@
+package org.jboss.seam.drools.config;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeBaseConfig
+{
+ private String knowledgeBuilderConfig;
+ private String knowledgeBaseConfig;
+ private String[] ruleResources;
+ private String[] eventListeners;
+
+ public String getKnowledgeBuilderConfig()
+ {
+ return knowledgeBuilderConfig;
+ }
+
+ public void setKnowledgeBuilderConfig(String knowledgeBuilderConfig)
+ {
+ this.knowledgeBuilderConfig = knowledgeBuilderConfig;
+ }
+
+ public String getKnowledgeBaseConfig()
+ {
+ return knowledgeBaseConfig;
+ }
+
+ public void setKnowledgeBaseConfig(String knowledgeBaseConfig)
+ {
+ this.knowledgeBaseConfig = knowledgeBaseConfig;
+ }
+
+ public String[] getRuleResources()
+ {
+ return ruleResources;
+ }
+
+ public void setRuleResources(String[] ruleResources)
+ {
+ this.ruleResources = ruleResources;
+ }
+
+ public String[] getEventListeners()
+ {
+ return eventListeners;
+ }
+
+ public void setEventListeners(String[] eventListeners)
+ {
+ this.eventListeners = eventListeners;
+ }
+
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer();
+ buff.append("knowledgeBuilderConfig: " + knowledgeBuilderConfig + "\n").append("knowledgeBaseConfig: " + knowledgeBaseConfig + "\n");
+ if (ruleResources != null)
+ {
+ buff.append("Rule Resources:\n");
+ for (String rr : ruleResources)
+ {
+ buff.append("\t" + rr);
+ }
+ }
+ if (eventListeners != null)
+ {
+ buff.append("\nEvent Listeners: \n");
+ for (String el : eventListeners)
+ {
+ buff.append("\t" + el);
+ }
+ }
+
+ return buff.toString();
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeSessionConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeSessionConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeSessionConfig.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,65 @@
+package org.jboss.seam.drools.config;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeSessionConfig
+{
+ private String[] eventListeners;
+ private String[] workItemHandlers;
+ private String knowledgeSessionConfig;
+
+ public String[] getEventListeners()
+ {
+ return eventListeners;
+ }
+
+ public void setEventListeners(String[] eventListeners)
+ {
+ this.eventListeners = eventListeners;
+ }
+
+ public String[] getWorkItemHandlers()
+ {
+ return workItemHandlers;
+ }
+
+ public void setWorkItemHandlers(String[] workItemHandlers)
+ {
+ this.workItemHandlers = workItemHandlers;
+ }
+
+ public String getKnowledgeSessionConfig()
+ {
+ return knowledgeSessionConfig;
+ }
+
+ public void setKnowledgeSessionConfig(String knowledgeSessionConfig)
+ {
+ this.knowledgeSessionConfig = knowledgeSessionConfig;
+ }
+
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer();
+ buff.append("knowledgeSessionConfig: " + knowledgeSessionConfig + "\n");
+ if (eventListeners != null)
+ {
+ buff.append("Event Listeners:\n");
+ for (String el : eventListeners)
+ {
+ buff.append("\t" + el);
+ }
+ }
+ if (workItemHandlers != null)
+ {
+ buff.append("\nWorkitem handlers: \n");
+ for (String el : workItemHandlers)
+ {
+ buff.append("\t" + el);
+ }
+ }
+ return buff.toString();
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeBuilderErrorsEvent.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeBuilderErrorsEvent.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeBuilderErrorsEvent.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,29 @@
+package org.jboss.seam.drools.events;
+
+import org.drools.builder.KnowledgeBuilderErrors;
+
+/**
+ * This event is fires in case of KnowledgeBuilder errors.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeBuilderErrorsEvent
+{
+ private KnowledgeBuilderErrors errors;
+
+ public KnowledgeBuilderErrorsEvent(KnowledgeBuilderErrors errors)
+ {
+ this.errors = errors;
+ }
+
+ public KnowledgeBuilderErrors getErrors()
+ {
+ return errors;
+ }
+
+ public void setErrors(KnowledgeBuilderErrors errors)
+ {
+ this.errors = errors;
+ }
+
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/RuleResourceAddedEvent.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/RuleResourceAddedEvent.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/RuleResourceAddedEvent.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,26 @@
+package org.jboss.seam.drools.events;
+
+/**
+ * This event is fires when a rule resource is added.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class RuleResourceAddedEvent
+{
+ String resource;
+
+ public RuleResourceAddedEvent(String resource)
+ {
+ this.resource = resource;
+ }
+
+ public String getResource()
+ {
+ return resource;
+ }
+
+ public void setResource(String resource)
+ {
+ this.resource = resource;
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,19 @@
+package org.jboss.seam.drools.interceptor;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.seam.drools.annotations.InsertFact;
+
+ at InsertFact @Interceptor
+public class InsertInterceptor
+{
+ @AroundInvoke
+ public Object manageTransaction(InvocationContext ctx) throws Exception {
+ InsertFact insertFactAnnotation = ctx.getMethod().getAnnotation(InsertFact.class);
+ System.out.println("ksession id: " +insertFactAnnotation.ksessionId());
+
+ return ctx.proceed();
+ }
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/FactProvider.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/FactProvider.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/FactProvider.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,20 @@
+package org.jboss.seam.drools.old;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Interface for fact providers.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public interface FactProvider
+{
+ public List<Object> getFacts();
+ public void setFacts(List<Object> facts);
+
+ public Map<String, Object> getGlobals();
+ public void setGlobals(Map<String, Object> globals);
+
+}
\ No newline at end of file
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,207 @@
+package org.jboss.seam.drools.old;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Properties;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.security.auth.login.Configuration;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseConfiguration;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderConfiguration;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.event.knowledgebase.KnowledgeBaseEventListener;
+import org.drools.io.ResourceFactory;
+import org.drools.template.ObjectDataCompiler;
+import org.jboss.seam.drools.events.KnowledgeBuilderErrorsEvent;
+import org.jboss.seam.drools.events.RuleResourceAddedEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Manager component for a Drools KnowledgeBase.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeBaseManager
+{
+ /** private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseManager.class);
+
+ private KnowledgeBaseManagerConfig kbaseManagerConfig;
+
+ @Inject
+ BeanManager manager;
+
+ @Inject
+ public KnowledgeBaseManager(KnowledgeBaseManagerConfig kbaseManagerConfig) {
+ this.kbaseManagerConfig = kbaseManagerConfig;
+ }
+
+ //@Produces
+ //@ApplicationScoped
+ public KnowledgeBase createKBase() throws Exception
+ {
+ KnowledgeBase kbase;
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(getKnowledgeBuilderConfiguration());
+
+ for (String nextResource : kbaseManagerConfig.getRuleResources())
+ {
+ addResource(kbuilder, nextResource);
+ }
+
+ KnowledgeBuilderErrors kbuildererrors = kbuilder.getErrors();
+ if (kbuildererrors.size() > 0)
+ {
+ for (KnowledgeBuilderError kbuildererror : kbuildererrors)
+ {
+ log.error(kbuildererror.getMessage());
+ }
+ manager.fireEvent(new KnowledgeBuilderErrorsEvent(kbuildererrors));
+ }
+
+ kbase = KnowledgeBaseFactory.newKnowledgeBase(getKnowledgeBaseConfiguration());
+ kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+
+ if (kbaseManagerConfig.getEventListeners() != null)
+ {
+ for (String eventListener : kbaseManagerConfig.getEventListeners())
+ {
+ addEventListener(kbase, eventListener);
+ }
+ }
+ return kbase;
+ }
+
+ //public void disposeKBase(@Disposes KnowledgeBase kbase)
+ //{
+ // kbase = null;
+ // }
+
+ private void addEventListener(org.drools.KnowledgeBase kbase, String eventListener) {
+ try {
+ @SuppressWarnings("unchecked")
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof KnowledgeBaseEventListener) {
+ kbase.addEventListener((KnowledgeBaseEventListener) eventListenerObject);
+ } else {
+ log.debug("Event Listener " + eventListener + " is not of type KnowledgeBaseEventListener");
+ }
+ } catch(Exception e) {
+ log.error("Error adding event listener " + e.getMessage());
+ }
+ }
+
+ protected void addResource(KnowledgeBuilder kbuilder, String resource) throws Exception
+ {
+ if(KnowledgeBaseManagerConfig.isValidResource(resource)) {
+ ResourceType resourceType = ResourceType.getResourceType(KnowledgeBaseManagerConfig.getResourceType(resource));
+ if(KnowledgeBaseManagerConfig.isRuleTemplate(resource)) {
+ @SuppressWarnings("unchecked")
+ Bean<TemplateDataProvider> templateDataProviderBean = (Bean<TemplateDataProvider>) manager.getBeans(KnowledgeBaseManagerConfig.getTemplateData(resource)).iterator().next();
+
+ TemplateDataProvider templateDataProvider = (TemplateDataProvider) manager.getReference(templateDataProviderBean, Configuration.class, manager.createCreationalContext(templateDataProviderBean));
+
+ InputStream templateStream = this.getClass().getClassLoader().getResourceAsStream(KnowledgeBaseManagerConfig.getRuleResource(resource));
+ if (templateStream == null)
+ {
+ throw new IllegalStateException("Could not locate rule resource: " + KnowledgeBaseManagerConfig.getRuleResource(resource));
+ }
+
+ ObjectDataCompiler converter = new ObjectDataCompiler();
+ String drl = converter.compile(templateDataProvider.getTemplateData(), templateStream);
+ templateStream.close();
+ log.debug("Generated following DRL from template: " + drl);
+ Reader rdr = new StringReader(drl);
+
+ kbuilder.add(ResourceFactory.newReaderResource(rdr), resourceType);
+ } else {
+ if (KnowledgeBaseManagerConfig.getResourcePath(resource).equals(KnowledgeBaseManagerConfig.RESOURCE_TYPE_URL))
+ {
+ kbuilder.add(ResourceFactory.newUrlResource(KnowledgeBaseManagerConfig.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseManagerConfig.getRuleResource(resource)));
+ }
+ else if (KnowledgeBaseManagerConfig.getResourcePath(resource).equals(KnowledgeBaseManagerConfig.RESOURCE_TYPE_FILE))
+ {
+ kbuilder.add(ResourceFactory.newFileResource(KnowledgeBaseManagerConfig.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseManagerConfig.getRuleResource(resource)));
+ }
+ else if (KnowledgeBaseManagerConfig.getResourcePath(resource).equals(KnowledgeBaseManagerConfig.RESOURCE_TYPE_CLASSPATH))
+ {
+ kbuilder.add(ResourceFactory.newClassPathResource(KnowledgeBaseManagerConfig.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseManagerConfig.getRuleResource(resource)));
+ }
+ else
+ {
+ log.error("Invalid resource path: " + KnowledgeBaseManagerConfig.getResourcePath(resource));
+ }
+ }
+ } else {
+ log.error("Invalid resource definition: " + resource);
+ }
+ }
+
+ public KnowledgeBuilderConfiguration getKnowledgeBuilderConfiguration() throws Exception
+ {
+ KnowledgeBuilderConfiguration kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
+ if(kbaseManagerConfig.getKnowledgeBuilderConfigProp() != null) {
+ kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbaseManagerConfig.getKnowledgeBuilderConfigProp(), null);
+ log.debug("KnowledgeBuilderConfiguration loaded: " + kbaseManagerConfig.getKnowledgeBuilderConfigProp());
+ } else {
+ // Only allow resource for .properties files
+ if (kbaseManagerConfig.getKnowledgeBuilderConfig() != null && kbaseManagerConfig.getKnowledgeBuilderConfig().endsWith(".properties"))
+ {
+ Properties kbuilderProp = new Properties();
+ InputStream in = this.getClass().getClassLoader().getResourceAsStream(kbaseManagerConfig.getKnowledgeBuilderConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeBuilderConfig: " + kbaseManagerConfig.getKnowledgeBuilderConfig());
+ }
+ kbuilderProp.load(in);
+ in.close();
+ kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbuilderProp, null);
+ log.debug("KnowledgeBuilderConfiguration loaded: " + kbaseManagerConfig.getKnowledgeBuilderConfig());
+ }
+ }
+ return kbuilderconfig;
+ }
+
+ public KnowledgeBaseConfiguration getKnowledgeBaseConfiguration() throws Exception
+ {
+ KnowledgeBaseConfiguration kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
+
+ if(kbaseManagerConfig.getKnowledgeBaseConfigProp() != null) {
+ kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(kbaseManagerConfig.getKnowledgeBaseConfigProp(), null);
+ log.debug("KnowledgeBaseConfiguration loaded: " + kbaseManagerConfig.getKnowledgeBaseConfigProp());
+ } else {
+ // Only allow resource for .properties files
+ if (kbaseManagerConfig.getKnowledgeBaseConfig() != null && kbaseManagerConfig.getKnowledgeBaseConfig().endsWith(".properties"))
+ {
+ Properties kbaseProp = new Properties();
+ InputStream in = this.getClass().getClassLoader().getResourceAsStream(kbaseManagerConfig.getKnowledgeBaseConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeBaseConfig: " + kbaseManagerConfig.getKnowledgeBaseConfig());
+ }
+ kbaseProp.load(in);
+ in.close();
+ kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(kbaseProp, null);
+ log.debug("KnowledgeBaseConfiguration loaded: " + kbaseManagerConfig.getKnowledgeBaseConfig());
+ }
+ }
+ return kbaseconfig;
+ }
+**/}
\ No newline at end of file
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,116 @@
+package org.jboss.seam.drools.old;
+
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+/**
+ * KnowledgeBaseManager Configuration.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeBaseManagerConfig
+{
+ /** private static final Pattern DIVIDER = Pattern.compile(";");
+ private static final int RESOURCE_PATH = 0;
+ private static final int RESOURCE = 1;
+ private static final int RESOURCE_TYPE = 2;
+ private static final int RESOURCE_TEMPLATE_DATA = 3;
+
+ public static final String RESOURCE_TYPE_URL = "url";
+ public static final String RESOURCE_TYPE_FILE = "file";
+ public static final String RESOURCE_TYPE_CLASSPATH = "classpath";
+
+ private String knowledgeBuilderConfig;
+ private String knowledgeBaseConfig;
+ private Properties knowledgeBuilderConfigProp;
+ private Properties knowledgeBaseConfigProp;
+ private String[] ruleResources;
+ private String[] eventListeners;
+
+ public static boolean isValidResource(String resource) {
+ return DIVIDER.split(resource.trim()).length >= 3;
+ }
+
+ public static boolean isRuleTemplate(String resource) {
+ return DIVIDER.split(resource.trim()).length == 4;
+ }
+
+ public static String getResourceType(String resource) {
+ return DIVIDER.split(resource.trim())[RESOURCE_TYPE];
+ }
+
+ public static String getRuleResource(String resource) {
+ return DIVIDER.split(resource.trim())[RESOURCE];
+ }
+
+ public static String getTemplateData(String resource) {
+ return DIVIDER.split(resource.trim())[RESOURCE_TEMPLATE_DATA];
+ }
+
+ public static String getResourcePath(String resource) {
+ return DIVIDER.split(resource.trim())[RESOURCE_PATH];
+ }
+
+ public String getKnowledgeBuilderConfig()
+ {
+ return knowledgeBuilderConfig;
+ }
+
+ public void setKnowledgeBuilderConfig(String knowledgeBuilderConfig)
+ {
+ this.knowledgeBuilderConfig = knowledgeBuilderConfig;
+ }
+
+ public String getKnowledgeBaseConfig()
+ {
+ return knowledgeBaseConfig;
+ }
+
+ public void setKnowledgeBaseConfig(String knowledgeBaseConfig)
+ {
+ this.knowledgeBaseConfig = knowledgeBaseConfig;
+ }
+
+ public String[] getRuleResources()
+ {
+ return ruleResources;
+ }
+
+ public void setRuleResources(String[] ruleResources)
+ {
+ this.ruleResources = ruleResources;
+ }
+
+ public String[] getEventListeners()
+ {
+ return eventListeners;
+ }
+
+ public void setEventListeners(String[] eventListeners)
+ {
+ this.eventListeners = eventListeners;
+ }
+
+ public Properties getKnowledgeBuilderConfigProp()
+ {
+ return knowledgeBuilderConfigProp;
+ }
+
+ public void setKnowledgeBuilderConfigProp(Properties knowledgeBuilderConfigProp)
+ {
+ this.knowledgeBuilderConfigProp = knowledgeBuilderConfigProp;
+ }
+
+ public Properties getKnowledgeBaseConfigProp()
+ {
+ return knowledgeBaseConfigProp;
+ }
+
+ public void setKnowledgeBaseConfigProp(Properties knowledgeBaseConfigProp)
+ {
+ this.knowledgeBaseConfigProp = knowledgeBaseConfigProp;
+ }
+
+
+
+**/ }
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,186 @@
+package org.jboss.seam.drools.old;
+
+import java.io.InputStream;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
+
+import java.lang.annotation.Annotation;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.security.auth.login.Configuration;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.rule.AgendaEventListener;
+import org.drools.event.rule.WorkingMemoryEventListener;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.StatelessKnowledgeSession;
+import org.drools.runtime.process.WorkItemHandler;
+//import org.jboss.seam.drools.events.KnowledgeSessionCreatedEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Manager component for a Drools Knowledge Sessions.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeSessionManager
+{
+ /** private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionManager.class);
+
+ private KnowledgeSessionManagerConfig ksessionManagerConfig;
+ private Map<Integer, KnowledgeRuntimeLogger> statefulKnowledgeLoggers = new Hashtable<Integer, KnowledgeRuntimeLogger>();
+
+ @Inject
+ BeanManager manager;
+
+ @Inject
+ public KnowledgeSessionManager(KnowledgeSessionManagerConfig ksessionManagerConfig)
+ {
+ this.ksessionManagerConfig = ksessionManagerConfig;
+ }
+
+ //@Produces
+ //@Any
+ public StatefulKnowledgeSession getStatefulSession(InjectionPoint ip, Instance<KnowledgeBase> kbase) throws Exception
+ {
+ StatefulKnowledgeSession ksession = kbase.select(ip.getQualifiers().toArray(new Annotation[0])).get().newStatefulKnowledgeSession(getKSessionConfig(), null);
+ addEventListeners(ksession);
+ addWorkItemHandlers(ksession);
+ addAuditLog(ksession);
+ manager.fireEvent(new KnowledgeSessionCreatedEvent(ksession.getId()));
+ return ksession;
+ }
+
+ //public void disposeStatefulSession(@Disposes StatefulKnowledgeSession statefulSession)
+ //{
+ // if (statefulKnowledgeLoggers.get(statefulSession.getId()) != null)
+ // {
+ // statefulKnowledgeLoggers.get(statefulSession.getId()).close();
+ // }
+ // statefulSession.dispose();
+ // }
+
+ @Produces
+ @Any
+ public StatelessKnowledgeSession getStatelessSession(InjectionPoint ip, Instance<KnowledgeBase> kbase) throws Exception
+ {
+ StatelessKnowledgeSession ksession = kbase.select(ip.getQualifiers().toArray(new Annotation[0])).get().newStatelessKnowledgeSession(getKSessionConfig());
+ addEventListeners(ksession);
+ manager.fireEvent(new KnowledgeSessionCreatedEvent(-1));
+ return ksession;
+ }
+
+ private KnowledgeSessionConfiguration getKSessionConfig() throws Exception
+ {
+ KnowledgeSessionConfiguration ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+ if(ksessionManagerConfig.getKnowledgeSessionConfigProp() != null) {
+ ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(ksessionManagerConfig.getKnowledgeSessionConfigProp());
+ } else {
+ // Only allow resource for .properties files
+ if (ksessionManagerConfig.getKnowledgeSessionConfig() != null && ksessionManagerConfig.getKnowledgeSessionConfig().endsWith(".properties"))
+ {
+ Properties ksessionProp = new Properties();
+ InputStream in = this.getClass().getClassLoader().getResourceAsStream(ksessionManagerConfig.getKnowledgeSessionConfig());
+ if (in == null)
+ {
+ throw new IllegalStateException("Could not locate knowledgeSessionrConfig: " + ksessionManagerConfig.getKnowledgeSessionConfig());
+ }
+ ksessionProp.load(in);
+ in.close();
+ ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(ksessionProp);
+ log.debug("KnowledgeSessionConfiguration loaded: " + ksessionManagerConfig.getKnowledgeSessionConfig());
+ }
+ }
+ return ksessionConfig;
+ }
+
+
+ private void addAuditLog(StatefulKnowledgeSession ksession) throws Exception {
+ if(ksessionManagerConfig.getAuditLog() != null) {
+ if(KnowledgeSessionManagerConfig.isFileLogger(ksessionManagerConfig.getAuditLog())) {
+ String logName = KnowledgeSessionManagerConfig.getFileLoggerPath(ksessionManagerConfig.getAuditLog()) + System.currentTimeMillis();
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, logName);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else if(KnowledgeSessionManagerConfig.isConsoleLogger(ksessionManagerConfig.getAuditLog())) {
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else if(KnowledgeSessionManagerConfig.isThreadedLogger(ksessionManagerConfig.getAuditLog())) {
+ String logName = KnowledgeSessionManagerConfig.getThreadedLoggerPath(ksessionManagerConfig.getAuditLog()) + System.currentTimeMillis();
+ int interval = KnowledgeSessionManagerConfig.getThreadedLoggerInterval(ksessionManagerConfig.getAuditLog());
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, logName, interval);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else {
+ log.warn("Invalid logger specified: " + ksessionManagerConfig.getAuditLog());
+ }
+ }
+ }
+
+ public void addEventListeners(StatefulKnowledgeSession ksession) throws Exception {
+ if(ksessionManagerConfig.getEventListeners() != null) {
+ for(String eventListener : ksessionManagerConfig.getEventListeners()) {
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof WorkingMemoryEventListener) {
+ ksession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof AgendaEventListener) {
+ ksession.addEventListener((AgendaEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof ProcessEventListener) {
+ ksession.addEventListener((ProcessEventListener) eventListenerObject);
+ } else {
+ log.debug("Invalid Event Listener: " + eventListener);
+ }
+ }
+ }
+ }
+
+ public void addEventListeners(StatelessKnowledgeSession ksession) throws Exception{
+ if(ksessionManagerConfig.getEventListeners() != null) {
+ for(String eventListener : ksessionManagerConfig.getEventListeners()) {
+ @SuppressWarnings("unchecked")
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof WorkingMemoryEventListener) {
+ ksession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof AgendaEventListener) {
+ ksession.addEventListener((AgendaEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof ProcessEventListener) {
+ ksession.addEventListener((ProcessEventListener) eventListenerObject);
+ } else {
+ log.debug("Invalid Event Listener: " + eventListener);
+ }
+ }
+ }
+ }
+
+ public void addWorkItemHandlers(StatefulKnowledgeSession ksession) {
+ if(ksessionManagerConfig.getWorkItemHandlers() != null) {
+ for(String workItemHandlerStr : ksessionManagerConfig.getWorkItemHandlers()) {
+ if(KnowledgeSessionManagerConfig.isValidWorkItemHandler(workItemHandlerStr)) {
+ @SuppressWarnings("unchecked")
+ Bean<WorkItemHandler> workItemHandlerBean = (Bean<WorkItemHandler>) manager.getBeans(KnowledgeSessionManagerConfig.getWorkItemHandlerType(workItemHandlerStr)).iterator().next();
+ WorkItemHandler handler = (WorkItemHandler) manager.getReference(workItemHandlerBean, Configuration.class, manager.createCreationalContext(workItemHandlerBean));
+ log.debug("Registering new WorkItemHandler: " + KnowledgeSessionManagerConfig.getWorkItemHandlerName(workItemHandlerStr));
+ ksession.getWorkItemManager().registerWorkItemHandler(KnowledgeSessionManagerConfig.getWorkItemHandlerName(workItemHandlerStr), handler);
+ }
+ }
+ }
+ }
+
+
+**/}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,106 @@
+package org.jboss.seam.drools.old;
+
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+/**
+ * KnowledgeSessionManager Configuration.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeSessionManagerConfig
+{
+ /** private static final Pattern DIVIDER = Pattern.compile(";");
+ private static final int WORKITEMHANDLER_NAME = 0;
+ private static final int WORKITEMHANDLER_TYPE = 1;
+ private static final int AUDIT_LOG_TYPE = 0;
+ private static final int AUDIT_LOG_INFO = 1;
+ private static final int AUDIT_LOG_INTERVAL = 2;
+ private static final String AUDIT_LOG_TYPE_FILE = "file";
+ private static final String AUDIT_LOG_TYPE_CONSOLE = "console";
+ private static final String AUDIT_LOG_TYPE_THREADED = "threaded";
+
+ private String[] eventListeners;
+ private String[] workItemHandlers;
+ private String knowledgeSessionConfig;
+ private Properties knowledgeSessionConfigProp;
+ private String auditLog;
+
+ public static String getWorkItemHandlerName(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_NAME];
+ }
+
+ public static String getWorkItemHandlerType(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_TYPE];
+ }
+
+ public static boolean isValidWorkItemHandler(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim()).length == 2;
+ }
+
+ public static boolean isFileLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_FILE;
+ }
+
+ public static boolean isConsoleLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_CONSOLE;
+ }
+
+ public static boolean isThreadedLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_THREADED;
+ }
+
+ public static String getFileLoggerPath(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_INFO];
+ }
+
+ public static String getThreadedLoggerPath(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_INFO];
+ }
+
+ public static int getThreadedLoggerInterval(String auditLog) {
+ return Integer.parseInt(DIVIDER.split(auditLog.trim())[AUDIT_LOG_INTERVAL]);
+ }
+
+ public String[] getEventListeners()
+ {
+ return eventListeners;
+ }
+ public void setEventListeners(String[] eventListeners)
+ {
+ this.eventListeners = eventListeners;
+ }
+ public String[] getWorkItemHandlers()
+ {
+ return workItemHandlers;
+ }
+ public void setWorkItemHandlers(String[] workItemHandlers)
+ {
+ this.workItemHandlers = workItemHandlers;
+ }
+ public String getKnowledgeSessionConfig()
+ {
+ return knowledgeSessionConfig;
+ }
+ public void setKnowledgeSessionConfig(String knowledgeSessionConfig)
+ {
+ this.knowledgeSessionConfig = knowledgeSessionConfig;
+ }
+ public String getAuditLog()
+ {
+ return auditLog;
+ }
+ public void setAuditLog(String auditLog)
+ {
+ this.auditLog = auditLog;
+ }
+ public Properties getKnowledgeSessionConfigProp()
+ {
+ return knowledgeSessionConfigProp;
+ }
+ public void setKnowledgeSessionConfigProp(Properties knowledgeSessionConfigProp)
+ {
+ this.knowledgeSessionConfigProp = knowledgeSessionConfigProp;
+ }
+
+**/}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/TemplateDataProvider.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/TemplateDataProvider.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/TemplateDataProvider.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,14 @@
+package org.jboss.seam.drools.old;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Interface for template data providers.
+ *
+ * @author Tihomir Surdilovic
+ */
+public interface TemplateDataProvider
+{
+ public Collection<Map<String, Object>> getTemplateData();
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KAgentProduced.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KAgentProduced.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KAgentProduced.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.qualifiers;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifier for Drools KnowledgeBase produced by the KnowledgeAgent.
+ * @author Tihomir Surdilovic
+ */
+ at Qualifier
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KAgentProduced
+{
+
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.qualifiers;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+ at Qualifier
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KBase
+{
+ String value() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.qualifiers;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+ at Qualifier
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KBaseConfig
+{
+ String value() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KSession.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KSession.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KSession.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.qualifiers;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+ at Qualifier
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KSession
+{
+ String value() default "";
+}
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils/ConfigUtils.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils/ConfigUtils.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils/ConfigUtils.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,73 @@
+package org.jboss.seam.drools.utils;
+
+import java.util.regex.Pattern;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+public class ConfigUtils
+{
+ private static final Pattern DIVIDER = Pattern.compile(":");
+ // KBase config
+ private static final int RESOURCE_PATH = 0;
+ private static final int RESOURCE = 1;
+ private static final int RESOURCE_TYPE = 2;
+ private static final int RESOURCE_TEMPLATE_DATA = 3;
+
+ public static final String RESOURCE_TYPE_URL = "url";
+ public static final String RESOURCE_TYPE_FILE = "file";
+ public static final String RESOURCE_TYPE_CLASSPATH = "classpath";
+
+ public static boolean isValidResource(String resource)
+ {
+ return DIVIDER.split(resource.trim()).length >= 3;
+ }
+
+ public static boolean isRuleTemplate(String resource)
+ {
+ return DIVIDER.split(resource.trim()).length == 4;
+ }
+
+ public static String getResourceType(String resource)
+ {
+ return DIVIDER.split(resource.trim())[RESOURCE_TYPE];
+ }
+
+ public static String getRuleResource(String resource)
+ {
+ return DIVIDER.split(resource.trim())[RESOURCE];
+ }
+
+ public static String getTemplateData(String resource)
+ {
+ return DIVIDER.split(resource.trim())[RESOURCE_TEMPLATE_DATA];
+ }
+
+ public static String getResourcePath(String resource)
+ {
+ return DIVIDER.split(resource.trim())[RESOURCE_PATH];
+ }
+
+ // KSession config
+ private static final int WORKITEMHANDLER_NAME = 0;
+ private static final int WORKITEMHANDLER_TYPE = 1;
+
+ public static String getWorkItemHandlerName(String workItemHandlerStr)
+ {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_NAME];
+ }
+
+ public static String getWorkItemHandlerType(String workItemHandlerStr)
+ {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_TYPE];
+ }
+
+ public static boolean isValidWorkItemHandler(String workItemHandlerStr)
+ {
+ return DIVIDER.split(workItemHandlerStr.trim()).length == 2;
+ }
+
+ // KAgent config
+
+}
Added: modules/drools/trunk/impl/src/main/resources/META-INF/javax.enterprise.inject.spi.Extension
===================================================================
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,39 @@
+package org.jboss.seam.drools.test.insertion;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.drools.interceptor.InsertInterceptor;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.formatter.Formatters;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class InsertInterceptorTest
+{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ String pkgPath = InsertInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/");
+ JavaArchive archive = Archives.create("test.jar", JavaArchive.class)
+ .addClasses(InsertInterceptor.class, InsertionBean.class)
+ .addManifestResource(pkgPath + "/InsertInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
+ System.out.println(archive.toString(Formatters.VERBOSE));
+ return archive;
+ }
+
+ @Inject InsertionBean insertionBean;
+
+ @Test
+ public void testInsertFactHappens() {
+ String result = insertionBean.insertResultAsFact();
+ assertTrue(result.equals("abc")); //TODO finish this test
+ }
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,11 @@
+package org.jboss.seam.drools.test.insertion;
+
+import org.jboss.seam.drools.annotations.InsertFact;
+
+public class InsertionBean
+{
+ @InsertFact(ksessionId=123)
+ public String insertResultAsFact() {
+ return "abc";
+ }
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,25 @@
+package org.jboss.seam.drools.test.kbase;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface ForKBaseTest
+{
+
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,75 @@
+package org.jboss.seam.drools.test.kbase;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import static org.junit.Assert.assertNotNull;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import junit.framework.Assert;
+
+import org.drools.KnowledgeBase;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.drools.KnowledgeBaseProducer;
+import org.jboss.seam.drools.config.KnowledgeBaseConfig;
+import org.jboss.seam.drools.qualifiers.KBase;
+import org.jboss.seam.drools.qualifiers.KBaseConfig;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.formatter.Formatters;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.extensions.resources.ResourceProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class KBaseTest
+{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ String pkgPath = KBaseTest.class.getPackage().getName().replaceAll("\\.", "/");
+ JavaArchive archive = Archives.create("test.jar", JavaArchive.class)
+ .addPackages(true, KnowledgeBaseProducer.class.getPackage())
+ .addPackages(true, ResourceProvider.class.getPackage())
+ .addClass(ForKBaseTest.class)
+ .addResource(pkgPath + "/kbasetest.drl", ArchivePaths.create("kbasetest.drl"))
+ .addResource(pkgPath + "/kbuilderconfig.properties", ArchivePaths.create("kbuilderconfig.properties"))
+ .addResource(pkgPath + "/kbaseconfig.properties", ArchivePaths.create("kbaseconfig.properties"))
+ .addManifestResource(pkgPath + "/KBaseTest-beans.xml", ArchivePaths.create("beans.xml"));
+ System.out.println(archive.toString(Formatters.VERBOSE));
+ return archive;
+ }
+
+ //@Inject @Any Instance<KnowledgeBaseConfig> kbaseConfigResolver;
+ @Inject @ForKBaseTest KnowledgeBaseConfig config;
+ @Inject @ForKBaseTest KnowledgeBase kbase;
+
+ @Test
+ public void testKBaseConfig() {
+ //Assert.assertFalse(kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).isUnsatisfied());
+ //KnowledgeBaseConfig kbaseConfig = kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).get();
+ assertNotNull(config);
+ System.out.println("\n\n\n**** " + config.toString() + "********\n\n\n");
+ }
+
+ @Test
+ public void testKBase() {
+ assertNotNull(kbase);
+ System.out.println("KBASE: " + kbase.toString());
+ }
+
+// static class KBaseConfigBinding extends AnnotationLiteral<ForKBaseTest> implements KBaseConfig
+// {
+// private String value = null;
+// public KBaseConfigBinding(String value)
+// {
+// this.value = value;
+// }
+//
+// public String value() {
+// return value;
+// }
+// }
+}
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/InsertInterceptorTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/InsertInterceptorTest-beans.xml (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/InsertInterceptorTest-beans.xml 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,10 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+ <interceptors>
+ <class>org.jboss.seam.drools.interceptor.InsertInterceptor</class>
+ </interceptors>
+
+</beans>
\ No newline at end of file
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,33 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:s="urn:java:seam:core"
+ xmlns:drools="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+ xmlns:test="urn:java:org.jboss.seam.drools.test.kbase">
+
+ <drools:KnowledgeBaseConfig>
+ <s:overrides/>
+ <test:ForKBaseTest/>
+ <drools:knowledgeBuilderConfig>kbuilderconfig.properties</drools:knowledgeBuilderConfig>
+ <drools:knowledgeBaseConfig>kbaseconfig.properties</drools:knowledgeBaseConfig>
+ <drools:ruleResources>
+ <s:value>classpath:kbasetest.drl:DRL</s:value>
+ </drools:ruleResources>
+ <drools:eventListeners>
+ <s:value>org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener</s:value>
+ </drools:eventListeners>
+ </drools:KnowledgeBaseConfig>
+
+ <drools:KnowledgeBaseProducer>
+ <s:specializes/>
+ <drools:produceKBase>
+ <test:ForKBaseTest/>
+ <s:parameters>
+ <drools:KnowledgeBaseConfig>
+ <s:Inject/>
+ <test:ForKBaseTest/>
+ </drools:KnowledgeBaseConfig>
+ </s:parameters>
+ </drools:produceKBase>
+ </drools:KnowledgeBaseProducer>
+
+</beans>
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbaseconfig.properties
===================================================================
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl 2010-04-07 03:18:58 UTC (rev 12409)
@@ -0,0 +1,6 @@
+package org.jboss.seam.drools.kbase
+
+rule "dummy"
+ then
+ System.out.println("in dummy action");
+end
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties
===================================================================
Modified: modules/drools/trunk/pom.xml
===================================================================
--- modules/drools/trunk/pom.xml 2010-04-07 03:05:52 UTC (rev 12408)
+++ modules/drools/trunk/pom.xml 2010-04-07 03:18:58 UTC (rev 12409)
@@ -15,7 +15,8 @@
<name>Seam Drools Parent</name>
<modules>
- <module>core</module>
+ <module>api</module>
+ <module>impl</module>
<module>docs</module>
<!-- <module>examples</module> -->
</modules>
@@ -35,7 +36,7 @@
</developers>
<properties>
- <arquillian.version>1.0.0.Alpha1</arquillian.version>
+ <arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
</properties>
<build>
@@ -105,6 +106,11 @@
<artifactId>drools-workitems</artifactId>
<version>5.1.0.M1</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0.Alpha1</version>
+ </dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
@@ -112,6 +118,11 @@
<version>4.8.1</version>
</dependency>
<dependency>
+ <groupId>org.jboss.seam.xml</groupId>
+ <artifactId>seam-xml-bean-config</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<version>${arquillian.version}</version>
Modified: modules/drools/trunk/readme.txt
===================================================================
--- modules/drools/trunk/readme.txt 2010-04-07 03:05:52 UTC (rev 12408)
+++ modules/drools/trunk/readme.txt 2010-04-07 03:18:58 UTC (rev 12409)
@@ -1,64 +1,42 @@
-Seam Drools 3.0.0 Beta 1
-==========================
-Seam Drools provides integration with the Drools 5 API.
+ Seam Drools Module
+ 3.0.0 SNAPSHOT
+ What is it?
+ ===========
-Contents of distribution
-========================
+The Seam 3 Drools Module provided integration with Drools 5.
+ Contents of distribution
+ ========================
-doc/
+ docs/
- API Docs and reference guide.
+ API Docs and reference guide.
-examples/
+ examples/
- Seam Drools Examples
+ Seam Drools examples
-lib/
-
- Seam Drools jar files
+ ...
-Licensing
-=========
+ Licensing
+ =========
-This distribution, as a whole, is licensed under the terms of the GNU Lesser General Public License
-(LGPL) Version 2.1, the text of which is contained in the file lgpl.txt.
+ This distribution, as a whole, is licensed under the terms of the Apache
+ License, Version 2.0 (see apl.txt).
-Seam Remoting URLs
-==================
-Seam Framework Home Page: http://www.seamframework.org
-Downloads: http://www.seamframework.org/Download/SeamDownloads
-Forums: http://www.seamframework.org/Community/SeamUsers
-Source Code: http://anonsvn.jboss.org/repos/seam/modules/drools/
-Issue Tracking: http://jira.jboss.org/jira/browse/SEAMDROOLS
+ Seam Drools URLs
+ ===============
-Release Notes
-=============
+ Seam 3 Faces Module: http://www.sfwk.org/Seam3/DroolsModule
+ Seam 3 Home Page: http://www.sfwk.org/Seam3
+ Downloads: http://www.sfwk.org/Seam3/DistributionDownloads
+ Forums: http://www.sfwk.org/Community/Seam3Users
+ Source Code: http://anonsvn.jboss.org/repos/seam/modules/drools
+ Issue Tracking: http://jira.jboss.org/jira/browse/SEAMDROOLS
-Version 3.0.0 Beta 1
---------------------
-First beta release of Seam Drools 3.x, ported from Seam 2.x to CDI.
+ Release Notes
+ =============
-
-* If using Maven, some artifacts may only be available in the JBoss Repository. To allow Seam Remoting to correctly function, add the JBoss Repository to Maven. Edit your ~/.m2/settings.xml, and add the following entry:
-
- <profile>
- <id>jboss.repository</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <url>http://repository.jboss.org/maven2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- </profile>
+ ...
More information about the seam-commits
mailing list