Author: shane.bryzak(a)jboss.com
Date: 2009-10-08 09:44:49 -0400 (Thu, 08 Oct 2009)
New Revision: 3902
Added:
extensions/trunk/se/src/main/java/org/jboss/weld/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/ShutdownManager.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/beans/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/bindings/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDeployment.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDiscovery.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WeldManagerUtils.java
extensions/trunk/se/src/test/java/org/jboss/weld/
extensions/trunk/se/src/test/java/org/jboss/weld/environment/
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/Listener.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WeldAnnotationProcessor.java
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingAnnotationProcessor.java
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingJspApplicationContextImpl.java
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/JspInitialization.java
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/WeldLifecycleListener.java
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/util/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWeldDiscoveryTest.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/
extensions/trunk/wicket/src/main/java/org/jboss/weld/
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldApplication.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldComponentInstantiationListener.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldMetaData.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldRequestCycle.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldWebRequestCycleProcessor.java
Removed:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeanDiscovery.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeansDeployment.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WebBeansManagerUtils.java
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/StartMainTest.java
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/services/
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/util/
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/tomcat/
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplication.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WebBeansAnnotationProcessor.java
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingAnnotationProcessor.java
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingJspApplicationContextImpl.java
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/JspInitialization.java
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/util/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansApplication.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansComponentInstantiationListener.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansMetaData.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansRequestCycle.java
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansWebRequestCycleProcessor.java
Modified:
extensions/trunk/bean-utils/pom.xml
extensions/trunk/logger/pom.xml
extensions/trunk/pom.xml
extensions/trunk/se/pom.xml
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/bindings/Parameters.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/AbstractScanner.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEBeanDeploymentArchive.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/Scanner.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/URLScanner.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/ContainerInitialized.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/Shutdown.java
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/Reflections.java
extensions/trunk/se/src/main/resources/log4j.xml
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/CustomEvent.java
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/InitObserverTestBean.java
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/MainTestBean.java
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ObserverTestBean.java
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ParametersTestBean.java
extensions/trunk/servlet/build/pom.xml
extensions/trunk/servlet/int/pom.xml
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/AbstractScanner.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/Scanner.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/ServletDeployment.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/URLScanner.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/WebAppBeanDeploymentArchive.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplication.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplicationFactory.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplicationFactory.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletResourceInjectionServices.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletServicesImpl.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Reflections.java
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Servlets.java
extensions/trunk/servlet/pom.xml
extensions/trunk/servlet/support/pom.xml
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/util/Reflections.java
extensions/trunk/servlet/tests/pom.xml
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/ExampleTest.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Game.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Generator.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockExampleTest.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockSentenceTranslator.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Random.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceParser.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceTranslator.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/TextTranslator.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Translator.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/LookupTest.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Mouse.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/RatServlet.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/ServletInjectionTest.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Sewer.java
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Vole.java
extensions/trunk/wicket/pom.xml
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/BeanManagerLookup.java
extensions/trunk/xsd/pom.xml
Log:
code refactoring
Modified: extensions/trunk/bean-utils/pom.xml
===================================================================
--- extensions/trunk/bean-utils/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/bean-utils/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,14 +1,14 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-bean-utils</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-bean-utils</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans Utilities For Managing Beans</name>
+ <name>Weld Utilities For Managing Beans</name>
<dependencies>
@@ -26,19 +26,19 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logging</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core-test</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core-test</artifactId>
<scope>test</scope>
</dependency>
@@ -65,9 +65,9 @@
</dependencies>
<scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions&...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/exten...
-
<
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/webbeans/extensions<...
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions</...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extension...
+ <
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/weld/extensions</url...
</scm>
<build>
@@ -77,7 +77,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
-
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
+
<
tagBase>https://svn.jboss.org/repos/weld/extensions/tags</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
Modified: extensions/trunk/logger/pom.xml
===================================================================
--- extensions/trunk/logger/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/logger/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,14 +1,14 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logger</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logger</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans Injectable Logger</name>
+ <name>Weld Injectable Logger</name>
<dependencies>
@@ -26,13 +26,13 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logging</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
@@ -49,14 +49,14 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core-test</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core-test</artifactId>
<scope>test</scope>
</dependency>
@@ -83,9 +83,9 @@
</dependencies>
<scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions&...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/exten...
-
<
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/webbeans/extensions<...
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions</...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extension...
+ <
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/weld/extensions</url...
</scm>
<build>
@@ -95,7 +95,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
-
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
+
<
tagBase>https://svn.jboss.org/repos/weld/extensions/tags</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
Modified: extensions/trunk/pom.xml
===================================================================
--- extensions/trunk/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,18 +1,18 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-extensions-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-version-matrix</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-version-matrix</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
- <name>Web Beans Extensions aggregator</name>
- <
url>http://www.seamframework.org/WebBeans</url>
+ <name>Weld Extensions aggregator</name>
+ <
url>http://www.seamframework.org/Weld</url>
<modules>
<module>servlet</module>
Modified: extensions/trunk/se/pom.xml
===================================================================
--- extensions/trunk/se/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/se/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-se</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-se</artifactId>
<packaging>jar</packaging>
- <name>Web Beans SE Module</name>
+ <name>Weld SE Module</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
@@ -25,7 +25,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
-
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
+
<
tagBase>https://svn.jboss.org/repos/weld/extensions/tags</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
@@ -47,8 +47,8 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-spi</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-spi</artifactId>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
@@ -65,21 +65,21 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
- <artifactId>inject-api</artifactId>
+ <artifactId>javax.inject</artifactId>
</dependency>
</dependencies>
<scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions&...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/exten...
- <
url>http://fisheye.jboss.org/browse/WebBeans/extensions</url>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions</...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extension...
+ <
url>http://fisheye.jboss.org/browse/Weld/extensions</url>
</scm>
</project>
Deleted:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,81 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeanManager;
-
-import javax.inject.Inject;
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.environment.se.events.Shutdown;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-
-@ApplicationScoped
-public class ShutdownManager
-{
-
- private static LogProvider log = Logging.getLogProvider(ShutdownManager.class);
-
- @Inject
- private WebBeansManager manager;
-
- private boolean hasShutdownBeenCalled = false;
-
- private Bootstrap bootstrap;
-
- /**
- * The observer of the optional shutdown request which will in turn fire the
- * Shutdown event.
- *
- * @param shutdownRequest
- */
- public void shutdown(@Observes @Shutdown BeanManager shutdownRequest)
- {
- synchronized (this)
- {
-
- if (!hasShutdownBeenCalled)
- {
- hasShutdownBeenCalled = true;
- bootstrap.shutdown();
- }
- else
- {
- log.debug("Skipping spurious call to shutdown");
- log.trace(Thread.currentThread().getStackTrace());
- }
- }
- }
-
- /**
- * Shutdown WebBeans SE gracefully (call this as an alternative to firing the
- * "@Shutdown Manager" event.
- */
- public void shutdown()
- {
- shutdown(manager);
- }
-
- public void setBootstrap(Bootstrap bootstrap)
- {
- this.bootstrap = bootstrap;
- }
-
-}
Deleted:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,98 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se;
-
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.environment.se.discovery.SEWebBeansDeployment;
-import org.jboss.webbeans.environment.se.events.ContainerInitialized;
-import org.jboss.webbeans.environment.se.util.Reflections;
-import org.jboss.webbeans.environment.se.util.WebBeansManagerUtils;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-
-/**
- * This is the main class that should always be called from the command line for
- * a WebBEans SE app. Something like: <code>
- * java -jar MyApp.jar org.jboss.webbeans.environment.se.StarMain arguments
- * </code>
- *
- * @author Peter Royle
- * @author Pete Muir
- */
-public class StartMain
-{
-
- private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
- private final Bootstrap bootstrap;
- private final BeanStore applicationBeanStore;
- public static String[] PARAMETERS;
- private WebBeansManager manager;
-
- public StartMain(String[] commandLineArgs)
- {
- PARAMETERS = commandLineArgs;
- try
- {
- bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME,
Bootstrap.class);
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Error loading Web Beans bootstrap, check
that Web Beans is on the classpath", e);
- }
- this.applicationBeanStore = new ConcurrentHashMapBeanStore();
- }
-
- public BeanManager go()
- {
- SEWebBeansDeployment deployment = new SEWebBeansDeployment()
- {
- };
- bootstrap.startContainer(Environments.SE, deployment, this.applicationBeanStore);
- final BeanDeploymentArchive mainBeanDepArch =
deployment.getBeanDeploymentArchives().get(0);
- this.manager = bootstrap.getManager(mainBeanDepArch);
- bootstrap.startInitialization();
- bootstrap.deployBeans();
- WebBeansManagerUtils.getInstanceByType(manager,
ShutdownManager.class).setBootstrap(bootstrap);
- bootstrap.validateBeans();
- bootstrap.endInitialization();
-
- this.manager.fireEvent(new ContainerInitialized());
- return this.manager;
- }
-
- /**
- * The main method called from the command line.
- *
- * @param args the command line arguments
- */
- public static void main(String[] args)
- {
- new StartMain(args).go();
- }
-
- public static String[] getParameters()
- {
- // TODO(PR): make immutable
- return PARAMETERS;
- }
-
-}
Copied:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/ShutdownManager.java (from
rev 3901,
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java)
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/ShutdownManager.java
(rev 0)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/ShutdownManager.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,81 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+
+import javax.inject.Inject;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.environment.se.events.Shutdown;
+
+@ApplicationScoped
+public class ShutdownManager
+{
+
+ private static LogProvider log = Logging.getLogProvider(ShutdownManager.class);
+
+ @Inject
+ private WeldManager manager;
+
+ private boolean hasShutdownBeenCalled = false;
+
+ private Bootstrap bootstrap;
+
+ /**
+ * The observer of the optional shutdown request which will in turn fire the
+ * Shutdown event.
+ *
+ * @param shutdownRequest
+ */
+ public void shutdown(@Observes @Shutdown BeanManager shutdownRequest)
+ {
+ synchronized (this)
+ {
+
+ if (!hasShutdownBeenCalled)
+ {
+ hasShutdownBeenCalled = true;
+ bootstrap.shutdown();
+ }
+ else
+ {
+ log.debug("Skipping spurious call to shutdown");
+ log.trace(Thread.currentThread().getStackTrace());
+ }
+ }
+ }
+
+ /**
+ * Shutdown WebBeans SE gracefully (call this as an alternative to firing the
+ * "@Shutdown Manager" event.
+ */
+ public void shutdown()
+ {
+ shutdown(manager);
+ }
+
+ public void setBootstrap(Bootstrap bootstrap)
+ {
+ this.bootstrap = bootstrap;
+ }
+
+}
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/StartMain.java
(from rev 3901,
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java)
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/StartMain.java
(rev 0)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/StartMain.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,98 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.environment.se.discovery.SEWeldDeployment;
+import org.jboss.weld.environment.se.events.ContainerInitialized;
+import org.jboss.weld.environment.se.util.Reflections;
+import org.jboss.weld.environment.se.util.WeldManagerUtils;
+
+/**
+ * This is the main class that should always be called from the command line for
+ * a WebBEans SE app. Something like: <code>
+ * java -jar MyApp.jar org.jboss.webbeans.environment.se.StarMain arguments
+ * </code>
+ *
+ * @author Peter Royle
+ * @author Pete Muir
+ */
+public class StartMain
+{
+
+ private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
+ private final Bootstrap bootstrap;
+ private final BeanStore applicationBeanStore;
+ public static String[] PARAMETERS;
+ private WeldManager manager;
+
+ public StartMain(String[] commandLineArgs)
+ {
+ PARAMETERS = commandLineArgs;
+ try
+ {
+ bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME,
Bootstrap.class);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Error loading Web Beans bootstrap, check
that Web Beans is on the classpath", e);
+ }
+ this.applicationBeanStore = new ConcurrentHashMapBeanStore();
+ }
+
+ public BeanManager go()
+ {
+ SEWeldDeployment deployment = new SEWeldDeployment()
+ {
+ };
+ bootstrap.startContainer(Environments.SE, deployment, this.applicationBeanStore);
+ final BeanDeploymentArchive mainBeanDepArch =
deployment.getBeanDeploymentArchives().get(0);
+ this.manager = bootstrap.getManager(mainBeanDepArch);
+ bootstrap.startInitialization();
+ bootstrap.deployBeans();
+ WeldManagerUtils.getInstanceByType(manager,
ShutdownManager.class).setBootstrap(bootstrap);
+ bootstrap.validateBeans();
+ bootstrap.endInitialization();
+
+ this.manager.fireEvent(new ContainerInitialized());
+ return this.manager;
+ }
+
+ /**
+ * The main method called from the command line.
+ *
+ * @param args the command line arguments
+ */
+ public static void main(String[] args)
+ {
+ new StartMain(args).go();
+ }
+
+ public static String[] getParameters()
+ {
+ // TODO(PR): make immutable
+ return PARAMETERS;
+ }
+
+}
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/beans (from rev
3901, extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans)
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.beans;
+package org.jboss.weld.environment.se.beans;
import java.util.ArrayList;
import java.util.Arrays;
@@ -24,8 +24,8 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
-import org.jboss.webbeans.environment.se.StartMain;
-import org.jboss.webbeans.environment.se.bindings.Parameters;
+import org.jboss.weld.environment.se.StartMain;
+import org.jboss.weld.environment.se.bindings.Parameters;
/**
* The simple bean that will hold the command line arguments and make them
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/bindings (from rev
3901, extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings)
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/bindings/Parameters.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/bindings/Parameters.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/bindings/Parameters.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.bindings;
+package org.jboss.weld.environment.se.bindings;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery (from
rev 3901, extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery)
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/AbstractScanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/AbstractScanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/AbstractScanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.discovery;
+package org.jboss.weld.environment.se.discovery;
import java.net.URL;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* Abstract base class for {@link Scanner} providing common functionality
@@ -34,9 +34,9 @@
private static final LogProvider log = Logging.getLogProvider(Scanner.class);
private final ClassLoader classLoader;
- private final SEWebBeanDiscovery webBeanDiscovery;
+ private final SEWeldDiscovery webBeanDiscovery;
- public AbstractScanner(ClassLoader classLoader, SEWebBeanDiscovery webBeanDiscovery)
+ public AbstractScanner(ClassLoader classLoader, SEWeldDiscovery webBeanDiscovery)
{
this.classLoader = classLoader;
this.webBeanDiscovery = webBeanDiscovery;
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEBeanDeploymentArchive.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/SEBeanDeploymentArchive.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEBeanDeploymentArchive.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.discovery;
+package org.jboss.weld.environment.se.discovery;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
* A Java SE implementation of BeanDeploymentArchive. It is essentially an
@@ -36,12 +36,12 @@
*/
public class SEBeanDeploymentArchive implements BeanDeploymentArchive
{
- private final SEWebBeanDiscovery wbDiscovery;
+ private final SEWeldDiscovery wbDiscovery;
private final ServiceRegistry serviceRegistry;
public SEBeanDeploymentArchive()
{
- wbDiscovery = new SEWebBeanDiscovery()
+ wbDiscovery = new SEWeldDiscovery()
{
};
serviceRegistry = new SimpleServiceRegistry();
Deleted:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeanDiscovery.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/SEWebBeanDiscovery.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeanDiscovery.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,74 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se.discovery;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.webbeans.environment.se.util.Reflections;
-
-/**
- * The means by which Web Beans are discovered on the classpath. This will only
- * discover simple web beans - there is no EJB/Servlet/JPA integration.
- *
- * @author Peter Royle
- * @author Pete Muir
- * @author Ales Justin
- */
-public abstract class SEWebBeanDiscovery
-{
-
- private final Set<Class<?>> wbClasses;
- private final Set<URL> wbUrls;
-
- public SEWebBeanDiscovery()
- {
- this.wbClasses = new HashSet<Class<?>>();
- this.wbUrls = new HashSet<URL>();
- scan();
- }
-
- public Iterable<Class<?>> discoverWebBeanClasses()
- {
- return Collections.unmodifiableSet(wbClasses);
- }
-
- public Collection<URL> discoverWebBeansXml()
- {
- return Collections.unmodifiableSet(wbUrls);
- }
-
- public Set<Class<?>> getWbClasses()
- {
- return wbClasses;
- }
-
- public Set<URL> getWbUrls()
- {
- return wbUrls;
- }
-
- private void scan()
- {
- Scanner scanner = new URLScanner(Reflections.getClassLoader(), this);
- scanner.scanResources(new String[] { "META-INF/beans.xml" });
- }
-
-}
Deleted:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeansDeployment.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/SEWebBeansDeployment.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWebBeansDeployment.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,69 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se.discovery;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-
-/**
- * WebBeans Deployment for Java SE environment.
- *
- * @author Peter Royle
- */
-public abstract class SEWebBeansDeployment implements Deployment
-{
- private final BeanDeploymentArchive beanDeploymentArchive;
- private final List<BeanDeploymentArchive> archInCollection;
-
- public SEWebBeansDeployment()
- {
- this.beanDeploymentArchive = new SEBeanDeploymentArchive();
- this.archInCollection = new ArrayList<BeanDeploymentArchive>(1);
- this.archInCollection.add(this.beanDeploymentArchive);
- }
-
- /**
- * {@inheritDoc}
- *
- * @return A collection containing the singular logical BeanDeploymentArchive
- * consisting of all Bean classes and beans.xml descriptors in the
- * current classpath.
- */
- public List<BeanDeploymentArchive> getBeanDeploymentArchives()
- {
- return this.archInCollection;
- }
-
- /**
- * {@inheritDoc}
- *
- * @return The singular logical BeanDeploymentArchive consisting of all which
- * contains all Beans classes.
- */
- public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
- {
- return this.beanDeploymentArchive;
- }
-
- public ServiceRegistry getServices()
- {
- return this.beanDeploymentArchive.getServices();
- }
-}
Copied:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDeployment.java
(from rev 3901,
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/SEWebBeansDeployment.java)
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDeployment.java
(rev 0)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDeployment.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,69 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.discovery;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+/**
+ * WebBeans Deployment for Java SE environment.
+ *
+ * @author Peter Royle
+ */
+public abstract class SEWeldDeployment implements Deployment
+{
+ private final BeanDeploymentArchive beanDeploymentArchive;
+ private final List<BeanDeploymentArchive> archInCollection;
+
+ public SEWeldDeployment()
+ {
+ this.beanDeploymentArchive = new SEBeanDeploymentArchive();
+ this.archInCollection = new ArrayList<BeanDeploymentArchive>(1);
+ this.archInCollection.add(this.beanDeploymentArchive);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return A collection containing the singular logical BeanDeploymentArchive
+ * consisting of all Bean classes and beans.xml descriptors in the
+ * current classpath.
+ */
+ public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+ {
+ return this.archInCollection;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return The singular logical BeanDeploymentArchive consisting of all which
+ * contains all Beans classes.
+ */
+ public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+ {
+ return this.beanDeploymentArchive;
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return this.beanDeploymentArchive.getServices();
+ }
+}
Copied:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDiscovery.java
(from rev 3901,
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/SEWebBeanDiscovery.java)
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDiscovery.java
(rev 0)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/SEWeldDiscovery.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,74 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.discovery;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.weld.environment.se.util.Reflections;
+
+/**
+ * The means by which Web Beans are discovered on the classpath. This will only
+ * discover simple web beans - there is no EJB/Servlet/JPA integration.
+ *
+ * @author Peter Royle
+ * @author Pete Muir
+ * @author Ales Justin
+ */
+public abstract class SEWeldDiscovery
+{
+
+ private final Set<Class<?>> wbClasses;
+ private final Set<URL> wbUrls;
+
+ public SEWeldDiscovery()
+ {
+ this.wbClasses = new HashSet<Class<?>>();
+ this.wbUrls = new HashSet<URL>();
+ scan();
+ }
+
+ public Iterable<Class<?>> discoverWebBeanClasses()
+ {
+ return Collections.unmodifiableSet(wbClasses);
+ }
+
+ public Collection<URL> discoverWebBeansXml()
+ {
+ return Collections.unmodifiableSet(wbUrls);
+ }
+
+ public Set<Class<?>> getWbClasses()
+ {
+ return wbClasses;
+ }
+
+ public Set<URL> getWbUrls()
+ {
+ return wbUrls;
+ }
+
+ private void scan()
+ {
+ Scanner scanner = new URLScanner(Reflections.getClassLoader(), this);
+ scanner.scanResources(new String[] { "META-INF/beans.xml" });
+ }
+
+}
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/Scanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/Scanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/Scanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.discovery;
+package org.jboss.weld.environment.se.discovery;
import java.io.File;
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/URLScanner.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/discovery/URLScanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/discovery/URLScanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.discovery;
+package org.jboss.weld.environment.se.discovery;
import java.io.File;
import java.io.IOException;
@@ -29,8 +29,8 @@
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* Implementation of {@link Scanner} which can scan a {@link URLClassLoader}
@@ -45,7 +45,7 @@
{
private static final LogProvider log = Logging.getLogProvider(URLScanner.class);
- public URLScanner(ClassLoader classLoader, SEWebBeanDiscovery webBeanDiscovery)
+ public URLScanner(ClassLoader classLoader, SEWeldDiscovery webBeanDiscovery)
{
super(classLoader, webBeanDiscovery);
}
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events (from rev
3901, extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events)
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/ContainerInitialized.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/ContainerInitialized.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/ContainerInitialized.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.events;
+package org.jboss.weld.environment.se.events;
/**
* The event that is fired when the WebBeans CDI container is initialized and
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/Shutdown.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Shutdown.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/events/Shutdown.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.events;
+package org.jboss.weld.environment.se.events;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Copied: extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util (from rev
3901, extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util)
Modified:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/Reflections.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/Reflections.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/Reflections.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.util;
+package org.jboss.weld.environment.se.util;
/**
* Reflection utilities
Deleted:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WebBeansManagerUtils.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/WebBeansManagerUtils.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WebBeansManagerUtils.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,43 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se.util;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-/**
- *
- * @author Peter Royle
- */
-public class WebBeansManagerUtils
-{
-
- public static <T> T getInstanceByType(BeanManager manager, Class<T> type,
Annotation... bindings)
- {
- final Bean<?> bean = manager.getBeans(type).iterator().next();
- CreationalContext cc = manager.createCreationalContext(bean);
- return (T) manager.getReference(bean, type, cc);
- }
-
- public static <T> T getInstanceByType(BeanManager manager, Class<T> type,
CreationalContext cc, Annotation... bindings)
- {
- return (T) manager.getReference(manager.getBeans(type).iterator().next(), type,
cc);
- }
-}
Copied:
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WeldManagerUtils.java
(from rev 3901,
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/util/WebBeansManagerUtils.java)
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WeldManagerUtils.java
(rev 0)
+++
extensions/trunk/se/src/main/java/org/jboss/weld/environment/se/util/WeldManagerUtils.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,43 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.util;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class WeldManagerUtils
+{
+
+ public static <T> T getInstanceByType(BeanManager manager, Class<T> type,
Annotation... bindings)
+ {
+ final Bean<?> bean = manager.getBeans(type).iterator().next();
+ CreationalContext cc = manager.createCreationalContext(bean);
+ return (T) manager.getReference(bean, type, cc);
+ }
+
+ public static <T> T getInstanceByType(BeanManager manager, Class<T> type,
CreationalContext cc, Annotation... bindings)
+ {
+ return (T) manager.getReference(manager.getBeans(type).iterator().next(), type,
cc);
+ }
+}
Modified: extensions/trunk/se/src/main/resources/log4j.xml
===================================================================
--- extensions/trunk/se/src/main/resources/log4j.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/se/src/main/resources/log4j.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -32,9 +32,9 @@
</filter>
</appender>
- <!-- ############### Web Beans logging ################### -->
+ <!-- ############### Weld logging ################### -->
- <category name="org.jboss.webbeans">
+ <category name="org.jboss.weld">
<priority value="INFO"/>
</category>
Deleted:
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/StartMainTest.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/StartMainTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/StartMainTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,118 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.se.test;
-
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.webbeans.environment.se.StartMain;
-import org.jboss.webbeans.environment.se.events.Shutdown;
-import org.jboss.webbeans.environment.se.test.beans.CustomEvent;
-import org.jboss.webbeans.environment.se.test.beans.InitObserverTestBean;
-import org.jboss.webbeans.environment.se.test.beans.MainTestBean;
-import org.jboss.webbeans.environment.se.test.beans.ObserverTestBean;
-import org.jboss.webbeans.environment.se.test.beans.ParametersTestBean;
-import org.jboss.webbeans.environment.se.util.WebBeansManagerUtils;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Peter Royle
- */
-public class StartMainTest
-{
-
- public static String[] ARGS = new String[] { "arg1", "arg2",
"arg3" };
- public static String[] ARGS_EMPTY = new String[] {};
-
- /**
- * Test of main method, of class StartMain. Checks that the beans found in
- * the org.jboss.webbeans.environment.se.beans package are initialised as
- * expected.
- */
- @Test
- public void testMain()
- {
- String[] args = ARGS;
- BeanManager manager = new StartMain(args).go();
-
- MainTestBean mainTestBean = WebBeansManagerUtils.getInstanceByType(manager,
MainTestBean.class);
- Assert.assertNotNull(mainTestBean);
-
- ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
- Assert.assertNotNull(paramsBean);
- Assert.assertNotNull(paramsBean.getParameters());
- Assert.assertNotNull(paramsBean.getParameters().get(0));
- Assert.assertEquals(ARGS[0], paramsBean.getParameters().get(0));
- Assert.assertNotNull(paramsBean.getParameters().get(1));
- Assert.assertEquals(ARGS[1], paramsBean.getParameters().get(1));
- Assert.assertNotNull(paramsBean.getParameters().get(2));
- Assert.assertEquals(ARGS[2], paramsBean.getParameters().get(2));
-
- shutdownManager(manager);
- }
-
- /**
- * Test of main method, of class StartMain when no command-line args are
- * provided.
- */
- @Test
- public void testMainEmptyArgs()
- {
- BeanManager manager = new StartMain(ARGS_EMPTY).go();
-
- MainTestBean mainTestBean = WebBeansManagerUtils.getInstanceByType(manager,
MainTestBean.class);
- Assert.assertNotNull(mainTestBean);
-
- ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
- Assert.assertNotNull(paramsBean);
- Assert.assertNotNull(paramsBean.getParameters());
-
- shutdownManager(manager);
- }
-
- @Test
- public void testObservers()
- {
- InitObserverTestBean.reset();
- ObserverTestBean.reset();
-
- BeanManager manager = new StartMain(ARGS_EMPTY).go();
- manager.fireEvent(new CustomEvent());
-
- Assert.assertTrue(ObserverTestBean.isBuiltInObserved());
- Assert.assertTrue(ObserverTestBean.isCustomObserved());
- Assert.assertTrue(ObserverTestBean.isInitObserved());
-
- Assert.assertTrue(InitObserverTestBean.isInitObserved());
- }
-
- private void shutdownManager(BeanManager manager)
- {
- manager.fireEvent(manager, new ShutdownAnnotation());
- }
-
- private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
- {
-
- public ShutdownAnnotation()
- {
- }
- }
-
-}
Copied:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java
(from rev 3901,
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/StartMainTest.java)
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java
(rev 0)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,118 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.test;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.environment.se.StartMain;
+import org.jboss.weld.environment.se.events.Shutdown;
+import org.jboss.weld.environment.se.test.beans.CustomEvent;
+import org.jboss.weld.environment.se.test.beans.InitObserverTestBean;
+import org.jboss.weld.environment.se.test.beans.MainTestBean;
+import org.jboss.weld.environment.se.test.beans.ObserverTestBean;
+import org.jboss.weld.environment.se.test.beans.ParametersTestBean;
+import org.jboss.weld.environment.se.util.WeldManagerUtils;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class StartMainTest
+{
+
+ public static String[] ARGS = new String[] { "arg1", "arg2",
"arg3" };
+ public static String[] ARGS_EMPTY = new String[] {};
+
+ /**
+ * Test of main method, of class StartMain. Checks that the beans found in
+ * the org.jboss.weld.environment.se.beans package are initialised as
+ * expected.
+ */
+ @Test
+ public void testMain()
+ {
+ String[] args = ARGS;
+ BeanManager manager = new StartMain(args).go();
+
+ MainTestBean mainTestBean = WeldManagerUtils.getInstanceByType(manager,
MainTestBean.class);
+ Assert.assertNotNull(mainTestBean);
+
+ ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
+ Assert.assertNotNull(paramsBean);
+ Assert.assertNotNull(paramsBean.getParameters());
+ Assert.assertNotNull(paramsBean.getParameters().get(0));
+ Assert.assertEquals(ARGS[0], paramsBean.getParameters().get(0));
+ Assert.assertNotNull(paramsBean.getParameters().get(1));
+ Assert.assertEquals(ARGS[1], paramsBean.getParameters().get(1));
+ Assert.assertNotNull(paramsBean.getParameters().get(2));
+ Assert.assertEquals(ARGS[2], paramsBean.getParameters().get(2));
+
+ shutdownManager(manager);
+ }
+
+ /**
+ * Test of main method, of class StartMain when no command-line args are
+ * provided.
+ */
+ @Test
+ public void testMainEmptyArgs()
+ {
+ BeanManager manager = new StartMain(ARGS_EMPTY).go();
+
+ MainTestBean mainTestBean = WeldManagerUtils.getInstanceByType(manager,
MainTestBean.class);
+ Assert.assertNotNull(mainTestBean);
+
+ ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
+ Assert.assertNotNull(paramsBean);
+ Assert.assertNotNull(paramsBean.getParameters());
+
+ shutdownManager(manager);
+ }
+
+ @Test
+ public void testObservers()
+ {
+ InitObserverTestBean.reset();
+ ObserverTestBean.reset();
+
+ BeanManager manager = new StartMain(ARGS_EMPTY).go();
+ manager.fireEvent(new CustomEvent());
+
+ Assert.assertTrue(ObserverTestBean.isBuiltInObserved());
+ Assert.assertTrue(ObserverTestBean.isCustomObserved());
+ Assert.assertTrue(ObserverTestBean.isInitObserved());
+
+ Assert.assertTrue(InitObserverTestBean.isInitObserved());
+ }
+
+ private void shutdownManager(BeanManager manager)
+ {
+ manager.fireEvent(manager, new ShutdownAnnotation());
+ }
+
+ private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
+ {
+
+ public ShutdownAnnotation()
+ {
+ }
+ }
+
+}
Copied: extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans (from
rev 3901, extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans)
Modified:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/CustomEvent.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/CustomEvent.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/CustomEvent.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.test.beans;
+package org.jboss.weld.environment.se.test.beans;
/**
* A custom event fired and observed by one of the tests, to test
Modified:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/InitObserverTestBean.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/InitObserverTestBean.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/InitObserverTestBean.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,12 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.test.beans;
+package org.jboss.weld.environment.se.test.beans;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
-import org.jboss.webbeans.environment.se.events.ContainerInitialized;
+import org.jboss.weld.environment.se.events.ContainerInitialized;
+
/**
* Tests the observing of both built-in and application-specific events.
*
Modified:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/MainTestBean.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/MainTestBean.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/MainTestBean.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.test.beans;
+package org.jboss.weld.environment.se.test.beans;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
Modified:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ObserverTestBean.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/ObserverTestBean.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ObserverTestBean.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.test.beans;
+package org.jboss.weld.environment.se.test.beans;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.Extension;
import javax.inject.Inject;
-import org.jboss.webbeans.environment.se.events.ContainerInitialized;
+import org.jboss.weld.environment.se.events.ContainerInitialized;
+
/**
* Tests the observing of both built-in and application-specific events.
*
Modified:
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ParametersTestBean.java
===================================================================
---
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/test/beans/ParametersTestBean.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/se/src/test/java/org/jboss/weld/environment/se/test/beans/ParametersTestBean.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.environment.se.test.beans;
+package org.jboss.weld.environment.se.test.beans;
import java.io.Serializable;
import java.util.List;
@@ -23,7 +23,8 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
-import org.jboss.webbeans.environment.se.bindings.Parameters;
+
+import org.jboss.weld.environment.se.bindings.Parameters;
import org.testng.Assert;
/**
Modified: extensions/trunk/servlet/build/pom.xml
===================================================================
--- extensions/trunk/servlet/build/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/servlet/build/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-servlet-parent</artifactId>
- <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>weld-servlet-parent</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Web Beans Servlet module</name>
- <
url>http://www.seamframework.org/WebBeans</url>
+ <name>Weld Servlet module</name>
+ <
url>http://www.seamframework.org/Weld</url>
<dependencies>
<dependency>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet-int</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet-int</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<optional>true</optional>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Modified: extensions/trunk/servlet/int/pom.xml
===================================================================
--- extensions/trunk/servlet/int/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/servlet/int/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-servlet-parent</artifactId>
- <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>weld-servlet-parent</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet-int</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet-int</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Web Beans Servlet Integration</name>
- <
url>http://www.seamframework.org/WebBeans</url>
+ <name>Weld Servlet Integration</name>
+ <
url>http://www.seamframework.org/Weld</url>
<dependencies>
<dependency>
@@ -28,8 +28,8 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-spi</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-spi</artifactId>
</dependency>
<dependency>
@@ -39,8 +39,8 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logging</artifactId>
</dependency>
<dependency>
Deleted:
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.servlet;
-
-import javax.el.ELContextListener;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.jsp.JspApplicationContext;
-import javax.servlet.jsp.JspFactory;
-
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.environment.servlet.deployment.ServletDeployment;
-import org.jboss.webbeans.environment.servlet.services.ServletResourceInjectionServices;
-import org.jboss.webbeans.environment.servlet.services.ServletServicesImpl;
-import org.jboss.webbeans.environment.servlet.util.Reflections;
-import org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor;
-import org.jboss.webbeans.injection.spi.ResourceInjectionServices;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-import org.jboss.webbeans.servlet.api.ServletListener;
-import org.jboss.webbeans.servlet.api.ServletServices;
-import org.jboss.webbeans.servlet.api.helpers.ForwardingServletListener;
-
-/**
- * @author Pete Muir
- */
-public class Listener extends ForwardingServletListener
-{
-
- private static final Log log = Logging.getLog(Listener.class);
-
- private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
- private static final String WEB_BEANS_LISTENER_CLASS_NAME =
"org.jboss.webbeans.servlet.WebBeansListener";
- private static final String APPLICATION_BEAN_STORE_ATTRIBUTE_NAME =
Listener.class.getName() + ".applicationBeanStore";
- private static final String EXPRESSION_FACTORY_NAME =
"org.jboss.webbeans.el.ExpressionFactory";
-
- private final transient Bootstrap bootstrap;
- private final transient ServletListener webBeansListener;
- private WebBeansManager manager;
-
- public Listener()
- {
- try
- {
- bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME);
- }
- catch (IllegalArgumentException e)
- {
- throw new IllegalStateException("Error loading Web Beans bootstrap, check
that Web Beans is on the classpath", e);
- }
- try
- {
- webBeansListener = Reflections.newInstance(WEB_BEANS_LISTENER_CLASS_NAME);
- }
- catch (IllegalArgumentException e)
- {
- throw new IllegalStateException("Error loading Web Beans listener, check
that Web Beans is on the classpath", e);
- }
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent sce)
- {
- bootstrap.shutdown();
- super.contextDestroyed(sce);
- }
-
- @Override
- public void contextInitialized(ServletContextEvent sce)
- {
- BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
- sce.getServletContext().setAttribute(APPLICATION_BEAN_STORE_ATTRIBUTE_NAME,
applicationBeanStore);
-
-
-
- ServletDeployment deployment = new ServletDeployment(sce.getServletContext());
- try
- {
-
deployment.getWebAppBeanDeploymentArchive().getServices().add(ResourceInjectionServices.class,
new ServletResourceInjectionServices() {});
- }
- catch (NoClassDefFoundError e)
- {
- // Support GAE
- log.warn("@Resource injection not available in simple beans");
- }
-
- deployment.getServices().add(ServletServices.class, new
ServletServicesImpl(deployment.getWebAppBeanDeploymentArchive()));
-
- bootstrap.startContainer(Environments.SERVLET, deployment,
applicationBeanStore).startInitialization();
- manager = bootstrap.getManager(deployment.getWebAppBeanDeploymentArchive());
-
- boolean tomcat = true;
- try
- {
- Reflections.classForName("org.apache.AnnotationProcessor");
- }
- catch (IllegalArgumentException e)
- {
- log.info("JSR-299 injection will not be available in Servlets, Filters etc.
This facility is only available in Tomcat");
- tomcat = false;
- }
-
- if (tomcat)
- {
- // Try pushing a Tomcat AnnotationProcessor into the servlet context
- try
- {
- Class<?> clazz =
Reflections.classForName(WebBeansAnnotationProcessor.class.getName());
- Object annotationProcessor =
clazz.getConstructor(WebBeansManager.class).newInstance(manager);
-
sce.getServletContext().setAttribute(WebBeansAnnotationProcessor.class.getName(),
annotationProcessor);
- }
- catch (Exception e)
- {
- log.error("Unable to create Tomcat AnnotationProcessor. JSR-299
injection will not be available in Servlets, Filters etc.", e);
- }
- }
-
- // Push the manager into the servlet context so we can access in JSF
- sce.getServletContext().setAttribute(BeanManager.class.getName(), manager);
-
- if (JspFactory.getDefaultFactory() != null)
- {
- JspApplicationContext jspApplicationContext =
JspFactory.getDefaultFactory().getJspApplicationContext(sce.getServletContext());
-
- // Register the ELResolver with JSP
- jspApplicationContext.addELResolver(manager.getELResolver());
-
- // Register ELContextListener with JSP
-
jspApplicationContext.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.webbeans.el.WebBeansELContextListener"));
-
- // Push the wrapped expression factory into the servlet context so that Tomcat
or Jetty can hook it in using a container code
- sce.getServletContext().setAttribute(EXPRESSION_FACTORY_NAME,
manager.wrapExpressionFactory(jspApplicationContext.getExpressionFactory()));
- }
-
- bootstrap.deployBeans().validateBeans().endInitialization();
- super.contextInitialized(sce);
- }
-
-
-
- @Override
- protected ServletListener delegate()
- {
- return webBeansListener;
- }
-
-}
Copied:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/Listener.java
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java)
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/Listener.java
(rev 0)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/Listener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.servlet;
+
+import javax.el.ELContextListener;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
+
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.servlet.api.ServletListener;
+import org.jboss.weld.servlet.api.ServletServices;
+import org.jboss.weld.servlet.api.helpers.ForwardingServletListener;
+import org.jboss.weld.environment.servlet.deployment.ServletDeployment;
+import org.jboss.weld.environment.servlet.services.ServletResourceInjectionServices;
+import org.jboss.weld.environment.servlet.services.ServletServicesImpl;
+import org.jboss.weld.environment.servlet.util.Reflections;
+import org.jboss.weld.environment.tomcat.WeldAnnotationProcessor;
+
+/**
+ * @author Pete Muir
+ */
+public class Listener extends ForwardingServletListener
+{
+
+ private static final Log log = Logging.getLog(Listener.class);
+
+ private static final String BOOTSTRAP_IMPL_CLASS_NAME =
"org.jboss.webbeans.bootstrap.WebBeansBootstrap";
+ private static final String WEB_BEANS_LISTENER_CLASS_NAME =
"org.jboss.webbeans.servlet.WebBeansListener";
+ private static final String APPLICATION_BEAN_STORE_ATTRIBUTE_NAME =
Listener.class.getName() + ".applicationBeanStore";
+ private static final String EXPRESSION_FACTORY_NAME =
"org.jboss.webbeans.el.ExpressionFactory";
+
+ private final transient Bootstrap bootstrap;
+ private final transient ServletListener webBeansListener;
+ private WeldManager manager;
+
+ public Listener()
+ {
+ try
+ {
+ bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalStateException("Error loading Web Beans bootstrap, check
that Web Beans is on the classpath", e);
+ }
+ try
+ {
+ webBeansListener = Reflections.newInstance(WEB_BEANS_LISTENER_CLASS_NAME);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalStateException("Error loading Web Beans listener, check
that Web Beans is on the classpath", e);
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce)
+ {
+ bootstrap.shutdown();
+ super.contextDestroyed(sce);
+ }
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce)
+ {
+ BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
+ sce.getServletContext().setAttribute(APPLICATION_BEAN_STORE_ATTRIBUTE_NAME,
applicationBeanStore);
+
+
+
+ ServletDeployment deployment = new ServletDeployment(sce.getServletContext());
+ try
+ {
+
deployment.getWebAppBeanDeploymentArchive().getServices().add(ResourceInjectionServices.class,
new ServletResourceInjectionServices() {});
+ }
+ catch (NoClassDefFoundError e)
+ {
+ // Support GAE
+ log.warn("@Resource injection not available in simple beans");
+ }
+
+ deployment.getServices().add(ServletServices.class, new
ServletServicesImpl(deployment.getWebAppBeanDeploymentArchive()));
+
+ bootstrap.startContainer(Environments.SERVLET, deployment,
applicationBeanStore).startInitialization();
+ manager = bootstrap.getManager(deployment.getWebAppBeanDeploymentArchive());
+
+ boolean tomcat = true;
+ try
+ {
+ Reflections.classForName("org.apache.AnnotationProcessor");
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.info("JSR-299 injection will not be available in Servlets, Filters etc.
This facility is only available in Tomcat");
+ tomcat = false;
+ }
+
+ if (tomcat)
+ {
+ // Try pushing a Tomcat AnnotationProcessor into the servlet context
+ try
+ {
+ Class<?> clazz =
Reflections.classForName(WeldAnnotationProcessor.class.getName());
+ Object annotationProcessor =
clazz.getConstructor(WeldManager.class).newInstance(manager);
+ sce.getServletContext().setAttribute(WeldAnnotationProcessor.class.getName(),
annotationProcessor);
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to create Tomcat AnnotationProcessor. JSR-299
injection will not be available in Servlets, Filters etc.", e);
+ }
+ }
+
+ // Push the manager into the servlet context so we can access in JSF
+ sce.getServletContext().setAttribute(BeanManager.class.getName(), manager);
+
+ if (JspFactory.getDefaultFactory() != null)
+ {
+ JspApplicationContext jspApplicationContext =
JspFactory.getDefaultFactory().getJspApplicationContext(sce.getServletContext());
+
+ // Register the ELResolver with JSP
+ jspApplicationContext.addELResolver(manager.getELResolver());
+
+ // Register ELContextListener with JSP
+
jspApplicationContext.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.webbeans.el.WebBeansELContextListener"));
+
+ // Push the wrapped expression factory into the servlet context so that Tomcat
or Jetty can hook it in using a container code
+ sce.getServletContext().setAttribute(EXPRESSION_FACTORY_NAME,
manager.wrapExpressionFactory(jspApplicationContext.getExpressionFactory()));
+ }
+
+ bootstrap.deployBeans().validateBeans().endInitialization();
+ super.contextInitialized(sce);
+ }
+
+
+
+ @Override
+ protected ServletListener delegate()
+ {
+ return webBeansListener;
+ }
+
+}
Copied:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment)
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/AbstractScanner.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/AbstractScanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/AbstractScanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.deployment;
+package org.jboss.weld.environment.servlet.deployment;
import java.net.URL;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
/**
* Abstract base class for {@link Scanner} providing common functionality
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/Scanner.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/Scanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/Scanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.deployment;
+package org.jboss.weld.environment.servlet.deployment;
import java.io.File;
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/ServletDeployment.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/ServletDeployment.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/ServletDeployment.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,14 +1,14 @@
-package org.jboss.webbeans.environment.servlet.deployment;
+package org.jboss.weld.environment.servlet.deployment;
import java.util.ArrayList;
import java.util.Collection;
import javax.servlet.ServletContext;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
public class ServletDeployment implements Deployment
{
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/URLScanner.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/URLScanner.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/URLScanner.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.deployment;
+package org.jboss.weld.environment.servlet.deployment;
import java.io.File;
import java.io.IOException;
@@ -29,8 +29,8 @@
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
/**
* Implementation of {@link Scanner} which can scan a {@link URLClassLoader}
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/WebAppBeanDeploymentArchive.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/deployment/WebAppBeanDeploymentArchive.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/deployment/WebAppBeanDeploymentArchive.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.deployment;
+package org.jboss.weld.environment.servlet.deployment;
import java.io.File;
import java.net.MalformedURLException;
@@ -26,12 +26,12 @@
import javax.servlet.ServletContext;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.environment.servlet.util.Reflections;
-import org.jboss.webbeans.environment.servlet.util.Servlets;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.environment.servlet.util.Reflections;
+import org.jboss.weld.environment.servlet.util.Servlets;
/**
* The means by which Web Beans are discovered on the classpath. This will only
Copied: extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf)
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplication.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/ForwardingApplication.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplication.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.jsf;
+package org.jboss.weld.environment.servlet.jsf;
import java.util.Collection;
import java.util.Iterator;
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplicationFactory.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/ForwardingApplicationFactory.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/ForwardingApplicationFactory.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.jsf;
+package org.jboss.weld.environment.servlet.jsf;
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
Deleted:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplication.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/WebBeansApplication.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplication.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.servlet.jsf;
-
-import javax.el.ELContextListener;
-import javax.el.ExpressionFactory;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
-import javax.servlet.ServletContext;
-
-import org.jboss.webbeans.environment.servlet.util.Reflections;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-
-/**
- * @author pmuir
- *
- */
-public class WebBeansApplication extends ForwardingApplication
-{
-
- private static final ELContextListener[] EMPTY_LISTENERS = {};
-
- private final Application application;
- private ExpressionFactory expressionFactory;
-
- public WebBeansApplication(Application application)
- {
- this.application = application;
- BeanManager beanManager = getBeanManager();
- if (beanManager != null)
- {
-
application.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.webbeans.el.WebBeansELContextListener"));
- application.addELResolver(beanManager.getELResolver());
- }
- }
-
- @Override
- protected Application delegate()
- {
- return application;
- }
-
- @Override
- public ExpressionFactory getExpressionFactory()
- {
- // Application is multi-threaded, but no need to guard against races (re-
- // creating the cached expression factory doesn't matter) or liveness
- // (the value read by all threads will be the same)
- // We have to do this lazily as Mojarra hasn't set the ExpressionFactory
- // when the object is created
- if (this.expressionFactory == null)
- {
- BeanManager beanManager = getBeanManager();
- if (beanManager != null)
- {
- this.expressionFactory =
beanManager.wrapExpressionFactory(delegate().getExpressionFactory());
- }
- else
- {
- // WB failed to initialize properly
- this.expressionFactory = delegate().getExpressionFactory();
- }
- }
- return expressionFactory;
- }
-
- private static WebBeansManager getBeanManager()
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- if (!(facesContext.getExternalContext().getContext() instanceof ServletContext))
- {
- throw new IllegalStateException("Not in a servlet environment!");
- }
- ServletContext ctx = (ServletContext)
facesContext.getExternalContext().getContext();
- if (ctx.getAttribute(BeanManager.class.getName()) == null)
- {
- throw new IllegalStateException("BeanManager has not been pushed into the
ServletContext");
- }
- return (WebBeansManager) ctx.getAttribute(BeanManager.class.getName());
- }
-
-}
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplicationFactory.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/WebBeansApplicationFactory.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WebBeansApplicationFactory.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.jsf;
+package org.jboss.weld.environment.servlet.jsf;
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
@@ -47,7 +47,7 @@
{
if (application == null)
{
- application = new WebBeansApplication(delegate().getApplication());
+ application = new WeldApplication(delegate().getApplication());
}
return application;
}
Copied:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/jsf/WebBeansApplication.java)
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java
(rev 0)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.servlet.jsf;
+
+import javax.el.ELContextListener;
+import javax.el.ExpressionFactory;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.environment.servlet.util.Reflections;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldApplication extends ForwardingApplication
+{
+
+ private static final ELContextListener[] EMPTY_LISTENERS = {};
+
+ private final Application application;
+ private ExpressionFactory expressionFactory;
+
+ public WeldApplication(Application application)
+ {
+ this.application = application;
+ BeanManager beanManager = getBeanManager();
+ if (beanManager != null)
+ {
+
application.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.weld.el.WeldELContextListener"));
+ application.addELResolver(beanManager.getELResolver());
+ }
+ }
+
+ @Override
+ protected Application delegate()
+ {
+ return application;
+ }
+
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ // Application is multi-threaded, but no need to guard against races (re-
+ // creating the cached expression factory doesn't matter) or liveness
+ // (the value read by all threads will be the same)
+ // We have to do this lazily as Mojarra hasn't set the ExpressionFactory
+ // when the object is created
+ if (this.expressionFactory == null)
+ {
+ BeanManager beanManager = getBeanManager();
+ if (beanManager != null)
+ {
+ this.expressionFactory =
beanManager.wrapExpressionFactory(delegate().getExpressionFactory());
+ }
+ else
+ {
+ // WB failed to initialize properly
+ this.expressionFactory = delegate().getExpressionFactory();
+ }
+ }
+ return expressionFactory;
+ }
+
+ private static WeldManager getBeanManager()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (!(facesContext.getExternalContext().getContext() instanceof ServletContext))
+ {
+ throw new IllegalStateException("Not in a servlet environment!");
+ }
+ ServletContext ctx = (ServletContext)
facesContext.getExternalContext().getContext();
+ if (ctx.getAttribute(BeanManager.class.getName()) == null)
+ {
+ throw new IllegalStateException("BeanManager has not been pushed into the
ServletContext");
+ }
+ return (WeldManager) ctx.getAttribute(BeanManager.class.getName());
+ }
+
+}
Copied:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/services)
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletResourceInjectionServices.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/services/ServletResourceInjectionServices.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletResourceInjectionServices.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,11 +1,11 @@
-package org.jboss.webbeans.environment.servlet.services;
+package org.jboss.weld.environment.servlet.services;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.jboss.webbeans.injection.spi.ResourceInjectionServices;
-import org.jboss.webbeans.injection.spi.helpers.AbstractResourceServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.injection.spi.helpers.AbstractResourceServices;
public abstract class ServletResourceInjectionServices extends AbstractResourceServices
implements ResourceInjectionServices
{
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletServicesImpl.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/services/ServletServicesImpl.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/services/ServletServicesImpl.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,9 +1,9 @@
-package org.jboss.webbeans.environment.servlet.services;
+package org.jboss.weld.environment.servlet.services;
import javax.servlet.ServletContext;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.servlet.api.ServletServices;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
public class ServletServicesImpl implements ServletServices
{
Copied: extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/util)
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Reflections.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/util/Reflections.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Reflections.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.servlet.util;
+package org.jboss.weld.environment.servlet.util;
/**
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Servlets.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/util/Servlets.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/Servlets.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.environment.servlet.util;
+package org.jboss.weld.environment.servlet.util;
import java.io.File;
import java.net.MalformedURLException;
Copied: extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat (from
rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/tomcat)
Deleted:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WebBeansAnnotationProcessor.java
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WebBeansAnnotationProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,53 +0,0 @@
-package org.jboss.webbeans.environment.tomcat;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.naming.NamingException;
-
-import org.apache.AnnotationProcessor;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-
-public class WebBeansAnnotationProcessor implements AnnotationProcessor
-{
-
- private final Map<Class<?>, InjectionTarget<?>> injectionTargets;
-
- private final WebBeansManager manager;
-
- public WebBeansAnnotationProcessor(WebBeansManager manager)
- {
- this.manager = manager;
- this.injectionTargets = new ConcurrentHashMap<Class<?>,
InjectionTarget<?>>();
- }
-
- public void processAnnotations(Object instance) throws IllegalAccessException,
InvocationTargetException, NamingException
- {
- // not data-race safe, however doesn't matter, as the injection target created
for class A is interchangable for another injection target created for class A
- // TODO Make this a concurrent cache when we switch to google collections
- Class<?> clazz = instance.getClass();
- if (!injectionTargets.containsKey(clazz))
- {
- injectionTargets.put(clazz,
manager.createInjectionTarget(manager.createAnnotatedType(clazz)));
- }
- CreationalContext<Object> cc = manager.createCreationalContext(null);
- InjectionTarget<Object> it = (InjectionTarget<Object>)
injectionTargets.get(clazz);
- it.inject(instance, cc);
- }
-
- public void postConstruct(Object arg0) throws IllegalAccessException,
InvocationTargetException
- {
- // TODO Auto-generated method stub
-
- }
-
- public void preDestroy(Object arg0) throws IllegalAccessException,
InvocationTargetException
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WeldAnnotationProcessor.java
(from rev 3901,
extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java)
===================================================================
---
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WeldAnnotationProcessor.java
(rev 0)
+++
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/tomcat/WeldAnnotationProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,53 @@
+package org.jboss.weld.environment.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.naming.NamingException;
+
+import org.apache.AnnotationProcessor;
+import org.jboss.weld.manager.api.WeldManager;
+
+public class WeldAnnotationProcessor implements AnnotationProcessor
+{
+
+ private final Map<Class<?>, InjectionTarget<?>> injectionTargets;
+
+ private final WeldManager manager;
+
+ public WeldAnnotationProcessor(WeldManager manager)
+ {
+ this.manager = manager;
+ this.injectionTargets = new ConcurrentHashMap<Class<?>,
InjectionTarget<?>>();
+ }
+
+ public void processAnnotations(Object instance) throws IllegalAccessException,
InvocationTargetException, NamingException
+ {
+ // not data-race safe, however doesn't matter, as the injection target created
for class A is interchangable for another injection target created for class A
+ // TODO Make this a concurrent cache when we switch to google collections
+ Class<?> clazz = instance.getClass();
+ if (!injectionTargets.containsKey(clazz))
+ {
+ injectionTargets.put(clazz,
manager.createInjectionTarget(manager.createAnnotatedType(clazz)));
+ }
+ CreationalContext<Object> cc = manager.createCreationalContext(null);
+ InjectionTarget<Object> it = (InjectionTarget<Object>)
injectionTargets.get(clazz);
+ it.inject(instance, cc);
+ }
+
+ public void postConstruct(Object arg0) throws IllegalAccessException,
InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void preDestroy(Object arg0) throws IllegalAccessException,
InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Modified: extensions/trunk/servlet/pom.xml
===================================================================
--- extensions/trunk/servlet/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/servlet/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,18 +1,18 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet-parent</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-version-matrix</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-version-matrix</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
- <name>Web Beans Servlet aggregator</name>
- <
url>http://www.seamframework.org/WebBeans</url>
+ <name>Weld Servlet aggregator</name>
+ <
url>http://www.seamframework.org/Weld</url>
<modules>
<module>int</module>
@@ -22,7 +22,7 @@
</modules>
<description>
- Support for Web Beans in Servlet Containers
+ Support for Weld in Servlet Containers
</description>
<developers>
@@ -61,7 +61,7 @@
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
<configuration>
-
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
+
<
tagBase>https://svn.jboss.org/repos/weld/extensions/tags</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
@@ -136,9 +136,9 @@
</licenses>
<scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions&...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/exten...
- <
url>http://fisheye.jboss.org/browse/WebBeans/extensions</url>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions</...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extension...
+ <
url>http://fisheye.jboss.org/browse/Weld/extensions</url>
</scm>
<distributionManagement>
Modified: extensions/trunk/servlet/support/pom.xml
===================================================================
--- extensions/trunk/servlet/support/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/servlet/support/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-servlet-parent</artifactId>
- <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>weld-servlet-parent</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-tomcat-support</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-tomcat-support</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Web Beans Servlet Integration: Tomcat Support</name>
+ <name>Weld Servlet Integration: Tomcat Support</name>
<
url>http://www.seamframework.org/WebBeans</url>
<dependencies>
Deleted:
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingAnnotationProcessor.java
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingAnnotationProcessor.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingAnnotationProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,29 +0,0 @@
-package org.jboss.webbeans.environment.tomcat;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.naming.NamingException;
-
-import org.apache.AnnotationProcessor;
-
-public abstract class ForwardingAnnotationProcessor implements AnnotationProcessor
-{
-
- protected abstract AnnotationProcessor delegate();
-
- public void postConstruct(Object instance) throws IllegalAccessException,
InvocationTargetException
- {
- delegate().postConstruct(instance);
- }
-
- public void preDestroy(Object instance) throws IllegalAccessException,
InvocationTargetException
- {
- delegate().preDestroy(instance);
- }
-
- public void processAnnotations(Object instance) throws IllegalAccessException,
InvocationTargetException, NamingException
- {
- delegate().processAnnotations(instance);
- }
-
-}
Deleted:
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingJspApplicationContextImpl.java
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingJspApplicationContextImpl.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingJspApplicationContextImpl.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.tomcat;
-
-import javax.el.ELContextListener;
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.servlet.jsp.JspContext;
-
-import org.apache.jasper.el.ELContextImpl;
-import org.apache.jasper.runtime.JspApplicationContextImpl;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingJspApplicationContextImpl extends
JspApplicationContextImpl
-{
-
- protected abstract JspApplicationContextImpl delegate();
-
- @Override
- public void addELContextListener(ELContextListener listener)
- {
- delegate().addELContextListener(listener);
- }
-
- @Override
- public void addELResolver(ELResolver resolver) throws IllegalStateException
- {
- delegate().addELResolver(resolver);
- }
-
- @Override
- public ELContextImpl createELContext(JspContext arg0)
- {
- return delegate().createELContext(arg0);
- }
-
- @Override
- public ExpressionFactory getExpressionFactory()
- {
- return delegate().getExpressionFactory();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return this == obj || delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
Deleted:
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/JspInitialization.java
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/JspInitialization.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/JspInitialization.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,86 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.environment.tomcat;
-
-import javax.el.ELContextListener;
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.servlet.ServletContext;
-import javax.servlet.jsp.JspApplicationContext;
-import javax.servlet.jsp.JspFactory;
-
-import org.apache.jasper.runtime.JspApplicationContextImpl;
-import org.jboss.webbeans.environment.tomcat.util.Reflections;
-
-/**
- * The Web Beans JSP initialization listener
- *
- *
- * @author Pete Muir
- *
- */
-public class JspInitialization
-{
-
- private static final String EXPRESSION_FACTORY_NAME =
"org.jboss.webbeans.el.ExpressionFactory";
-
- private static class WebBeansJspApplicationContextImpl extends
ForwardingJspApplicationContextImpl
- {
- private final JspApplicationContextImpl delegate;
- private final ExpressionFactory expressionFactory;
-
- public WebBeansJspApplicationContextImpl(JspApplicationContextImpl delegate,
ExpressionFactory expressionFactory)
- {
- this.delegate = delegate;
- this.expressionFactory = expressionFactory;
- }
-
- @Override
- protected JspApplicationContextImpl delegate()
- {
- return delegate;
- }
-
- @Override
- public ExpressionFactory getExpressionFactory()
- {
- return expressionFactory;
- }
-
- }
-
- public void initialize(ServletContext context)
- {
- // get JspApplicationContext.
- JspApplicationContext jspAppContext =
JspFactory.getDefaultFactory().getJspApplicationContext(context);
-
- if (context.getAttribute(EXPRESSION_FACTORY_NAME) != null)
- {
- ExpressionFactory expressionFactory = (ExpressionFactory)
context.getAttribute(EXPRESSION_FACTORY_NAME);
- // Hack into JBoss Web/Catalina to replace the ExpressionFactory
- JspApplicationContextImpl wrappedJspApplicationContextImpl = new
WebBeansJspApplicationContextImpl(JspApplicationContextImpl.getInstance(context),
expressionFactory);
- context.setAttribute(JspApplicationContextImpl.class.getName(),
wrappedJspApplicationContextImpl);
- }
- // otherwise something went wrong starting WB, so don't register with JSP
- }
-}
Deleted:
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,89 +0,0 @@
-package org.jboss.webbeans.environment.tomcat;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.naming.NamingException;
-import javax.servlet.ServletContext;
-
-import org.apache.AnnotationProcessor;
-import org.apache.catalina.LifecycleEvent;
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.core.StandardContext;
-
-public class WebBeansLifecycleListener implements LifecycleListener
-{
-
- private static final AnnotationProcessor DUMMY_PROCESSOR = new AnnotationProcessor()
- {
-
- public void postConstruct(Object arg0) throws IllegalAccessException,
InvocationTargetException {}
-
- public void preDestroy(Object arg0) throws IllegalAccessException,
InvocationTargetException {}
-
- public void processAnnotations(Object arg0) throws IllegalAccessException,
InvocationTargetException, NamingException {}
-
- };
-
- public void lifecycleEvent(LifecycleEvent event)
- {
- if (event.getType().equals("after_start") && event.getLifecycle()
instanceof StandardContext)
- {
- StandardContext context = (StandardContext) event.getLifecycle();
- final ServletContext servletContext = context.getServletContext();
-
- // Initialize servlet injection
- final AnnotationProcessor originalAnnotationProcessor =
context.getAnnotationProcessor();
- context.setAnnotationProcessor(new ForwardingAnnotationProcessor()
- {
-
- private AnnotationProcessor processor;
-
- @Override
- protected AnnotationProcessor delegate()
- {
- return originalAnnotationProcessor;
- }
-
- @Override
- public void processAnnotations(Object instance) throws
IllegalAccessException, InvocationTargetException, NamingException
- {
- super.processAnnotations(instance);
- getProcessor().processAnnotations(instance);
- }
-
- @Override
- public void postConstruct(Object instance) throws IllegalAccessException,
InvocationTargetException
- {
- super.postConstruct(instance);
- getProcessor().postConstruct(instance);
- }
-
- @Override
- public void preDestroy(Object instance) throws IllegalAccessException,
InvocationTargetException
- {
- super.preDestroy(instance);
- getProcessor().preDestroy(instance);
- }
-
- private AnnotationProcessor getProcessor()
- {
- if (processor == null)
- {
- Object o =
servletContext.getAttribute("org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor");
- if (o instanceof AnnotationProcessor)
- {
- processor = (AnnotationProcessor) o;
- }
- else
- {
- return DUMMY_PROCESSOR;
- }
- }
- return processor;
- }
-
- });
- }
- }
-
-}
Copied:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingAnnotationProcessor.java
(from rev 3901,
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingAnnotationProcessor.java)
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingAnnotationProcessor.java
(rev 0)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingAnnotationProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,29 @@
+package org.jboss.weld.environment.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+
+import org.apache.AnnotationProcessor;
+
+public abstract class ForwardingAnnotationProcessor implements AnnotationProcessor
+{
+
+ protected abstract AnnotationProcessor delegate();
+
+ public void postConstruct(Object instance) throws IllegalAccessException,
InvocationTargetException
+ {
+ delegate().postConstruct(instance);
+ }
+
+ public void preDestroy(Object instance) throws IllegalAccessException,
InvocationTargetException
+ {
+ delegate().preDestroy(instance);
+ }
+
+ public void processAnnotations(Object instance) throws IllegalAccessException,
InvocationTargetException, NamingException
+ {
+ delegate().processAnnotations(instance);
+ }
+
+}
Copied:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingJspApplicationContextImpl.java
(from rev 3901,
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/ForwardingJspApplicationContextImpl.java)
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingJspApplicationContextImpl.java
(rev 0)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/ForwardingJspApplicationContextImpl.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.tomcat;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.servlet.jsp.JspContext;
+
+import org.apache.jasper.el.ELContextImpl;
+import org.apache.jasper.runtime.JspApplicationContextImpl;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingJspApplicationContextImpl extends
JspApplicationContextImpl
+{
+
+ protected abstract JspApplicationContextImpl delegate();
+
+ @Override
+ public void addELContextListener(ELContextListener listener)
+ {
+ delegate().addELContextListener(listener);
+ }
+
+ @Override
+ public void addELResolver(ELResolver resolver) throws IllegalStateException
+ {
+ delegate().addELResolver(resolver);
+ }
+
+ @Override
+ public ELContextImpl createELContext(JspContext arg0)
+ {
+ return delegate().createELContext(arg0);
+ }
+
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ return delegate().getExpressionFactory();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return this == obj || delegate().equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+}
Copied:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/JspInitialization.java
(from rev 3901,
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/JspInitialization.java)
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/JspInitialization.java
(rev 0)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/JspInitialization.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,86 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.tomcat;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
+
+import org.apache.jasper.runtime.JspApplicationContextImpl;
+import org.jboss.weld.environment.tomcat.util.Reflections;
+
+/**
+ * The Web Beans JSP initialization listener
+ *
+ *
+ * @author Pete Muir
+ *
+ */
+public class JspInitialization
+{
+
+ private static final String EXPRESSION_FACTORY_NAME =
"org.jboss.webbeans.el.ExpressionFactory";
+
+ private static class WebBeansJspApplicationContextImpl extends
ForwardingJspApplicationContextImpl
+ {
+ private final JspApplicationContextImpl delegate;
+ private final ExpressionFactory expressionFactory;
+
+ public WebBeansJspApplicationContextImpl(JspApplicationContextImpl delegate,
ExpressionFactory expressionFactory)
+ {
+ this.delegate = delegate;
+ this.expressionFactory = expressionFactory;
+ }
+
+ @Override
+ protected JspApplicationContextImpl delegate()
+ {
+ return delegate;
+ }
+
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ return expressionFactory;
+ }
+
+ }
+
+ public void initialize(ServletContext context)
+ {
+ // get JspApplicationContext.
+ JspApplicationContext jspAppContext =
JspFactory.getDefaultFactory().getJspApplicationContext(context);
+
+ if (context.getAttribute(EXPRESSION_FACTORY_NAME) != null)
+ {
+ ExpressionFactory expressionFactory = (ExpressionFactory)
context.getAttribute(EXPRESSION_FACTORY_NAME);
+ // Hack into JBoss Web/Catalina to replace the ExpressionFactory
+ JspApplicationContextImpl wrappedJspApplicationContextImpl = new
WebBeansJspApplicationContextImpl(JspApplicationContextImpl.getInstance(context),
expressionFactory);
+ context.setAttribute(JspApplicationContextImpl.class.getName(),
wrappedJspApplicationContextImpl);
+ }
+ // otherwise something went wrong starting WB, so don't register with JSP
+ }
+}
Copied:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/WeldLifecycleListener.java
(from rev 3901,
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java)
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/WeldLifecycleListener.java
(rev 0)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/WeldLifecycleListener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,89 @@
+package org.jboss.weld.environment.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+import javax.servlet.ServletContext;
+
+import org.apache.AnnotationProcessor;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.core.StandardContext;
+
+public class WeldLifecycleListener implements LifecycleListener
+{
+
+ private static final AnnotationProcessor DUMMY_PROCESSOR = new AnnotationProcessor()
+ {
+
+ public void postConstruct(Object arg0) throws IllegalAccessException,
InvocationTargetException {}
+
+ public void preDestroy(Object arg0) throws IllegalAccessException,
InvocationTargetException {}
+
+ public void processAnnotations(Object arg0) throws IllegalAccessException,
InvocationTargetException, NamingException {}
+
+ };
+
+ public void lifecycleEvent(LifecycleEvent event)
+ {
+ if (event.getType().equals("after_start") && event.getLifecycle()
instanceof StandardContext)
+ {
+ StandardContext context = (StandardContext) event.getLifecycle();
+ final ServletContext servletContext = context.getServletContext();
+
+ // Initialize servlet injection
+ final AnnotationProcessor originalAnnotationProcessor =
context.getAnnotationProcessor();
+ context.setAnnotationProcessor(new ForwardingAnnotationProcessor()
+ {
+
+ private AnnotationProcessor processor;
+
+ @Override
+ protected AnnotationProcessor delegate()
+ {
+ return originalAnnotationProcessor;
+ }
+
+ @Override
+ public void processAnnotations(Object instance) throws
IllegalAccessException, InvocationTargetException, NamingException
+ {
+ super.processAnnotations(instance);
+ getProcessor().processAnnotations(instance);
+ }
+
+ @Override
+ public void postConstruct(Object instance) throws IllegalAccessException,
InvocationTargetException
+ {
+ super.postConstruct(instance);
+ getProcessor().postConstruct(instance);
+ }
+
+ @Override
+ public void preDestroy(Object instance) throws IllegalAccessException,
InvocationTargetException
+ {
+ super.preDestroy(instance);
+ getProcessor().preDestroy(instance);
+ }
+
+ private AnnotationProcessor getProcessor()
+ {
+ if (processor == null)
+ {
+ Object o =
servletContext.getAttribute("org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor");
+ if (o instanceof AnnotationProcessor)
+ {
+ processor = (AnnotationProcessor) o;
+ }
+ else
+ {
+ return DUMMY_PROCESSOR;
+ }
+ }
+ return processor;
+ }
+
+ });
+ }
+ }
+
+}
Copied:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/util
(from rev 3901,
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/util)
Modified:
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/util/Reflections.java
===================================================================
---
extensions/trunk/servlet/support/src/main/java/org/jboss/webbeans/environment/tomcat/util/Reflections.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/support/src/main/java/org/jboss/weld/environment/tomcat/util/Reflections.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.environment.tomcat.util;
+package org.jboss.weld.environment.tomcat.util;
/**
Modified: extensions/trunk/servlet/tests/pom.xml
===================================================================
--- extensions/trunk/servlet/tests/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/servlet/tests/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-servlet-parent</artifactId>
- <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>weld-servlet-parent</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet-test</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Web Beans Servlet Integration Tests</name>
- <
url>http://www.seamframework.org/WebBeans</url>
+ <name>Weld Servlet Integration Tests</name>
+ <
url>http://www.seamframework.org/Weld</url>
<dependencies>
<dependency>
@@ -54,8 +54,8 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core-test</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core-test</artifactId>
<scope>test</scope>
<version>1.0.0-SNAPSHOT</version> <!-- waiting on >=
1.0.0.PREVIEW2 -->
</dependency>
@@ -72,20 +72,20 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-spi</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-spi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet-int</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet-int</artifactId>
<scope>test</scope>
<version>1.0.0-SNAPSHOT</version> <!-- waiting on >= 1.0.0.CR2
-->
</dependency>
@@ -189,8 +189,8 @@
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
</artifactItem>
<artifactItem>
-
<groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet</artifactId>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
</artifactItem>
Copied:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery
(from rev 3901,
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery)
Deleted:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,43 +0,0 @@
-package org.jboss.webbeans.environment.servlet.discovery;
-
-import java.net.URL;
-import java.util.Set;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.environment.servlet.deployment.WebAppBeanDeploymentArchive;
-import org.jboss.webbeans.mock.MockServletContext;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * A set of tests to verify the discovery of JSR-299 resources in a servlet environment.
- *
- * @author Dan Allen
- */
-@Artifact
-// for now we are just going to look for the one in test-classes/META-INF/beans.xml using
standalone mode
-//@Resources(
-// @Resource(source = "beans.xml", destination =
"WEB-INF/classes/META-INF/beans.xml")
-//)
-public class ServletWebBeanDiscoveryTest extends AbstractWebBeansTest
-{
- /**
- * Verify that the scanner properly locates any META-INF/beans.xml. To prevent a
brittle test,
- * assume that there is at least one found and that the path ends with
META-INF/beans.xml. Technically,
- * META-INF would need to be the root of the classpath.
- */
- @Test
- public void testDiscoverMetaInfBeansXml()
- {
- WebAppBeanDeploymentArchive discovery = new WebAppBeanDeploymentArchive(new
MockServletContext("."))
- {
- };
-
- Set<URL> beansXmls = discovery.getWbUrls();
- assert beansXmls.size() >= 1 : "Expecting to find at least one
META-INF/beans.xml resource on the test classpath";
- for (URL beansXml : beansXmls)
- {
- assert beansXml.getPath().endsWith("META-INF/beans.xml") :
beansXml.getPath() + " does not end with META-INF/beans.xml as expected";
- }
- }
-}
Copied:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWeldDiscoveryTest.java
(from rev 3901,
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java)
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWeldDiscoveryTest.java
(rev 0)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/environment/servlet/discovery/ServletWeldDiscoveryTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,43 @@
+package org.jboss.weld.environment.servlet.discovery;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.environment.servlet.deployment.WebAppBeanDeploymentArchive;
+import org.jboss.weld.mock.MockServletContext;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+/**
+ * A set of tests to verify the discovery of JSR-299 resources in a servlet environment.
+ *
+ * @author Dan Allen
+ */
+@Artifact
+// for now we are just going to look for the one in test-classes/META-INF/beans.xml using
standalone mode
+//@Resources(
+// @Resource(source = "beans.xml", destination =
"WEB-INF/classes/META-INF/beans.xml")
+//)
+public class ServletWeldDiscoveryTest extends AbstractWeldTest
+{
+ /**
+ * Verify that the scanner properly locates any META-INF/beans.xml. To prevent a
brittle test,
+ * assume that there is at least one found and that the path ends with
META-INF/beans.xml. Technically,
+ * META-INF would need to be the root of the classpath.
+ */
+ @Test
+ public void testDiscoverMetaInfBeansXml()
+ {
+ WebAppBeanDeploymentArchive discovery = new WebAppBeanDeploymentArchive(new
MockServletContext("."))
+ {
+ };
+
+ Set<URL> beansXmls = discovery.getWbUrls();
+ assert beansXmls.size() >= 1 : "Expecting to find at least one
META-INF/beans.xml resource on the test classpath";
+ for (URL beansXml : beansXmls)
+ {
+ assert beansXml.getPath().endsWith("META-INF/beans.xml") :
beansXml.getPath() + " does not end with META-INF/beans.xml as expected";
+ }
+ }
+}
Copied: extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples
(from rev 3901,
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples)
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/ExampleTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/ExampleTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/ExampleTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,13 +1,13 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.jboss.webbeans.test.harness.ServletLifecycleContainersImpl;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.weld.test.harness.ServletLifecycleContainersImpl;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Artifact
-public class ExampleTest extends AbstractWebBeansTest
+public class ExampleTest extends AbstractWeldTest
{
@Test
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Game.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Game.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Game.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import javax.inject.Inject;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Generator.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Generator.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Generator.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockExampleTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockExampleTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockExampleTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,13 +1,13 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
@Artifact
@BeansXml("beans.xml")
-public class MockExampleTest extends AbstractWebBeansTest
+public class MockExampleTest extends AbstractWeldTest
{
@Test
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockSentenceTranslator.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockSentenceTranslator.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/MockSentenceTranslator.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import javax.enterprise.inject.Alternative;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Random.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Random.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Random.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceParser.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceParser.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceParser.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import java.util.Arrays;
import java.util.List;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceTranslator.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceTranslator.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/SentenceTranslator.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
public class SentenceTranslator implements Translator
{
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/TextTranslator.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/TextTranslator.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/TextTranslator.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
import javax.inject.Inject;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Translator.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Translator.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/examples/Translator.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.examples;
+package org.jboss.weld.test.tomcat.examples;
public interface Translator
Copied: extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup
(from rev 3901,
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup)
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/LookupTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/LookupTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/LookupTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
@@ -7,7 +7,7 @@
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
@Artifact(addCurrentPackage=false)
@@ -16,7 +16,7 @@
@Resource(source="context.xml",
destination="/META-INF/context.xml")
})
@Classes({Mouse.class, Vole.class, LookupTest.class})
-public class LookupTest extends AbstractWebBeansTest
+public class LookupTest extends AbstractWeldTest
{
@Test
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Mouse.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Mouse.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Mouse.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
import javax.enterprise.inject.spi.BeanManager;
import javax.naming.InitialContext;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/RatServlet.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/RatServlet.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/RatServlet.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
import java.io.IOException;
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/ServletInjectionTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/ServletInjectionTest.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/ServletInjectionTest.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
@@ -13,7 +13,7 @@
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -27,7 +27,7 @@
RatServlet.class,
Sewer.class
})
-public class ServletInjectionTest extends AbstractWebBeansTest
+public class ServletInjectionTest extends AbstractWeldTest
{
private static final Logger log = Logger.getLogger(ServletInjectionTest.class);
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Sewer.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Sewer.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Sewer.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
public class Sewer
{
Modified:
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Vole.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Vole.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/weld/test/tomcat/lookup/Vole.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.test.tomcat.lookup;
+package org.jboss.weld.test.tomcat.lookup;
import javax.annotation.Resource;
import javax.enterprise.inject.spi.BeanManager;
Modified: extensions/trunk/wicket/pom.xml
===================================================================
--- extensions/trunk/wicket/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/wicket/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,15 +1,15 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-version-matrix</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-version-matrix</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-wicket</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-wicket</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans Wicket Integration</name>
+ <name>Weld Wicket Integration</name>
<dependencies>
<dependency>
@@ -25,12 +25,12 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-core</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@@ -52,7 +52,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
-
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
+
<
tagBase>https://svn.jboss.org/repos/weld/extensions/tags</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
@@ -60,9 +60,9 @@
</build>
<scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions&...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/exten...
-
<
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/webbeans/extensions<...
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions</...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extension...
+ <
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/weld/extensions</url...
</scm>
</project>
Copied: extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket (from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket)
Modified:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/BeanManagerLookup.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/BeanManagerLookup.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/BeanManagerLookup.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.wicket;
+package org.jboss.weld.wicket;
import javax.enterprise.inject.spi.BeanManager;
import javax.naming.Context;
Deleted:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansApplication.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansApplication.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,97 +0,0 @@
-package org.jboss.webbeans.wicket;
-
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.apache.wicket.Request;
-import org.apache.wicket.RequestCycle;
-import org.apache.wicket.Response;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.http.WebRequest;
-import org.apache.wicket.protocol.http.WebResponse;
-import org.apache.wicket.request.IRequestCycleProcessor;
-
-/**
- * A convenience subclass of wicket's WebApplication which adds the hooks
- * necessary to use JSR-299 injections in wicket components, as well as manage
- * JSR-299 conversation scopes with Wicket page metadata. If you have your own
- * WebApplication subclass, and can't subclass this class, you just need to do
- * the three things that this class does, i.e. register the
- * WebBeansComponentInstantiationListener, and override the two methods below to
- * return the RequestCycle and IRequestCycleProcessor subclasses specific to
- * WebBeans, or your subclasses of those classes.
- *
- * @author cpopetz
- *
- * @see WebApplication
- * @see WebBeansWebRequestCycleProcessor
- * @see WebBeansRequestCycle
- */
-public abstract class WebBeansApplication extends WebApplication
-{
-
- private <T> T getInstanceByType(Class<T> beanType)
- {
- BeanManager manager = BeanManagerLookup.getBeanManager();
- Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType,
manager.getBeans(beanType));
- return (T) manager.getReference(bean, beanType,
manager.createCreationalContext(bean));
- }
-
- private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>>
beans)
- {
- if (beans.size() == 0)
- {
- throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans
of " + type);
- }
- else if (beans.size() > 1)
- {
- throw new AmbiguousResolutionException("More than one bean available for
type " + type);
- }
- return beans.iterator().next();
- }
-
- /**
- */
- public WebBeansApplication()
- {
- }
-
- /**
- * Add our component instantiation listener
- *
- * @see WebBeansComponentInstantiationListener
- */
- protected void internalInit()
- {
- super.internalInit();
-
addComponentInstantiationListener(getInstanceByType(WebBeansComponentInstantiationListener.class));
- }
-
-
- /**
- * Override to return our WebBeans-specific request cycle processor
- *
- * @see WebBeansWebRequestCycleProcessor
- */
- @Override
- protected IRequestCycleProcessor newRequestCycleProcessor()
- {
- return getInstanceByType(WebBeansWebRequestCycleProcessor.class);
- }
-
- /**
- * Override to return our WebBeans-specific request cycle
- *
- * @see WebBeansRequestCycle
- */
- @Override
- public RequestCycle newRequestCycle(final Request request, final Response response)
- {
- return new WebBeansRequestCycle(this, (WebRequest) request, (WebResponse)
response);
- }
-}
Deleted:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansComponentInstantiationListener.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansComponentInstantiationListener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,31 +0,0 @@
-package org.jboss.webbeans.wicket;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.application.IComponentInstantiationListener;
-
-/**
- * This listener uses the BeanManager to handle injections for all wicket components.
- *
- * @author cpopetz
- *
- */
-public class WebBeansComponentInstantiationListener implements
IComponentInstantiationListener
-{
- @Inject
- BeanManager manager;
-
- public void onInstantiation(Component component)
- {
- /*
- * The manager could be null in unit testing environments
- */
- if (manager != null)
- {
- manager.createInjectionTarget(manager.createAnnotatedType((Class)
component.getClass()))
- .inject(component, manager.createCreationalContext(null));
- }
- }
-}
\ No newline at end of file
Deleted:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansMetaData.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansMetaData.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,23 +0,0 @@
-package org.jboss.webbeans.wicket;
-
-import org.apache.wicket.MetaDataKey;
-
-/**
- * Public storage for the metadata key used by the WebBeans integration to store
- * conversation ids in wicket page metadata.
- *
- * @author cpopetz
- *
- */
-public class WebBeansMetaData
-{
-
- /**
- * This is the key we will use to to store the conversation metadata in the
- * wicket page.
- */
- public static final MetaDataKey CID = new MetaDataKey<String>()
- {
- private static final long serialVersionUID = -8788010688731927318L;
- };
-}
Deleted:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansRequestCycle.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansRequestCycle.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,150 +0,0 @@
-package org.jboss.webbeans.wicket;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.Conversation;
-import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.apache.wicket.IRequestTarget;
-import org.apache.wicket.Page;
-import org.apache.wicket.Response;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.http.WebRequest;
-import org.apache.wicket.protocol.http.WebRequestCycle;
-import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
-import org.apache.wicket.request.target.component.IPageRequestTarget;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.conversation.ConversationManager;
-import org.jboss.webbeans.servlet.ConversationBeanStore;
-
-/**
- * WebBeansRequestCycle is a subclass of the standard wicket WebRequestCycle
- * which:
- * <ul>
- * <li>restores long-running conversations specified in wicket page metadata
- * when a page target is first used.
- * <li>propagates long running conversations to new page targets by specifying
- * the above metadata
- * <li>propagates long running conversations across redirects through the use of
- * a request parameter if the redirect is handled with a BookmarkablePageRequest
- * <li>Sets up the conversational context
- * </ul>
- *
- * @see WebBeansWebRequestCycleProcessor Which handles propogation of
- * conversation data for newly-started long running conversations, by
- * storing their ids in the page metadata
- * @author cpopetz
- *
- */
-public class WebBeansRequestCycle extends WebRequestCycle
-{
-
- public WebBeansRequestCycle(WebApplication application, WebRequest request, Response
response)
- {
- super(application, request, response);
- }
-
- /**
- * Override to set up the conversation context and to choose the conversation
- * if a conversation id is present in target metadata.
- */
- @Override
- protected void onRequestTargetSet(IRequestTarget target)
- {
- super.onRequestTargetSet(target);
-
- Page page = null;
- if (target instanceof IPageRequestTarget)
- {
- page = ((IPageRequestTarget) target).getPage();
- }
-
- // Two possible specifications of cid: page metadata or request url; the
- // latter is used to propagate the conversation to mounted (bookmarkable)
- // paths after a redirect
-
- String specifiedCid = null;
- if (page != null)
- {
- specifiedCid = (String) page.getMetaData(WebBeansMetaData.CID);
- }
- else
- {
- specifiedCid = request.getParameter("cid");
- }
-
- BeanManager manager = BeanManagerLookup.getBeanManager();
-
- Conversation conversation = getInstanceByType(manager, Conversation.class);
-
- // restore a conversation if it exists
- if (specifiedCid != null)
- {
- // Restore this conversation
- getInstanceByType(manager,
ConversationManager.class).beginOrRestoreConversation(specifiedCid);
- }
-
- // handle propagation of existing long running converstaions to new
- // targets
- if (conversation.isLongRunning())
- {
- // Note that we can't propagate conversations with other redirect
- // targets like RequestRedirectTarget through this mechanism, because
- // it does not provide an interface to modify its target URL. If
- // propagation with those targets is to be supported, it needs a custom
- // Response subclass.
- if (isRedirect() && target instanceof BookmarkablePageRequestTarget)
- {
- BookmarkablePageRequestTarget bookmark = (BookmarkablePageRequestTarget)
target;
- // if a cid has already been specified, don't override it
- if (!bookmark.getPageParameters().containsKey("cid"))
- bookmark.getPageParameters().add("cid", conversation.getId());
- }
-
- // If we have a target page, propagate the conversation to the page's
- // metadata
- if (page != null)
- {
- page.setMetaData(WebBeansMetaData.CID, conversation.getId());
- }
- }
-
- ConversationContext conversationContext =
Container.instance().deploymentServices().get(
- ContextLifecycle.class).getConversationContext();
- // Now set up the conversational context if it isn't already
- if (!conversationContext.isActive())
- {
- conversationContext.setBeanStore(new ConversationBeanStore(((WebRequest)
request)
- .getHttpServletRequest().getSession(), conversation.getId()));
- conversationContext.setActive(true);
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> T getInstanceByType(BeanManager manager, Class<T> beanType,
Annotation... bindings)
- {
- Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType,
manager.getBeans(beanType, bindings));
- return (T) manager.getReference(bean, beanType,
manager.createCreationalContext(bean));
- }
-
- private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>>
beans)
- {
- if (beans.size() == 0)
- {
- throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans
of " + type);
- }
- else if (beans.size() > 1)
- {
- throw new AmbiguousResolutionException("More than one bean available for
type " + type);
- }
- return beans.iterator().next();
- }
-
-}
\ No newline at end of file
Deleted:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansWebRequestCycleProcessor.java
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java 2009-10-08
10:48:12 UTC (rev 3901)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WebBeansWebRequestCycleProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -1,54 +0,0 @@
-package org.jboss.webbeans.wicket;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Inject;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.RequestCycle;
-import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.conversation.ConversationManager;
-
-/**
- * WebBeansWebRequestCycleProcessor is a subclass of the standard wicket
- * WebRequestCycleProcessor which saves the conversation id of any long-running
- * cornversation in wicket page metadata. It also cleans up the conversation
- * context.
- *
- * @author cpopetz
- *
- */
-public class WebBeansWebRequestCycleProcessor extends WebRequestCycleProcessor
-{
- @Inject
- Conversation conversation;
- @Inject
- ConversationManager conversationManager;
-
- /**
- * If a long running conversation has been started, store its id into page
- * metadata
- */
- @Override
- public void respond(RequestCycle requestCycle)
- {
- super.respond(requestCycle);
- if (conversation.isLongRunning())
- {
- Page page = RequestCycle.get().getResponsePage();
- if (page != null)
- {
- page.setMetaData(WebBeansMetaData.CID, conversation.getId());
- }
- }
-
- //cleanup and deactivate the conversation context
- conversationManager.cleanupConversation();
-
- ConversationContext conversationContext =
Container.instance().deploymentServices().get(
- ContextLifecycle.class).getConversationContext();
- conversationContext.setActive(false);
- }
-}
\ No newline at end of file
Copied: extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldApplication.java
(from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java)
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldApplication.java
(rev 0)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldApplication.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,97 @@
+package org.jboss.weld.wicket;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.wicket.Request;
+import org.apache.wicket.RequestCycle;
+import org.apache.wicket.Response;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.WebRequest;
+import org.apache.wicket.protocol.http.WebResponse;
+import org.apache.wicket.request.IRequestCycleProcessor;
+
+/**
+ * A convenience subclass of wicket's WebApplication which adds the hooks
+ * necessary to use JSR-299 injections in wicket components, as well as manage
+ * JSR-299 conversation scopes with Wicket page metadata. If you have your own
+ * WebApplication subclass, and can't subclass this class, you just need to do
+ * the three things that this class does, i.e. register the
+ * WebBeansComponentInstantiationListener, and override the two methods below to
+ * return the RequestCycle and IRequestCycleProcessor subclasses specific to
+ * WebBeans, or your subclasses of those classes.
+ *
+ * @author cpopetz
+ *
+ * @see WebApplication
+ * @see WeldWebRequestCycleProcessor
+ * @see WeldRequestCycle
+ */
+public abstract class WeldApplication extends WebApplication
+{
+
+ private <T> T getInstanceByType(Class<T> beanType)
+ {
+ BeanManager manager = BeanManagerLookup.getBeanManager();
+ Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType,
manager.getBeans(beanType));
+ return (T) manager.getReference(bean, beanType,
manager.createCreationalContext(bean));
+ }
+
+ private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>>
beans)
+ {
+ if (beans.size() == 0)
+ {
+ throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans
of " + type);
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("More than one bean available for
type " + type);
+ }
+ return beans.iterator().next();
+ }
+
+ /**
+ */
+ public WeldApplication()
+ {
+ }
+
+ /**
+ * Add our component instantiation listener
+ *
+ * @see WebBeansComponentInstantiationListener
+ */
+ protected void internalInit()
+ {
+ super.internalInit();
+
addComponentInstantiationListener(getInstanceByType(WeldComponentInstantiationListener.class));
+ }
+
+
+ /**
+ * Override to return our WebBeans-specific request cycle processor
+ *
+ * @see WeldWebRequestCycleProcessor
+ */
+ @Override
+ protected IRequestCycleProcessor newRequestCycleProcessor()
+ {
+ return getInstanceByType(WeldWebRequestCycleProcessor.class);
+ }
+
+ /**
+ * Override to return our WebBeans-specific request cycle
+ *
+ * @see WeldRequestCycle
+ */
+ @Override
+ public RequestCycle newRequestCycle(final Request request, final Response response)
+ {
+ return new WeldRequestCycle(this, (WebRequest) request, (WebResponse) response);
+ }
+}
Copied:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldComponentInstantiationListener.java
(from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java)
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldComponentInstantiationListener.java
(rev 0)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldComponentInstantiationListener.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,31 @@
+package org.jboss.weld.wicket;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.application.IComponentInstantiationListener;
+
+/**
+ * This listener uses the BeanManager to handle injections for all wicket components.
+ *
+ * @author cpopetz
+ *
+ */
+public class WeldComponentInstantiationListener implements
IComponentInstantiationListener
+{
+ @Inject
+ BeanManager manager;
+
+ public void onInstantiation(Component component)
+ {
+ /*
+ * The manager could be null in unit testing environments
+ */
+ if (manager != null)
+ {
+ manager.createInjectionTarget(manager.createAnnotatedType((Class)
component.getClass()))
+ .inject(component, manager.createCreationalContext(null));
+ }
+ }
+}
\ No newline at end of file
Copied: extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldMetaData.java
(from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java)
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldMetaData.java
(rev 0)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldMetaData.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,23 @@
+package org.jboss.weld.wicket;
+
+import org.apache.wicket.MetaDataKey;
+
+/**
+ * Public storage for the metadata key used by the WebBeans integration to store
+ * conversation ids in wicket page metadata.
+ *
+ * @author cpopetz
+ *
+ */
+public class WeldMetaData
+{
+
+ /**
+ * This is the key we will use to to store the conversation metadata in the
+ * wicket page.
+ */
+ public static final MetaDataKey CID = new MetaDataKey<String>()
+ {
+ private static final long serialVersionUID = -8788010688731927318L;
+ };
+}
Copied: extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldRequestCycle.java
(from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java)
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldRequestCycle.java
(rev 0)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldRequestCycle.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,150 @@
+package org.jboss.weld.wicket;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.wicket.IRequestTarget;
+import org.apache.wicket.Page;
+import org.apache.wicket.Response;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.WebRequest;
+import org.apache.wicket.protocol.http.WebRequestCycle;
+import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
+import org.apache.wicket.request.target.component.IPageRequestTarget;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.servlet.ConversationBeanStore;
+
+/**
+ * WebBeansRequestCycle is a subclass of the standard wicket WebRequestCycle
+ * which:
+ * <ul>
+ * <li>restores long-running conversations specified in wicket page metadata
+ * when a page target is first used.
+ * <li>propagates long running conversations to new page targets by specifying
+ * the above metadata
+ * <li>propagates long running conversations across redirects through the use of
+ * a request parameter if the redirect is handled with a BookmarkablePageRequest
+ * <li>Sets up the conversational context
+ * </ul>
+ *
+ * @see WeldWebRequestCycleProcessor Which handles propogation of
+ * conversation data for newly-started long running conversations, by
+ * storing their ids in the page metadata
+ * @author cpopetz
+ *
+ */
+public class WeldRequestCycle extends WebRequestCycle
+{
+
+ public WeldRequestCycle(WebApplication application, WebRequest request, Response
response)
+ {
+ super(application, request, response);
+ }
+
+ /**
+ * Override to set up the conversation context and to choose the conversation
+ * if a conversation id is present in target metadata.
+ */
+ @Override
+ protected void onRequestTargetSet(IRequestTarget target)
+ {
+ super.onRequestTargetSet(target);
+
+ Page page = null;
+ if (target instanceof IPageRequestTarget)
+ {
+ page = ((IPageRequestTarget) target).getPage();
+ }
+
+ // Two possible specifications of cid: page metadata or request url; the
+ // latter is used to propagate the conversation to mounted (bookmarkable)
+ // paths after a redirect
+
+ String specifiedCid = null;
+ if (page != null)
+ {
+ specifiedCid = (String) page.getMetaData(WeldMetaData.CID);
+ }
+ else
+ {
+ specifiedCid = request.getParameter("cid");
+ }
+
+ BeanManager manager = BeanManagerLookup.getBeanManager();
+
+ Conversation conversation = getInstanceByType(manager, Conversation.class);
+
+ // restore a conversation if it exists
+ if (specifiedCid != null)
+ {
+ // Restore this conversation
+ getInstanceByType(manager,
ConversationManager.class).beginOrRestoreConversation(specifiedCid);
+ }
+
+ // handle propagation of existing long running converstaions to new
+ // targets
+ if (conversation.isLongRunning())
+ {
+ // Note that we can't propagate conversations with other redirect
+ // targets like RequestRedirectTarget through this mechanism, because
+ // it does not provide an interface to modify its target URL. If
+ // propagation with those targets is to be supported, it needs a custom
+ // Response subclass.
+ if (isRedirect() && target instanceof BookmarkablePageRequestTarget)
+ {
+ BookmarkablePageRequestTarget bookmark = (BookmarkablePageRequestTarget)
target;
+ // if a cid has already been specified, don't override it
+ if (!bookmark.getPageParameters().containsKey("cid"))
+ bookmark.getPageParameters().add("cid", conversation.getId());
+ }
+
+ // If we have a target page, propagate the conversation to the page's
+ // metadata
+ if (page != null)
+ {
+ page.setMetaData(WeldMetaData.CID, conversation.getId());
+ }
+ }
+
+ ConversationContext conversationContext =
Container.instance().deploymentServices().get(
+ ContextLifecycle.class).getConversationContext();
+ // Now set up the conversational context if it isn't already
+ if (!conversationContext.isActive())
+ {
+ conversationContext.setBeanStore(new ConversationBeanStore(((WebRequest)
request)
+ .getHttpServletRequest().getSession(), conversation.getId()));
+ conversationContext.setActive(true);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T getInstanceByType(BeanManager manager, Class<T> beanType,
Annotation... bindings)
+ {
+ Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType,
manager.getBeans(beanType, bindings));
+ return (T) manager.getReference(bean, beanType,
manager.createCreationalContext(bean));
+ }
+
+ private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>>
beans)
+ {
+ if (beans.size() == 0)
+ {
+ throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans
of " + type);
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("More than one bean available for
type " + type);
+ }
+ return beans.iterator().next();
+ }
+
+}
\ No newline at end of file
Copied:
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldWebRequestCycleProcessor.java
(from rev 3901,
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java)
===================================================================
---
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldWebRequestCycleProcessor.java
(rev 0)
+++
extensions/trunk/wicket/src/main/java/org/jboss/weld/wicket/WeldWebRequestCycleProcessor.java 2009-10-08
13:44:49 UTC (rev 3902)
@@ -0,0 +1,54 @@
+package org.jboss.weld.wicket;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.RequestCycle;
+import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.conversation.ConversationManager;
+
+/**
+ * WebBeansWebRequestCycleProcessor is a subclass of the standard wicket
+ * WebRequestCycleProcessor which saves the conversation id of any long-running
+ * cornversation in wicket page metadata. It also cleans up the conversation
+ * context.
+ *
+ * @author cpopetz
+ *
+ */
+public class WeldWebRequestCycleProcessor extends WebRequestCycleProcessor
+{
+ @Inject
+ Conversation conversation;
+ @Inject
+ ConversationManager conversationManager;
+
+ /**
+ * If a long running conversation has been started, store its id into page
+ * metadata
+ */
+ @Override
+ public void respond(RequestCycle requestCycle)
+ {
+ super.respond(requestCycle);
+ if (conversation.isLongRunning())
+ {
+ Page page = RequestCycle.get().getResponsePage();
+ if (page != null)
+ {
+ page.setMetaData(WeldMetaData.CID, conversation.getId());
+ }
+ }
+
+ //cleanup and deactivate the conversation context
+ conversationManager.cleanupConversation();
+
+ ConversationContext conversationContext =
Container.instance().deploymentServices().get(
+ ContextLifecycle.class).getConversationContext();
+ conversationContext.setActive(false);
+ }
+}
\ No newline at end of file
Modified: extensions/trunk/xsd/pom.xml
===================================================================
--- extensions/trunk/xsd/pom.xml 2009-10-08 10:48:12 UTC (rev 3901)
+++ extensions/trunk/xsd/pom.xml 2009-10-08 13:44:49 UTC (rev 3902)
@@ -1,24 +1,24 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-xsd-generator</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-xsd-generator</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans XSD generator</name>
+ <name>Weld XSD generator</name>
<dependencies>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logging</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
</dependency>
<dependency>