Seam SVN: r12640 - modules/servlet/trunk.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-26 05:50:01 -0400 (Mon, 26 Apr 2010)
New Revision: 12640
Modified:
modules/servlet/trunk/pom.xml
Log:
weld-extensions to snapshot
Modified: modules/servlet/trunk/pom.xml
===================================================================
--- modules/servlet/trunk/pom.xml 2010-04-26 09:18:50 UTC (rev 12639)
+++ modules/servlet/trunk/pom.xml 2010-04-26 09:50:01 UTC (rev 12640)
@@ -28,7 +28,8 @@
<properties>
<arquillian.version>1.0.0.Alpha1</arquillian.version>
<weld.version>1.0.1-Final</weld.version>
- </properties>
+ <weldx.version>1.0.0-SNAPSHOT</weldx.version>
+ </properties>
<repositories>
<repository>
@@ -66,7 +67,7 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-extensions</artifactId>
- <version>1.0.0.Alpha1</version>
+ <version>${weldx.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
14 years, 8 months
Seam SVN: r12639 - branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-26 05:18:50 -0400 (Mon, 26 Apr 2010)
New Revision: 12639
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
Log:
minor
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-26 06:50:56 UTC (rev 12638)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-26 09:18:50 UTC (rev 12639)
@@ -167,7 +167,14 @@
public void restart()
{
- executeAntTarget("restart");
+ if (explode)
+ {
+ executeAntTarget("restart");
+ }
+ else
+ {
+ executeAntTarget("deploy");
+ }
}
public void addIdentityManagement()
14 years, 8 months
Seam SVN: r12638 - modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-04-26 02:50:56 -0400 (Mon, 26 Apr 2010)
New Revision: 12638
Added:
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/FieldsetQualifier.java
Log:
forgot file
Added: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/FieldsetQualifier.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/FieldsetQualifier.java (rev 0)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/FieldsetQualifier.java 2010-04-26 06:50:56 UTC (rev 12638)
@@ -0,0 +1,24 @@
+/*
+ * Distributed under the LGPL License
+ *
+ */
+package org.jboss.seam.xml.test.fieldset;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Qualifier
+public @interface FieldsetQualifier
+{
+
+}
14 years, 8 months
Seam SVN: r12637 - modules/jms/trunk/impl.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-04-25 22:22:01 -0400 (Sun, 25 Apr 2010)
New Revision: 12637
Modified:
modules/jms/trunk/impl/pom.xml
Log:
Updated Arquillian version to 1.0.0.Alpha1
Modified: modules/jms/trunk/impl/pom.xml
===================================================================
--- modules/jms/trunk/impl/pom.xml 2010-04-26 02:21:39 UTC (rev 12636)
+++ modules/jms/trunk/impl/pom.xml 2010-04-26 02:22:01 UTC (rev 12637)
@@ -15,7 +15,7 @@
<description>Implementation of the Seam JMS Module</description>
<properties>
- <arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
+ <arquillian.version>1.0.0.Alpha1</arquillian.version>
</properties>
<dependencies>
14 years, 8 months
Seam SVN: r12636 - in modules/jms/trunk: dist and 1 other directory.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-04-25 22:21:39 -0400 (Sun, 25 Apr 2010)
New Revision: 12636
Modified:
modules/jms/trunk/
modules/jms/trunk/dist/
Log:
Updated svn:ignore for more Eclipse-specific project files
Property changes on: modules/jms/trunk
___________________________________________________________________
Name: svn:ignore
- .settings
.project
+ .classpath
.project
.settings
Property changes on: modules/jms/trunk/dist
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ .classpath
.project
.settings
target
14 years, 8 months
Seam SVN: r12635 - in modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces: event and 1 other directory.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-25 17:41:10 -0400 (Sun, 25 Apr 2010)
New Revision: 12635
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
Log:
Other name for BM key in context listener
Multiple key search in FSCBMP
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java 2010-04-25 21:11:37 UTC (rev 12634)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java 2010-04-25 21:41:10 UTC (rev 12635)
@@ -21,10 +21,14 @@
*/
package org.jboss.seam.faces.beanManager;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.enterprise.inject.spi.BeanManager;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
+import org.jboss.seam.faces.event.BeanManagerServletContextListener;
import org.jboss.weld.extensions.beanManager.BeanManagerProvider;
/**
@@ -38,6 +42,15 @@
{
public static final FacesServletContextBeanManagerProvider DEFAULT = new FacesServletContextBeanManagerProvider();
+ private static final List<String> SERVLET_CONTEXT_KEYS = new ArrayList<String>()
+ {
+ private static final long serialVersionUID = 1L;
+ {
+ add(BeanManager.class.getName());
+ add(BeanManagerServletContextListener.BEANMANAGER_SERVLETCONTEXT_KEY);
+ }
+ };
+
public BeanManager getBeanManager()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -46,9 +59,23 @@
return null;
}
ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
- return (BeanManager) servletContext.getAttribute(BeanManager.class.getName());
+ return getBeanManager(servletContext);
}
+ private BeanManager getBeanManager(ServletContext servletContext)
+ {
+ BeanManager beanManager = null;
+ for (String key : SERVLET_CONTEXT_KEYS)
+ {
+ beanManager = (BeanManager) servletContext.getAttribute(key);
+ if (beanManager != null)
+ {
+ break;
+ }
+ }
+ return beanManager;
+ }
+
public int getPrecedence()
{
return 20;
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java 2010-04-25 21:11:37 UTC (rev 12634)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java 2010-04-25 21:41:10 UTC (rev 12635)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.faces.event;
import javax.enterprise.inject.spi.BeanManager;
@@ -5,8 +26,16 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+/**
+ * A Servlet Context Listener that places the BeanManager under a known attribute key
+ *
+ * @author Nicklas Karlsson
+ *
+ */
public class BeanManagerServletContextListener implements ServletContextListener
{
+ public static final String BEANMANAGER_SERVLETCONTEXT_KEY = "org.jboss.seam.faces.javax.enterprise.spi.BeanManager";
+
@Inject
private BeanManager beanManager;
@@ -16,7 +45,7 @@
public void contextInitialized(ServletContextEvent sce)
{
- sce.getServletContext().setAttribute(BeanManager.class.getName(), beanManager);
+ sce.getServletContext().setAttribute(BEANMANAGER_SERVLETCONTEXT_KEY, beanManager);
}
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-25 21:11:37 UTC (rev 12634)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java 2010-04-25 21:41:10 UTC (rev 12635)
@@ -23,7 +23,6 @@
import java.lang.annotation.Annotation;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
14 years, 8 months
Seam SVN: r12634 - in modules/faces/trunk/impl/src/main: resources/META-INF and 1 other directory.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-25 17:11:37 -0400 (Sun, 25 Apr 2010)
New Revision: 12634
Added:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java
modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml
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/SystemEventBridge.java
Log:
own ServletContextListener for sticking the BeanManager into the ServletContext attribute of the BM class name
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/BeanManagerServletContextListener.java 2010-04-25 21:11:37 UTC (rev 12634)
@@ -0,0 +1,23 @@
+package org.jboss.seam.faces.event;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class BeanManagerServletContextListener implements ServletContextListener
+{
+ @Inject
+ private BeanManager beanManager;
+
+ public void contextDestroyed(ServletContextEvent sce)
+ {
+ }
+
+ public void contextInitialized(ServletContextEvent sce)
+ {
+ sce.getServletContext().setAttribute(BeanManager.class.getName(), beanManager);
+ }
+
+
+}
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-25 21:11:20 UTC (rev 12633)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java 2010-04-25 21:11:37 UTC (rev 12634)
@@ -25,6 +25,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
@@ -39,7 +40,6 @@
import org.jboss.seam.faces.event.qualifier.RenderResponse;
import org.jboss.seam.faces.event.qualifier.RestoreView;
import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-import org.jboss.weld.extensions.beanManager.BeanManagerAware;
import org.slf4j.Logger;
/**
@@ -63,13 +63,15 @@
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
*
*/
-@ApplicationScoped
-public class PhaseEventBridge extends BeanManagerAware implements PhaseListener
+public class PhaseEventBridge implements PhaseListener
{
private static final long serialVersionUID = -6181019551463318453L;
@Inject
private Logger log;
+
+ @Inject
+ private BeanManager beanManager;
/**
* @param whenQualifier When this event occurred (e.g.:
@@ -115,7 +117,7 @@
*/
Annotation[] qualifiers = new Annotation[] { whenQualifier, phaseQualifier };
log.debug("Fired event #0 with qualifiers #1", event, qualifiers);
- getBeanManager().fireEvent(event, qualifiers);
+ beanManager.fireEvent(event, qualifiers);
}
public void afterPhase(final PhaseEvent e)
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-25 21:11:20 UTC (rev 12633)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java 2010-04-25 21:11:37 UTC (rev 12634)
@@ -23,8 +23,8 @@
import java.lang.annotation.Annotation;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
import javax.faces.component.UIViewRoot;
import javax.faces.event.AbortProcessingException;
@@ -35,10 +35,10 @@
import javax.faces.event.PreRenderViewEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
+import javax.inject.Inject;
import org.jboss.seam.faces.event.qualifier.Component;
import org.jboss.seam.faces.event.qualifier.View;
-import org.jboss.weld.extensions.beanManager.BeanManagerAware;
/**
* A SystemEventListener used to bridge JSF system events to the CDI event
@@ -63,9 +63,10 @@
*
* @author Nicklas Karlsson
*/
-@ApplicationScoped
-public class SystemEventBridge extends BeanManagerAware implements SystemEventListener
+public class SystemEventBridge implements SystemEventListener
{
+ @Inject
+ BeanManager beanManager;
public boolean isListenerForSource(final Object source)
{
@@ -76,7 +77,7 @@
{
Object payload = e.getClass().cast(e);
Annotation[] qualifiers = getQualifiers(e);
- getBeanManager().fireEvent(payload, qualifiers);
+ beanManager.fireEvent(payload, qualifiers);
}
private Annotation[] getQualifiers(SystemEvent e)
Added: modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml (rev 0)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-04-25 21:11:37 UTC (rev 12634)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-fragment version="3.0" 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/web-fragment_3_0.xsd">
+ <name>seamfaces</name>
+
+ <listener>
+ <listener-class>org.jboss.seam.faces.event.BeanManagerServletContextListener</listener-class>
+ </listener>
+
+</web-fragment>
\ No newline at end of file
14 years, 8 months
Seam SVN: r12633 - modules/servlet/trunk/impl/src/main/resources/META-INF.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-25 17:11:20 -0400 (Sun, 25 Apr 2010)
New Revision: 12633
Modified:
modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml
Log:
own ServletContextListener for sticking the BeanManager into the ServletContext attribute of the BM class name
Modified: modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-04-25 06:56:48 UTC (rev 12632)
+++ modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-04-25 21:11:20 UTC (rev 12633)
@@ -3,11 +3,7 @@
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/web-fragment_3_0.xsd">
<name>seamservlet</name>
-<!-- <ordering>-->
-<!-- <after>-->
-<!-- <name>weld</name>-->
-<!-- </after>-->
-<!-- </ordering>-->
+
<listener>
<listener-class>org.jboss.seam.servlet.event.ServletEventListener</listener-class>
</listener>
14 years, 8 months
Seam SVN: r12632 - in modules/drools/trunk: impl and 7 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-25 02:56:48 -0400 (Sun, 25 Apr 2010)
New Revision: 12632
Added:
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
modules/drools/trunk/impl/kagenttestone.drl
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml
Removed:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java
modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl
Log:
Added kagent test and new producer method for KnowledgeAgent
Added: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java (rev 0)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.qualifiers.config;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface AgentConfig {
+
+}
Added: modules/drools/trunk/impl/kagenttestone.drl
===================================================================
Modified: 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 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -59,10 +59,23 @@
ResourceProvider resourceProvider;
@Produces
+ @ApplicationScoped
+ public KnowledgeAgent produceKnowledgeAgent(DroolsConfig config) throws Exception
+ {
+ return getAgent(config);
+ }
+
+ @Produces
@Scanned
@ApplicationScoped
public KnowledgeBase produceScannedKnowledgeBase(DroolsConfig config) throws Exception
{
+ KnowledgeAgent agent = getAgent(config);
+ return agent.getKnowledgeBase();
+ }
+
+ private KnowledgeAgent getAgent(DroolsConfig config) throws Exception
+ {
if (config.getAgentName() == null || config.getAgentName().length() < 1)
{
throw new IllegalStateException("KnowledgeAgent configuration does not specify the name of the KnowlegeAgent.");
@@ -73,7 +86,7 @@
throw new IllegalStateException("No change set rule resource specified.");
}
- if(config.getRuleResources().getResources().length > 0) {
+ if(config.getRuleResources().getResources().length > 1) {
throw new IllegalStateException("More than one change set rule resource specified for KnowledgeAgent. Make sure only a single change set resource is specified.");
}
@@ -93,7 +106,7 @@
ResourceFactory.getResourceChangeScannerService().start();
}
- return kagent.getKnowledgeBase();
+ return kagent;
}
@@ -103,7 +116,7 @@
ResourceFactory.getResourceChangeNotifierService().stop();
ResourceFactory.getResourceChangeScannerService().stop();
}
-
+
private void applyChangeSet(KnowledgeAgent kagent, String entry)
{
String[] entryParts = RuleResources.DIVIDER.split(entry.trim());
Added: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java (rev 0)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.config;
+
+import org.jboss.seam.drools.qualifiers.config.AgentConfig;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@AgentConfig
+public class AgentRuleResources extends RuleResources
+{
+
+}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -85,7 +85,6 @@
}
StatefulKnowledgeSession ksession = ksessionSource.select((Annotation[]) annotationTypeList.toArray(new Annotation[annotationTypeList.size()])).get();
- System.out.println("***** SEI ksession: " + ksession);
if (ksession != null)
{
Object retObj = ctx.proceed();
@@ -101,12 +100,10 @@
{
if (event != null && event.length() > 0)
{
- System.out.println("***** signalling to process : " + type + " - " + event);
pi.signalEvent(type, event);
}
else
{
- System.out.println("***** signalling to process : " + type + " - " + retObj);
pi.signalEvent(type, retObj);
}
}
@@ -116,12 +113,10 @@
{
if (event != null && event.length() > 0)
{
- System.out.println("***** signalling to ksession : " + type + " - " + event);
ksession.signalEvent(type, event);
}
else
{
- System.out.println("***** signalling to ksession : " + type + " - " + retObj);
ksession.signalEvent(type, retObj);
}
Modified: modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-04-25 06:56:48 UTC (rev 12632)
@@ -117,6 +117,15 @@
</d:DroolsConfig>
</s:parameters>
</d:produceScannedKnowledgeBase>
+ <d:produceKnowledgeAgent>
+ <s:ApplyQualifiers />
+ <s:parameters>
+ <d:DroolsConfig>
+ <s:Inject />
+ <s:ApplyQualifiers />
+ </d:DroolsConfig>
+ </s:parameters>
+ </d:produceKnowledgeAgent>
<d:disposeScannedKnowledgeBase>
<s:parameters>
<drools:KnowledgeBase>
@@ -331,5 +340,42 @@
</d:RuleResources>
</s:parameters>
</d:DroolsConfig>
+
+ <d:DroolsConfig>
+ <s:specializes />
+ <d:AgentConfig />
+ <d:kagentPropertiestMap>
+ <s:entry>
+ <s:key>drools.agent.scanResources</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.scanDirectories</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.newInstance</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.monitorChangeSetEvents</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ </d:kagentPropertiestMap>
+ <d:startChangeNotifierService>true</d:startChangeNotifierService>
+ <d:startChangeScannerService>true</d:startChangeScannerService>
+ <d:scannerInterval>60</d:scannerInterval>
+ <d:agentName>
+ <s:value>kagent</s:value>
+ </d:agentName>
+ <s:parameters>
+ <d:RuleResources>
+ <d:AgentConfig />
+ <s:type>
+ <d:AgentRuleResources />
+ </s:type>
+ </d:RuleResources>
+ </s:parameters>
+ </d:DroolsConfig>
</beans>
\ No newline at end of file
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -18,15 +18,82 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.drools.test.kagent;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.fail;
+
+
+import javax.enterprise.inject.Default;
+
+import org.drools.agent.KnowledgeAgent;
+import org.drools.io.ResourceFactory;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.rule.FactHandle;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.drools.KnowledgeBaseProducer;
+import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.test.DroolsModuleFilter;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+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 KAgentTest
{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ String pkgPath = KAgentTest.class.getPackage().getName().replaceAll("\\.", "/");
+ JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addPackages(true, new DroolsModuleFilter("kagent"), KnowledgeBaseProducer.class.getPackage())
+ .addPackages(true, ResourceProvider.class.getPackage())
+ .addClass(Person.class)
+ .addClass(KAgentTestConfig.class)
+ .addResource(pkgPath + "/kagenttestone.drl", ArchivePaths.create("kagenttestone.drl"))
+ .addResource(pkgPath + "/kagenttesttwo.drl", ArchivePaths.create("kagenttesttwo.drl"))
+ .addResource(pkgPath + "/kagenttestchangeset.xml", ArchivePaths.create("kagenttestchangeset.xml"))
+ // .addResource(pkgPath + "/kbuilderconfig.properties",
+ // ArchivePaths.create("kbuilderconfig.properties"))
+ // .addResource(pkgPath + "/kbaseconfig.properties",
+ // ArchivePaths.create("kbaseconfig.properties"))
+ .addManifestResource(pkgPath + "/KAgentTest-beans.xml", ArchivePaths.create("beans.xml"));
+ // System.out.println(archive.toString(Formatters.VERBOSE));
+ return archive;
+ }
+
@Test
- public void testKAgent() {
-
+ public void testKAgentConfiguration(@KAgentTestConfig DroolsConfig config)
+ {
+ assertNotNull(config);
+ assertTrue(config.isStartChangeNotifierService());
+ assertTrue(config.isStartChangeScannerService());
+ assertTrue(config.getAgentName() != null);
+ assertTrue(config.getScannerInterval() > 0);
}
+
+ @Test
+ public void testKAgent(@Default @KAgentTestConfig KnowledgeAgent agent, ResourceProvider resourceProvider)
+ {
+ assertNotNull(agent);
+ assertNotNull(resourceProvider);
+ Person p1 = new Person(19);
+ StatefulKnowledgeSession ksession1 = agent.getKnowledgeBase().newStatefulKnowledgeSession();
+ FactHandle fh1 = ksession1.insert(p1);
+ ksession1.fireAllRules();
+ Person p1f = (Person) ksession1.getObject(fh1);
+ assertTrue(p1f.isEligible());
+ ksession1.dispose();
+ ResourceFactory.getResourceChangeNotifierService().stop();
+ ResourceFactory.getResourceChangeScannerService().stop();
+ }
+
}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.kagent;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface KAgentTestConfig
+{
+
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.kagent;
+
+public class Person
+{
+ private int age;
+ private boolean eligible;
+
+ public Person(int age) {
+ this.age = age;
+ }
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public boolean isEligible()
+ {
+ return eligible;
+ }
+
+ public void setEligible(boolean eligible)
+ {
+ this.eligible = eligible;
+ }
+
+
+}
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl 2010-04-25 06:56:48 UTC (rev 12632)
@@ -8,7 +8,6 @@
when
$p : Person( age >=18 )
then
- System.out.println("*****************\nIN RULE \n ***************");
modify($p) {
setEligible(true);
}
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,66 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc., and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<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:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+ xmlns:test="urn:java:org.jboss.seam.drools.test.kagent">
+
+ <d:RuleResources>
+ <s:overrides/>
+ <test:KAgentTestConfig/>
+ <d:resources>
+ <s:value>classpath;kagenttestchangeset.xml;CHANGE_SET</s:value>
+ </d:resources>
+ </d:RuleResources>
+
+ <d:DroolsConfig>
+ <test:KAgentTestConfig/>
+ <d:kagentPropertiestMap>
+ <s:entry>
+ <s:key>drools.agent.scanResources</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.scanDirectories</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.newInstance</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.monitorChangeSetEvents</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ </d:kagentPropertiestMap>
+ <d:startChangeNotifierService>true</d:startChangeNotifierService>
+ <d:startChangeScannerService>true</d:startChangeScannerService>
+ <d:scannerInterval>30</d:scannerInterval>
+ <d:agentName>
+ <s:value>testagent</s:value>
+ </d:agentName>
+ <d:ruleResources>
+ <s:Inject/>
+ <test:KAgentTestConfig/>
+ </d:ruleResources>
+ </d:DroolsConfig>
+</beans>
Deleted: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml
===================================================================
Copied: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml (from rev 12561, modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml)
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml 2010-04-25 06:56:48 UTC (rev 12632)
@@ -0,0 +1,7 @@
+<change-set xmlns='http://drools.org/drools-5.0/change-set'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
+ xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
+ <add>
+ <resource source='classpath:kagenttestone.drl' type='DRL' />
+ </add>
+</change-set>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl 2010-04-25 06:56:48 UTC (rev 12632)
@@ -1,29 +1,13 @@
-#created on: Apr 19, 2010
package org.jboss.seam.drools.test.kagent
-#list any import classes here.
+import org.jboss.seam.drools.test.kagent.Person;
-
-
-#declare any global variables here
-
-
-
-
-rule "Your First Rule"
-
- when
- #conditions
- then
- #actions
-
-end
-
-rule "Your Second Rule"
- #include attributes such as "salience" here...
- when
- #conditions
- then
- #actions
-
-end
+rule "is eligible"
+lock-on-active
+when
+ $p : Person( age > 18 )
+then
+ modify($p) {
+ setEligible(true);
+ }
+end
\ No newline at end of file
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl 2010-04-25 03:38:36 UTC (rev 12631)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl 2010-04-25 06:56:48 UTC (rev 12632)
@@ -1,29 +1,13 @@
-#created on: Apr 19, 2010
package org.jboss.seam.drools.test.kagent
-#list any import classes here.
+import org.jboss.seam.drools.test.kagent.Person;
-
-
-#declare any global variables here
-
-
-
-
-rule "Your First Rule"
-
- when
- #conditions
- then
- #actions
-
-end
-
-rule "Your Second Rule"
- #include attributes such as "salience" here...
- when
- #conditions
- then
- #actions
-
-end
+rule "is eligible"
+lock-on-active
+when
+ $p : Person( age > 21 )
+then
+ modify($p) {
+ setEligible(true);
+ }
+end
\ No newline at end of file
14 years, 8 months
Seam SVN: r12631 - build.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-24 23:38:36 -0400 (Sat, 24 Apr 2010)
New Revision: 12631
Added:
build/branches/
build/tags/
Log:
add tags and branches
14 years, 8 months