Author: ppitonak(a)redhat.com
Date: 2011-04-28 07:38:21 -0400 (Thu, 28 Apr 2011)
New Revision: 22449
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Message.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/HornetQInitializer.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/TopicsInitializer.java
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/glassfish-web.xml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/messageProducer.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/resources/script/push.js
Removed:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushEventProcuder.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/event-producer.xhtml
Modified:
modules/tests/metamer/trunk/application/pom.xml
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/faces-config.xml
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/jboss-web.xml
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/web.xml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml
Log:
https://issues.jboss.org/browse/RFPL-982
new implementation of a4j:push added
Modified: modules/tests/metamer/trunk/application/pom.xml
===================================================================
--- modules/tests/metamer/trunk/application/pom.xml 2011-04-27 21:56:42 UTC (rev 22448)
+++ modules/tests/metamer/trunk/application/pom.xml 2011-04-28 11:38:21 UTC (rev 22449)
@@ -27,7 +27,7 @@
<packaging>war</packaging>
<name>Metamer: RichFaces Testing Application</name>
- <distributionManagement>
+ <distributionManagement>
<snapshotRepository>
<id>jboss-qa-snapshots</id>
<name>JBoss QA snapshot repository</name>
@@ -43,6 +43,7 @@
<properties>
<jetty.port>8080</jetty.port>
+ <hornetq.version>2.1.2.Final</hornetq.version>
</properties>
<dependencies>
@@ -61,8 +62,8 @@
</dependency>
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
</dependency>
<dependency>
@@ -87,6 +88,35 @@
</dependency>
<dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-core</artifactId>
+ <version>${hornetq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jms</artifactId>
+ <version>${hornetq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-logging</artifactId>
+ <version>${hornetq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.2.2.Final</version>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
@@ -109,16 +139,16 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.12.1.GA</version>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.12.1.GA</version>
</dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.1.0.Final</version>
- </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.1.0.Final</version>
+ </dependency>
</dependencies>
<build>
@@ -132,7 +162,7 @@
</resources>
<plugins>
- <plugin>
+ <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
@@ -140,22 +170,22 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
<!-- disable default (inherited) attach-souces execution, use war sources
instead -->
- <execution>
- <id>attach-sources</id>
- <phase>none</phase>
- </execution>
- </executions>
- </plugin>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <attachClasses>true</attachClasses>
- <attachSources>true</attachSources>
+ <attachClasses>true</attachClasses>
+ <attachSources>true</attachSources>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
@@ -169,59 +199,59 @@
</configuration>
<executions>
<!-- disable default war execution (use jee6 profile instead) -->
- <execution>
- <id>default-war</id>
- <phase>none</phase>
- </execution>
- <execution>
- <id>exploded-war</id>
- <phase>package</phase>
- <goals>
- <goal>exploded</goal>
- </goals>
- </execution>
+ <execution>
+ <id>default-war</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>exploded-war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exploded</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
<plugin>
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>maven-replacer-plugin</artifactId>
- <version>1.3.2</version>
- <executions>
- <execution>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>replace</goal>
- </goals>
- <configuration>
-
<file>target/${project.build.finalName}/WEB-INF/web.xml</file>
- <regex>true</regex>
- <regexFlags>
- <regexFlag>MULTILINE</regexFlag>
- </regexFlags>
-
<token><param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>\s*<param-value>false</param-value></token>
-
<value><param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name><param-value>true</param-value></value>
- </configuration>
- </execution>
- </executions>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>maven-replacer-plugin</artifactId>
+ <version>1.3.2</version>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <configuration>
+
<file>target/${project.build.finalName}/WEB-INF/web.xml</file>
+ <regex>true</regex>
+ <regexFlags>
+ <regexFlag>MULTILINE</regexFlag>
+ </regexFlags>
+
<token><param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>\s*<param-value>false</param-value></token>
+
<value><param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name><param-value>true</param-value></value>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <fileset>
-
<directory>target/${project.build.finalName}/WEB-INF</directory>
- <includes>
- <include>web.xml</include>
- </includes>
- </fileset>
- </configuration>
- </execution>
- </executions>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <configuration>
+ <fileset>
+
<directory>target/${project.build.finalName}/WEB-INF</directory>
+ <includes>
+ <include>web.xml</include>
+ </includes>
+ </fileset>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
@@ -255,112 +285,112 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<profiles>
- <profile>
- <id>checkstyle</id>
- <activation>
- <property>
- <name>!eclipse</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>war-default</id>
- <activation>
- <property>
- <name>!disable-default-war</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <classifier>jee6</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*,WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
- </configuration>
- <executions>
- <execution>
- <id>default-war</id>
- <phase>package</phase>
- <goals>
- <goal>war</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>war-jee6-bundled-mojarra</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <executions>
- <execution>
- <id>jee6-bundled-mojarra</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>jee6-bundled-mojarra</classifier>
-
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>war-jee6-bundled-myfaces</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <executions>
- <execution>
- <id>jee6-bundled-myfaces</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>jee6-bundled-myfaces</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
+ <profile>
+ <id>checkstyle</id>
+ <activation>
+ <property>
+ <name>!eclipse</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>war-default</id>
+ <activation>
+ <property>
+ <name>!disable-default-war</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <classifier>jee6</classifier>
+
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*,WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>default-war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>war-jee6-bundled-mojarra</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6-bundled-mojarra</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+
<classifier>jee6-bundled-mojarra</classifier>
+
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>war-jee6-bundled-myfaces</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6-bundled-myfaces</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+
<classifier>jee6-bundled-myfaces</classifier>
+
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>war-mojarra</id>
<activation>
<property>
@@ -372,18 +402,18 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
- <execution>
- <id>mojarra</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>mojarra</classifier>
-
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
+ <execution>
+ <id>mojarra</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <classifier>mojarra</classifier>
+
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
@@ -401,18 +431,18 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
- <execution>
- <id>myfaces</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>myfaces</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
+ <execution>
+ <id>myfaces</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <classifier>myfaces</classifier>
+
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
@@ -430,18 +460,18 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
- <execution>
- <id>mojarra-snapshot</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>mojarra-snapshot</classifier>
-
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
+ <execution>
+ <id>mojarra-snapshot</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+
<classifier>mojarra-snapshot</classifier>
+
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
@@ -459,124 +489,124 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
- <execution>
- <id>myfaces-snapshot</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>myfaces-snapshot</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
+ <execution>
+ <id>myfaces-snapshot</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+
<classifier>myfaces-snapshot</classifier>
+
<packagingExcludes>WEB-INF/lib/jsf-api-*,WEB-INF/lib/jsf-impl-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
- <id>war-mojarra_2_1_0</id>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>2.1.0-b11</version>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>2.1.0-b11</version>
- </dependency>
- </dependencies>
+ <id>war-mojarra_2_1_0</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.1.0-b11</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.1.0-b11</version>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
- <execution>
- <id>mojarra_2_1_0</id>
- <phase>integration-test</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <classifier>mojarra_2_1_0</classifier>
-
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
- </configuration>
- </execution>
- </executions>
+ <execution>
+ <id>mojarra_2_1_0</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <classifier>mojarra_2_1_0</classifier>
+
<packagingExcludes>WEB-INF/lib/myfaces-api-*,WEB-INF/lib/myfaces-impl-*</packagingExcludes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
- </profile>
+ </profile>
<profile>
- <id>myfaces-development</id>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <scope>provided</scope>
- </dependency>
+ <id>myfaces-development</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>mojarra_2_1-development</id>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>2.1.0-b11</version>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>2.1.0-b11</version>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>jee-development</id>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.1.0.Final</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>mojarra_2_1-development</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.1.0-b11</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.1.0-b11</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jee-development</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.1.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Message.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Message.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Message.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer;
+
+import java.io.Serializable;
+
+/**
+ * Representation of a message pushed to the page using JMS.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class Message implements Serializable {
+
+ private String text;
+ private String author;
+ private String timestamp;
+
+ public Message() {
+ }
+
+ public Message(String text, String author, String timestamp) {
+ this.text = text;
+ this.author = author;
+ this.timestamp = timestamp;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+}
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushBean.java 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushBean.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -23,17 +23,17 @@
import java.io.Serializable;
import java.util.Date;
-//import java.util.EventListener;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
-import javax.faces.event.ActionEvent;
+import org.richfaces.application.push.MessageException;
+import org.richfaces.application.push.TopicKey;
-//import org.ajax4jsf.event.PushEventListener;
+import org.richfaces.application.push.TopicsContext;
import org.richfaces.component.UIPush;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,20 +49,11 @@
private static final long serialVersionUID = 4810889475400649809L;
private static Logger logger;
+ private transient TopicsContext topicsContext;
private Attributes attributes;
- private int counter = 0;
-// private transient volatile PushEventListener listener;
- @ManagedProperty(value = "#{a4jPushEventProcuder}")
- private transient A4JPushEventProcuder pushEventProducer;
+ private String username;
+ private String message;
- public A4JPushEventProcuder getPushEventProducer() {
- return pushEventProducer;
- }
-
- public void setPushEventProducer(A4JPushEventProcuder pushEventProducer) {
- this.pushEventProducer = pushEventProducer;
- }
-
/**
* Initializes the managed bean.
*/
@@ -71,15 +62,17 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
+ topicsContext = TopicsContext.lookup();
+
attributes = Attributes.getComponentAttributesFromClass(UIPush.class,
getClass());
- attributes.setAttribute("interval", 1000);
- attributes.setAttribute("action", "increaseCounterAction");
- attributes.setAttribute("actionListener",
"increaseCounterActionListener");
- attributes.setAttribute("rendered", true);
- attributes.setAttribute("enabled", true);
-
- // will be set on page and cannot be changed
- attributes.remove("eventProducer");
+// attributes.setAttribute("interval", 1000);
+// attributes.setAttribute("action",
"increaseCounterAction");
+// attributes.setAttribute("actionListener",
"increaseCounterActionListener");
+// attributes.setAttribute("rendered", true);
+// attributes.setAttribute("enabled", true);
+//
+// // will be set on page and cannot be changed
+// attributes.remove("eventProducer");
}
/**
@@ -101,33 +94,40 @@
this.attributes = attributes;
}
-// public void setListener(EventListener listener) {
-// this.listener = (PushEventListener) listener;
-// pushEventProducer.registerListener(this.listener);
-// }
- public int getCounter() {
- return counter;
+ public String getUsername() {
+ return username;
}
- public String increaseCounterAction() {
- counter++;
- return null;
+ public void setUsername(String username) {
+ this.username = username;
}
- public String decreaseCounterAction() {
- counter--;
- return null;
+ public String getMessage() {
+ return message;
}
- public void increaseCounterActionListener(ActionEvent event) {
- counter++;
+ public void setMessage(String message) {
+ this.message = message;
}
- public void decreaseCounterActionListener(ActionEvent event) {
- counter--;
+ public void setTopicsContext(TopicsContext topicsContext) {
+ this.topicsContext = topicsContext;
}
- public Date getDate() {
- return new Date();
+ private TopicsContext getTopicsContext() {
+ if (topicsContext == null) {
+ topicsContext = TopicsContext.lookup();
+ }
+ return topicsContext;
}
+
+ public void send() {
+ try {
+ logger.info("sending message \"" + message + "\" by
user " + username);
+ Message msg = new Message(message, username, new Date().toString());
+ getTopicsContext().publish(new TopicKey("metamer",
"xxx"), msg);
+ } catch (MessageException messageException) {
+ logger.error("Could not send message \"" + message +
"\" by user " + username + ".", messageException);
+ }
+ }
}
Deleted:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushEventProcuder.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushEventProcuder.java 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JPushEventProcuder.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.metamer.bean;
-
-import java.io.Serializable;
-//import java.util.Collection;
-//import java.util.EventObject;
-//import java.util.HashSet;
-//import java.util.LinkedList;
-
-import javax.annotation.PostConstruct;
-import javax.faces.bean.ApplicationScoped;
-import javax.faces.bean.ManagedBean;
-
-//import org.ajax4jsf.event.PushEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Managed bean for a4j:push.
- *
- * @author Nick Belaevski, <a href="mailto:ppitonak@redhat.com">Pavol
Pitonak</a>
- * @version $Revision$
- */
-@ManagedBean(name = "a4jPushEventProcuder")
-@ApplicationScoped
-public class A4JPushEventProcuder implements Serializable {
-
- private static final long serialVersionUID = 4532283098337277878L;
- private Logger logger;
-// FIXME example has to be reimplemented because of new implementation of a4j:push
-// private Collection<PushEventListener> registeredListeners = new
HashSet<PushEventListener>();
-
- @PostConstruct
- public void init() {
- logger = LoggerFactory.getLogger(getClass());
- }
-// public void registerListener(PushEventListener listener) {
-// synchronized (registeredListeners) {
-// registeredListeners.add(listener);
-// }
-// }
-//
-// public void produceEvent() {
-// Collection<PushEventListener> listeners;
-// synchronized (registeredListeners) {
-// listeners = new LinkedList<PushEventListener>(registeredListeners);
-// }
-// for (PushEventListener listener : listeners) {
-// listener.onEvent(new EventObject(A4JPushBean.class));
-// }
-// logger.debug("push event (listeners: " + listeners.size() +
")");
-// }
-}
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -69,8 +69,7 @@
InputStream inStream =
getClass().getClassLoader().getResourceAsStream("version.properties");
properties.load(inStream);
} catch (Exception e) {
- LOGGER
- .warn(
+ LOGGER.warn(
"Unable to load version.properties using
PomVersion.class.getClassLoader().getResourceAsStream(...)",
e);
}
@@ -114,7 +113,7 @@
}
fullVersion = implementationTitle + " by " + implementationVendor +
", version " + implementationVersion
- + " SVN r. " + scmRevision;
+ + " SVN r. " + scmRevision;
return fullVersion;
}
@@ -157,23 +156,23 @@
}
public String getJsfVersion() {
-
-
+
+
if (jsfVersion != null) {
return jsfVersion;
}
-
+
FacesContext facesContext = FacesContext.getCurrentInstance();
-
+
if (facesContext == null) {
return UNKNOWN_JSF;
}
-
+
jsfVersion = UNKNOWN_JSF;
Class<?> applicationClass = facesContext.getApplication().getClass();
Package pack = applicationClass.getPackage();
-
+
if (pack.getImplementationTitle() != null) {
jsfVersion = pack.getImplementationTitle();
if (pack.getImplementationVersion() != null) {
@@ -185,8 +184,7 @@
}
public String getBrowserVersion() {
- HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext()
- .getRequest();
+ HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
return request.getHeader("user-agent");
}
@@ -222,13 +220,13 @@
return result;
}
- private static String getTomcatVersionInfo() {
+ public static String getTomcatVersionInfo() {
String result = (String) new InfoObtainer() {
@Override
protected Object obtainInfo() throws ClassNotFoundException,
IllegalAccessException,
- InstantiationException, SecurityException, NoSuchMethodException,
IllegalArgumentException,
- InvocationTargetException {
+ InstantiationException, SecurityException, NoSuchMethodException,
IllegalArgumentException,
+ InvocationTargetException {
Class<?> clazz =
Class.forName("org.apache.catalina.util.ServerInfo");
return clazz.getMethod("getServerInfo").invoke(null);
@@ -238,7 +236,7 @@
return result.replace("/", " ");
}
- private static String getJBossASVersionInfo() {
+ public static String getJBossASVersionInfo() {
String versionNumber = (String) new
JBossASVersionInfoObtainer("getVersionNumber").getInfo();
String buildNumber = (String) new
JBossASVersionInfoObtainer("getBuildID").getInfo();
@@ -246,7 +244,7 @@
return null;
}
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("JBoss AS ");
buffer.append(versionNumber);
@@ -259,6 +257,7 @@
}
private static class JBossASVersionInfoObtainer extends InfoObtainer {
+
private String methodName;
public JBossASVersionInfoObtainer(String methodName) {
@@ -268,7 +267,7 @@
@Override
protected Object obtainInfo() throws ClassNotFoundException,
IllegalAccessException, InstantiationException,
- SecurityException, NoSuchMethodException, IllegalArgumentException,
InvocationTargetException {
+ SecurityException, NoSuchMethodException, IllegalArgumentException,
InvocationTargetException {
Class<?> clazz =
Class.forName("org.jboss.bootstrap.impl.as.server.ASVersion");
Object classInstance =
clazz.getMethod("getInstance").invoke(null);
@@ -277,9 +276,10 @@
}
private abstract static class InfoObtainer {
+
protected abstract Object obtainInfo() throws ClassNotFoundException,
IllegalAccessException,
- InstantiationException, SecurityException, NoSuchMethodException,
IllegalArgumentException,
- InvocationTargetException;
+ InstantiationException, SecurityException, NoSuchMethodException,
IllegalArgumentException,
+ InvocationTargetException;
public final Object getInfo() {
try {
@@ -302,12 +302,11 @@
}
}
- private static class FailToRetrieveInfo extends RuntimeException {
+ public static class FailToRetrieveInfo extends RuntimeException {
public FailToRetrieveInfo(String message, Throwable cause) {
super(message, cause);
}
-
}
private static String fail(String message, Exception e) {
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/HornetQInitializer.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/HornetQInitializer.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/HornetQInitializer.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.listener;
+
+import java.util.HashSet;
+
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PostConstructApplicationEvent;
+import javax.faces.event.PreDestroyApplicationEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+import javax.naming.InitialContext;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.application.push.PushContextFactory;
+import org.richfaces.tests.metamer.bean.VersionBean;
+import org.richfaces.tests.metamer.bean.VersionBean.FailToRetrieveInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener that initializes HornetQ in Tomcat.
+ *
+ * @author Nick Belaevski
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class HornetQInitializer implements SystemEventListener {
+
+ private static Logger logger;
+ private JMSServerManager serverManager;
+
+ public HornetQInitializer() {
+ logger = LoggerFactory.getLogger(getClass());
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException {
+ String serverType = null;
+
+ try {
+ serverType = VersionBean.getTomcatVersionInfo();
+ } catch (FailToRetrieveInfo e) {
+ serverType = e.getMessage();
+ }
+
+ if (serverType != null && serverType.contains("Tomcat")
&& event instanceof PostConstructApplicationEvent) {
+ try {
+ startHornetQ();
+ } catch (Exception e) {
+ throw new AbortProcessingException(e);
+ }
+
+ //force push context initialization so that its PreDestroyApplicationevent
listener is added before HornetQ stopper
+ ServiceTracker.getService(PushContextFactory.class).getPushContext();
+
+ Application application =
FacesContext.getCurrentInstance().getApplication();
+ application.subscribeToEvent(PreDestroyApplicationEvent.class, this);
+ } else {
+ try {
+ stopHornetQ();
+ } catch (Exception e) {
+ throw new AbortProcessingException(e);
+ }
+ }
+ }
+
+ private void stopHornetQ() throws Exception {
+ if (serverManager != null) {
+ logger.info("stopping HornetQ");
+ serverManager.stop();
+ serverManager = null;
+ }
+ }
+
+ private void startHornetQ() throws Exception {
+ logger.info("starting HornetQ");
+
+ // create the Configuration and set the properties accordingly
+ Configuration configuration = new ConfigurationImpl();
+ configuration.setPersistenceEnabled(false);
+ configuration.setSecurityEnabled(false);
+
+ TransportConfiguration transpConf = new
TransportConfiguration(NettyAcceptorFactory.class.getName());
+
+ HashSet<TransportConfiguration> setTransp = new
HashSet<TransportConfiguration>();
+ setTransp.add(transpConf);
+
+ configuration.setAcceptorConfigurations(setTransp);
+
+ // create and start the server
+ HornetQServer server = HornetQServers.newHornetQServer(configuration);
+
+ serverManager = new JMSServerManagerImpl(server);
+
+ //if you want to use JNDI, simple inject a context here or don't call this
method and make sure the JNDI parameters are set.
+ InitialContext context = new InitialContext();
+ serverManager.setContext(context);
+ serverManager.start();
+
+ ConnectionFactoryConfiguration connectionFactoryConfiguration = new
ConnectionFactoryConfigurationImpl("ConnectionFactory",
+ new TransportConfiguration(NettyConnectorFactory.class.getName()),
(String) null);
+ connectionFactoryConfiguration.setUseGlobalPools(false);
+
+ serverManager.createConnectionFactory(false, connectionFactoryConfiguration,
"ConnectionFactory");
+
+ serverManager.createTopic(false, "metamer",
"/topic/metamer");
+ }
+
+ public boolean isListenerForSource(Object source) {
+ return true;
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/TopicsInitializer.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/TopicsInitializer.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/listener/TopicsInitializer.java 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.listener;
+
+import java.text.MessageFormat;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+import javax.servlet.http.HttpServletRequest;
+
+import org.richfaces.application.push.EventAbortedException;
+import org.richfaces.application.push.Session;
+import org.richfaces.application.push.SessionPreSubscriptionEvent;
+import org.richfaces.application.push.SessionSubscriptionEvent;
+import org.richfaces.application.push.SessionTopicListener;
+import org.richfaces.application.push.SessionUnsubscriptionEvent;
+import org.richfaces.application.push.Topic;
+import org.richfaces.application.push.TopicKey;
+import org.richfaces.application.push.TopicsContext;
+import org.richfaces.application.push.impl.DefaultMessageDataSerializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener that subscribes to JMS topics.
+ *
+ * @author Nick Belaevski
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TopicsInitializer implements SystemEventListener {
+
+ private static Logger logger;
+
+ public TopicsInitializer() {
+ logger = LoggerFactory.getLogger(getClass());
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException {
+ TopicsContext topicsContext = TopicsContext.lookup();
+
+ Topic topic = topicsContext.getOrCreateTopic(new TopicKey("metamer",
"xxx"));
+
+ topic.setMessageDataSerializer(DefaultMessageDataSerializer.instance());
+
+ topic.addTopicListener(new SessionTopicListener() {
+
+ public void processUnsubscriptionEvent(SessionUnsubscriptionEvent event)
throws EventAbortedException {
+ logger.info("unsubscibe from JMS topic");
+ TopicKey topicKey = event.getTopicKey();
+ Session session = event.getSession();
+ System.out.println(MessageFormat.format("Session {0} disconnected
from {1}", session.getId(),
+ topicKey.getTopicAddress()));
+ }
+
+ public void processSubscriptionEvent(SessionSubscriptionEvent event) throws
EventAbortedException {
+ logger.info("subscibe to JMS topic");
+ TopicKey topicKey = event.getTopicKey();
+ Session session = event.getSession();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ HttpServletRequest hsr = (HttpServletRequest)
facesContext.getExternalContext().getRequest();
+
+ System.out.println(MessageFormat.format("Session {0} connected to
{1} from {2}", session.getId(),
+ topicKey.getTopicAddress(), hsr.getRemoteAddr()));
+ }
+
+ public void processPreSubscriptionEvent(SessionPreSubscriptionEvent event)
throws EventAbortedException {
+ logger.info("presubscription to JMS topic");
+ ExternalContext externalContext =
FacesContext.getCurrentInstance().getExternalContext();
+ }
+ });
+ }
+
+ public boolean isListenerForSource(Object source) {
+ return true;
+ }
+}
Property changes on: modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF
___________________________________________________________________
Modified: svn:ignore
- sun-web.xml
lib
+ sun-web.xml
lib
.glassfish-web.xml.swp
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/faces-config.xml 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/faces-config.xml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,8 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xi="http://www.w3.org/2001/XInclude"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
- <lifecycle>
-
<phase-listener>org.richfaces.tests.metamer.RichPhaseListener</phase-listener>
- </lifecycle>
+<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+ <application>
+ <system-event-listener>
+
<system-event-listener-class>org.richfaces.tests.metamer.listener.HornetQInitializer</system-event-listener-class>
+
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
+ </system-event-listener>
+ <system-event-listener>
+
<system-event-listener-class>org.richfaces.tests.metamer.listener.TopicsInitializer</system-event-listener-class>
+
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
+ </system-event-listener>
+ </application>
+
+ <lifecycle>
+
<phase-listener>org.richfaces.tests.metamer.RichPhaseListener</phase-listener>
+ </lifecycle>
</faces-config>
Added: modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/glassfish-web.xml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/glassfish-web.xml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/glassfish-web.xml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application
Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
+<glassfish-web-app error-url="">
+ <context-root>/metamer</context-root>
+ <class-loader delegate="true"/>
+ <jsp-config>
+ <property name="keepgenerated" value="true">
+ <description>Keep a copy of the generated servlet class' java
code.</description>
+ </property>
+ </jsp-config>
+</glassfish-web-app>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/jboss-web.xml 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/jboss-web.xml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
- <context-root>metamer</context-root>
-</jboss-web>
\ No newline at end of file
+ <context-root>/metamer</context-root>
+</jboss-web>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/web.xml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/web.xml 2011-04-27
21:56:42 UTC (rev 22448)
+++ modules/tests/metamer/trunk/application/src/main/webapp/WEB-INF/web.xml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
<display-name>metamer</display-name>
+
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
+
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
@@ -24,14 +28,15 @@
<param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
<param-value>2097152</param-value>
</context-param>
- <filter>
- <filter-name>Test Identity Filter</filter-name>
-
<filter-class>org.richfaces.tests.metamer.TestIdentityFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>Test Identity Filter</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- </filter-mapping>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionUsername</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionPassword</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
@@ -45,4 +50,24 @@
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
+
+ <filter>
+ <filter-name>PushFilter</filter-name>
+ <filter-class>org.richfaces.webapp.PushFilter</filter-class>
+ <async-supported>true</async-supported>
+ </filter>
+ <filter-mapping>
+ <filter-name>PushFilter</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+ <filter>
+ <filter-name>Test Identity Filter</filter-name>
+
<filter-class>org.richfaces.tests.metamer.TestIdentityFilter</filter-class>
+ <async-supported>true</async-supported>
+ </filter>
+ <filter-mapping>
+ <filter-name>Test Identity Filter</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+
</web-app>
Deleted:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/event-producer.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/event-producer.xhtml 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/event-producer.xhtml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets">
-
- <!--
-JBoss, Home of Professional Open Source
-Copyright 2010-2011, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- -->
-
- <ui:composition template="/templates/template.xhtml">
-
- <f:metadata>
- <f:event type="preRenderView"
listener="#{a4jPushEventProcuder.produceEvent}" />
- </f:metadata>
-
- <ui:define name="head">
- </ui:define>
-
- <ui:define name="outOfTemplateBefore">
- </ui:define>
-
- <ui:define name="component">
- <h:button value="Generate push event" />
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- </ui:define>
-
- </ui:composition>
-</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/list.xhtml 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/list.xhtml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -35,8 +35,8 @@
Simple page that contains <b>a4j:push</b> and input boxes for
all its attributes.
</metamer:testPageLink>
- <metamer:testPageLink id="event-producer"
outcome="event-producer" value="Event Producer">
- Page that is bind to application bean producing events catched by
a4j:push.
+ <metamer:testPageLink id="messageProducer"
outcome="messageProducer" value="Message Producer">
+ Page that is bind to application bean producing messages catched by
a4j:push.
</metamer:testPageLink>
</ui:define>
Copied:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/messageProducer.xhtml
(from rev 22442,
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/event-producer.xhtml)
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/messageProducer.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/messageProducer.xhtml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:panelGrid id="inputs" columns="2">
+ <h:outputLabel id="nameLabel" value="Your name:"
for="nameInput"/>
+ <h:inputText id="nameInput"
value="#{a4jPushBean.username}" />
+ <h:outputLabel id="messageLabel" value="Your
message:" for="messageInput"/>
+ <h:inputText id="messageInput"
value="#{a4jPushBean.message}" />
+ </h:panelGrid>
+
+ <br/>
+ <h:commandButton id="submitButton" value="Send
Message" action="#{a4jPushBean.send}" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml 2011-04-27
21:56:42 UTC (rev 22448)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml 2011-04-28
11:38:21 UTC (rev 22449)
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
xmlns:rich="http://richfaces.org/rich"
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:h="http://java.sun.com/jsf/html">
<!--
JBoss, Home of Professional Open Source
@@ -36,46 +37,22 @@
</f:metadata>
</ui:define>
- <ui:define name="head"/>
+ <ui:define name="head">
+ <h:outputScript library="script" name="push.js"/>
+ </ui:define>
<ui:define name="component">
- <h:panelGroup id="time">
- <h:outputText value="Server: " />
- <h:outputText id="serverDate"
value="#{a4jPushBean.date}" title="#{a4jPushBean.date.time}">
- <f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss.SSS"
/>
- </h:outputText>
- ***
- <metamer:clientTime id="clientDate" label="Client:
" />
- ***
- <h:outputText value="Counter: " />
- <h:outputText id="outputCounter"
value="#{a4jPushBean.counter}"/>
- </h:panelGroup>
+ <ul class="push-list"></ul>
- <a4j:push id="push"
- action="#{a4jPushBean.attributes.action}"
-
actionListener="#{a4jPushBean.attributes.actionListener}"
-
bypassUpdates="#{a4jPushBean.attributes['bypassUpdates'].value}"
-
enabled="#{a4jPushBean.attributes['enabled'].value}"
- eventProducer="#{a4jPushBean.setListener}"
-
hasActiveBehavior="#{a4jPushBean.attributes['hasActiveBehavior'].value}"
-
immediate="#{a4jPushBean.attributes['immediate'].value}"
-
interval="#{a4jPushBean.attributes['interval'].value}"
-
onbeforedomupdate="#{a4jPushBean.attributes['onbeforedomupdate'].value}"
-
onbegin="#{a4jPushBean.attributes['onbegin'].value}"
-
oncomplete="#{a4jPushBean.attributes['oncomplete'].value}"
-
ondataavailable="#{a4jPushBean.attributes['ondataavailable'].value}"
-
rendered="#{a4jPushBean.attributes['rendered'].value}"
- value="#{a4jPushBean.attributes['value'].value}"
- >
- <a4j:ajax render="time" />
- <f:param name="testParam" value="testValue" />
- <f:param name="testParam1" value="testValue1"
/>
+ <a4j:push address="xxx@metamer" onerror="alert('Error:
' + event.rf.data)"
+ ondataavailable="updateList(event.rf.data)" >
</a4j:push>
+
</ui:define>
<ui:define name="outOfTemplateAfter">
- <metamer:attributes value="#{a4jPushBean.attributes}"
id="attributes" />
+ <ui:remove><metamer:attributes
value="#{a4jPushBean.attributes}" id="attributes"
/></ui:remove>
</ui:define>
</ui:composition>
Copied: modules/tests/metamer/trunk/application/src/main/webapp/resources/script/push.js
(from rev 22448,
modules/tests/metamer/trunk/application/src/main/webapp/resources/script/common.js)
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/script/push.js
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/resources/script/push.js 2011-04-28
11:38:21 UTC (rev 22449)
@@ -0,0 +1,5 @@
+function updateList(data) {
+ author = '<span style="font-weight:bold"
class="author">' + data.author + '</span>: ';
+ message = '<span class="message">' + data.text +
'</span>';
+ jQuery("ul.push-list").append('<li>' + author + message +
'</li>');
+}