Seam SVN: r12411 - modules/servlet/trunk/src/main/java/org/jboss/seam/servlet.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-07 02:28:08 -0400 (Wed, 07 Apr 2010)
New Revision: 12411
Modified:
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java
Log:
coding conventions
Modified: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java 2010-04-07 06:27:27 UTC (rev 12410)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java 2010-04-07 06:28:08 UTC (rev 12411)
@@ -24,8 +24,8 @@
* @author Nicklas Karlsson
*
*/
-@SessionScoped
-public class HttpManager implements Serializable
+
+public @SessionScoped class HttpManager implements Serializable
{
private static final long serialVersionUID = 5191073522575178427L;
14 years, 8 months
Seam SVN: r12410 - in modules/faces/trunk/impl/src: main/java/org/jboss/seam/faces/context/conversation and 5 other directories.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-07 02:27:27 -0400 (Wed, 07 Apr 2010)
New Revision: 12410
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/NamedConversationAliasProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/ExternalContextProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/FacesContextProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/NavigationHandlerProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java
Log:
qualifier/annotation placement conventions
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -36,23 +36,21 @@
package org.jboss.seam.faces.component;
import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.ValueExpression;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodBinding;
import javax.faces.el.MethodNotFoundException;
-import javax.el.MethodExpression;
-import javax.el.MethodInfo;
-import javax.el.ELException;
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-
-import java.util.Arrays;
-import java.lang.reflect.Method;
-
/**
* <p>
* Wrap a MethodExpression instance and expose it as a MethodBinding
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -23,9 +23,7 @@
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
-@ConversationBoundary
-@Interceptor
-public class ConversationBoundaryInterceptor implements Serializable
+public @ConversationBoundary @Interceptor class ConversationBoundaryInterceptor implements Serializable
{
private static final long serialVersionUID = -2729227895205287477L;
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/NamedConversationAliasProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/NamedConversationAliasProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/conversation/NamedConversationAliasProducer.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -14,10 +14,7 @@
*/
public class NamedConversationAliasProducer
{
- public @Produces
- @Named
- @Typed(/* no types - prevents injection */)
- Conversation getConversation(final Conversation conversation)
+ public @Produces @Named @Typed(/* no types - prevents injection */) Conversation getConversation(final Conversation conversation)
{
return conversation;
}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/ExternalContextProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/ExternalContextProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/ExternalContextProducer.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -28,9 +28,7 @@
*/
public class ExternalContextProducer
{
- public @Produces
- @RequestScoped
- ExternalContext getExternalContext(final FacesContext context)
+ public @Produces @RequestScoped ExternalContext getExternalContext(final FacesContext context)
{
return context.getExternalContext();
}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/FacesContextProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/FacesContextProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/FacesContextProducer.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -48,9 +48,7 @@
*/
public class FacesContextProducer
{
- public @Produces
- @RequestScoped
- FacesContext getFacesContext()
+ public @Produces @RequestScoped FacesContext getFacesContext()
{
FacesContext ctx = FacesContext.getCurrentInstance();
if (ctx == null)
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/NavigationHandlerProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/NavigationHandlerProducer.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/NavigationHandlerProducer.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -21,9 +21,7 @@
@Inject
FacesContext context;
- public @Produces
- @RequestScoped
- NavigationHandler getNavigationHandler()
+ public @Produces @RequestScoped NavigationHandler getNavigationHandler()
{
if (context != null)
{
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -42,8 +42,7 @@
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
*
*/
-@ApplicationScoped
-public class PhaseEventBridge extends BeanManagerAware implements PhaseListener
+public @ApplicationScoped class PhaseEventBridge extends BeanManagerAware implements PhaseListener
{
private static final long serialVersionUID = -6181019551463318453L;
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -32,8 +32,7 @@
*
* @author Nicklas Karlsson
*/
-@ApplicationScoped
-public class SystemEventBridge extends BeanManagerAware implements SystemEventListener
+public @ApplicationScoped class SystemEventBridge extends BeanManagerAware implements SystemEventListener
{
public boolean isListenerForSource(final Object source)
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -9,7 +9,6 @@
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
*
*/
-@RequestScoped
-public class ImproperlyAnnotatedBean
+public @RequestScoped class ImproperlyAnnotatedBean
{
}
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -13,8 +13,7 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*/
-@RequestScoped
-public class ConversationalBean
+public @RequestScoped class ConversationalBean
{
@Inject
Conversation conversation;
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -20,8 +20,7 @@
import org.jboss.seam.faces.event.qualifier.RestoreView;
import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-@ApplicationScoped
-public class PhaseEventObserver
+public @ApplicationScoped class PhaseEventObserver
{
private Map<String, List<PhaseId>> observations = new HashMap<String, List<PhaseId>>();
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java 2010-04-07 03:18:58 UTC (rev 12409)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java 2010-04-07 06:27:27 UTC (rev 12410)
@@ -9,8 +9,7 @@
import javax.faces.event.PreDestroyApplicationEvent;
import javax.faces.event.PreDestroyCustomScopeEvent;
-@ApplicationScoped
-public class SystemEventObserver
+public @ApplicationScoped class SystemEventObserver
{
public static boolean componentSystemEvent;
public static boolean excecptionQueuedEvent;
14 years, 8 months
Seam SVN: r12409 - in modules/drools/trunk: impl and 35 other directories.
by seam-commits@lists.jboss.org
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
+ */
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Documented
+@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;
+
+@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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@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;
+
+(a)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;
+
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@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;
+
+(a)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>
+ ...
14 years, 8 months
Seam SVN: r12408 - modules/drools/trunk.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-06 23:05:52 -0400 (Tue, 06 Apr 2010)
New Revision: 12408
Removed:
modules/drools/trunk/impl/
Log:
14 years, 8 months
Seam SVN: r12407 - modules/drools/trunk.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-06 23:05:11 -0400 (Tue, 06 Apr 2010)
New Revision: 12407
Removed:
modules/drools/trunk/core/
Log:
deleted
14 years, 8 months
Seam SVN: r12406 - modules/drools/trunk.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-06 23:04:49 -0400 (Tue, 06 Apr 2010)
New Revision: 12406
Removed:
modules/drools/trunk/.settings/
Log:
deleted
14 years, 8 months
Seam SVN: r12405 - in modules/drools/trunk: impl and 20 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-06 22:52:49 -0400 (Tue, 06 Apr 2010)
New Revision: 12405
Added:
modules/drools/trunk/core/
modules/drools/trunk/impl/
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/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/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/config/KnowledgeSessionConfig.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/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/META-INF/javax.enterprise.inject.spi.Extension
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/kbase/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java
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
Removed:
modules/drools/trunk/core/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotation/InsertFact.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotation/flow/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeSessionCreatedEvent.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifier/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/util/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/insertion/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/kbase/
modules/drools/trunk/impl/src/test/resources/META-INF/beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/insertion/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/kbase/
Modified:
modules/drools/trunk/impl/pom.xml
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
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/KnowledgeBaseConfig.java
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/old/KnowledgeSessionManager.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/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/KBaseTest.java
Log:
Module Anatomy
Copied: modules/drools/trunk/impl (from rev 12376, modules/drools/trunk/core)
Modified: modules/drools/trunk/impl/pom.xml
===================================================================
--- modules/drools/trunk/core/pom.xml 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/pom.xml 2010-04-07 02:52:49 UTC (rev 12405)
@@ -9,10 +9,10 @@
</parent>
<groupId>org.jboss.seam.drools</groupId>
- <artifactId>seam-drools-core</artifactId>
+ <artifactId>seam-drools-impl</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Seam Drools Core</name>
+ <name>Seam Drools Module Core Implementation</name>
<repositories>
<repository>
@@ -78,7 +78,7 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-extensions</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
@@ -89,7 +89,6 @@
<dependency>
<groupId>org.jboss.seam.xml</groupId>
<artifactId>seam-xml-bean-config</artifactId>
- <version>3.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -102,6 +101,13 @@
<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>
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 02:52:49 UTC (rev 12405)
@@ -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 02:52:49 UTC (rev 12405)
@@ -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;
+}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -3,6 +3,8 @@
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;
@@ -21,6 +23,7 @@
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;
@@ -36,8 +39,7 @@
@Inject BeanManager manager;
@Inject ResourceProvider resourceProvider;
- @Produces
- public KnowledgeBase produceKBase(KnowledgeBaseConfig kbaseConfig) throws Exception
+ @Produces public KnowledgeBase produceKBase(KnowledgeBaseConfig kbaseConfig) throws Exception
{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(getKnowledgeBuilderConfiguration(kbaseConfig));
@@ -68,6 +70,11 @@
}
return kbase;
}
+
+ public void disposeKBase(@Disposes @Any KnowledgeBase kbase) {
+ log.info("Disposing Knowledge Base");
+ kbase = null;
+ }
private KnowledgeBuilderConfiguration getKnowledgeBuilderConfiguration(KnowledgeBaseConfig kbaseConfig) throws Exception
{
@@ -84,6 +91,8 @@
in.close();
droolsKbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbuilderProp, null);
log.debug("KnowledgeBuilderConfiguration loaded: " + kbaseConfig.getKnowledgeBuilderConfig());
+ } else {
+ log.warn("Invalid config type: " + kbaseConfig.getKnowledgeBuilderConfig());
}
return droolsKbuilderConfig;
}
@@ -110,26 +119,26 @@
private void addResource(KnowledgeBuilder kbuilder, String resource) throws Exception
{
//TODO add support for drools templates definition!
- ResourceType resourceType = ResourceType.getResourceType(KnowledgeBaseConfig.getResourceType(resource));
- if(KnowledgeBaseConfig.isValidResource(resource)) {
- if (KnowledgeBaseConfig.getResourcePath(resource).equals(KnowledgeBaseConfig.RESOURCE_TYPE_URL))
+ ResourceType resourceType = ResourceType.getResourceType(ConfigUtils.getResourceType(resource));
+ if(ConfigUtils.isValidResource(resource)) {
+ if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_URL))
{
- kbuilder.add(ResourceFactory.newUrlResource(KnowledgeBaseConfig.getRuleResource(resource)), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseConfig.getRuleResource(resource)));
+ kbuilder.add(ResourceFactory.newUrlResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
}
- else if (KnowledgeBaseConfig.getResourcePath(resource).equals(KnowledgeBaseConfig.RESOURCE_TYPE_FILE))
+ else if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_FILE))
{
- kbuilder.add(ResourceFactory.newFileResource(KnowledgeBaseConfig.getRuleResource(resource)), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseConfig.getRuleResource(resource)));
+ kbuilder.add(ResourceFactory.newFileResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
}
- else if (KnowledgeBaseConfig.getResourcePath(resource).equals(KnowledgeBaseConfig.RESOURCE_TYPE_CLASSPATH))
+ else if (ConfigUtils.getResourcePath(resource).equals(ConfigUtils.RESOURCE_TYPE_CLASSPATH))
{
- kbuilder.add(ResourceFactory.newClassPathResource(KnowledgeBaseConfig.getRuleResource(resource)), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(KnowledgeBaseConfig.getRuleResource(resource)));
+ kbuilder.add(ResourceFactory.newClassPathResource(ConfigUtils.getRuleResource(resource)), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(ConfigUtils.getRuleResource(resource)));
}
else
{
- log.error("Invalid resource path: " + KnowledgeBaseConfig.getResourcePath(resource));
+ log.error("Invalid resource path: " + ConfigUtils .getResourcePath(resource));
}
} else {
log.error("Invalid resource definition: " + resource);
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 02:52:49 UTC (rev 12405)
@@ -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 02:52:49 UTC (rev 12405)
@@ -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 02:52:49 UTC (rev 12405)
@@ -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;
+}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotation/InsertFact.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/InsertFact.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotation/InsertFact.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,32 +0,0 @@
-package org.jboss.seam.drools.annotation;
-
-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
- */
-@InterceptorBinding
-@Target({TYPE, METHOD})
-@Documented
-@Retention(RUNTIME)
-@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 "";
-}
Copied: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/InsertFact.java (from rev 12376, modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/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 02:52:49 UTC (rev 12405)
@@ -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
+ */
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Documented
+@Retention(RUNTIME)
+@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 "";
+}
Copied: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow (from rev 12376, modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/flow)
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/flow/Abort.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/Abort.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.annotation.flow;
+package org.jboss.seam.drools.annotations.flow;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/flow/SignalEvent.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/SignalEvent.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.annotation.flow;
+package org.jboss.seam.drools.annotations.flow;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/annotation/flow/StartProcess.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/annotations/flow/StartProcess.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.annotation.flow;
+package org.jboss.seam.drools.annotations.flow;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/KnowledgeBaseConfig.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,67 +1,15 @@
package org.jboss.seam.drools.config;
-import java.util.regex.Pattern;
-
/**
*
* @author Tihomir Surdilovic
*/
public class KnowledgeBaseConfig
-{
- 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";
-
- 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];
- }
-
+{
private String knowledgeBuilderConfig;
private String knowledgeBaseConfig;
private String[] ruleResources;
private String[] eventListeners;
-
- public String toString() {
- StringBuffer buff = new StringBuffer();
- buff.append("knowledgeBuilderConfig: " + getKnowledgeBuilderConfig() + "\n")
- .append("knowledgeBaseConfig: " + getKnowledgeBaseConfig() + "\n")
- .append("Rule Resources:\n");
- for(String rr : getRuleResources()) {
- buff.append("\t" + rr);
- }
- buff.append("\nEvent Listeners: \n");
- for(String el : getEventListeners()) {
- buff.append("\t" + el);
- }
-
- return buff.toString();
- }
public String getKnowledgeBuilderConfig()
{
@@ -102,4 +50,28 @@
{
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 02:52:49 UTC (rev 12405)
@@ -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();
+ }
+}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeSessionCreatedEvent.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/events/KnowledgeSessionCreatedEvent.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/events/KnowledgeSessionCreatedEvent.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,26 +0,0 @@
-package org.jboss.seam.drools.events;
-
-/**
- * This event is fires when Stateful or Stateless KnowledgeSession is created.
- *
- * @author Tihomir Surdilovic
- */
-public class KnowledgeSessionCreatedEvent
-{
- private int sessionId;
-
- public KnowledgeSessionCreatedEvent(int sessionId) {
- this.sessionId = sessionId;
- }
-
- public int getSessionId()
- {
- return sessionId;
- }
-
- public void setSessionId(int sessionId)
- {
- this.sessionId = sessionId;
- }
-
-}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/InsertInterceptor.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -4,7 +4,7 @@
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
-import org.jboss.seam.drools.annotation.InsertFact;
+import org.jboss.seam.drools.annotations.InsertFact;
@InsertFact @Interceptor
public class InsertInterceptor
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -28,7 +28,7 @@
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.jboss.seam.drools.events.KnowledgeSessionCreatedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Copied: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers (from rev 12376, modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/qualifier)
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 02:52:49 UTC (rev 12405)
@@ -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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface KAgentProduced
+{
+
+}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/qualifier/KBase.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBase.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.qualifier;
+package org.jboss.seam.drools.qualifiers;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
@@ -13,6 +13,10 @@
import javax.inject.Qualifier;
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
@Qualifier
@Target({TYPE, METHOD, FIELD, PARAMETER})
@Documented
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/qualifier/KBaseConfig.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/qualifiers/KBaseConfig.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.qualifier;
+package org.jboss.seam.drools.qualifiers;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
@@ -13,6 +13,10 @@
import javax.inject.Qualifier;
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
@Qualifier
@Target({TYPE, METHOD, FIELD, PARAMETER})
@Documented
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 02:52:49 UTC (rev 12405)
@@ -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
+ */
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface KSession
+{
+ String value() default "";
+}
Copied: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/utils (from rev 12376, modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/util)
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 02:52:49 UTC (rev 12405)
@@ -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
===================================================================
Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion (from rev 12376, modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/insertion)
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/insertion/InsertInterceptorTest.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertInterceptorTest.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.insertion;
+package org.jboss.seam.drools.test.insertion;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@@ -10,6 +10,7 @@
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;
@@ -20,7 +21,12 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(InsertInterceptor.class, InsertionBean.class).addManifestResource(InsertInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/") + "/InsertInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
+ 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;
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/insertion/InsertionBean.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/insertion/InsertionBean.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,6 +1,6 @@
-package org.jboss.seam.drools.insertion;
+package org.jboss.seam.drools.test.insertion;
-import org.jboss.seam.drools.annotation.InsertFact;
+import org.jboss.seam.drools.annotations.InsertFact;
public class InsertionBean
{
Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase (from rev 12376, modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase)
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 02:52:49 UTC (rev 12405)
@@ -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;
+
+@Qualifier
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface ForKBaseTest
+{
+
+}
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.kbase;
+package org.jboss.seam.drools.test.kbase;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
@@ -13,8 +13,8 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
import org.jboss.seam.drools.config.KnowledgeBaseConfig;
-import org.jboss.seam.drools.qualifier.KBase;
-import org.jboss.seam.drools.qualifier.KBaseConfig;
+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;
@@ -33,6 +33,7 @@
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"))
@@ -41,34 +42,35 @@
return archive;
}
- @Inject @Any Instance<KnowledgeBaseConfig> kbaseConfigResolver;
- @Inject @KBaseConfig("kbaseconfig1") KnowledgeBaseConfig config;
+ //@Inject @Any Instance<KnowledgeBaseConfig> kbaseConfigResolver;
+ @Inject @ForKBaseTest KnowledgeBaseConfig config;
+ @Inject @ForKBaseTest KnowledgeBase kbase;
- @Inject @KBase("kbase1") KnowledgeBase kbase;
-
@Test
public void testKBaseConfig() {
- Assert.assertFalse(kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).isUnsatisfied());
- KnowledgeBaseConfig kbaseConfig = kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).get();
- assertNotNull(kbaseConfig);
- System.out.println("\n\n\n**** " + kbaseConfig.toString() + "********\n\n\n");
+ System.out.println("*********** GOT HERE!");
+ //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<KBaseConfig> implements KBaseConfig
- {
- private String value = null;
- public KBaseConfigBinding(String value)
- {
- this.value = value;
- }
-
- public String value() {
- return value;
- }
- }
+// static class KBaseConfigBinding extends AnnotationLiteral<ForKBaseTest> implements KBaseConfig
+// {
+// private String value = null;
+// public KBaseConfigBinding(String value)
+// {
+// this.value = value;
+// }
+//
+// public String value() {
+// return value;
+// }
+// }
}
Deleted: modules/drools/trunk/impl/src/test/resources/META-INF/beans.xml
===================================================================
--- modules/drools/trunk/core/src/test/resources/META-INF/beans.xml 2010-04-03 03:32:15 UTC (rev 12376)
+++ modules/drools/trunk/impl/src/test/resources/META-INF/beans.xml 2010-04-07 02:52:49 UTC (rev 12405)
@@ -1,38 +0,0 @@
-<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:drools-qualifier="urn:java:org.jboss.seam.drools.qualifier"
- xmlns:drools-test="urn:java:org.jboss.seam.drools.kbase">
-
- <drools:KnowledgeBaseConfig>
- <s:overrides/>
- <drools-qualifier:KBaseConfig value="kbaseconfig1" />
- <drools:knowledgeBuilderConfig>
- <s:value>/kbuilderconfig.properties</s:value>
- </drools:knowledgeBuilderConfig>
- <drools:knowledgeBaseConfig>
- <s:value>/kbaseconfig.properties</s:value>
- </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>
- <drools-qualifier:KBase value="kbase1" />
- <s:parameters>
- <drools:KnowledgeBaseConfig>
- <s:Inject />
- <drools-qualifier:KBaseConfig value="kbaseconfig1" />
- </drools:KnowledgeBaseConfig>
- </s:parameters>
- </drools:produceKBase>
- </drools:KnowledgeBaseProducer>
-
-</beans>
\ No newline at end of file
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/insertion/InsertInterceptorTest-beans.xml (from rev 12376, modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/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 02:52:49 UTC (rev 12405)
@@ -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
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml (from rev 12376, modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/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 02:52:49 UTC (rev 12405)
@@ -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>
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbaseconfig.properties (from rev 12376, modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbaseconfig.properties)
===================================================================
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl (from rev 12376, modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/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 02:52:49 UTC (rev 12405)
@@ -0,0 +1,6 @@
+package org.jboss.seam.drools.kbase
+
+rule "dummy"
+ then
+ System.out.println("in dummy action");
+end
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties (from rev 12376, modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbuilderconfig.properties)
===================================================================
14 years, 8 months
Seam SVN: r12404 - in modules/drools/trunk: api and 11 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-06 22:51:37 -0400 (Tue, 06 Apr 2010)
New Revision: 12404
Added:
modules/drools/trunk/api/
modules/drools/trunk/api/pom.xml
modules/drools/trunk/api/src/
modules/drools/trunk/api/src/main/
modules/drools/trunk/api/src/main/java/
modules/drools/trunk/api/src/main/java/org/
modules/drools/trunk/api/src/main/java/org/jboss/
modules/drools/trunk/api/src/main/java/org/jboss/seam/
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/
modules/drools/trunk/api/src/main/resources/
modules/drools/trunk/api/src/test/
modules/drools/trunk/api/src/test/java/
modules/drools/trunk/api/src/test/java/org/
modules/drools/trunk/api/src/test/java/org/jboss/
modules/drools/trunk/api/src/test/java/org/jboss/seam/
modules/drools/trunk/api/src/test/java/org/jboss/seam/drools/
modules/drools/trunk/api/src/test/resources/
Log:
Module Anatomy
Added: modules/drools/trunk/api/pom.xml
===================================================================
--- modules/drools/trunk/api/pom.xml (rev 0)
+++ modules/drools/trunk/api/pom.xml 2010-04-07 02:51:37 UTC (rev 12404)
@@ -0,0 +1,115 @@
+<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-api</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Seam Drools Module API</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>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.6.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
14 years, 8 months
Seam SVN: r12403 - in modules/faces/trunk: docs and 5 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-06 20:44:02 -0400 (Tue, 06 Apr 2010)
New Revision: 12403
Added:
modules/faces/trunk/apl.txt
modules/faces/trunk/assembly.xml
modules/faces/trunk/docs/reference/
modules/faces/trunk/docs/reference/pom.xml
modules/faces/trunk/docs/reference/src/
modules/faces/trunk/docs/reference/src/main/
modules/faces/trunk/docs/reference/src/main/docbook/
modules/faces/trunk/docs/reference/src/main/docbook/en-US/
modules/faces/trunk/docs/reference/src/main/docbook/en-US/author_group.xml
modules/faces/trunk/docs/reference/src/main/docbook/en-US/book_info.xml
modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml
modules/faces/trunk/docs/reference/src/main/docbook/en-US/preface.xml
modules/faces/trunk/readme.txt
Log:
add docbook project and distribution files
Added: modules/faces/trunk/apl.txt
===================================================================
--- modules/faces/trunk/apl.txt (rev 0)
+++ modules/faces/trunk/apl.txt 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: modules/faces/trunk/assembly.xml
===================================================================
--- modules/faces/trunk/assembly.xml (rev 0)
+++ modules/faces/trunk/assembly.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,89 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>bin</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>api/target/site/apidocs</directory>
+ <outputDirectory>seam-faces/doc/api</outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>examples</directory>
+ <outputDirectory>seam-faces/examples</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <includes>
+ <include>seam-faces-example-tinyurl/pom.xml</include>
+ <include>seam-faces-example-tinyurl/src/**</include>
+ <include>seam-faces-example-tinyrul/readme.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>seam-faces</outputDirectory>
+ <includes>
+ <include>readme.txt</include>
+ <include>apl.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>api/src/main/java</directory>
+ <outputDirectory>seam-faces/source</outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>impl/src/main/java</directory>
+ <outputDirectory>seam-faces/source</outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>seam-faces/lib</outputDirectory>
+ <useProjectArtifact>false</useProjectArtifact>
+ <includes>
+ <include>org.jboss.weld:weld-extensions</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+ <moduleSets>
+ <moduleSet>
+ <includes>
+ <include>org.jboss.seam.xml:seam-faces-api:jar</include>
+ <include>org.jboss.seam.xml:seam-faces:jar</include>
+ </includes>
+ <binaries>
+ <outputDirectory>seam-faces/lib</outputDirectory>
+ <unpack>false</unpack>
+ </binaries>
+ </moduleSet>
+
+ <moduleSet>
+ <includes>
+ <include>org.jboss.seam.xml:seam-faces-reference-guide</include>
+ </includes>
+ <binaries>
+ <outputDirectory>seam-faces/doc/reference</outputDirectory>
+ <unpack>true</unpack>
+ </binaries>
+ </moduleSet>
+
+ </moduleSets>
+</assembly>
Added: modules/faces/trunk/docs/reference/pom.xml
===================================================================
--- modules/faces/trunk/docs/reference/pom.xml (rev 0)
+++ modules/faces/trunk/docs/reference/pom.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,101 @@
+<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/xsd/maven-4.0.0.xsd">
+
+ <!--
+ <parent>
+ <groupId>org.jboss.seam.faces</groupId>
+ <artifactId>seam-faces-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.seam.faces</groupId>
+ <artifactId>seam-faces-reference-guide</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>Seam Faces Module Reference Guide</name>
+
+ <properties>
+ <mpjdocbook.version>2.2.0</mpjdocbook.version>
+ <pdf.name>${project.artifactId}.pdf</pdf.name>
+ </properties>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>${mpjdocbook.version}</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <masterTranslation>en-US</masterTranslation>
+ <imageResource>
+ <directory>${project.basedir}/src/main/docbook/en-US</directory>
+ <includes>
+ <include>images/*.png</include>
+ <include>images/*.jpg</include>
+ </includes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${pdf.name}</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <transformerParameters>
+ <property>
+ <name>javax.xml.parsers.DocumentBuilderFactory</name>
+ <value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.parsers.SAXParserFactory</name>
+ <value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
+ </property>
+ </transformerParameters>
+ <localeSeparator>-</localeSeparator>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: modules/faces/trunk/docs/reference/src/main/docbook/en-US/author_group.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/author_group.xml (rev 0)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/author_group.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
+<authorgroup>
+ <author>
+ <firstname>Dan</firstname>
+ <surname>Allen</surname>
+ </author>
+ <author>
+ <firstname>Lincoln</firstname>
+ <surname>Baxter III</surname>
+ </author>
+
+ <!--
+vim:et:ts=3:sw=3:tw=120
+-->
+</authorgroup>
Added: modules/faces/trunk/docs/reference/src/main/docbook/en-US/book_info.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/book_info.xml (rev 0)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/book_info.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
+
+<bookinfo>
+ <title>Seam Faces Module</title>
+ <subtitle>Reference Guide</subtitle>
+ <releaseinfo>3.0.0-SNAPSHOT</releaseinfo>
+
+ <xi:include href="author_group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+<!--
+vim:et:ts=3:sw=3:tw=120
+-->
+</bookinfo>
Added: modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml (rev 0)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
+<book lang="en">
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="book_info.xml" />
+
+ <toc />
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="preface.xml" />
+
+ <!--
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chapterXX.xml" />
+ -->
+
+<!--
+vim:et:ts=3:sw=3:tw=120
+-->
+</book>
Added: modules/faces/trunk/docs/reference/src/main/docbook/en-US/preface.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/preface.xml (rev 0)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/preface.xml 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
+<preface>
+ <title>Preface: lorem ipsum</title>
+ <para>
+ </para>
+
+<!--
+vim:et:ts=3:sw=3:tw=120
+-->
+</preface>
Added: modules/faces/trunk/readme.txt
===================================================================
--- modules/faces/trunk/readme.txt (rev 0)
+++ modules/faces/trunk/readme.txt 2010-04-07 00:44:02 UTC (rev 12403)
@@ -0,0 +1,45 @@
+
+ Seam Faces Module
+ 3.0.0 SNAPSHOT
+
+ What is it?
+ ===========
+
+ The Seam 3 Faces Module is focused on enhancements for the JavaServer Faces
+ (JSF) web framework, extended integration between JSF and CDI, and integration
+ between JSF and other Seam 3 modules.
+
+ Contents of distribution
+ ========================
+
+ docs/
+
+ API Docs and reference guide.
+
+ examples/
+
+ Seam Faces examples
+
+ ...
+
+ Licensing
+ =========
+
+ This distribution, as a whole, is licensed under the terms of the Apache
+ License, Version 2.0 (see apl.txt).
+
+
+ Seam Faces URLs
+ ===============
+
+ Seam 3 Faces Module: http://www.sfwk.org/Seam3/FacesModule
+ 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/faces
+ Issue Tracking: http://jira.jboss.org/jira/browse/SEAMFACES
+
+ Release Notes
+ =============
+
+ ...
14 years, 8 months
Seam SVN: r12402 - modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-06 20:00:23 -0400 (Tue, 06 Apr 2010)
New Revision: 12402
Modified:
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java
Log:
javadoc
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java 2010-04-06 21:34:31 UTC (rev 12401)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java 2010-04-07 00:00:23 UTC (rev 12402)
@@ -20,7 +20,7 @@
/**
* Verify that the ExternalContextProducer produces the same ExternalContext as
- * returned by FacesContext#getExternalContext().
+ * returned by FacesContext#getExternalContext() and the CDI producer method.
*
* @author Dan Allen
*/
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java 2010-04-06 21:34:31 UTC (rev 12401)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java 2010-04-07 00:00:23 UTC (rev 12402)
@@ -20,7 +20,8 @@
/**
* Verify that the FacesContextProducer produces the same FacesContext as
- * returned by FacesContext#getCurrentInstance().
+ * returned by FacesContext#getCurrentInstance() and by the CDI producer
+ * method.
*
* @author Dan Allen
*/
14 years, 8 months