Seam SVN: r11365 - in branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam: example and 3 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-08-12 07:16:31 -0400 (Wed, 12 Aug 2009)
New Revision: 11365
Added:
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/ExcelTest.java
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/
Removed:
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/ExcelTest.java
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/test/
Modified:
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/RenderTest.java
branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/testng.xml
Log:
JBPAPP-2462
Copied: branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/ExcelTest.java (from rev 11364, branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/ExcelTest.java)
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/ExcelTest.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/ExcelTest.java 2009-08-12 11:16:31 UTC (rev 11365)
@@ -0,0 +1,120 @@
+package org.jboss.seam.example.excel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Name("excelTest")
+(a)Scope(ScopeType.SESSION)
+public class ExcelTest
+{
+
+ private List<Person> people = new LinkedList<Person>();
+ private List<Person> result = new LinkedList<Person>();
+ private List<List<Person>> repeat = new LinkedList<List<Person>>();
+ private String searchWord;
+
+
+ @Create
+ public void create()
+ {
+ people.add(new Person("Pete Muir", "Red Hat Inc.", "Project Lead"));
+ people.add(new Person("Gavin King", "Red Hat Inc.", "Project Founder"));
+ people.add(new Person("Norman Richards", "Red Hat Inc.", "Seam Core"));
+ people.add(new Person("Shane Bryzak", "Red Hat Inc.", "Seam Security, Seam Remoting"));
+ people.add(new Person("Michael Yuan", "Individual", ""));
+ people.add(new Person("Mike Youngstrom", "Individual", "Spring Integration"));
+ people.add(new Person("Ales Justin", "Red Hat Inc.", "JBoss5/MC Integration"));
+ people.add(new Person("Christian Bauer", "Red Hat Inc.", "Seam Wiki, REST and GWT integration"));
+ people.add(new Person("Jay Balunas", "Red Hat Inc.", "Cross-platform testing"));
+ people.add(new Person("Dan Allen", "Individual", "Seam-gen, Bug fixes"));
+ people.add(new Person("Matt Drees", "Individual", "Seam Core"));
+ people.add(new Person("Jacob Orshalick", "Focus IT Solutions LLC", ""));
+ people.add(new Person("Nicklas Karlsson", "Individual", "Excel reporting"));
+ people.add(new Person("Daniel Roth", "Individual", "Excel reporting"));
+ people.add(new Person("Judy Guglielmin", "ICESoft Inc.", "ICEFaces integration"));
+ people.add(new Person("Max Rydahl Andersen", "Red Hat Inc.", "Lead developer JBoss Tools, Hibernate Tools, Seam Tools"));
+ people.add(new Person("Emmanuel Bernard", "Red Hat Inc.", "Lead developer Hibernate Annotations, EntityManager, Validator, Search"));
+ repeat.add(people.subList(0, 5));
+ }
+
+ public List<List<Person>> getRepeat()
+ {
+ return repeat;
+ }
+
+ public void setRepeat(List<List<Person>> repeat)
+ {
+ this.repeat = repeat;
+ }
+
+ public void setSearchWord(String searchWord)
+ {
+ this.searchWord = searchWord;
+ }
+
+ public String getSearchWord()
+ {
+ return searchWord;
+ }
+
+ public List<Person> getPeople()
+ {
+ return people;
+ }
+
+ public List<Person> getResult()
+ {
+ return result;
+ }
+
+ public void search()
+ {
+ result = new LinkedList<Person>();
+ for (Person person : people)
+ {
+ if (person.getName().toLowerCase().contains(searchWord.toLowerCase()))
+ result.add(person);
+ }
+ }
+
+ public void clear()
+ {
+ this.result = new LinkedList<Person>();
+ }
+
+ public class Person
+ {
+ String name;
+ String company;
+ String task;
+
+ public Person(String name, String company, String task)
+ {
+ this.company = company;
+ this.name = name;
+ this.task = task;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getTask()
+ {
+ return task;
+ }
+
+ public String getCompany()
+ {
+ return company;
+ }
+
+ }
+
+}
Copied: branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test (from rev 11364, branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/test)
Modified: branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/RenderTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/test/RenderTest.java 2009-08-11 21:06:42 UTC (rev 11364)
+++ branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/RenderTest.java 2009-08-12 11:16:31 UTC (rev 11365)
@@ -1,16 +1,13 @@
-package org.jboss.seam.excel.test;
+package org.jboss.seam.example.excel.test;
import java.io.ByteArrayInputStream;
-import java.util.List;
-import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.document.ByteArrayDocumentData;
import org.jboss.seam.document.DocumentData;
-import org.jboss.seam.excel.ExcelTest.Person;
import org.jboss.seam.faces.Renderer;
import org.jboss.seam.mock.SeamTest;
import org.testng.annotations.Test;
Modified: branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/test/testng.xml 2009-08-11 21:06:42 UTC (rev 11364)
+++ branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/example/excel/test/testng.xml 2009-08-12 11:16:31 UTC (rev 11365)
@@ -4,7 +4,7 @@
<test name="Excel Tests">
<classes>
- <class name="org.jboss.seam.excel.test.RenderTest"/>
+ <class name="org.jboss.seam.example.excel.test.RenderTest"/>
</classes>
</test>
Deleted: branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/ExcelTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/ExcelTest.java 2009-08-11 21:06:42 UTC (rev 11364)
+++ branches/enterprise/JBPAPP_5_0/examples/excel/src/org/jboss/seam/excel/ExcelTest.java 2009-08-12 11:16:31 UTC (rev 11365)
@@ -1,122 +0,0 @@
-package org.jboss.seam.excel;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
-@Name("excelTest")
-(a)Scope(ScopeType.SESSION)
-public class ExcelTest
-{
-
- private List<Person> people = new LinkedList<Person>();
- private List<Person> result = new LinkedList<Person>();
- private List<List<Person>> repeat = new LinkedList<List<Person>>();
- private String searchWord;
-
-
- @Create
- public void create()
- {
- people.add(new Person("Pete Muir", "Red Hat Inc.", "Project Lead"));
- people.add(new Person("Gavin King", "Red Hat Inc.", "Project Founder"));
- people.add(new Person("Norman Richards", "Red Hat Inc.", "Seam Core"));
- people.add(new Person("Shane Bryzak", "Red Hat Inc.", "Seam Security, Seam Remoting"));
- people.add(new Person("Michael Yuan", "Individual", ""));
- people.add(new Person("Mike Youngstrom", "Individual", "Spring Integration"));
- people.add(new Person("Ales Justin", "Red Hat Inc.", "JBoss5/MC Integration"));
- people.add(new Person("Christian Bauer", "Red Hat Inc.", "Seam Wiki, REST and GWT integration"));
- people.add(new Person("Jay Balunas", "Red Hat Inc.", "Cross-platform testing"));
- people.add(new Person("Dan Allen", "Individual", "Seam-gen, Bug fixes"));
- people.add(new Person("Matt Drees", "Individual", "Seam Core"));
- people.add(new Person("Jacob Orshalick", "Focus IT Solutions LLC", ""));
- people.add(new Person("Nicklas Karlsson", "Individual", "Excel reporting"));
- people.add(new Person("Daniel Roth", "Individual", "Excel reporting"));
- people.add(new Person("Judy Guglielmin", "ICESoft Inc.", "ICEFaces integration"));
- people.add(new Person("Max Rydahl Andersen", "Red Hat Inc.", "Lead developer JBoss Tools, Hibernate Tools, Seam Tools"));
- people.add(new Person("Emmanuel Bernard", "Red Hat Inc.", "Lead developer Hibernate Annotations, EntityManager, Validator, Search"));
- repeat.add(people.subList(0, 5));
- }
-
- public List<List<Person>> getRepeat()
- {
- return repeat;
- }
-
- public void setRepeat(List<List<Person>> repeat)
- {
- this.repeat = repeat;
- }
-
- public void setSearchWord(String searchWord)
- {
- this.searchWord = searchWord;
- }
-
- public String getSearchWord()
- {
- return searchWord;
- }
-
- public List<Person> getPeople()
- {
- return people;
- }
-
- public List<Person> getResult()
- {
- return result;
- }
-
- public void search()
- {
- result = new LinkedList<Person>();
- for (Person person : people)
- {
- if (person.getName().toLowerCase().contains(searchWord.toLowerCase()))
- result.add(person);
- }
- }
-
- public void clear()
- {
- this.result = new LinkedList<Person>();
- }
-
- public class Person
- {
- String name;
- String company;
- String task;
-
- public Person(String name, String company, String task)
- {
- this.company = company;
- this.name = name;
- this.task = task;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getTask()
- {
- return task;
- }
-
- public String getCompany()
- {
- return company;
- }
-
- }
-
-}
15 years, 4 months
Seam SVN: r11364 - in branches/community/Seam_2_2_Drools5: examples and 5 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2009-08-11 17:06:42 -0400 (Tue, 11 Aug 2009)
New Revision: 11364
Added:
branches/community/Seam_2_2_Drools5/examples/drools/resources/kbaseconfig.properties
branches/community/Seam_2_2_Drools5/examples/drools/resources/kbuilderconfig.properties
branches/community/Seam_2_2_Drools5/examples/drools/resources/ksessionconfig.properties
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeActionHandler.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeAssignmentHandler.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeDecisionHandler.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeHandler.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/SeamDelegate.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools5-2.2.xsd
Modified:
branches/community/Seam_2_2_Drools5/build/default.build.properties
branches/community/Seam_2_2_Drools5/build/validate.xml
branches/community/Seam_2_2_Drools5/examples/build.xml
branches/community/Seam_2_2_Drools5/examples/drools/resources/.gpd.pageflow.jpdl.xml
branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.jpg
branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.xml
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RandomNumber.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
Log:
Drools5 integration.
Modified: branches/community/Seam_2_2_Drools5/build/default.build.properties
===================================================================
--- branches/community/Seam_2_2_Drools5/build/default.build.properties 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/build/default.build.properties 2009-08-11 21:06:42 UTC (rev 11364)
@@ -12,5 +12,5 @@
#
# Other program locations
# -----------------------
-jboss.home /Applications/jboss-5.1.0.GA
+jboss.home /home/tsurdilo/support/eap-4.3.0.GA_CP06/jboss-eap-4.3/jboss-as
tomcat.home /Applications/apache-tomcat-6.0
Modified: branches/community/Seam_2_2_Drools5/build/validate.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/build/validate.xml 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/build/validate.xml 2009-08-11 21:06:42 UTC (rev 11364)
@@ -8,7 +8,8 @@
http://jboss.com/products/seam/bpm ${src.schema.dir}/bpm-${schema.version}.xsd
http://jboss.com/products/seam/components ${src.schema.dir}/components-${schema.version}.xsd
http://jboss.com/products/seam/core ${src.schema.dir}/core-${schema.version}.xsd
- http://jboss.com/products/seam/drools ${src.schema.dir}/drools-${schema.version}.xsd
+ http://jboss.com/products/seam/drools ${src.schema.dir}/drools-${schema.version}.xsd
+ http://jboss.com/products/seam/drools5 ${src.schema.dir}/drools5-${schema.version}.xsd
http://jboss.com/products/seam/framework ${src.schema.dir}/framework-${schema.version}.xsd
http://jboss.com/products/seam/international ${src.schema.dir}/international-${schema.version}.xsd
http://jboss.com/products/seam/jms ${src.schema.dir}/jms-${schema.version}.xsd
Modified: branches/community/Seam_2_2_Drools5/examples/build.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/build.xml 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/examples/build.xml 2009-08-11 21:06:42 UTC (rev 11364)
@@ -465,6 +465,7 @@
<include name="seam.properties" />
<include name="seam.quartz.properties" />
<include name="*.drl" />
+ <include name="*.properties"/>
<include name="META-INF/persistence.xml" />
<include name="META-INF/ejb-jar.xml" />
<include name="META-INF/orm.xml" />
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/.gpd.pageflow.jpdl.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/.gpd.pageflow.jpdl.xml 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/.gpd.pageflow.jpdl.xml 2009-08-11 21:06:42 UTC (rev 11364)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<root-container name="numberGuess" width="750" height="744">
+<root-container name="numberGuess" width="687" height="408">
<node name="displayGuess" x="157" y="35" width="140" height="40">
<edge>
<label x="-44" y="-10"/>
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-11 21:06:42 UTC (rev 11364)
@@ -4,32 +4,45 @@
xmlns:bpm="http://jboss.com/products/seam/bpm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
- "http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
+ "http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd
http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd">
-
- <drools:rule-base name="ruleBase" rule-files="numberguess.drl"/>
+
+ <drools:knowledge-base name="kbase" knowledge-builder-config="kbuilderconfig.properties" knowledge-base-config="kbaseconfig.properties">
+ <drools:rule-resources>
+ <value>classpath:numberguess.drl:DRL</value>
+ </drools:rule-resources>
+ </drools:knowledge-base>
+
+ <drools:stateful-knowledge-session name="ksession" knowledge-base="#{kbase}" knowledge-session-config="ksessionconfig.properties">
+ <drools:event-listeners>
+ <value>org.drools.event.rule.DebugAgendaEventListener</value>
+ <value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
+ </drools:event-listeners>
+ </drools:stateful-knowledge-session>
+
+ <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.drl"/> -->
<!-- use this in order to load from decision table instead -->
- <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.xls"/> -->
+ <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.xls"/> -->
<!-- use this in order to load from a drl and also add a ruleflow -->
- <!-- <drools:rule-base name="ruleBase" rule-files="numberguessforflow.drl, numberguess.rf"/> -->
+ <!-- <drools:rule-base name="ruleBase" rule-files="numberguessforflow.drl, numberguess.rf"/> -->
<!-- use this in order to load from a xls and also add a ruleflow -->
<!-- <drools:rule-base name="ruleBase" rule-files="numberguessforflow.xls, numberguess.rf"/> -->
<!-- use this if you want to register a custom consequence exception handler -->
<!-- <drools:rule-base name="ruleBase" rule-files="numberguess.xls" consequence-exception-handler="#{gameConsequenceExceptionHandler}"/> -->
- <drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}">
+ <!-- <drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}"> -->
<!-- add WM event listeners -->
<!-- <drools:event-listeners>
<value>org.drools.event.DebugWorkingMemoryEventListener</value>
<value>org.drools.event.DebugAgendaEventListener</value>
</drools:event-listeners> -->
- </drools:managed-working-memory>
-
+ <!-- </drools:managed-working-memory> -->
<bpm:jbpm>
<bpm:pageflow-definitions>
<value>pageflow.jpdl.xml</value>
</bpm:pageflow-definitions>
</bpm:jbpm>
+
</components>
Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/kbaseconfig.properties
===================================================================
Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/kbuilderconfig.properties
===================================================================
Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/ksessionconfig.properties
===================================================================
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.jpg
===================================================================
(Binary files differ)
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.xml 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/pageflow.jpdl.xml 2009-08-11 21:06:42 UTC (rev 11364)
@@ -18,8 +18,8 @@
<decision name="drools">
- <handler class="org.jboss.seam.drools.DroolsDecisionHandler">
- <workingMemoryName>workingMemory</workingMemoryName>
+ <handler class="org.jboss.seam.drools.KnowledgeDecisionHandler">
+ <workingMemoryName>ksession</workingMemoryName>
<!-- if a ruleflow was added, start a process -->
<!-- <startProcessId>numberguessid</startProcessId> -->
<assertObjects>
Modified: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RandomNumber.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RandomNumber.java 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RandomNumber.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -21,9 +21,21 @@
}
@Unwrap
- public int getValue()
+ public Integer getValue()
{
return randomNumber;
}
+
+ public int getRandomNumber()
+ {
+ return randomNumber;
+ }
+
+ public void setRandomNumber(int randomNumber)
+ {
+ this.randomNumber = randomNumber;
+ }
+
+
}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeActionHandler.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeActionHandler.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeActionHandler.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,33 @@
+package org.jboss.seam.drools;
+
+import java.util.List;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * A jBPM ActionHandler that delegates to a Drools StatefulKnowledgeSession
+ * held in a Seam context variable.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public class KnowledgeActionHandler extends KnowledgeHandler implements ActionHandler
+{
+
+ public List<String> assertObjects;
+ public List<String> retractObjects;
+ public String workingMemoryName;
+ public String startProcessId;
+
+ public void execute(ExecutionContext executionContext) throws Exception
+ {
+ org.drools.runtime.StatefulKnowledgeSession ksession = getKnowledgeSession(workingMemoryName, assertObjects, retractObjects, executionContext);
+ if(startProcessId != null && startProcessId.trim().length() > 0 )
+ {
+ ksession.startProcess(startProcessId);
+ }
+ ksession.fireAllRules();
+ }
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeAssignmentHandler.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeAssignmentHandler.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeAssignmentHandler.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,33 @@
+package org.jboss.seam.drools;
+
+import java.util.List;
+
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.taskmgmt.def.AssignmentHandler;
+import org.jbpm.taskmgmt.exe.Assignable;
+
+/**
+ * A jBPM AssignmentHandler that delegates to a Drools StatefulKnowledgeSession
+ * held in a Seam context variable.
+ *
+ * @author Tihomir Surdilovic
+ */
+public class KnowledgeAssignmentHandler extends KnowledgeHandler implements AssignmentHandler
+{
+ public String workingMemoryName;
+ public List<String> assertObjects;
+ public List<String> retractObjects;
+ public String startProcessId;
+
+ public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception
+ {
+ org.drools.runtime.StatefulKnowledgeSession ksession = getKnowledgeSession(workingMemoryName, assertObjects, retractObjects, executionContext);
+ ksession.setGlobal( "assignable", assignable );
+ if(startProcessId != null && startProcessId.trim().length() > 0 )
+ {
+ ksession.startProcess(startProcessId);
+ }
+ ksession.fireAllRules();
+ }
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,167 @@
+package org.jboss.seam.drools;
+
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+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.io.ResourceFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.core.ResourceLoader;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * Manager component for a Drools KnowledgeBase
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+(a)Scope(ScopeType.APPLICATION)
+@BypassInterceptors
+public class KnowledgeBase
+{
+ private static final LogProvider log = Logging.getLogProvider(KnowledgeBase.class);
+ private static final Pattern COLON = 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 String RESOURCE_TYPE_URL = "url";
+ private static final String RESOURCE_TYPE_FILE = "file";
+ private static final String RESOURCE_TYPE_CLASSPATH = "classpath";
+
+ private String knowledgeBuilderConfig;
+ private String knowledgeBaseConfig;
+ private String[] ruleResources;
+ private org.drools.KnowledgeBase kbase;
+
+ @Create
+ public void createKnowledgeBase() throws Exception {
+ KnowledgeBuilderConfiguration kbuilderconfig;
+ if(knowledgeBaseConfig != null) {
+ Properties kbuilderProp = new Properties();
+ InputStream stream = ResourceLoader.instance().getResourceAsStream(knowledgeBuilderConfig);
+ if (stream==null)
+ {
+ throw new IllegalStateException("could not locate knowledgeBuilder configuration: " + knowledgeBaseConfig);
+ }
+ kbuilderProp.load(stream);
+ log.info("loading knowledge builder config properties: " + kbuilderProp.toString());
+ kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbuilderProp, null);
+ } else {
+ kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderconfig);
+
+ if(ruleResources != null) {
+ for(String nextResource : ruleResources) {
+ addResource(kbuilder, nextResource);
+ }
+ }
+
+ KnowledgeBuilderErrors kbuildererrors = kbuilder.getErrors();
+ if(kbuildererrors.size() > 0) {
+ for(KnowledgeBuilderError kbuildererror : kbuildererrors) {
+ log.error(kbuildererror.getMessage());
+ }
+ }
+
+ KnowledgeBaseConfiguration kbaseconfig;
+
+ if(knowledgeBaseConfig != null) {
+ Properties kbaseProp = new Properties();
+ InputStream stream = ResourceLoader.instance().getResourceAsStream(knowledgeBaseConfig);
+ if (stream==null)
+ {
+ throw new IllegalStateException("could not locate knowledgeBase configuration: " + knowledgeBaseConfig);
+ }
+ kbaseProp.load(stream);
+ log.info("loading knowledge base config properties: " + kbaseProp.toString());
+ kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(kbaseProp, null);
+ } else {
+ kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
+ }
+
+ kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseconfig);
+ kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+
+
+ }
+
+
+ @Unwrap
+ public org.drools.KnowledgeBase getKnowledgeBase()
+ {
+ return kbase;
+ }
+
+ 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;
+ }
+
+ protected void addResource(KnowledgeBuilder kbuilder, String resource) {
+ String[] resourceParts = COLON.split(resource.trim());
+
+ log.info("New resource path: " + resourceParts[0]);
+ log.info("New resource location: " + resourceParts[1]);
+ log.info("New resource type: " + resourceParts[2]);
+
+ if(resourceParts.length != 3) {
+ log.error("Unable to use resource: " + resource);
+ } else {
+ ResourceType resourceType = ResourceType.getResourceType(resourceParts[RESOURCE_TYPE]);
+ if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_URL)) {
+ kbuilder.add(ResourceFactory.newUrlResource(resourceParts[RESOURCE]), resourceType);
+ } else if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_FILE)) {
+ kbuilder.add(ResourceFactory.newFileResource(resourceParts[RESOURCE]), resourceType);
+ } else if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_CLASSPATH)) {
+ kbuilder.add(ResourceFactory.newClassPathResource(resourceParts[RESOURCE]), resourceType);
+ } else {
+ log.error("Unable to use resource path: " + resourceParts[RESOURCE_PATH]);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeDecisionHandler.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeDecisionHandler.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeDecisionHandler.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,35 @@
+package org.jboss.seam.drools;
+
+import java.util.List;
+
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.node.DecisionHandler;
+
+/**
+ * A jBPM DecisionHandler that delegates to a Drools StatefulKnowledgeSession
+ * held in a Seam context variable. The decision outcome is returned
+ * by setting the outcome attribute of the global named "decision".
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public class KnowledgeDecisionHandler extends KnowledgeHandler implements DecisionHandler
+{
+ public List<String> assertObjects;
+ public List<String> retractObjects;
+ public String workingMemoryName;
+ public String startProcessId;
+
+ public String decide(ExecutionContext executionContext) throws Exception
+ {
+ org.drools.runtime.StatefulKnowledgeSession ksession = getKnowledgeSession(workingMemoryName, assertObjects, retractObjects, executionContext);
+ ksession.setGlobal("decision", new Decision());
+ if(startProcessId != null && startProcessId.trim().length() > 0 )
+ {
+ ksession.startProcess(startProcessId);
+ }
+ ksession.fireAllRules();
+ return ( (Decision) ksession.getGlobal("decision") ).getOutcome();
+ }
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeHandler.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeHandler.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeHandler.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,92 @@
+package org.jboss.seam.drools;
+
+import java.util.List;
+
+import org.drools.runtime.rule.FactHandle;
+import org.jboss.seam.Component;
+import org.jboss.seam.bpm.Actor;
+import org.jboss.seam.core.Expressions;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.jpdl.el.ELException;
+
+/**
+ * Common functionality for jBPM handlers for Drools5.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public class KnowledgeHandler
+{
+ protected org.drools.runtime.StatefulKnowledgeSession getKnowledgeSession(String knowledgeSessionName, List<String> expressions, List<String> retractions, ExecutionContext executionContext) throws ELException
+ {
+ org.drools.runtime.StatefulKnowledgeSession ksession = (org.drools.runtime.StatefulKnowledgeSession) Component.getInstance(knowledgeSessionName, true);
+
+ if(expressions != null && expressions.size() > 0)
+ {
+ for (String objectName: expressions)
+ {
+ Object object = Expressions.instance().createValueExpression(objectName).getValue();
+ //Object object = new SeamVariableResolver().resolveVariable(objectName);
+ // assert the object into the rules engine
+ if (object instanceof Iterable)
+ {
+ for (Object element: (Iterable) object)
+ {
+ assertObject(ksession, element);
+ }
+ }
+ else
+ {
+ assertObject(ksession, object);
+ }
+ }
+ }
+
+ if(retractions != null && retractions.size() > 0)
+ {
+ for (String objectName: retractions)
+ {
+ Object object = Expressions.instance().createValueExpression(objectName).getValue();
+ //Object object = new SeamVariableResolver().resolveVariable(objectName);
+ // retract the object from the rules engine
+ if (object instanceof Iterable)
+ {
+ for (Object element: (Iterable) object)
+ {
+ retractObject(ksession, element);
+ }
+ }
+ else
+ {
+ retractObject(ksession, object);
+ }
+ }
+ }
+
+ ksession.insert(Actor.instance());
+
+ return ksession;
+ }
+
+ private void assertObject(org.drools.runtime.StatefulKnowledgeSession ksession, Object element)
+ {
+ FactHandle fact = ksession.getFactHandle(element);
+ if (fact==null)
+ {
+ ksession.insert(element);
+ }
+ else
+ {
+ ksession.update(fact, element);
+ }
+ }
+
+ private void retractObject(org.drools.runtime.StatefulKnowledgeSession ksession, Object element)
+ {
+ FactHandle fact = ksession.getFactHandle(element);
+ if (fact != null)
+ {
+ ksession.retract(fact);
+ }
+ }
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/SeamDelegate.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/SeamDelegate.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/SeamDelegate.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,51 @@
+package org.jboss.seam.drools;
+
+import org.drools.runtime.Globals;
+import org.jboss.seam.Component;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Init;
+
+/**
+ * Resolves Seam context variables as Drools globals
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public class SeamDelegate implements Globals
+{
+ private Globals delegate;
+
+ public Object get(String name)
+ {
+ if ( !Contexts.isApplicationContextActive() )
+ {
+ return delegate.get(name);
+ }
+ else
+ {
+ Object instance = Component.getInstance(name);
+ if (instance==null)
+ {
+ instance = delegate.get(name);
+ return instance==null ?
+ Init.instance().getRootNamespace().getChild(name) :
+ instance;
+ }
+ else
+ {
+ return instance;
+ }
+ }
+ }
+
+ public void set(String name, Object value)
+ {
+ delegate.set(name, value);
+ }
+
+ public void setDelegate(Globals delegate)
+ {
+ this.delegate = delegate;
+ }
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,174 @@
+package org.jboss.seam.drools;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import org.drools.KnowledgeBaseFactory;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.spi.GlobalResolver;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.rule.AgendaEventListener;
+import org.drools.event.rule.WorkingMemoryEventListener;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.core.Mutable;
+import org.jboss.seam.core.ResourceLoader;
+import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * A conversation-scoped Drools StatefulKnowledgeSession for a named KnowledgeBase
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+(a)Scope(ScopeType.CONVERSATION)
+@BypassInterceptors
+public class StatefulKnowledgeSession implements Mutable, Serializable
+{
+ private static final LogProvider log = Logging.getLogProvider(org.jboss.seam.drools.StatefulKnowledgeSession.class);
+ private static final Pattern COLON = Pattern.compile(":");
+ private static final int GLOBAL_NAME = 0;
+ private static final int GLOBAL_OBJ = 1;
+ private static final int GLOBAL_TYPE = 2;
+
+ private ValueExpression<org.drools.KnowledgeBase> knowledgeBase;
+ private String[] globals;
+ private String[] eventListeners;
+ private String knowledgeSessionConfig;
+
+ private org.drools.runtime.StatefulKnowledgeSession ksession;
+
+ @Unwrap
+ public org.drools.runtime.StatefulKnowledgeSession getStatefulKnowledgeSession() throws Exception {
+ if(ksession == null) {
+ KnowledgeSessionConfiguration ksessionconfig;
+ if(knowledgeSessionConfig != null) {
+ Properties ksessionProp = new Properties();
+ InputStream stream = ResourceLoader.instance().getResourceAsStream(knowledgeSessionConfig);
+ if (stream==null) {
+ throw new IllegalStateException("could not locate knowledgeSession configuration: " + knowledgeSessionConfig);
+ }
+ ksessionProp.load(stream);
+ log.info("loading knowledge session config properties: " + ksessionProp.toString());
+ ksessionconfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(ksessionProp);
+ } else {
+ ksessionconfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+ }
+
+ ksession = knowledgeBase.getValue().newStatefulKnowledgeSession(ksessionconfig, null);
+
+ ksession.getGlobals().setDelegate(new SeamDelegate());
+
+ if(eventListeners != null) {
+ for(String eventListener : eventListeners) {
+ setEventListener(ksession, eventListener);
+ }
+ }
+
+ if(globals != null) {
+ for(String nextGlobal : globals) {
+ String[] globalParts = COLON.split(nextGlobal.trim());
+ if(globalParts.length == 3) {
+ log.info("setting global: " + globalParts[GLOBAL_NAME] + " - " + globalParts[GLOBAL_OBJ]);
+ try {
+ Class ctype = Class.forName(globalParts[GLOBAL_TYPE]);
+ ksession.setGlobal(globalParts[GLOBAL_NAME], Expressions.instance().createValueExpression(globalParts[GLOBAL_OBJ], ctype).getValue());
+ } catch (Exception e) {
+ log.error("Error setting global: " + globalParts[GLOBAL_NAME] + " - " + globalParts[GLOBAL_OBJ] + " Exception : " + e.getMessage());
+ }
+ } else {
+ log.warn("Invalid global entry: " + nextGlobal);
+ }
+ }
+ }
+ }
+
+ return ksession;
+ }
+
+ protected GlobalResolver createGlobalResolver(GlobalResolver delegate)
+ {
+ return new SeamGlobalResolver(delegate);
+ }
+
+ protected void setEventListener(org.drools.runtime.StatefulKnowledgeSession ksession, String eventListener) {
+ try {
+ 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.warn("event Listener " + eventListener + " is not of valid type");
+ }
+ } catch(Exception e) {
+ log.warn("error adding event listener " + eventListener);
+ }
+ }
+
+ public boolean clearDirty()
+ {
+ return true;
+ }
+
+ @Destroy
+ public void destroy()
+ {
+ if(ksession != null) {
+ ksession.dispose();
+ }
+ }
+
+ public ValueExpression<org.drools.KnowledgeBase> getKnowledgeBase()
+ {
+ return knowledgeBase;
+ }
+
+ public void setKnowledgeBase(ValueExpression<org.drools.KnowledgeBase> knowledgeBase)
+ {
+ this.knowledgeBase = knowledgeBase;
+ }
+
+ public String[] getGlobals()
+ {
+ return globals;
+ }
+
+ public void setGlobals(String[] globals)
+ {
+ this.globals = globals;
+ }
+
+ public String[] getEventListeners()
+ {
+ return eventListeners;
+ }
+
+ public void setEventListeners(String[] eventListeners)
+ {
+ this.eventListeners = eventListeners;
+ }
+
+ public String getKnowledgeSessionConfig()
+ {
+ return knowledgeSessionConfig;
+ }
+
+ public void setKnowledgeSessionConfig(String knowledgeSessionConfig)
+ {
+ this.knowledgeSessionConfig = knowledgeSessionConfig;
+ }
+
+}
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd 2009-08-11 11:28:22 UTC (rev 11363)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd 2009-08-11 21:06:42 UTC (rev 11364)
@@ -59,5 +59,44 @@
<xs:attribute name="rule-base" type="components:expressionType"/>
</xs:attributeGroup>
<xs:element name="event-listeners" type="components:multiValuedProperty"/>
+
+ <xs:element name="knowledge-base">
+ <xs:annotation>
+ <xs:documentation>Drools KnowledgeBase</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element minOccurs="0" maxOccurs="1" ref="drools:rule-resources"/>
+ </xs:choice>
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="drools:attlist.KnowledgeBase"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="rule-resources" type="components:multiValuedProperty"/>
+ <xs:attributeGroup name="attlist.KnowledgeBase">
+ <xs:attribute name="knowledge-builder-config" type="components:string"/>
+ <xs:attribute name="knowledge-base-config" type="components:string"/>
+ </xs:attributeGroup>
+
+ <xs:element name="stateful-knowledge-session">
+ <xs:annotation>
+ <xs:documentation>Drools StatefulKnowledgeSession</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element minOccurs="0" maxOccurs="1" ref="drools:event-listeners"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="drools:globals"/>
+ </xs:choice>
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="drools:attlist.StatefulKnowledgeSession"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.StatefulKnowledgeSession">
+ <xs:attribute name="knowledge-base" type="components:expressionType"/>
+ <xs:attribute name="globals" type="components:string"/>
+ <xs:attribute name="event-listeners" type="components:string"/>
+ <xs:attribute name="knowledge-session-config" type="components:string"/>
+ </xs:attributeGroup>
+ <xs:element name="globals" type="components:multiValuedProperty"/>
</xs:schema>
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools5-2.2.xsd
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools5-2.2.xsd (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools5-2.2.xsd 2009-08-11 21:06:42 UTC (rev 11364)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+ targetNamespace="http://jboss.com/products/seam/drools" xmlns:drools="http://jboss.com/products/seam/drools"
+ xmlns:components="http://jboss.com/products/seam/components" attributeFormDefault="unqualified">
+
+ <xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.2.xsd"/>
+
+ <xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.2.xsd"/>
+
+ <xs:element name="knowledge-base">
+ <xs:annotation>
+ <xs:documentation>Drools KnowledgeBase</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="1" maxOccurs="1">
+ <xs:element name="knowledge-builder-config" type="components:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="knowledge-base-config" type="components:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="rule-resources" type="components:multiValuedProperty" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="drools:attlist.KnowledgeBase"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.KnowledgeBase">
+ <xs:attribute name="knowledge-builder-config" type="components:string"/>
+ <xs:attribute name="knowledge-base-config" type="components:string"/>
+ </xs:attributeGroup>
+</xs:schema>
\ No newline at end of file
15 years, 4 months
Seam SVN: r11363 - branches/community/Seam_2_2/src/test/ftest.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-08-11 07:28:22 -0400 (Tue, 11 Aug 2009)
New Revision: 11363
Modified:
branches/community/Seam_2_2/src/test/ftest/build.xml
Log:
JBQA-2500 Added functional tests for metawidget examples to the testall target
Modified: branches/community/Seam_2_2/src/test/ftest/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-11 09:06:34 UTC (rev 11362)
+++ branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-11 11:28:22 UTC (rev 11363)
@@ -107,6 +107,9 @@
<testexample name="jpa" />
<testexample name="mail" />
<testexample name="messages" />
+ <testexample name="metawidget/booking" />
+ <testexample name="metawidget/dvdstore" />
+ <testexample name="metawidget/groovybooking" />
<testexample name="nestedbooking" />
<testexample name="numberguess" />
<testexample name="openid" />
@@ -204,6 +207,9 @@
<cleanexample name="jpa" />
<cleanexample name="mail" />
<cleanexample name="messages" />
+ <cleanexample name="metawidget/booking" />
+ <cleanexample name="metawidget/dvdstore" />
+ <cleanexample name="metawidget/groovybooking" />
<cleanexample name="nestedbooking" />
<cleanexample name="numberguess" />
<cleanexample name="openid" />
@@ -238,6 +244,9 @@
<undeployexample name="jpa" />
<undeployexample name="mail" />
<undeployexample name="messages" />
+ <undeployexample name="metawidget/booking" />
+ <undeployexample name="metawidget/dvdstore" />
+ <undeployexample name="metawidget/groovybooking" />
<undeployexample name="nestedbooking" />
<undeployexample name="numberguess" />
<undeployexample name="openid" />
15 years, 4 months
Seam SVN: r11362 - branches/community/Seam_2_2/src/test/ftest.
by seam-commits@lists.jboss.org
Author: oskutka(a)redhat.com
Date: 2009-08-11 05:06:34 -0400 (Tue, 11 Aug 2009)
New Revision: 11362
Modified:
branches/community/Seam_2_2/src/test/ftest/ftest.properties
Log:
Don't start JBoss server for ftests by default.
Modified: branches/community/Seam_2_2/src/test/ftest/ftest.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/ftest.properties 2009-08-11 08:42:30 UTC (rev 11361)
+++ branches/community/Seam_2_2/src/test/ftest/ftest.properties 2009-08-11 09:06:34 UTC (rev 11362)
@@ -65,7 +65,7 @@
jboss5.profile=default
jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
-run.container.per.suite=true
+run.container.per.suite=false
jboss.deployments.restart=10
# seam-gen specific properties
15 years, 4 months
Seam SVN: r11361 - in branches/community/Seam_2_2/src/test/ftest: examples and 1 other directory.
by seam-commits@lists.jboss.org
Author: oskutka(a)redhat.com
Date: 2009-08-11 04:42:30 -0400 (Tue, 11 Aug 2009)
New Revision: 11361
Modified:
branches/community/Seam_2_2/src/test/ftest/build.xml
branches/community/Seam_2_2/src/test/ftest/examples/build.xml
branches/community/Seam_2_2/src/test/ftest/ftest.ci.properties
branches/community/Seam_2_2/src/test/ftest/ftest.properties
Log:
JBSEAM-4293 Make JBoss restart after a specified number of ftests run to prevent OutOfMemoryError
Modified: branches/community/Seam_2_2/src/test/ftest/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-10 23:27:39 UTC (rev 11360)
+++ branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-11 08:42:30 UTC (rev 11361)
@@ -42,6 +42,9 @@
</fileset>
</path>
+ <!-- TODO : should the libs be in seam/lib and managed with mvn? -->
+ <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="../../../lib/groovy-all.jar"/>
+
<target name="testall" description="Run functional testsuite based on container property">
<fail unless="container">Please set container property.</fail>
<antcall target="testall.${container}" />
@@ -49,7 +52,7 @@
<target name="testall.jboss4" description="Run functional testsuite for JBoss 4">
<property name="container" value="jboss4" />
- <antcall target="start.container.before.suite" />
+ <antcall target="start.container" />
<antcall target="start.selenium.server" />
<!-- Execute tests for all examples jboss-->
<testexample name="blog" />
@@ -82,11 +85,12 @@
<testexample name="wicket" />
<testexample name="wicket-runtime" />
<antcall target="stop.selenium.server" />
+ <antcall target="stop.container" />
</target>
<target name="testall.jboss5" description="Run functional testsuite for JBoss 5">
<property name="container" value="jboss5" />
- <antcall target="start.container.before.suite" />
+ <antcall target="start.container" />
<antcall target="start.selenium.server" />
<!-- Execute tests for all examples jboss-->
<testexample name="blog" />
@@ -119,6 +123,7 @@
<testexample name="wicket" />
<testexample name="wicket-runtime" />
<antcall target="stop.selenium.server" />
+ <antcall target="stop.container" />
</target>
<target name="testall.jboss-embedded" description="Run functional testsuite for JBoss Embedded">
@@ -159,7 +164,7 @@
<property name="container" value="jboss4" />
<antcall target="test.single.example" />
</target>
-
+
<target name="test.jboss5" description="Run tests for single example on JBoss 5">
<property name="container" value="jboss5" />
<antcall target="test.single.example" />
@@ -279,6 +284,17 @@
<attribute name="path" default="examples/@{name}" />
<attribute name="message" default="Running functional tests on @{name} example" />
<sequential>
+ <groovy>
+ <![CDATA[
+ def testExamplesRunSoFar = properties['testExamplesRunSoFar'] == null ? 0 : Integer.valueOf(properties['testExamplesRunSoFar']);
+ def jbossDeploymentsRestart = properties['jboss.deployments.restart'] == null ? 0 : Integer.valueOf(properties['jboss.deployments.restart']);
+ if (jbossDeploymentsRestart > 0 && testExamplesRunSoFar > 0 && testExamplesRunSoFar % jbossDeploymentsRestart == 0 ) {
+ ant.antcall(target:"restart.container");
+ }
+ testExamplesRunSoFar++;
+ properties['testExamplesRunSoFar'] = testExamplesRunSoFar;
+ ]]>
+ </groovy>
<echo>@{message}</echo>
<callExample path="@{path}" target="test" />
</sequential>
@@ -312,8 +328,22 @@
</ant>
</sequential>
</macrodef>
+
+ <target name="restart.container" if="run.container.per.suite">
+ <echo>Restarting container</echo>
+ <antcall target="stop.container" >
+ </antcall>
+ <antcall target="start.container" >
+ </antcall>
+ </target>
- <target name="start.container.before.suite" if="run.container.per.suite">
+ <target name="stop.container" if="run.container.per.suite">
+ <echo>Stopping container</echo>
+ <ant antfile="examples/build.xml" target="stop.container.jboss" inheritall="false">
+ <property name="container" value="${container}" />
+ </ant>
+ </target>
+ <target name="start.container" if="run.container.per.suite">
<echo>Starting container</echo>
<ant antfile="examples/build.xml" target="start.container.jboss" inheritall="false">
<property name="container" value="${container}" />
Modified: branches/community/Seam_2_2/src/test/ftest/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2009-08-10 23:27:39 UTC (rev 11360)
+++ branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2009-08-11 08:42:30 UTC (rev 11361)
@@ -223,4 +223,25 @@
<server:start name="${container.profile}" />
</target>
+ <target name="stop.container.jboss" depends="container.properties" >
+ <sequential>
+ <echo message="Shutting down JBoss server"/>
+ <java classname="org.jboss.Shutdown" fork="false" dir="${container.home}/bin">
+ <classpath>
+ <pathelement location="${container.home}/bin/shutdown.jar" />
+ <!--<pathelement location="${container.home}/client/jbossall-client.jar" />-->
+ </classpath>
+ <arg value="--server"/>
+ <arg value="jnp://localhost:1099"/>
+ <arg value="--shutdown"/>
+ </java>
+ <waitfor maxwait="300" maxwaitunit="second">
+ <not>
+ <socket server="localhost" port="1099" />
+ </not>
+ </waitfor>
+ <sleep seconds="3"/>
+ </sequential>
+ </target>
+
</project>
Modified: branches/community/Seam_2_2/src/test/ftest/ftest.ci.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/ftest.ci.properties 2009-08-10 23:27:39 UTC (rev 11360)
+++ branches/community/Seam_2_2/src/test/ftest/ftest.ci.properties 2009-08-11 08:42:30 UTC (rev 11361)
@@ -52,6 +52,9 @@
jboss5.profile=default
jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+run.container.per.suite=true
+jboss.deployments.restart=10
+
# seam-gen specific properties
seamgen.delete.project=true
Modified: branches/community/Seam_2_2/src/test/ftest/ftest.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/ftest.properties 2009-08-10 23:27:39 UTC (rev 11360)
+++ branches/community/Seam_2_2/src/test/ftest/ftest.properties 2009-08-11 08:42:30 UTC (rev 11361)
@@ -65,6 +65,9 @@
jboss5.profile=default
jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+run.container.per.suite=true
+jboss.deployments.restart=10
+
# seam-gen specific properties
#seamgen.delete.project=true
15 years, 4 months
Seam SVN: r11360 - branches/community/Seam_2_2/src/main/org/jboss/seam/jmx.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-08-10 19:27:39 -0400 (Mon, 10 Aug 2009)
New Revision: 11360
Added:
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/AgentID.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/DefaultExceptionHandler.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/JMXInvocationHandler.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxyCreationException.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/Mbean.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyContext.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyExceptionHandler.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/RuntimeProxyException.java
branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/package-info.java
Log:
JBSEAM-4339
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/AgentID.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/AgentID.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/AgentID.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,103 @@
+package org.jboss.seam.jmx;
+
+import java.net.InetAddress;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.util.Random;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
+
+import org.jboss.mx.server.ServerConstants;
+
+/**
+ * Utility class for creating JMX agent identifiers. Also contains the
+ * helper method for retrieving the <tt>AgentID</tt> of an existing MBean server
+ * instance.
+ *
+ * @see javax.management.MBeanServerDelegateMBean
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ *
+ */
+public class AgentID
+ implements ServerConstants
+{
+ // Static ----------------------------------------------------
+ private static SynchronizedLong id = new SynchronizedLong(0);
+
+ private static final Random rand = new Random(System.currentTimeMillis());
+
+ /**
+ * Creates a new agent ID string. The identifier is of the form
+ * <tt><ip.address>/<creation time in ms>/<VMID+(random int 0-100)>/<sequence #></tt>.<P>
+ *
+ * This AgentID string is globally unique.
+ *
+ * @return Agent ID string
+ */
+ public static String create()
+ {
+ String ipAddress = null;
+
+ try
+ {
+ ipAddress = (String) AccessController.doPrivileged(
+ new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ }
+ );
+ }
+ catch(PrivilegedActionException e)
+ {
+ ipAddress = "127.0.0.1";
+ }
+ // use the VMID to create a more unique ID that can be used to guarantee that this
+ // MBeanServerID is unique across multiple JVMs, even on the same host
+ String vmid = new java.rmi.dgc.VMID().toString().replace(':','x').replace('-','X') + rand.nextInt(100);
+
+ return ipAddress + "/" + System.currentTimeMillis() + "/" + vmid + "/"+ (id.increment());
+ }
+ /**
+ * test
+ *
+ * @param args
+ */
+ public static void main (String args[])
+ {
+ for (int c=0;c<10;c++)
+ System.out.println(AgentID.create());
+ }
+
+ /**
+ * Returns the agent identifier string of a given MBean server instance.
+ *
+ * @return <tt>MBeanServerId</tt> attribute of the MBean server delegate.
+ */
+ public static String get(MBeanServer server)
+ {
+ try
+ {
+ ObjectName name = new ObjectName(MBEAN_SERVER_DELEGATE);
+ String agentID = (String)server.getAttribute(name, "MBeanServerId");
+
+ return agentID;
+ }
+ catch (Throwable t)
+ {
+ throw new Error("Cannot find the MBean server delegate: " + t.toString());
+ }
+ }
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/DefaultExceptionHandler.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/DefaultExceptionHandler.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/DefaultExceptionHandler.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,110 @@
+package org.jboss.seam.jmx;
+
+
+import java.lang.reflect.Method;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.AttributeNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeErrorException;
+
+/**
+ * Default exception handler for MBean proxy.
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ *
+ */
+public class DefaultExceptionHandler
+ implements ProxyExceptionHandler
+{
+
+ // InstanceNotFound, AttributeNotFound and InvalidAttributeValue
+ // are not exceptions declared in the mgmt interface and therefore
+ // must be rethrown as runtime exceptions to avoid UndeclaredThrowable
+ // exceptions on the client
+
+ public Object handleInstanceNotFound(ProxyContext ctx,
+ InstanceNotFoundException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ throw new RuntimeProxyException("Instance not found: " + e.toString());
+ }
+
+ public Object handleAttributeNotFound(ProxyContext ctx,
+ AttributeNotFoundException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ throw new RuntimeProxyException("Attribute not found: " + e.toString());
+ }
+
+ public Object handleInvalidAttributeValue(ProxyContext ctx,
+ InvalidAttributeValueException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ throw new RuntimeProxyException("Invalid attribute value: " + e.toString());
+ }
+
+ public Object handleMBeanException(ProxyContext ctx, MBeanException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ // assuming MBeanException only wraps mgmt interface "application"
+ // exceptions therefore we can safely rethrow the target exception
+ // as its declared in the mgmt interface
+ throw e.getTargetException();
+ }
+
+ public Object handleReflectionException(ProxyContext ctx,
+ ReflectionException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ // use of reflection exception is inconsistent in the API so the
+ // safest bet is to rethrow a runtime exception
+
+ Exception target = e.getTargetException();
+ if (target instanceof RuntimeException)
+ throw target;
+ else
+ throw new RuntimeProxyException(target.toString());
+ }
+
+ public Object handleRuntimeOperationsException(ProxyContext ctx,
+ RuntimeOperationsException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ // target is always a runtime exception, so its ok to throw it from here
+ throw e.getTargetException();
+ }
+
+ public Object handleRuntimeMBeanException(ProxyContext ctx,
+ RuntimeMBeanException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ // target is always a runtime exception, so its ok to throw it from here
+ throw e.getTargetException();
+ }
+
+ public Object handleRuntimeError(ProxyContext ctx, RuntimeErrorException e,
+ Method m, Object[] args)
+ throws Exception
+ {
+ // just unwrap and throw the actual error
+ throw e.getTargetError();
+ }
+
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/JMXInvocationHandler.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/JMXInvocationHandler.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/JMXInvocationHandler.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,445 @@
+package org.jboss.seam.jmx;
+
+
+import java.io.Serializable;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import java.util.HashMap;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.RuntimeErrorException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeOperationsException;
+
+/**
+ * Invocation handler for MBean proxies.
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ *
+ */
+public class JMXInvocationHandler
+ implements ProxyContext, InvocationHandler, Serializable
+{
+ private static final long serialVersionUID = 3714728148040623702L;
+
+ // Attributes -------------------------------------------------
+
+ /**
+ * Reference to the MBean server this proxy connects to.
+ */
+ protected MBeanServer server = null;
+
+ /**
+ * The object name of the MBean this proxy represents.
+ */
+ protected ObjectName objectName = null;
+
+ /**
+ * Default exception handler for the proxy.
+ */
+ private ProxyExceptionHandler handler = new DefaultExceptionHandler();
+
+ /**
+ * MBean attribute meta data.
+ */
+ private HashMap attributeMap = new HashMap();
+
+ /**
+ * Indicates whether Object.toString() should be delegated to the resource
+ * or handled by the proxy.
+ */
+ private boolean delegateToStringToResource = false;
+
+ /**
+ * Indicates whether Object.equals() should be delegated to the resource
+ * or handled by the proxy.
+ */
+ private boolean delegateEqualsToResource = false;
+
+ /**
+ * Indicates whether Object.hashCode() should be delegated to the resource
+ * or handled by the proxy.
+ */
+ private boolean delegateHashCodeToResource = false;
+
+
+ // Constructors -----------------------------------------------
+
+ /**
+ * Constructs a new JMX MBean Proxy invocation handler.
+ *
+ * @param server reference to the MBean server this proxy connects to
+ * @param name object name of the MBean this proxy represents
+ *
+ * @throws MBeanProxyCreationException wraps underlying JMX exceptions in
+ * case the proxy creation fails
+ */
+ public JMXInvocationHandler(MBeanServer server, ObjectName name)
+ throws MBeanProxyCreationException
+ {
+ try
+ {
+ if (server == null)
+ throw new MBeanProxyCreationException("null agent reference");
+
+ this.server = server;
+ this.objectName = name;
+
+ MBeanInfo info = server.getMBeanInfo(objectName);
+ MBeanAttributeInfo[] attributes = info.getAttributes();
+ MBeanOperationInfo[] operations = info.getOperations();
+
+ // collect the MBean attribute metadata for standard mbean proxies
+ for (int i = 0; i < attributes.length; ++i)
+ attributeMap.put(attributes[i].getName(), attributes[i]);
+
+ // Check whether the target resource exposes the common object methods.
+ // Dynamic Proxy will delegate these methods automatically to the
+ // invoke() implementation.
+ for (int i = 0; i < operations.length; ++i)
+ {
+ if (operations[i].getName().equals("toString") &&
+ operations[i].getReturnType().equals("java.lang.String") &&
+ operations[i].getSignature().length == 0)
+ {
+ delegateToStringToResource = true;
+ }
+
+ else if (operations[i].getName().equals("equals") &&
+ operations[i].getReturnType().equals(Boolean.TYPE.getName()) &&
+ operations[i].getSignature().length == 1 &&
+ operations[i].getSignature() [0].getType().equals("java.lang.Object"))
+ {
+ delegateEqualsToResource = true;
+ }
+
+ else if (operations[i].getName().equals("hashCode") &&
+ operations[i].getReturnType().equals(Integer.TYPE.getName()) &&
+ operations[i].getSignature().length == 0)
+ {
+ delegateHashCodeToResource = true;
+ }
+ }
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new MBeanProxyCreationException("Object name " + name + " not found: " + e.toString());
+ }
+ catch (IntrospectionException e)
+ {
+ throw new MBeanProxyCreationException(e.toString());
+ }
+ catch (ReflectionException e)
+ {
+ throw new MBeanProxyCreationException(e.toString());
+ }
+ }
+
+
+ // InvocationHandler implementation ---------------------------
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Exception
+ {
+ Class declaringClass = method.getDeclaringClass();
+
+ // Handle methods from Object class. If the target resource exposes
+ // operation metadata with same signature then the invocations will be
+ // delegated to the target. Otherwise this instance of invocation handler
+ // will execute them.
+ if (declaringClass == Object.class)
+ return handleObjectMethods(method, args);
+
+ // Check methods from ProxyContext interface. If invoked, delegate
+ // to the context implementation part of this invocation handler.
+ if (declaringClass == ProxyContext.class)
+ return method.invoke(this, args);
+
+ // Check methods from DynamicMBean interface. This allows the proxy
+ // to be used in cases where the underlying metadata has changed (a la
+ // Dynamic MBean).
+ if (declaringClass == DynamicMBean.class)
+ return handleDynamicMBeanInvocation(method, args);
+
+ try
+ {
+ String methodName = method.getName();
+
+ // Assume a get/setAttribute convention on the typed proxy interface.
+ // If the MBean metadata exposes a matching attribute then use the
+ // MBeanServer attribute accessors to read/modify the value. If not,
+ // fallback to MBeanServer.invoke() assuming this is an operation
+ // invocation despite the accessor naming convention.
+
+ // getter
+ if (methodName.startsWith("get") && args == null)
+ {
+ String attrName = methodName.substring(3, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null)
+ {
+ String retType = method.getReturnType().getName();
+
+ // check for correct return type on the getter
+ if (retType.equals(info.getType()))
+ {
+ return server.getAttribute(objectName, attrName);
+ }
+ }
+ }
+
+ // boolean getter
+ else if (methodName.startsWith("is") && args == null)
+ {
+ String attrName = methodName.substring(2, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null && info.isIs())
+ {
+ Class retType = method.getReturnType();
+
+ // check for correct return type on the getter
+ if (retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))
+ {
+ return server.getAttribute(objectName, attrName);
+ }
+ }
+ }
+
+ // setter
+ else if (methodName.startsWith("set") && args != null && args.length == 1)
+ {
+ String attrName = methodName.substring(3, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null && method.getReturnType().equals(Void.TYPE))
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+ Class signatureClass = null;
+ String classType = info.getType();
+
+ if (isPrimitive(classType))
+ signatureClass = getPrimitiveClass(classType);
+ else
+ signatureClass = cl.loadClass(info.getType());
+
+ if (signatureClass.isAssignableFrom(args[0].getClass()))
+ {
+ server.setAttribute(objectName, new Attribute(attrName, args[0]));
+ return null;
+ }
+ }
+ }
+
+ String[] signature = null;
+
+ if (args != null)
+ {
+ signature = new String[args.length];
+ Class[] sign = method.getParameterTypes();
+
+ for (int i = 0; i < sign.length; ++i)
+ signature[i] = sign[i].getName();
+ }
+
+ return server.invoke(objectName, methodName, args, signature);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ return getExceptionHandler().handleInstanceNotFound(this, e, method, args);
+ }
+ catch (AttributeNotFoundException e)
+ {
+ return getExceptionHandler().handleAttributeNotFound(this, e, method, args);
+ }
+ catch (InvalidAttributeValueException e)
+ {
+ return getExceptionHandler().handleInvalidAttributeValue(this, e, method, args);
+ }
+ catch (MBeanException e)
+ {
+ return getExceptionHandler().handleMBeanException(this, e, method, args);
+ }
+ catch (ReflectionException e)
+ {
+ return getExceptionHandler().handleReflectionException(this, e, method, args);
+ }
+ catch (RuntimeOperationsException e)
+ {
+ return getExceptionHandler().handleRuntimeOperationsException(this, e, method, args);
+ }
+ catch (RuntimeMBeanException e)
+ {
+ return getExceptionHandler().handleRuntimeMBeanException(this, e, method, args);
+ }
+ catch (RuntimeErrorException e)
+ {
+ return getExceptionHandler().handleRuntimeError(this, e, method, args);
+ }
+ }
+
+ public ProxyExceptionHandler getExceptionHandler()
+ {
+ return handler;
+ }
+
+
+ // ProxyContext implementation -----------------------------------
+
+ // The proxy provides an access point for the client to methods not part
+ // of the MBean's management interface. It can be used to configure the
+ // invocation (with context, client side interceptors, RPC), exception
+ // handling, act as an access point to MBean server interface and so on.
+
+ public void setExceptionHandler(ProxyExceptionHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public MBeanServer getMBeanServer()
+ {
+ return server;
+ }
+
+ public ObjectName getObjectName()
+ {
+ return objectName;
+ }
+
+
+ // Object overrides ----------------------------------------------
+
+ public String toString()
+ {
+ return "MBeanProxy for " + objectName + " (Agent ID: " + AgentID.get(server) + ")";
+ }
+
+
+ // Private -------------------------------------------------------
+
+ private Object handleObjectMethods(Method method, Object[] args)
+ throws InstanceNotFoundException, ReflectionException,
+ IntrospectionException, MBeanException
+ {
+ if (method.getName().equals("toString"))
+ {
+ if (delegateToStringToResource)
+ return server.invoke(objectName, "toString", null, null);
+ else
+ return toString();
+ }
+
+ else if (method.getName().equals("equals"))
+ {
+ if (delegateEqualsToResource)
+ {
+ return server.invoke(objectName, "equals",
+ new Object[] { args[0] },
+ new String[] { "java.lang.Object" }
+ );
+ }
+ else if (Proxy.isProxyClass(args[0].getClass()))
+ {
+ Proxy prxy = (Proxy)args[0];
+ return new Boolean(this.equals(Proxy.getInvocationHandler(prxy)));
+ }
+ else
+ {
+ return new Boolean(this.equals(args[0]));
+ }
+ }
+
+ else if (method.getName().equals("hashCode"))
+ {
+ if (delegateHashCodeToResource)
+ return server.invoke(objectName, "hashCode", null, null);
+ else
+ return new Integer(this.hashCode());
+ }
+
+ else throw new Error("Unexpected method invocation!");
+ }
+
+ private Object handleDynamicMBeanInvocation(Method method, Object[] args)
+ throws InstanceNotFoundException, ReflectionException,
+ IntrospectionException, MBeanException, AttributeNotFoundException,
+ InvalidAttributeValueException
+ {
+ String methodName = method.getName();
+
+ if (methodName.equals("setAttribute"))
+ {
+ server.setAttribute(objectName, (Attribute)args[0]);
+ return null;
+ }
+ else if (methodName.equals("setAttributes"))
+ return server.setAttributes(objectName, (AttributeList)args[0]);
+ else if (methodName.equals("getAttribute"))
+ return server.getAttribute(objectName, (String)args[0]);
+ else if (methodName.equals("getAttributes"))
+ return server.getAttributes(objectName, (String[])args[0]);
+ else if (methodName.equals("invoke"))
+ return server.invoke(objectName, (String)args[0], (Object[])args[1], (String[])args[2]);
+ else if (methodName.equals("getMBeanInfo"))
+ return server.getMBeanInfo(objectName);
+
+ else throw new Error("Unexpected method invocation!");
+ }
+
+ private boolean isPrimitive(String type)
+ {
+ if (type.equals(Integer.TYPE.getName())) return true;
+ if (type.equals(Long.TYPE.getName())) return true;
+ if (type.equals(Boolean.TYPE.getName())) return true;
+ if (type.equals(Byte.TYPE.getName())) return true;
+ if (type.equals(Character.TYPE.getName())) return true;
+ if (type.equals(Short.TYPE.getName())) return true;
+ if (type.equals(Float.TYPE.getName())) return true;
+ if (type.equals(Double.TYPE.getName())) return true;
+ if (type.equals(Void.TYPE.getName())) return true;
+
+ return false;
+ }
+
+ private Class getPrimitiveClass(String type)
+ {
+ if (type.equals(Integer.TYPE.getName())) return Integer.TYPE;
+ if (type.equals(Long.TYPE.getName())) return Long.TYPE;
+ if (type.equals(Boolean.TYPE.getName())) return Boolean.TYPE;
+ if (type.equals(Byte.TYPE.getName())) return Byte.TYPE;
+ if (type.equals(Character.TYPE.getName()))return Character.TYPE;
+ if (type.equals(Short.TYPE.getName())) return Short.TYPE;
+ if (type.equals(Float.TYPE.getName())) return Float.TYPE;
+ if (type.equals(Double.TYPE.getName())) return Double.TYPE;
+ if (type.equals(Void.TYPE.getName())) return Void.TYPE;
+
+ return null;
+ }
+
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxy.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxy.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,119 @@
+package org.jboss.seam.jmx;
+
+import java.lang.reflect.Proxy;
+
+import javax.management.DynamicMBean;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+public class MBeanProxy
+{
+
+ // Static --------------------------------------------------------
+
+ /**
+ * Creates a proxy to an MBean in the given MBean server.
+ *
+ * @param intrface the interface this proxy implements
+ * @param name object name of the MBean this proxy connects to
+ * @param agentID agent ID of the MBean server this proxy connects to
+ *
+ * @return proxy instance
+ *
+ * @throws MBeanProxyCreationException if the proxy could not be created
+ */
+ public static Object get(Class intrface, ObjectName name, String agentID) throws MBeanProxyCreationException
+ {
+ return get(intrface, name, (MBeanServer)MBeanServerFactory.findMBeanServer(agentID).get(0));
+ }
+
+ /**
+ * Creates a proxy to an MBean in the given MBean server.
+ *
+ * @param intrface the interface this proxy implements
+ * @param name object name of the MBean this proxy connects to
+ * @param server MBean server this proxy connects to
+ *
+ * @return proxy instance
+ *
+ * @throws MBeanProxyCreationException if the proxy could not be created
+ */
+ public static Object get(Class intrface, ObjectName name, MBeanServer server) throws MBeanProxyCreationException
+ {
+ return get(new Class[] { intrface, ProxyContext.class, DynamicMBean.class }, name, server);
+ }
+
+ /**
+ */
+ public static Object get(ObjectName name, MBeanServer server) throws MBeanProxyCreationException
+ {
+ return get(new Class[] { ProxyContext.class, DynamicMBean.class }, name, server);
+ }
+
+ private static Object get(Class[] interfaces, ObjectName name, MBeanServer server) throws MBeanProxyCreationException
+ {
+ return Proxy.newProxyInstance(
+ Thread.currentThread().getContextClassLoader(),
+ interfaces, new JMXInvocationHandler(server, name)
+ );
+ }
+
+ /**
+ * Convenience method for registering an MBean and retrieving a proxy for it.
+ *
+ * @param instance MBean instance to be registered
+ * @param intrface the interface this proxy implements
+ * @param name object name of the MBean
+ * @param agentID agent ID of the MBean server this proxy connects to
+ *
+ * @return proxy instance
+ *
+ * @throws MBeanProxyCreationException if the proxy could not be created
+ */
+ public static Object create(Class instance, Class intrface, ObjectName name, String agentID) throws MBeanProxyCreationException
+ {
+ return create(instance, intrface, name, (MBeanServer)MBeanServerFactory.findMBeanServer(agentID).get(0));
+ }
+
+ /**
+ * Convenience method for registering an MBean and retrieving a proxy for it.
+ *
+ * @param instance MBean instance to be registered
+ * @param intrface the interface this proxy implements
+ * @param name object name of the MBean
+ * @param server MBean server this proxy connects to
+ *
+ * @throws MBeanProxyCreationException if the proxy could not be created
+ */
+ public static Object create(Class instance, Class intrface, ObjectName name, MBeanServer server) throws MBeanProxyCreationException
+ {
+ try
+ {
+ server.createMBean(instance.getName(), name);
+ return get(intrface, name, server);
+ }
+ catch (ReflectionException e) {
+ throw new MBeanProxyCreationException("Creating the MBean failed: " + e.toString());
+ }
+ catch (InstanceAlreadyExistsException e) {
+ throw new MBeanProxyCreationException("Instance already exists: " + name);
+ }
+ catch (MBeanRegistrationException e) {
+ throw new MBeanProxyCreationException("Error registering the MBean to the server: " + e.toString());
+ }
+ catch (MBeanException e) {
+ throw new MBeanProxyCreationException(e.toString());
+ }
+ catch (NotCompliantMBeanException e) {
+ throw new MBeanProxyCreationException("Not a compliant MBean " + instance.getClass().getName() + ": " + e.toString());
+ }
+ }
+
+}
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxyCreationException.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxyCreationException.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/MBeanProxyCreationException.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,24 @@
+package org.jboss.seam.jmx;
+
+import javax.management.JMException;
+
+public class MBeanProxyCreationException
+ extends JMException
+{
+ private static final long serialVersionUID = 1008637966352433381L;
+
+ // Constructors --------------------------------------------------
+ public MBeanProxyCreationException()
+ {
+ super();
+ }
+
+ public MBeanProxyCreationException(String msg)
+ {
+ super(msg);
+ }
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/Mbean.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/Mbean.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/Mbean.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,46 @@
+package org.jboss.seam.jmx;
+
+import javax.management.ObjectName;
+
+import org.jboss.seam.annotations.Unwrap;
+
+public class Mbean
+{
+ String objectName;
+ String agentId;
+ String proxyClass;
+
+ public String getAgentId() {
+ return agentId;
+ }
+
+ public void setAgentId(String agentId) {
+ this.agentId = agentId;
+ }
+
+ public String getObjectName() {
+ return objectName;
+ }
+
+ public void setObjectName(String objectName) {
+ this.objectName = objectName;
+ }
+
+ public String getProxyClass() {
+ return proxyClass;
+ }
+
+ public void setProxyClass(String proxyClass) {
+ this.proxyClass = proxyClass;
+ }
+
+ @Unwrap
+ public Object createProxy() {
+ try {
+ Object o = MBeanProxy.get(Class.forName(proxyClass), new ObjectName(getObjectName()), getAgentId());
+ return o;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyContext.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyContext.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyContext.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,23 @@
+package org.jboss.seam.jmx;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ *
+ */
+public interface ProxyContext
+{
+ void setExceptionHandler(ProxyExceptionHandler handler);
+
+ MBeanServer getMBeanServer();
+
+ ObjectName getObjectName();
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyExceptionHandler.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyExceptionHandler.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/ProxyExceptionHandler.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,40 @@
+package org.jboss.seam.jmx;
+
+import java.lang.reflect.Method;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.AttributeNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeErrorException;
+
+/**
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ */
+public interface ProxyExceptionHandler
+{
+ public Object handleInstanceNotFound(ProxyContext ctx, InstanceNotFoundException e, Method m, Object[] args) throws Exception;
+
+ public Object handleAttributeNotFound(ProxyContext ctx, AttributeNotFoundException e, Method m, Object[] args) throws Exception;
+
+ public Object handleInvalidAttributeValue(ProxyContext ctx, InvalidAttributeValueException e, Method m, Object[] args) throws Exception;
+
+ public Object handleMBeanException(ProxyContext ctx, MBeanException e, Method m, Object[] args) throws Exception;
+
+ public Object handleReflectionException(ProxyContext ctx, ReflectionException e, Method m, Object[] args) throws Exception;
+
+ public Object handleRuntimeOperationsException(ProxyContext ctx, RuntimeOperationsException e, Method m, Object[] args) throws Exception;
+
+ public Object handleRuntimeMBeanException(ProxyContext ctx, RuntimeMBeanException e, Method m, Object[] args) throws Exception;
+
+ public Object handleRuntimeError(ProxyContext ctx, RuntimeErrorException e, Method m, Object[] args) throws Exception;
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/RuntimeProxyException.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/RuntimeProxyException.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/RuntimeProxyException.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,29 @@
+package org.jboss.seam.jmx;
+
+import javax.management.JMRuntimeException;
+
+/**
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+ * @version $Revision: 81019 $
+ */
+public class RuntimeProxyException
+ extends JMRuntimeException
+{
+ private static final long serialVersionUID = -1166909485463779459L;
+
+ // Constructors --------------------------------------------------
+ public RuntimeProxyException()
+ {
+ super();
+ }
+
+ public RuntimeProxyException(String msg)
+ {
+ super(msg);
+ }
+}
+
+
+
+
Added: branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/package-info.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/package-info.java (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/jmx/package-info.java 2009-08-10 23:27:39 UTC (rev 11360)
@@ -0,0 +1,6 @@
+@Namespace(value="http://jboss.com/products/seam/jmx", prefix="org.jboss.seam.jmx")
+@AutoCreate
+package org.jboss.seam.jmx;
+
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Namespace;
15 years, 4 months
Seam SVN: r11359 - tags.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-10 10:27:41 -0400 (Mon, 10 Aug 2009)
New Revision: 11359
Added:
tags/JBPAPP_5_0-CR2/
Log:
tagged Seam for EAP 5 CR2
Copied: tags/JBPAPP_5_0-CR2 (from rev 11358, branches/enterprise/JBPAPP_5_0)
15 years, 4 months
Seam SVN: r11358 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-10 09:09:26 -0400 (Mon, 10 Aug 2009)
New Revision: 11358
Modified:
branches/enterprise/JBPAPP_5_0/build/sample.build.properties
Log:
JBPAPP-2436 - removed references to jboss 4.2.3
Modified: branches/enterprise/JBPAPP_5_0/build/sample.build.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/sample.build.properties 2009-08-10 12:32:42 UTC (rev 11357)
+++ branches/enterprise/JBPAPP_5_0/build/sample.build.properties 2009-08-10 13:09:26 UTC (rev 11358)
@@ -3,10 +3,7 @@
#
# Location of JBoss AS and Tomcat
# -------------------------------
-#jboss.home /Applications/jboss-4.2.3.GA # Default
-#tomcat.home /Applications/apache-tomcat-6.0 # Default
-#jboss.home C:\\jboss-4.2.3.GA
-#tomcat.home C:\\Tomcat-6.0
+#jboss.home /jboss-eap-5.0/jboss-as # Default
#
# Misc Settings
# -------------
15 years, 4 months
Seam SVN: r11357 - in branches/enterprise/JBPAPP_5_0: examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom and 7 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-10 08:32:42 -0400 (Mon, 10 Aug 2009)
New Revision: 11357
Modified:
branches/enterprise/JBPAPP_5_0/examples/dvdstore/src/com/jboss/dvd/seam/testng.xml
branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/LoggerBean.java
branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/test/testng.xml
branches/enterprise/JBPAPP_5_0/examples/seamdiscs/src/org/jboss/seam/example/seamdiscs/test/testng.xml
branches/enterprise/JBPAPP_5_0/examples/seamspace/src/org/jboss/seam/example/seamspace/test/testng.xml
branches/enterprise/JBPAPP_5_0/src/test/excel/unit/org/jboss/seam/test/excel/unit/testng.xml
branches/enterprise/JBPAPP_5_0/src/test/integration/src/org/jboss/seam/test/integration/testng.xml
branches/enterprise/JBPAPP_5_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/testng.xml
Log:
JBPAPP-2410 - replaced colons by dashes in testng test names
Modified: branches/enterprise/JBPAPP_5_0/examples/dvdstore/src/com/jboss/dvd/seam/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/dvdstore/src/com/jboss/dvd/seam/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/examples/dvdstore/src/com/jboss/dvd/seam/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,25 +1,25 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="DVD Store" verbose="2" parallel="false">
- <test name="DVD Store: Model Unit Tests">
+ <test name="DVD Store - Model Unit Tests">
<classes>
<class name="com.jboss.dvd.seam.test.ProductUnitTest" />
</classes>
</test>
- <test name="DVD Store: Store Beans">
+ <test name="DVD Store - Store Beans">
<classes>
<class name="com.jboss.dvd.seam.test.SearchTest"/>
<class name="com.jboss.dvd.seam.test.BestSellersTest"/>
</classes>
</test>
- <test name="DVD Store: Admin Beans">
+ <test name="DVD Store - Admin Beans">
<classes>
<class name="com.jboss.dvd.seam.test.StoreManagerTest"/>
</classes>
</test>
- <test name="DVD Store: Order">
+ <test name="DVD Store - Order">
<classes>
<class name="com.jboss.dvd.seam.test.OrderTest" />
</classes>
Modified: branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/LoggerBean.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/LoggerBean.java 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/LoggerBean.java 2009-08-10 12:32:42 UTC (rev 11357)
@@ -25,7 +25,9 @@
{
try
{
- ChatroomEvent event = (ChatroomEvent) ( (ObjectMessage) msg ).getObject();
+ Object omsg = ((ObjectMessage) msg ).getObject();
+ log.info("URL is **** " + Thread.currentThread().getContextClassLoader().getResource("ChatroomEvent"));
+ ChatroomEvent event = (ChatroomEvent) omsg;
log.info( "#0: #1", event.getUser(), event.getData()==null ? event.getAction() : event.getData() );
}
catch (JMSException jmse)
Modified: branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/test/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/test/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/test/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -2,7 +2,7 @@
<suite name="SeamBay" verbose="2" parallel="false">
- <test name="SeamBay: Create Auction">
+ <test name="SeamBay - Create Auction">
<classes>
<class name="org.jboss.seam.example.seambay.test.AuctionTest"/>
</classes>
Modified: branches/enterprise/JBPAPP_5_0/examples/seamdiscs/src/org/jboss/seam/example/seamdiscs/test/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/seamdiscs/src/org/jboss/seam/example/seamdiscs/test/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/examples/seamdiscs/src/org/jboss/seam/example/seamdiscs/test/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="SeamDiscs" verbose="2" parallel="false">
- <test name="SeamDiscs: Artist Tests">
+ <test name="SeamDiscs - Artist Tests">
<parameter name="datasourceJndiName" value="java:/seamdiscsDatasource"/>
<parameter name="database" value="HSQL" />
@@ -12,7 +12,7 @@
</test>
- <test name="SeamDiscs: Disc Tests">
+ <test name="SeamDiscs - Disc Tests">
<parameter name="datasourceJndiName" value="java:/seamdiscsDatasource"/>
<parameter name="database" value="HSQL" />
@@ -25,7 +25,7 @@
</test>
- <test name="SeamDiscs: Login Test">
+ <test name="SeamDiscs - Login Test">
<parameter name="datasourceJndiName" value="java:/seamdiscsDatasource"/>
<parameter name="database" value="HSQL" />
Modified: branches/enterprise/JBPAPP_5_0/examples/seamspace/src/org/jboss/seam/example/seamspace/test/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/seamspace/src/org/jboss/seam/example/seamspace/test/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/examples/seamspace/src/org/jboss/seam/example/seamspace/test/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -2,13 +2,13 @@
<suite name="SeamSpace" verbose="2" parallel="false">
- <test name="SeamSpace: Register">
+ <test name="SeamSpace - Register">
<classes>
<class name="org.jboss.seam.example.seamspace.test.RegisterTest"/>
</classes>
</test>
- <test name="SeamSpace: Blog">
+ <test name="SeamSpace - Blog">
<classes>
<class name="org.jboss.seam.example.seamspace.test.BlogTest"/>
</classes>
Modified: branches/enterprise/JBPAPP_5_0/src/test/excel/unit/org/jboss/seam/test/excel/unit/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/excel/unit/org/jboss/seam/test/excel/unit/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/src/test/excel/unit/org/jboss/seam/test/excel/unit/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Seam Mail Unit Testsuite" verbose="2" parallel="false">
- <test name="Seam Unit Tests: Excel">
+ <test name="Seam Unit Tests - Excel">
<classes>
<class name="org.jboss.seam.test.excel.unit.TestCsvWorkbook"/>
</classes>
Modified: branches/enterprise/JBPAPP_5_0/src/test/integration/src/org/jboss/seam/test/integration/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/integration/src/org/jboss/seam/test/integration/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/src/test/integration/src/org/jboss/seam/test/integration/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Seam Integration Testsuite" verbose="2" parallel="false">
- <test name="Seam Integration Tests: Contexts and Components">
+ <test name="Seam Integration Tests - Contexts and Components">
<classes>
<class name="org.jboss.seam.test.integration.PageContextTest" />
<class name="org.jboss.seam.test.integration.ConversationTest" />
@@ -11,14 +11,14 @@
<class name="org.jboss.seam.test.integration.NamespaceResolverTest" />
</classes>
</test>
- <test name="Seam Integration Tests: Persistence">
+ <test name="Seam Integration Tests - Persistence">
<classes>
<class name="org.jboss.seam.test.integration.EntityTest" />
<class name="org.jboss.seam.test.integration.EntityPassivationTest" />
</classes>
</test>
- <test name="Seam Integration Tests: Events">
+ <test name="Seam Integration Tests - Events">
<classes>
<class name="org.jboss.seam.test.integration.EventTest" />
</classes>
@@ -30,52 +30,52 @@
</classes>
</test>
- <test name="Seam Integration Tests: Framework">
+ <test name="Seam Integration Tests - Framework">
<classes>
<class name="org.jboss.seam.test.integration.IdentifierTest" />
</classes>
</test>
- <test name="Seam Integration Tests: i8ln">
+ <test name="Seam Integration Tests - i8ln">
<classes>
<class name="org.jboss.seam.test.integration.i8ln.TimeZoneTest" />
<class name="org.jboss.seam.test.integration.i8ln.LocaleTest" />
</classes>
</test>
- <test name="Seam Integration Tests: BPM">
+ <test name="Seam Integration Tests - BPM">
<classes>
<class name="org.jboss.seam.test.integration.BusinessProcessTest" />
<class name="org.jboss.seam.test.integration.bpm.SeamExpressionEvaluatorTest" />
</classes>
</test>
- <test name="Seam Integration Tests: JMS">
+ <test name="Seam Integration Tests - JMS">
<classes>
<class name="org.jboss.seam.test.integration.MessagingTest" />
</classes>
</test>
- <test name="Seam Integration Tests: Mocks">
+ <test name="Seam Integration Tests - Mocks">
<classes>
<class name="org.jboss.seam.test.integration.mock.SeamMockELResolverTest" />
<class name="org.jboss.seam.test.integration.mock.SeamTestTest" />
</classes>
</test>
- <test name="Seam Integration Tests: Pages dot xml">
+ <test name="Seam Integration Tests - Pages dot xml">
<classes>
<class name="org.jboss.seam.test.integration.PageParamTest" />
</classes>
</test>
- <test name="Seam Integration Tests: DataBinding">
+ <test name="Seam Integration Tests - DataBinding">
<classes>
<class name="org.jboss.seam.test.integration.databinding.DataModelTest" />
</classes>
</test>
- <test name="Seam Integration Tests: Security">
+ <test name="Seam Integration Tests - Security">
<classes>
<class name="org.jboss.seam.test.integration.security.SecurityTest" />
</classes>
Modified: branches/enterprise/JBPAPP_5_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Seam Mail Unit Testsuite" verbose="2" parallel="false">
- <test name="Seam Unit Tests: Mail">
+ <test name="Seam Unit Tests - Mail">
<classes>
<class name="org.jboss.seam.test.mail.unit.HeaderTest"/>
</classes>
Modified: branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/testng.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/testng.xml 2009-08-08 10:45:13 UTC (rev 11356)
+++ branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/testng.xml 2009-08-10 12:32:42 UTC (rev 11357)
@@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Seam Unit Testsuite" verbose="2" parallel="false">
- <test name="Seam Unit Tests: Core">
+ <test name="Seam Unit Tests - Core">
<classes>
<class name="org.jboss.seam.test.unit.CoreTest"/>
<class name="org.jboss.seam.test.unit.InitializationTest"/>
@@ -13,13 +13,13 @@
</classes>
</test>
- <test name="Seam Unit Tests: Mail">
+ <test name="Seam Unit Tests - Mail">
<classes>
<class name="org.jboss.seam.test.unit.MailTest"/>
</classes>
</test>
- <test name="Seam Unit Tests: BPM and Pageflow">
+ <test name="Seam Unit Tests - BPM and Pageflow">
<classes>
<class name="org.jboss.seam.test.unit.bpm.ActorTest" />
<class name="org.jboss.seam.test.unit.bpm.TaskListTest" />
@@ -27,7 +27,7 @@
</classes>
</test>
- <test name="Seam Unit Tests: Pages dot xml">
+ <test name="Seam Unit Tests - Pages dot xml">
<classes>
<class name="org.jboss.seam.test.unit.PageActionsTest" />
<class name="org.jboss.seam.test.unit.PageDescriptorTest" />
@@ -35,45 +35,45 @@
</classes>
</test>
- <test name="Seam Unit Tests: JSF integration">
+ <test name="Seam Unit Tests - JSF integration">
<classes>
<class name="org.jboss.seam.test.unit.PhaseListenerTest"/>
</classes>
</test>
- <test name="Seam Unit Tests: Remoting">
+ <test name="Seam Unit Tests - Remoting">
<classes>
<class name="org.jboss.seam.test.unit.RemotingTest"/>
</classes>
</test>
- <test name="Seam Unit Tests: Password Hash">
+ <test name="Seam Unit Tests - Password Hash">
<classes>
<class name="org.jboss.seam.test.unit.PasswordHashTest"/>
</classes>
</test>
- <test name="Seam Unit Tests: Framework">
+ <test name="Seam Unit Tests - Framework">
<classes>
<class name="org.jboss.seam.test.unit.HomeTest" />
<class name="org.jboss.seam.test.unit.QueryTest" />
</classes>
</test>
- <test name="Seam Unit Tests: Filters">
+ <test name="Seam Unit Tests - Filters">
<classes>
<class name="org.jboss.seam.test.unit.web.MultipartRequestTest" />
<class name="org.jboss.seam.test.unit.web.IdentityRequestWrapperTest" />
</classes>
</test>
- <test name="Seam Unit Tests: Resources and i8ln">
+ <test name="Seam Unit Tests - Resources and i8ln">
<classes>
<class name="org.jboss.seam.test.unit.InterpolatorTest"/>
</classes>
</test>
- <test name="Seam Unit Tests: URL Rewrite">
+ <test name="Seam Unit Tests - URL Rewrite">
<classes>
<class name="org.jboss.seam.test.unit.web.RewriteTest" />
</classes>
15 years, 4 months