[webbeans-commits] Webbeans SVN: r1292 - in ri/tags: 1.0.0.ALPHA2 and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 11:36:52 -0500 (Thu, 29 Jan 2009)
New Revision: 1292
Added:
ri/tags/1.0.0.ALPHA2/
ri/tags/1.0.0.ALPHA2/dist/readme.txt
ri/tags/1.0.0.ALPHA2/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/
ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml
Removed:
ri/tags/1.0.0.ALPHA2/dist/readme.txt
ri/tags/1.0.0.ALPHA2/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml
Log:
[maven-release-plugin] copy for tag 1.0.0.ALPHA2
Copied: ri/tags/1.0.0.ALPHA2 (from rev 1284, ri/trunk)
Deleted: ri/tags/1.0.0.ALPHA2/dist/readme.txt
===================================================================
--- ri/trunk/dist/readme.txt 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/dist/readme.txt 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,43 +0,0 @@
-Web Beans RI
-------------
-
-Web Beans (JSR-299) is a new Java standard for dependency injection and
-contextual lifecycle management.
-
-This distribution, as a whole, is licensed under the terms of the FSF Lesser Gnu
-Public License (see lgpl.txt). Parts of it are licensed under the Apache Public
-License (see apl.txt). In particular, the Web Beans API and the Web Beans RI
-runtimes are licensed under the APL. At least these parts are licensed under the
-APL:
-
-* src/webbeans-ri/main/**/*
-* src/webbeans-api/main/**/*
-* src/webbeans-ri-spi/main/**/*
-* lib/webbeans/webbeans-ri.jar
-* lib/webbeans/webbeans-api.jar
-* lib/webbeans/webbeans-ri-spi.jar
-
-This distribution consists of:
-
-doc/
- -- The Web Beans Reference guide, take a look at doc/en/html/index.html for
- getting started using Web Beans and the Web Beans RI
-
-examples/
- -- The Web Beans RI examples, the examples are described in more detail in
- the reference guide
-
-jboss-as/
- -- Installer for JBoss AS, change into this directory, and run ant update
- There are more details in the reference guide
-
-lib/
- -- Libraries for building the examples
-
-lib/webbeans
- -- The Web Beans RI and API jars, for use outside of JBoss AS
-
-src/
- -- The sources of the Web Beans RI, including src/webbeans-api,
- src/webbeans-ri and src/reference. To build the sources, just type mvn in
- the subdirectory.
Copied: ri/tags/1.0.0.ALPHA2/dist/readme.txt (from rev 1287, ri/trunk/dist/readme.txt)
===================================================================
--- ri/tags/1.0.0.ALPHA2/dist/readme.txt (rev 0)
+++ ri/tags/1.0.0.ALPHA2/dist/readme.txt 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,42 @@
+Web Beans
+------------
+
+Java Contexts and Dependency Injection (JSR-299) is a new Java standard for
+dependency injection and contextual lifecycle management. Web Beans is the
+reference implementation of JSR-299.
+
+This distribution, as a whole, is licensed under the terms of the FSF Lesser Gnu
+Public License (see lgpl.txt). Parts of it are licensed under the Apache Public
+License (see apl.txt). In particular, the API and the Web Beans runtime are
+licensed under the APL. At least these parts are licensed under the APL:
+
+* src/webbeans-ri/main/**/*
+* src/webbeans-api/main/**/*
+* src/webbeans-ri-spi/main/**/*
+* lib/webbeans/webbeans-ri.jar
+* lib/webbeans/webbeans-api.jar
+* lib/webbeans/webbeans-ri-spi.jar
+
+This distribution consists of:
+
+doc/
+ -- The Reference guide, take a look at doc/en/html/index.html for getting
+ started using Web Beans and the facilities offered by JSR-299.
+
+examples/
+ -- The Web Beans examples, the examples are described in more detail in the
+ reference guide
+
+jboss-as/
+ -- Installer for JBoss AS, change into this directory, and run ant update
+ There are more details in the reference guide
+
+lib/
+ -- Libraries for building the examples
+
+lib/webbeans
+ -- The Web Beans and API jars, for use outside of JBoss AS
+
+src/
+ -- The sources of Web Beans, including src/webbeans-api, src/webbeans-ri and
+ src/reference. To build the sources, just type mvn in the subdirectory.
Deleted: ri/tags/1.0.0.ALPHA2/pom.xml
===================================================================
--- ri/trunk/pom.xml 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,458 +0,0 @@
-<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>parent</artifactId>
- <packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
-
- <name>Web Beans</name>
- <url>http://www.seamframework.org/WebBeans</url>
-
- <description>
- The reference implementation of JSR 299: Web Beans
- </description>
-
- <developers>
- <developer>
- <name>Pete Muir</name>
- <roles>
- <role>Project Lead</role>
- </roles>
- <email>pete.muir(a)jboss.org</email>
- <organization>JBoss, a division of Red Hat</organization>
- <url>http://in.relation.to/Bloggers/Pete</url>
- </developer>
-
- <developer>
- <name>Shane Bryzak</name>
- <organization>JBoss, a division of Red Hat</organization>
- </developer>
-
- <developer>
- <name>David Allen</name>
- </developer>
-
- <developer>
- <name>Nicklas Karlsson</name>
- </developer>
- </developers>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <url>http://snapshots.jboss.org/maven2</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2</url>
- </pluginRepository>
- </pluginRepositories>
-
- <modules>
- <module>webbeans-api</module>
- <module>webbeans-ri</module>
- <module>webbeans-ri-spi</module>
- </modules>
-
- <properties>
- <webbeans.tck.version>1.0.0-SNAPSHOT</webbeans.tck.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.8</version>
- <classifier>jdk15</classifier>
- </dependency>
-
- <dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>ejb-api</artifactId>
- <version>3.0</version>
- </dependency>
-
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.scannotation</groupId>
- <artifactId>scannotation</artifactId>
- <version>1.0.2</version>
- </dependency>
-
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.8.1.GA</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.0.1B</version>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.2_10</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- <version>0.8</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-embedded</artifactId>
- <version>1.0.0-Alpha1</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>bsh</groupId>
- <artifactId>bsh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-client</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-saaj</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-jaxws</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-api</artifactId>
- <version>3.1.0-Alpha1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
- <version>1.0_02.CR2</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- <version>1.1.15.B1</version>
- </dependency>
-
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-ri</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-api</artifactId>
-
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-ri</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-ri-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans.tck</groupId>
- <artifactId>webbeans-tck-api</artifactId>
- <version>${webbeans.tck.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans.tck</groupId>
- <artifactId>webbeans-tck-impl</artifactId>
- <version>${webbeans.tck.version}</version>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <build>
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav</artifactId>
- <version>1.0-beta-2</version>
- </extension>
- </extensions>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-versions</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>2.0.9</version>
- </requireMavenVersion>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addDefaultImplementationEntries>
- true
- </addDefaultImplementationEntries>
- <addDefaultSpecificationEntries>
- true
- </addDefaultSpecificationEntries>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.4.3</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <profiles>
- <profile>
- <id>coverage</id>
- <activation>
- <property>
- <name>coverage</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>emma-maven-plugin</artifactId>
- <version>1.0-alpha-1</version>
- <inherited>true</inherited>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
-
- <goal>instrument</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <forkMode>once</forkMode>
- <reportFormat>xml</reportFormat>
- <classesDirectory>
- ${project.build.directory}/generated-classes/emma/classes
- </classesDirectory>
- </configuration>
-
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <ciManagement>
- <system>Hudson</system>
- <url />
- </ciManagement>
-
- <issueManagement>
- <system>JIRA</system>
- <url>http://jira.jboss.org/browse/WBRI</url>
- </issueManagement>
-
- <inceptionYear>2008</inceptionYear>
-
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- <license>
- <name>Lesser Gnu Public License, Version 2.1</name>
- <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri</developerConnection>
- <url>http://fisheye.jboss.org/browse/WebBeans/ri</url>
- </scm>
-
- <distributionManagement>
- <repository>
- <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
- <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
- <!-- todo : replace this with direct svn access once the svnkit providers are available -->
- <id>repository.jboss.org</id>
- <url>file://${maven.repository.root}</url>
- </repository>
- <snapshotRepository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <url>dav:https://snapshots.jboss.org/maven2</url>
- </snapshotRepository>
- </distributionManagement>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <configuration>
- <formats>
- <format>html</format>
- <format>xml</format>
- </formats>
- <instrumentation>
- <ignores>
- <ignore>javax.webbeans.*</ignore>
- </ignores>
- </instrumentation>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
-</project>
Copied: ri/tags/1.0.0.ALPHA2/pom.xml (from rev 1291, ri/trunk/pom.xml)
===================================================================
--- ri/tags/1.0.0.ALPHA2/pom.xml (rev 0)
+++ ri/tags/1.0.0.ALPHA2/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,458 @@
+<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>parent</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0.0.ALPHA2</version>
+
+ <name>Web Beans</name>
+ <url>http://www.seamframework.org/WebBeans</url>
+
+ <description>
+ The reference implementation of JSR 299: Web Beans
+ </description>
+
+ <developers>
+ <developer>
+ <name>Pete Muir</name>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <email>pete.muir(a)jboss.org</email>
+ <organization>JBoss, a division of Red Hat</organization>
+ <url>http://in.relation.to/Bloggers/Pete</url>
+ </developer>
+
+ <developer>
+ <name>Shane Bryzak</name>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
+ <name>David Allen</name>
+ </developer>
+
+ <developer>
+ <name>Nicklas Karlsson</name>
+ </developer>
+ </developers>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>http://snapshots.jboss.org/maven2</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <modules>
+ <module>webbeans-api</module>
+<!-- <module>webbeans-ri</module>-->
+ <module>webbeans-ri-spi</module>
+ </modules>
+
+ <properties>
+ <webbeans.tck.version>1.0.0-SNAPSHOT</webbeans.tck.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.8</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.scannotation</groupId>
+ <artifactId>scannotation</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.8.1.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.0.1B</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_10</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>0.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-embedded</artifactId>
+ <version>1.0.0-Alpha1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-client</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.ws.native</groupId>
+ <artifactId>jbossws-native-saaj</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.ws.native</groupId>
+ <artifactId>jbossws-native-jaxws</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0-Alpha1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <version>1.0_02.CR2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.15.B1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-api</artifactId>
+
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans.tck</groupId>
+ <artifactId>webbeans-tck-api</artifactId>
+ <version>${webbeans.tck.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans.tck</groupId>
+ <artifactId>webbeans-tck-impl</artifactId>
+ <version>${webbeans.tck.version}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-versions</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>2.0.9</version>
+ </requireMavenVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>
+ true
+ </addDefaultImplementationEntries>
+ <addDefaultSpecificationEntries>
+ true
+ </addDefaultSpecificationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>coverage</id>
+ <activation>
+ <property>
+ <name>coverage</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>1.0-alpha-1</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+
+ <goal>instrument</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <forkMode>once</forkMode>
+ <reportFormat>xml</reportFormat>
+ <classesDirectory>
+ ${project.build.directory}/generated-classes/emma/classes
+ </classesDirectory>
+ </configuration>
+
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <ciManagement>
+ <system>Hudson</system>
+ <url />
+ </ciManagement>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.jboss.org/browse/WBRI</url>
+ </issueManagement>
+
+ <inceptionYear>2008</inceptionYear>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ </license>
+ <license>
+ <name>Lesser Gnu Public License, Version 2.1</name>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.ALPHA2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.ALPHA2</developerConnection>
+ <url>http://fisheye.jboss.org/browse/WebBeans/ri/tags/1.0.0.ALPHA2</url>
+ </scm>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <configuration>
+ <formats>
+ <format>html</format>
+ <format>xml</format>
+ </formats>
+ <instrumentation>
+ <ignores>
+ <ignore>javax.webbeans.*</ignore>
+ </ignores>
+ </instrumentation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml
===================================================================
--- ri/trunk/webbeans-api/pom.xml 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,17 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-api</artifactId>
- <packaging>jar</packaging>
- <name>Web Beans API</name>
- <url>http://www.seamframework.org/WebBeans</url>
-
-
-</project>
\ No newline at end of file
Copied: ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml (from rev 1291, ri/trunk/webbeans-api/pom.xml)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-api/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0.ALPHA2</version>
+ </parent>
+
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Web Beans API</name>
+ <url>http://www.seamframework.org/WebBeans</url>
+
+
+</project>
\ No newline at end of file
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,569 +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.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.Named;
-import javax.annotation.Stereotype;
-import javax.context.Dependent;
-import javax.event.Event;
-import javax.inject.BindingType;
-import javax.inject.DefinitionException;
-import javax.inject.Specializes;
-import javax.inject.Standard;
-import javax.inject.manager.Bean;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.context.DependentInstancesStore;
-import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.AnnotationStore.AnnotationMap;
-import org.jboss.webbeans.literal.CurrentLiteral;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MergedStereotypes;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * An abstract bean representation common for all beans
- *
- * @author Pete Muir
- *
- * @param <T> the type of bean
- * @param <E> the Class<?> of the bean type
- */
-public abstract class AbstractBean<T, E> extends RIBean<T>
-{
-
- @SuppressWarnings("unchecked")
- private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new HashSet<Class<?>>(Arrays.asList(Event.class, ManagerImpl.class));
-
- private boolean proxyable;
- protected DependentInstancesStore dependentInstancesStore;
-
- /**
- * Helper class for getting deployment type
- *
- * Loops through the enabled deployment types (backwards) and returns the
- * first one present in the possible deployments type, resulting in the
- * deployment type of highest priority
- *
- * @param enabledDeploymentTypes The currently enabled deployment types
- * @param possibleDeploymentTypes The possible deployment types
- * @return The deployment type
- */
- public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, AnnotationMap possibleDeploymentTypes)
- {
- for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
- {
- if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i))))
- {
- return enabledDeploymentTypes.get(i);
- }
- }
- return null;
- }
-
- // Logger
- private LogProvider log = Logging.getLogProvider(AbstractBean.class);
- // The binding types
- private Set<Annotation> bindingTypes;
- // The name
- protected String name;
- // The scope type
- protected Class<? extends Annotation> scopeType;
- // The merged stereotypes
- private MergedStereotypes<T, E> mergedStereotypes;
- // The deployment type
- protected Class<? extends Annotation> deploymentType;
- // The type
- protected Class<T> type;
- // The API types
- protected Set<Type> types;
- // The injection points
- protected Set<AnnotatedInjectionPoint<?, ?>> injectionPoints;
- // If the type a primitive?
- private boolean primitive;
- // The Web Beans manager
- protected ManagerImpl manager;
-
- /**
- * Constructor
- *
- * @param manager The Web Beans manager
- */
- public AbstractBean(ManagerImpl manager)
- {
- super(manager);
- this.manager = manager;
- injectionPoints = new HashSet<AnnotatedInjectionPoint<?,?>>();
- dependentInstancesStore = new DependentInstancesStore();
- }
-
- /**
- * Initializes the bean and its metadata
- */
- protected void init()
- {
- mergedStereotypes = new MergedStereotypes<T, E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class));
- initBindingTypes();
- if (isSpecializing())
- {
- preCheckSpecialization();
- initSpecialization();
- postSpecialization();
- }
- initDefaultBindings();
- initType();
- initPrimitive();
- if (log.isDebugEnabled())
- log.debug("Building Web Bean bean metadata for " + getType());
- initName();
- initDeploymentType();
- checkDeploymentType();
- initScopeType();
- initTypes();
- initProxyable();
- checkRequiredTypesImplemented();
- }
-
- /**
- * Initializes the API types
- */
- protected void initTypes()
- {
- types = new HashSet<Type>();
- Reflections.getTypeHierachy(getType(), types);
- }
-
- /**
- * Initializes the binding types
- */
- protected void initBindingTypes()
- {
- this.bindingTypes = new HashSet<Annotation>();
- this.bindingTypes.addAll(getAnnotatedItem().getMetaAnnotations(BindingType.class));
- }
-
- protected void initDefaultBindings()
- {
- if (bindingTypes.size() == 0)
- {
- log.trace("Adding default @Current binding type");
- this.bindingTypes.add(new CurrentLiteral());
- }
- else
- {
- if (log.isTraceEnabled())
- log.trace("Using binding types " + bindingTypes + " specified by annotations");
- }
- }
-
- /**
- * Initializes the deployment types
- */
- protected abstract void initDeploymentType();
-
- protected void initDeploymentTypeFromStereotype()
- {
- AnnotationMap possibleDeploymentTypes = getMergedStereotypes().getPossibleDeploymentTypes();
- if (possibleDeploymentTypes.size() > 0)
- {
- this.deploymentType = getDeploymentType(manager.getEnabledDeploymentTypes(), possibleDeploymentTypes);
- if (log.isTraceEnabled())
- log.trace("Deployment type " + deploymentType + " specified by stereotype");
- return;
- }
- }
-
- /**
- * Gets the default deployment type
- *
- * @return The default deployment type
- */
- protected abstract Class<? extends Annotation> getDefaultDeploymentType();
-
- /**
- * Initializes the name
- */
- protected void initName()
- {
- boolean beanNameDefaulted = false;
- if (getAnnotatedItem().isAnnotationPresent(Named.class))
- {
- String javaName = getAnnotatedItem().getAnnotation(Named.class).value();
- if ("".equals(javaName))
- {
- log.trace("Using default name (specified by annotations)");
- beanNameDefaulted = true;
- }
- else
- {
- if (log.isTraceEnabled())
- log.trace("Using name " + javaName + " specified by annotations");
- this.name = javaName;
- return;
- }
- }
-
- if (beanNameDefaulted || getMergedStereotypes().isBeanNameDefaulted())
- {
- this.name = getDefaultName();
- return;
- }
- }
-
- protected void initProxyable()
- {
- proxyable = Beans.apiTypesAreProxyable(getTypes());
- }
-
- /**
- * Initializes the primitive flag
- */
- protected void initPrimitive()
- {
- this.primitive = Reflections.isPrimitive(getType());
- }
-
- protected boolean checkInjectionPointsAreSerializable()
- {
- // TODO CACHE THIS and rebuild on addBean
- // TODO: a bit crude, don't check *all* injectionpoints, only those listed
- // in the spec for passivation checks
- for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
- {
- Annotation[] bindings = injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
- Bean<?> resolvedBean = manager.resolveByType(injectionPoint.getType(), bindings).iterator().next();
- if (Dependent.class.equals(resolvedBean.getScopeType()) && !resolvedBean.isSerializable())
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Initializes the scope type
- */
- protected abstract void initScopeType();
-
- protected boolean initScopeTypeFromStereotype()
- {
- Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
- if (possibleScopeTypes.size() == 1)
- {
- this.scopeType = possibleScopeTypes.iterator().next().annotationType();
- if (log.isTraceEnabled())
- log.trace("Scope " + scopeType + " specified by stereotype");
- return true;
- }
- else if (possibleScopeTypes.size() > 1)
- {
- throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on the bean");
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Initializes the type of the bean
- */
- protected abstract void initType();
-
- /**
- * Validates the deployment type
- */
- protected void checkDeploymentType()
- {
- if (deploymentType == null)
- {
- throw new DefinitionException("type: " + getType() + " must specify a deployment type");
- }
- else if (deploymentType.equals(Standard.class) && !STANDARD_WEB_BEAN_CLASSES.contains(getAnnotatedItem().getType()))
- {
- throw new DefinitionException(getAnnotatedItem().getName() + " cannot have deployment type @Standard");
- }
- }
-
- /**
- * Validates that the required types are implemented
- */
- protected void checkRequiredTypesImplemented()
- {
- for (Class<?> requiredType : getMergedStereotypes().getRequiredTypes())
- {
- if (log.isTraceEnabled())
- log.trace("Checking if required type " + requiredType + " is implemented");
- if (!requiredType.isAssignableFrom(type))
- {
- throw new DefinitionException("Required type " + requiredType + " isn't implemented on " + type);
- }
- }
- }
-
- protected void postSpecialization()
- {
- if (getAnnotatedItem().isAnnotationPresent(Named.class) && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
- {
- throw new DefinitionException("Cannot put name on specializing and specialized class");
- }
- this.bindingTypes.addAll(getSpecializedBean().getBindings());
- if (isSpecializing() && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
- {
- this.name = getSpecializedBean().getName();
- return;
- }
- manager.getSpecializedBeans().put(getSpecializedBean(), this);
- }
-
- protected void preCheckSpecialization()
- {
-
- }
-
- protected void initSpecialization()
- {
-
- }
-
- /**
- * Binds the decorators to the proxy
- */
- protected void bindDecorators()
- {
- // TODO Implement decorators
- }
-
- /**
- * Binds the interceptors to the proxy
- */
- protected void bindInterceptors()
- {
- // TODO Implement interceptors
- }
-
- /**
- * Returns the annotated time the bean represents
- *
- * @return The annotated item
- */
- protected abstract AnnotatedItem<T, E> getAnnotatedItem();
-
- /**
- * Gets the binding types
- *
- * @return The set of binding types
- *
- * @see javax.inject.manager.Bean#getBindings()
- */
- public Set<Annotation> getBindings()
- {
- return bindingTypes;
- }
-
- /**
- * Gets the default name of the bean
- *
- * @return The default name
- */
- protected abstract String getDefaultName();
-
- public abstract AbstractBean<?, ?> getSpecializedBean();
-
- /**
- * Gets the deployment type of the bean
- *
- * @return The deployment type
- *
- * @see javax.inject.manager.Bean#getDeploymentType()
- */
- public Class<? extends Annotation> getDeploymentType()
- {
- return deploymentType;
- }
-
- public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
- {
- return injectionPoints;
- }
-
- /**
- * Gets the merged stereotypes of the bean
- *
- * @return The set of merged stereotypes
- */
- protected MergedStereotypes<T, E> getMergedStereotypes()
- {
- return mergedStereotypes;
- }
-
- /**
- * Gets the name of the bean
- *
- * @return The name
- *
- * @see javax.inject.manager.Bean#getName()
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Gets the scope type of the bean
- *
- * @return The scope type
- *
- * @see javax.inject.manager.Bean#getScopeType()
- */
- public Class<? extends Annotation> getScopeType()
- {
- return scopeType;
- }
-
- /**
- * Gets the type of the bean
- *
- * @return The type
- */
- public Class<T> getType()
- {
- return type;
- }
-
- /**
- * Gets the API types of the bean
- *
- * @return The set of API types
- *
- * @see javax.inject.manager.Bean#getTypes()
- */
- @Override
- public Set<Type> getTypes()
- {
- return types;
- }
-
- /**
- * Checks if this beans annotated item is assignable from another annotated
- * item
- *
- * @param annotatedItem The other annotation to check
- * @return True if assignable, otherwise false
- */
- public boolean isAssignableFrom(AnnotatedItem<?, ?> annotatedItem)
- {
- return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
- }
-
- /**
- * Indicates if bean is nullable
- *
- * @return True if nullable, false otherwise
- *
- * @see javax.inject.manager.Bean#isNullable()
- */
- @Override
- public boolean isNullable()
- {
- return !isPrimitive();
- }
-
- /**
- * Indicates if bean type is a primitive
- *
- * @return True if primitive, false otherwise
- */
- public boolean isPrimitive()
- {
- return primitive;
- }
-
- @Override
- public boolean isSerializable()
- {
- // TODO: OK?
- return true;
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "AbstractBean " + getName();
- }
-
- public boolean isProxyable()
- {
- return proxyable;
- }
- public DependentInstancesStore getDependentInstancesStore()
- {
- return dependentInstancesStore;
- }
-
- public boolean isDependent()
- {
- return Dependent.class.equals(scopeType);
- }
-
- public boolean isSpecializing()
- {
- return getAnnotatedItem().isAnnotationPresent(Specializes.class);
- }
-
- @Override
- // TODO Fix this!!!
- public boolean equals(Object other)
- {
- if (other instanceof AbstractBean)
- {
- AbstractBean<?, ?> that = (AbstractBean<?, ?>) other;
- boolean equal = this.getTypes().equals(that.getTypes()) && this.getBindings().equals(that.getBindings());
- return equal;
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- int result = 17;
- result = 31 * result + getTypes().hashCode();
- result = 31 * result + getBindings().hashCode();
- return result;
- }
-
-}
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java (from rev 1287, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,577 @@
+/*
+ * 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.bean;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.Named;
+import javax.annotation.Stereotype;
+import javax.context.Dependent;
+import javax.event.Event;
+import javax.inject.BindingType;
+import javax.inject.DefinitionException;
+import javax.inject.Specializes;
+import javax.inject.Standard;
+import javax.inject.manager.Bean;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.context.DependentInstancesStore;
+import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotationStore.AnnotationMap;
+import org.jboss.webbeans.literal.CurrentLiteral;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.metadata.MergedStereotypes;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * An abstract bean representation common for all beans
+ *
+ * @author Pete Muir
+ *
+ * @param <T> the type of bean
+ * @param <E> the Class<?> of the bean type
+ */
+public abstract class AbstractBean<T, E> extends RIBean<T>
+{
+
+ @SuppressWarnings("unchecked")
+ private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new HashSet<Class<?>>(Arrays.asList(Event.class, ManagerImpl.class));
+
+ private boolean proxyable;
+ protected DependentInstancesStore dependentInstancesStore;
+
+ /**
+ * Helper class for getting deployment type
+ *
+ * Loops through the enabled deployment types (backwards) and returns the
+ * first one present in the possible deployments type, resulting in the
+ * deployment type of highest priority
+ *
+ * @param enabledDeploymentTypes The currently enabled deployment types
+ * @param possibleDeploymentTypes The possible deployment types
+ * @return The deployment type
+ */
+ public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, AnnotationMap possibleDeploymentTypes)
+ {
+ for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
+ {
+ if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i))))
+ {
+ return enabledDeploymentTypes.get(i);
+ }
+ }
+ return null;
+ }
+
+ // Logger
+ private LogProvider log = Logging.getLogProvider(AbstractBean.class);
+ // The binding types
+ private Set<Annotation> bindingTypes;
+ // The name
+ protected String name;
+ // The scope type
+ protected Class<? extends Annotation> scopeType;
+ // The merged stereotypes
+ private MergedStereotypes<T, E> mergedStereotypes;
+ // The deployment type
+ protected Class<? extends Annotation> deploymentType;
+ // The type
+ protected Class<T> type;
+ // The API types
+ protected Set<Type> types;
+ // The injection points
+ protected Set<AnnotatedInjectionPoint<?, ?>> injectionPoints;
+ // If the type a primitive?
+ private boolean primitive;
+ // The Web Beans manager
+ protected ManagerImpl manager;
+
+ protected boolean _serializable;
+
+ /**
+ * Constructor
+ *
+ * @param manager The Web Beans manager
+ */
+ public AbstractBean(ManagerImpl manager)
+ {
+ super(manager);
+ this.manager = manager;
+ injectionPoints = new HashSet<AnnotatedInjectionPoint<?,?>>();
+ dependentInstancesStore = new DependentInstancesStore();
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ protected void init()
+ {
+ mergedStereotypes = new MergedStereotypes<T, E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class));
+ initBindingTypes();
+ if (isSpecializing())
+ {
+ preCheckSpecialization();
+ initSpecialization();
+ postSpecialization();
+ }
+ initDefaultBindings();
+ initType();
+ initPrimitive();
+ if (log.isDebugEnabled())
+ log.debug("Building Web Bean bean metadata for " + getType());
+ initName();
+ initDeploymentType();
+ checkDeploymentType();
+ initScopeType();
+ initTypes();
+ initSerializable();
+ initProxyable();
+ checkRequiredTypesImplemented();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ protected void initTypes()
+ {
+ types = new HashSet<Type>();
+ Reflections.getTypeHierachy(getType(), types);
+ }
+
+ /**
+ * Initializes the binding types
+ */
+ protected void initBindingTypes()
+ {
+ this.bindingTypes = new HashSet<Annotation>();
+ this.bindingTypes.addAll(getAnnotatedItem().getMetaAnnotations(BindingType.class));
+ }
+
+ protected void initDefaultBindings()
+ {
+ if (bindingTypes.size() == 0)
+ {
+ log.trace("Adding default @Current binding type");
+ this.bindingTypes.add(new CurrentLiteral());
+ }
+ else
+ {
+ if (log.isTraceEnabled())
+ log.trace("Using binding types " + bindingTypes + " specified by annotations");
+ }
+ }
+
+ /**
+ * Initializes the deployment types
+ */
+ protected abstract void initDeploymentType();
+
+ protected void initDeploymentTypeFromStereotype()
+ {
+ AnnotationMap possibleDeploymentTypes = getMergedStereotypes().getPossibleDeploymentTypes();
+ if (possibleDeploymentTypes.size() > 0)
+ {
+ this.deploymentType = getDeploymentType(manager.getEnabledDeploymentTypes(), possibleDeploymentTypes);
+ if (log.isTraceEnabled())
+ log.trace("Deployment type " + deploymentType + " specified by stereotype");
+ return;
+ }
+ }
+
+ /**
+ * Gets the default deployment type
+ *
+ * @return The default deployment type
+ */
+ protected abstract Class<? extends Annotation> getDefaultDeploymentType();
+
+ /**
+ * Initializes the name
+ */
+ protected void initName()
+ {
+ boolean beanNameDefaulted = false;
+ if (getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ String javaName = getAnnotatedItem().getAnnotation(Named.class).value();
+ if ("".equals(javaName))
+ {
+ log.trace("Using default name (specified by annotations)");
+ beanNameDefaulted = true;
+ }
+ else
+ {
+ if (log.isTraceEnabled())
+ log.trace("Using name " + javaName + " specified by annotations");
+ this.name = javaName;
+ return;
+ }
+ }
+
+ if (beanNameDefaulted || getMergedStereotypes().isBeanNameDefaulted())
+ {
+ this.name = getDefaultName();
+ return;
+ }
+ }
+
+ protected void initProxyable()
+ {
+ proxyable = Beans.apiTypesAreProxyable(getTypes());
+ }
+
+ /**
+ * Initializes the primitive flag
+ */
+ protected void initPrimitive()
+ {
+ this.primitive = Reflections.isPrimitive(getType());
+ }
+
+ protected boolean checkInjectionPointsAreSerializable()
+ {
+ // TODO CACHE THIS and rebuild on addBean
+ // TODO: a bit crude, don't check *all* injectionpoints, only those listed
+ // in the spec for passivation checks
+ for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
+ {
+ Annotation[] bindings = injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
+ Bean<?> resolvedBean = manager.resolveByType(injectionPoint.getType(), bindings).iterator().next();
+ if (Dependent.class.equals(resolvedBean.getScopeType()) && !resolvedBean.isSerializable())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Initializes the scope type
+ */
+ protected abstract void initScopeType();
+
+ protected boolean initScopeTypeFromStereotype()
+ {
+ Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
+ if (possibleScopeTypes.size() == 1)
+ {
+ this.scopeType = possibleScopeTypes.iterator().next().annotationType();
+ if (log.isTraceEnabled())
+ log.trace("Scope " + scopeType + " specified by stereotype");
+ return true;
+ }
+ else if (possibleScopeTypes.size() > 1)
+ {
+ throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on the bean");
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Initializes the type of the bean
+ */
+ protected abstract void initType();
+
+ /**
+ * Validates the deployment type
+ */
+ protected void checkDeploymentType()
+ {
+ if (deploymentType == null)
+ {
+ throw new DefinitionException("type: " + getType() + " must specify a deployment type");
+ }
+ else if (deploymentType.equals(Standard.class) && !STANDARD_WEB_BEAN_CLASSES.contains(getAnnotatedItem().getType()))
+ {
+ throw new DefinitionException(getAnnotatedItem().getName() + " cannot have deployment type @Standard");
+ }
+ }
+
+ /**
+ * Validates that the required types are implemented
+ */
+ protected void checkRequiredTypesImplemented()
+ {
+ for (Class<?> requiredType : getMergedStereotypes().getRequiredTypes())
+ {
+ if (log.isTraceEnabled())
+ log.trace("Checking if required type " + requiredType + " is implemented");
+ if (!requiredType.isAssignableFrom(type))
+ {
+ throw new DefinitionException("Required type " + requiredType + " isn't implemented on " + type);
+ }
+ }
+ }
+
+ protected void postSpecialization()
+ {
+ if (getAnnotatedItem().isAnnotationPresent(Named.class) && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ throw new DefinitionException("Cannot put name on specializing and specialized class");
+ }
+ this.bindingTypes.addAll(getSpecializedBean().getBindings());
+ if (isSpecializing() && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ this.name = getSpecializedBean().getName();
+ return;
+ }
+ manager.getSpecializedBeans().put(getSpecializedBean(), this);
+ }
+
+ protected void preCheckSpecialization()
+ {
+
+ }
+
+ protected void initSpecialization()
+ {
+
+ }
+
+ /**
+ * Binds the decorators to the proxy
+ */
+ protected void bindDecorators()
+ {
+ // TODO Implement decorators
+ }
+
+ /**
+ * Binds the interceptors to the proxy
+ */
+ protected void bindInterceptors()
+ {
+ // TODO Implement interceptors
+ }
+
+ /**
+ * Returns the annotated time the bean represents
+ *
+ * @return The annotated item
+ */
+ protected abstract AnnotatedItem<T, E> getAnnotatedItem();
+
+ /**
+ * Gets the binding types
+ *
+ * @return The set of binding types
+ *
+ * @see javax.inject.manager.Bean#getBindings()
+ */
+ public Set<Annotation> getBindings()
+ {
+ return bindingTypes;
+ }
+
+ /**
+ * Gets the default name of the bean
+ *
+ * @return The default name
+ */
+ protected abstract String getDefaultName();
+
+ public abstract AbstractBean<?, ?> getSpecializedBean();
+
+ /**
+ * Gets the deployment type of the bean
+ *
+ * @return The deployment type
+ *
+ * @see javax.inject.manager.Bean#getDeploymentType()
+ */
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return deploymentType;
+ }
+
+ public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ /**
+ * Gets the merged stereotypes of the bean
+ *
+ * @return The set of merged stereotypes
+ */
+ protected MergedStereotypes<T, E> getMergedStereotypes()
+ {
+ return mergedStereotypes;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return The name
+ *
+ * @see javax.inject.manager.Bean#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the scope type of the bean
+ *
+ * @return The scope type
+ *
+ * @see javax.inject.manager.Bean#getScopeType()
+ */
+ public Class<? extends Annotation> getScopeType()
+ {
+ return scopeType;
+ }
+
+ /**
+ * Gets the type of the bean
+ *
+ * @return The type
+ */
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ /**
+ * Gets the API types of the bean
+ *
+ * @return The set of API types
+ *
+ * @see javax.inject.manager.Bean#getTypes()
+ */
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ /**
+ * Checks if this beans annotated item is assignable from another annotated
+ * item
+ *
+ * @param annotatedItem The other annotation to check
+ * @return True if assignable, otherwise false
+ */
+ public boolean isAssignableFrom(AnnotatedItem<?, ?> annotatedItem)
+ {
+ return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
+ }
+
+ /**
+ * Indicates if bean is nullable
+ *
+ * @return True if nullable, false otherwise
+ *
+ * @see javax.inject.manager.Bean#isNullable()
+ */
+ @Override
+ public boolean isNullable()
+ {
+ return !isPrimitive();
+ }
+
+ /**
+ * Indicates if bean type is a primitive
+ *
+ * @return True if primitive, false otherwise
+ */
+ public boolean isPrimitive()
+ {
+ return primitive;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return _serializable;
+ }
+
+ protected void initSerializable()
+ {
+ _serializable = isPrimitive() || getTypes().contains(Serializable.class);
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "AbstractBean " + getName();
+ }
+
+ public boolean isProxyable()
+ {
+ return proxyable;
+ }
+ public DependentInstancesStore getDependentInstancesStore()
+ {
+ return dependentInstancesStore;
+ }
+
+ public boolean isDependent()
+ {
+ return Dependent.class.equals(scopeType);
+ }
+
+ public boolean isSpecializing()
+ {
+ return getAnnotatedItem().isAnnotationPresent(Specializes.class);
+ }
+
+ @Override
+ // TODO Fix this!!!
+ public boolean equals(Object other)
+ {
+ if (other instanceof AbstractBean)
+ {
+ AbstractBean<?, ?> that = (AbstractBean<?, ?>) other;
+ boolean equal = this.getTypes().equals(that.getTypes()) && this.getBindings().equals(that.getBindings());
+ return equal;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ result = 31 * result + getTypes().hashCode();
+ result = 31 * result + getBindings().hashCode();
+ return result;
+ }
+
+}
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,388 +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.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.context.CreationalContext;
-import javax.context.Dependent;
-import javax.context.ScopeType;
-import javax.inject.DefinitionException;
-import javax.inject.DeploymentType;
-import javax.inject.IllegalProductException;
-import javax.inject.Initializer;
-import javax.inject.Produces;
-import javax.inject.manager.InjectionPoint;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.context.CreationalContextImpl;
-import org.jboss.webbeans.context.DependentContext;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MetaDataCache;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * The implicit producer bean
- *
- * @author Gavin King
- *
- * @param <T>
- * @param <S>
- */
-public abstract class AbstractProducerBean<T, S> extends AbstractBean<T, S>
-{
- // The declaring bean
- protected AbstractClassBean<?> declaringBean;
-
- private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
-
- /**
- * Constructor
- *
- * @param declaringBean The declaring bean
- * @param manager The Web Beans manager
- */
- public AbstractProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl manager)
- {
- super(manager);
- this.declaringBean = declaringBean;
- }
-
- /**
- * Gets the deployment types
- *
- * @return The deployment types of the declaring bean
- */
- @Override
- protected Class<? extends Annotation> getDefaultDeploymentType()
- {
- return deploymentType = declaringBean.getDeploymentType();
- }
-
- /**
- * Initializes the API types
- */
- @Override
- protected void initTypes()
- {
- if (getType().isArray() || getType().isPrimitive())
- {
- types = new HashSet<Type>();
- types.add(getType());
- types.add(Object.class);
- }
- else if (getType().isInterface())
- {
- super.initTypes();
- types.add(Object.class);
- }
- else
- {
- super.initTypes();
- }
- }
-
- /**
- * Initializes the type
- */
- @Override
- protected void initType()
- {
- try
- {
- if (getAnnotatedItem() != null)
- {
- this.type = getAnnotatedItem().getType();
- }
- }
- catch (ClassCastException e)
- {
- throw new RuntimeException(" Cannot cast producer type " + getAnnotatedItem().getType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
- }
- }
-
- /**
- * Gets the declared bean type
- *
- * @return The bean type
- */
- protected Type getDeclaredBeanType()
- {
- Type type = getClass();
- if (type instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- if (parameterizedType.getActualTypeArguments().length == 1)
- {
- return parameterizedType.getActualTypeArguments()[0];
- }
- }
- return null;
- }
-
- /**
- * Returns the declaring bean
- *
- * @return The bean representation
- */
- public AbstractClassBean<?> getDeclaringBean()
- {
- return declaringBean;
- }
-
- /**
- * Validates the producer method
- */
- protected void checkProducerReturnType()
- {
- for (Type type : getAnnotatedItem().getActualTypeArguments())
- {
- if (!(type instanceof Class))
- {
- throw new DefinitionException("Producer type cannot be parameterized with type parameter or wildcard:\n" + this.getAnnotatedItem());
- }
- }
- }
-
- /**
- * Initializes the bean and its metadata
- */
- @Override
- protected void init()
- {
- super.init();
- checkProducerReturnType();
- }
-
- /**
- * Validates the return value
- *
- * @param instance The instance to validate
- */
- protected void checkReturnValue(T instance)
- {
- if (instance == null && !isDependent())
- {
- throw new IllegalProductException("Cannot return null from a non-dependent producer method");
- }
- boolean passivating = MetaDataCache.instance().getScopeModel(getScopeType()).isPassivating();
- if (passivating && !Reflections.isSerializable(instance.getClass()))
- {
- throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
- }
- InjectionPoint injectionPoint = manager.getInjectionPoint();
- if (injectionPoint == null)
- {
- return;
- }
- if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()) && !isSerializable())
- {
- if (injectionPoint.getMember() instanceof Field)
- {
- if (!Reflections.isTransient(injectionPoint.getMember()))
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
- }
- }
- else if (injectionPoint.getMember() instanceof Method)
- {
- Method method = (Method) injectionPoint.getMember();
- if (method.isAnnotationPresent(Initializer.class))
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope");
- }
- if (method.isAnnotationPresent(Produces.class))
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope");
- }
- }
- else if (injectionPoint.getMember() instanceof Constructor)
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope");
- }
- else
- {
- // TODO: possible case?
- }
- }
- }
-
- @Override
- protected void initScopeType()
- {
- Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
- if (scopeAnnotations.size() > 1)
- {
- throw new DefinitionException("At most one scope may be specified");
- }
- if (scopeAnnotations.size() == 1)
- {
- this.scopeType = scopeAnnotations.iterator().next().annotationType();
- log.trace("Scope " + scopeType + " specified by annotation");
- return;
- }
-
- initScopeTypeFromStereotype();
-
- if (this.scopeType == null)
- {
- this.scopeType = Dependent.class;
- log.trace("Using default @Dependent scope");
- }
- }
-
- @Override
- protected void initDeploymentType()
- {
- Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
- if (deploymentTypes.size() > 1)
- {
- throw new DefinitionException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().toString());
- }
- else if (deploymentTypes.size() == 1)
- {
- this.deploymentType = deploymentTypes.iterator().next().annotationType();
- log.trace("Deployment type " + deploymentType + " specified by annotation");
- return;
- }
-
- initDeploymentTypeFromStereotype();
-
- if (this.deploymentType == null)
- {
- this.deploymentType = getDefaultDeploymentType();
- log.trace("Using default " + this.deploymentType + " deployment type");
- return;
- }
- }
-
- /**
- * Gets the receiver of the product
- *
- * @return The receiver
- */
- protected Object getReceiver(CreationalContext<?> creationalContext)
- {
- // This is a bit dangerous, as it means that producer methods can end of
- // executing on partially constructed instances. Also, it's not required
- // by the spec...
- if (creationalContext instanceof CreationalContextImpl)
- {
- CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>) creationalContext;
- if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
- {
- log.warn("Executing producer method on incomplete declaring bean due to circular injection");
- return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
- }
- }
- return getAnnotatedItem().isStatic() ? null : manager.getInstance(getDeclaringBean());
- }
-
- /**
- * Creates an instance of the bean
- *
- * @returns The instance
- */
- public T create(CreationalContext<T> creationalContext)
- {
- Object dependentCollector = new Object();
- try
- {
- if (getDeclaringBean().isDependent())
- {
- DependentContext.INSTANCE.setCurrentInjectionInstance(dependentCollector);
- }
- DependentContext.INSTANCE.setActive(true);
- T instance = produceInstance(creationalContext);
- checkReturnValue(instance);
- return instance;
- }
- finally
- {
- if (getDeclaringBean().isDependent())
- {
- DependentContext.INSTANCE.clearCurrentInjectionInstance(dependentCollector);
- dependentInstancesStore.destroyDependentInstances(dependentCollector);
- }
- DependentContext.INSTANCE.setActive(false);
- }
- }
-
- public void destroy(T instance)
- {
- try
- {
- DependentContext.INSTANCE.setActive(true);
- // TODO Implement any cleanup needed
- }
- finally
- {
- DependentContext.INSTANCE.setActive(false);
- }
- }
-
- protected abstract T produceInstance(CreationalContext<T> creationalContext);
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
- if (getName() == null)
- {
- buffer.append("unnamed producer bean");
- }
- else
- {
- buffer.append("simple producer bean '" + getName() + "'");
- }
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types " + getBindings() + "\n");
- return buffer.toString();
- }
-
- @Override
- public boolean equals(Object other)
- {
- if (other instanceof AbstractProducerBean)
- {
- AbstractProducerBean<?, ?> that = (AbstractProducerBean<?, ?>) other;
- return super.equals(other) && this.getDeclaringBean().equals(that.getDeclaringBean());
- }
- else
- {
- return false;
- }
- }
-
-}
\ No newline at end of file
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java (from rev 1287, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,394 @@
+/*
+ * 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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.context.Dependent;
+import javax.context.ScopeType;
+import javax.inject.DefinitionException;
+import javax.inject.DeploymentType;
+import javax.inject.IllegalProductException;
+import javax.inject.Initializer;
+import javax.inject.Produces;
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.context.CreationalContextImpl;
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * The implicit producer bean
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ */
+public abstract class AbstractProducerBean<T, S> extends AbstractBean<T, S>
+{
+ // The declaring bean
+ protected AbstractClassBean<?> declaringBean;
+
+ private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
+
+ /**
+ * Constructor
+ *
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ */
+ public AbstractProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ {
+ super(manager);
+ this.declaringBean = declaringBean;
+ }
+
+ /**
+ * Gets the deployment types
+ *
+ * @return The deployment types of the declaring bean
+ */
+ @Override
+ protected Class<? extends Annotation> getDefaultDeploymentType()
+ {
+ return deploymentType = declaringBean.getDeploymentType();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ @Override
+ protected void initTypes()
+ {
+ if (getType().isArray() || getType().isPrimitive())
+ {
+ types = new HashSet<Type>();
+ types.add(getType());
+ types.add(Object.class);
+ }
+ else if (getType().isInterface())
+ {
+ super.initTypes();
+ types.add(Object.class);
+ }
+ else
+ {
+ super.initTypes();
+ }
+ }
+
+ /**
+ * Initializes the type
+ */
+ @Override
+ protected void initType()
+ {
+ try
+ {
+ if (getAnnotatedItem() != null)
+ {
+ this.type = getAnnotatedItem().getType();
+ }
+ }
+ catch (ClassCastException e)
+ {
+ throw new RuntimeException(" Cannot cast producer type " + getAnnotatedItem().getType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
+ }
+ }
+
+ /**
+ * Gets the declared bean type
+ *
+ * @return The bean type
+ */
+ protected Type getDeclaredBeanType()
+ {
+ Type type = getClass();
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ if (parameterizedType.getActualTypeArguments().length == 1)
+ {
+ return parameterizedType.getActualTypeArguments()[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the declaring bean
+ *
+ * @return The bean representation
+ */
+ public AbstractClassBean<?> getDeclaringBean()
+ {
+ return declaringBean;
+ }
+
+ /**
+ * Validates the producer method
+ */
+ protected void checkProducerReturnType()
+ {
+ for (Type type : getAnnotatedItem().getActualTypeArguments())
+ {
+ if (!(type instanceof Class))
+ {
+ throw new DefinitionException("Producer type cannot be parameterized with type parameter or wildcard:\n" + this.getAnnotatedItem());
+ }
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ protected void init()
+ {
+ super.init();
+ checkProducerReturnType();
+ }
+
+ /**
+ * Validates the return value
+ *
+ * @param instance The instance to validate
+ */
+ protected void checkReturnValue(T instance)
+ {
+ if (instance == null && !isDependent())
+ {
+ throw new IllegalProductException("Cannot return null from a non-dependent producer method");
+ }
+ boolean passivating = MetaDataCache.instance().getScopeModel(getScopeType()).isPassivating();
+ if (passivating && !Reflections.isSerializable(instance.getClass()))
+ {
+ throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
+ }
+ InjectionPoint injectionPoint = manager.getInjectionPoint();
+ if (injectionPoint == null)
+ {
+ return;
+ }
+ if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()))
+ {
+ if (injectionPoint.getMember() instanceof Field)
+ {
+ if (!Reflections.isTransient(injectionPoint.getMember()) && !Reflections.isSerializable(instance.getClass()))
+ {
+ throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
+ }
+ }
+ else if (injectionPoint.getMember() instanceof Method)
+ {
+ Method method = (Method) injectionPoint.getMember();
+ if (method.isAnnotationPresent(Initializer.class))
+ {
+ throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope");
+ }
+ if (method.isAnnotationPresent(Produces.class))
+ {
+ throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope");
+ }
+ }
+ else if (injectionPoint.getMember() instanceof Constructor)
+ {
+ throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope");
+ }
+ else
+ {
+ // TODO: possible case?
+ }
+ }
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
+ if (scopeAnnotations.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
+ if (scopeAnnotations.size() == 1)
+ {
+ this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ return;
+ }
+
+ initScopeTypeFromStereotype();
+
+ if (this.scopeType == null)
+ {
+ this.scopeType = Dependent.class;
+ log.trace("Using default @Dependent scope");
+ }
+ }
+
+ @Override
+ protected void initDeploymentType()
+ {
+ Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
+ if (deploymentTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().toString());
+ }
+ else if (deploymentTypes.size() == 1)
+ {
+ this.deploymentType = deploymentTypes.iterator().next().annotationType();
+ log.trace("Deployment type " + deploymentType + " specified by annotation");
+ return;
+ }
+
+ initDeploymentTypeFromStereotype();
+
+ if (this.deploymentType == null)
+ {
+ this.deploymentType = getDefaultDeploymentType();
+ log.trace("Using default " + this.deploymentType + " deployment type");
+ return;
+ }
+ }
+
+ @Override
+ protected void initSerializable()
+ {
+ _serializable = true;
+ }
+
+ /**
+ * Gets the receiver of the product
+ *
+ * @return The receiver
+ */
+ protected Object getReceiver(CreationalContext<?> creationalContext)
+ {
+ // This is a bit dangerous, as it means that producer methods can end of
+ // executing on partially constructed instances. Also, it's not required
+ // by the spec...
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>) creationalContext;
+ if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
+ {
+ log.warn("Executing producer method on incomplete declaring bean due to circular injection");
+ return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
+ }
+ }
+ return getAnnotatedItem().isStatic() ? null : manager.getInstance(getDeclaringBean());
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @returns The instance
+ */
+ public T create(CreationalContext<T> creationalContext)
+ {
+ Object dependentCollector = new Object();
+ try
+ {
+ if (getDeclaringBean().isDependent())
+ {
+ DependentContext.INSTANCE.setCurrentInjectionInstance(dependentCollector);
+ }
+ DependentContext.INSTANCE.setActive(true);
+ T instance = produceInstance(creationalContext);
+ checkReturnValue(instance);
+ return instance;
+ }
+ finally
+ {
+ if (getDeclaringBean().isDependent())
+ {
+ DependentContext.INSTANCE.clearCurrentInjectionInstance(dependentCollector);
+ dependentInstancesStore.destroyDependentInstances(dependentCollector);
+ }
+ DependentContext.INSTANCE.setActive(false);
+ }
+ }
+
+ public void destroy(T instance)
+ {
+ try
+ {
+ DependentContext.INSTANCE.setActive(true);
+ // TODO Implement any cleanup needed
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
+ }
+
+ protected abstract T produceInstance(CreationalContext<T> creationalContext);
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer bean");
+ }
+ else
+ {
+ buffer.append("simple producer bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types " + getBindings() + "\n");
+ return buffer.toString();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof AbstractProducerBean)
+ {
+ AbstractProducerBean<?, ?> that = (AbstractProducerBean<?, ?>) other;
+ return super.equals(other) && this.getDeclaringBean().equals(that.getDeclaringBean());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,561 +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.util;
-
-import java.beans.Introspector;
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.inject.BindingType;
-import javax.inject.ExecutionException;
-
-
-/**
- * Utility class for static reflection-type operations
- *
- * @author Pete Muir
- *
- */
-public class Reflections
-{
-
- /**
- * Gets the property name from a getter method
- *
- * @param method The getter method
- * @return The name of the property. Returns null if method wasn't JavaBean
- * getter-styled
- */
- public static String getPropertyName(Method method)
- {
- String methodName = method.getName();
- if (methodName.matches("^(get).*") && method.getParameterTypes().length == 0)
- {
- return Introspector.decapitalize(methodName.substring(3));
- }
- else if (methodName.matches("^(is).*") && method.getParameterTypes().length == 0)
- {
- return Introspector.decapitalize(methodName.substring(2));
- }
- else
- {
- return null;
- }
-
- }
-
- /**
- * Checks if class is final
- *
- * @param clazz The class to check
- * @return True if final, false otherwise
- */
- public static boolean isFinal(Class<?> clazz)
- {
- return Modifier.isFinal(clazz.getModifiers());
- }
-
- /**
- * Checks if member is final
- *
- * @param member The member to check
- * @return True if final, false otherwise
- */
- public static boolean isFinal(Member member)
- {
- return Modifier.isFinal(member.getModifiers());
- }
-
- /**
- * Checks if type or member is final
- *
- * @param type Type or member
- * @return True if final, false otherwise
- */
- public static boolean isTypeOrAnyMethodFinal(Class<?> type)
- {
- if (isFinal(type))
- {
- return true;
- }
- for (Method method : type.getDeclaredMethods())
- {
- if (isFinal(method))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Checks if type is primitive
- *
- * @param type Type to check
- * @return True if primitive, false otherwise
- */
- public static boolean isPrimitive(Class<?> type)
- {
- return type.isPrimitive();
- }
-
- /**
- * Checks if type is static
- *
- * @param type Type to check
- * @return True if static, false otherwise
- */
- public static boolean isStatic(Class<?> type)
- {
- return Modifier.isStatic(type.getModifiers());
- }
-
- /**
- * Checks if member is static
- *
- * @param member Member to check
- * @return True if static, false otherwise
- */
- public static boolean isStatic(Member member)
- {
- return Modifier.isStatic(member.getModifiers());
- }
-
- public static boolean isTransient(Member member)
- {
- return Modifier.isTransient(member.getModifiers());
- }
-
- /**
- * Checks if clazz is abstract
- *
- * @param clazz Class to check
- * @return True if abstract, false otherwise
- */
- public static boolean isAbstract(Class<?> clazz)
- {
- return Modifier.isAbstract(clazz.getModifiers());
- }
-
- /**
- * Checks if class is a static inner one
- *
- * @param clazz Class to check
- * @return True if static, false otherwise
- */
- public static boolean isStaticInnerClass(Class<?> clazz)
- {
- return clazz.isMemberClass() && isStatic(clazz);
- }
-
- /**
- * Checks if class is a non-static inner one
- *
- * @param clazz Class to Check
- * @return True if static, false otherwise
- */
- public static boolean isNonMemberInnerClass(Class<?> clazz)
- {
- return clazz.isMemberClass() && !isStatic(clazz);
- }
-
- /**
- * Gets a constructor with matching parameter types
- *
- * @param <T> The type
- * @param clazz The class
- * @param parameterTypes The parameter types
- * @return The matching constructor. Null is returned if none is found
- */
- public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes)
- {
- try
- {
- return clazz.getDeclaredConstructor(parameterTypes);
- }
- catch (NoSuchMethodException e)
- {
- return null;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error accessing constructor (with parameters " + parameterTypes + ") of " + clazz, e);
- }
- }
-
- /**
- * Gets all methods with a given annotation
- *
- * @param clazz The class the examine
- * @param annotationType The annotation type to search for
- * @return A list of matching methods. An empty list is returned if no
- * matches are found
- */
- public static List<Method> getMethods(Class<?> clazz, Class<? extends Annotation> annotationType)
- {
- List<Method> methods = new ArrayList<Method>();
- for (Method method : clazz.getMethods())
- {
- if (method.isAnnotationPresent(annotationType))
- {
- methods.add(method);
- }
- }
- return methods;
- }
-
- /**
- * Gets all constructors with a given annotation
- *
- * @param <T> The type of the class
- * @param clazz The class
- * @param annotationType The annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getAnnotatedConstructors(Class<? extends T> clazz, Class<? extends Annotation> annotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- if (constructor.isAnnotationPresent(annotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- return constructors;
- }
-
- /**
- * Gets constructors with a given annotated parameter
- *
- * @param <T> The type
- * @param clazz The class
- * @param parameterAnnotationType The parameter annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getConstructorsForAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> parameterAnnotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- for (Annotation[] annotations : constructor.getParameterAnnotations())
- {
- for (Annotation annotation : annotations)
- {
- if (annotation.annotationType().equals(parameterAnnotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- }
- }
- return constructors;
- }
-
- /**
- * Gets constructors with a given meta-annotated parameter
- *
- * @param <T> The type
- * @param clazz The class
- * @param metaAnnotationType The parameter meta-annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getConstructorsForMetaAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> metaAnnotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- for (Annotation[] annotations : constructor.getParameterAnnotations())
- {
- for (Annotation annotation : annotations)
- {
- if (annotation.annotationType().isAnnotationPresent(metaAnnotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- }
- }
- return constructors;
- }
-
- /**
- * Checks if all annotations types are in a given set of annotations
- *
- * @param annotations The annotation set
- * @param annotationTypes The annotation types to match
- * @return True if match, false otherwise
- */
- public static boolean annotationTypeSetMatches(Set<Class<? extends Annotation>> annotations, Class<? extends Annotation>... annotationTypes)
- {
- List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
- annotationTypeList.addAll(Arrays.asList(annotationTypes));
- for (Class<? extends Annotation> annotation : annotations)
- {
- if (annotationTypeList.contains(annotation))
- {
- annotationTypeList.remove(annotation);
- }
- else
- {
- return false;
- }
- }
- return annotationTypeList.size() == 0;
- }
-
- /**
- * Checks if all annotations are in a given set of annotations
- *
- * @param annotations The annotation set
- * @param annotationTypes The annotations to match
- * @return True if match, false otherwise
- */
- public static boolean annotationSetMatches(Set<Annotation> annotations, Class<? extends Annotation>... annotationTypes)
- {
- List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
- annotationTypeList.addAll(Arrays.asList(annotationTypes));
- for (Annotation annotation : annotations)
- {
- if (annotationTypeList.contains(annotation.annotationType()))
- {
- annotationTypeList.remove(annotation.annotationType());
- }
- else
- {
- return false;
- }
- }
- return annotationTypeList.size() == 0;
- }
-
- /**
- * Gets the actual type arguments of a class
- *
- * @param clazz The class to examine
- * @return The type arguments
- */
- public static Type[] getActualTypeArguments(Class<?> clazz)
- {
- if (clazz.getGenericSuperclass() instanceof ParameterizedType)
- {
- return ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments();
- }
- else
- {
- return new Type[0];
- }
- }
-
- /**
- * Checks if raw type is array type
- *
- * @param rawType The raw type to check
- * @return True if array, false otherwise
- */
- public static boolean isArrayType(Class<?> rawType)
- {
- return rawType.isArray();
- }
-
- /**
- * Checks if type is parameterized type
- *
- * @param type The type to check
- * @return True if parameterized, false otherwise
- */
- public static boolean isParameterizedType(Class<?> type)
- {
- return type.getTypeParameters().length > 0;
- }
-
- /**
- * Invokes a method and wraps exceptions
- *
- * @param method The method to invoke
- * @param instance The instance to invoke on
- * @param parameters The parameters
- * @return The return value
- */
- public static Object invokeAndWrap(Method method, Object instance, Object... parameters)
- {
- try
- {
- method.setAccessible(true);
- return method.invoke(instance, parameters);
- }
- catch (IllegalArgumentException e)
- {
- throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
- }
- catch (InvocationTargetException e)
- {
- throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
- }
- }
-
- /**
- * Gets value of a field and wraps exceptions
- *
- * @param field The field to set on
- * @param target The instance to set on
- * @return The value to set
- */
- public static Object getAndWrap(Field field, Object target)
- {
- try
- {
- return field.get(target);
- }
- catch (IllegalArgumentException e)
- {
- throw new ExecutionException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new ExecutionException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
- }
- }
-
- /**
- * Looks up a method in the type hierarchy of an instance
- *
- * @param method The method to look for
- * @param instance The instance to start from
- * @return The method found, or an NoSuchMethodException if it is not found
- */
- public static Method lookupMethod(Method method, Object instance)
- {
- for (Class<? extends Object> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass())
- {
- try
- {
- Method targetMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
- if (!targetMethod.isAccessible())
- {
- targetMethod.setAccessible(true);
- }
- return targetMethod;
- }
- catch (NoSuchMethodException nsme)
- {
- // Expected, nothing to see here.
- }
- }
- throw new IllegalArgumentException("Method " + method.getName() + " not implemented by instance");
- }
-
- /**
- * Indicates if an instance is a Javassist proxy
- *
- * @param instance The instance to examine
- * @return True if proxy, false otherwise
- */
- public static boolean isProxy(Object instance)
- {
- return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
- }
-
- /**
- * Gets the type hierarchy for a class
- *
- * A recursive function that adds the class to the set of type and then calls
- * itself with the suprerclass as paramater until the top of the hierarchy is
- * reached. For each steps, adds all interfaces of the class to the set.
- * Since the data structure is a set, duplications are eliminated
- *
- * @param clazz The class to examine
- * @return The set of classes and interfaces in the hierarchy
- * @see #getTypeHierachy(Class, Set)
- */
- public static Set<Class<?>> getTypeHierachy(Class<?> clazz)
- {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- getTypeHierachy(clazz, classes);
- return classes;
- }
-
- /**
- * Gets the flattened type hierarchy for a class, including all super classes
- * and the entire interface type hierarchy
- *
- * @param clazz the class to examine
- * @param classes the set of types
- */
- public static void getTypeHierachy(Class<?> clazz, Set<? super Class<?>> classes)
- {
- if (clazz != null)
- {
- classes.add(clazz);
- getTypeHierachy(clazz.getSuperclass(), classes);
- for (Class<?> c : clazz.getInterfaces())
- {
- getTypeHierachy(c, classes);
- }
- }
- }
-
- /**
- * Checks the bindingType to make sure the annotation was declared properly
- * as a binding type (annotated with @BindingType).
- *
- * @param bindingType The binding type to check
- * @return true only if the annotation is really a binding type
- */
- public static boolean isBindingType(Annotation bindingType)
- {
- boolean isBindingAnnotation = false;
- if (bindingType.annotationType().isAnnotationPresent(BindingType.class))
- {
- isBindingAnnotation = true;
- }
- return isBindingAnnotation;
- }
-
- public static boolean isSerializable(Class<?> clazz)
- {
- return getTypeHierachy(clazz).contains(Serializable.class);
- }
-
-}
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java (from rev 1287, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,561 @@
+/*
+ * 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.util;
+
+import java.beans.Introspector;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.inject.BindingType;
+import javax.inject.ExecutionException;
+
+
+/**
+ * Utility class for static reflection-type operations
+ *
+ * @author Pete Muir
+ *
+ */
+public class Reflections
+{
+
+ /**
+ * Gets the property name from a getter method
+ *
+ * @param method The getter method
+ * @return The name of the property. Returns null if method wasn't JavaBean
+ * getter-styled
+ */
+ public static String getPropertyName(Method method)
+ {
+ String methodName = method.getName();
+ if (methodName.matches("^(get).*") && method.getParameterTypes().length == 0)
+ {
+ return Introspector.decapitalize(methodName.substring(3));
+ }
+ else if (methodName.matches("^(is).*") && method.getParameterTypes().length == 0)
+ {
+ return Introspector.decapitalize(methodName.substring(2));
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+
+ /**
+ * Checks if class is final
+ *
+ * @param clazz The class to check
+ * @return True if final, false otherwise
+ */
+ public static boolean isFinal(Class<?> clazz)
+ {
+ return Modifier.isFinal(clazz.getModifiers());
+ }
+
+ /**
+ * Checks if member is final
+ *
+ * @param member The member to check
+ * @return True if final, false otherwise
+ */
+ public static boolean isFinal(Member member)
+ {
+ return Modifier.isFinal(member.getModifiers());
+ }
+
+ /**
+ * Checks if type or member is final
+ *
+ * @param type Type or member
+ * @return True if final, false otherwise
+ */
+ public static boolean isTypeOrAnyMethodFinal(Class<?> type)
+ {
+ if (isFinal(type))
+ {
+ return true;
+ }
+ for (Method method : type.getDeclaredMethods())
+ {
+ if (isFinal(method))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks if type is primitive
+ *
+ * @param type Type to check
+ * @return True if primitive, false otherwise
+ */
+ public static boolean isPrimitive(Class<?> type)
+ {
+ return type.isPrimitive();
+ }
+
+ /**
+ * Checks if type is static
+ *
+ * @param type Type to check
+ * @return True if static, false otherwise
+ */
+ public static boolean isStatic(Class<?> type)
+ {
+ return Modifier.isStatic(type.getModifiers());
+ }
+
+ /**
+ * Checks if member is static
+ *
+ * @param member Member to check
+ * @return True if static, false otherwise
+ */
+ public static boolean isStatic(Member member)
+ {
+ return Modifier.isStatic(member.getModifiers());
+ }
+
+ public static boolean isTransient(Member member)
+ {
+ return Modifier.isTransient(member.getModifiers());
+ }
+
+ /**
+ * Checks if clazz is abstract
+ *
+ * @param clazz Class to check
+ * @return True if abstract, false otherwise
+ */
+ public static boolean isAbstract(Class<?> clazz)
+ {
+ return Modifier.isAbstract(clazz.getModifiers());
+ }
+
+ /**
+ * Checks if class is a static inner one
+ *
+ * @param clazz Class to check
+ * @return True if static, false otherwise
+ */
+ public static boolean isStaticInnerClass(Class<?> clazz)
+ {
+ return clazz.isMemberClass() && isStatic(clazz);
+ }
+
+ /**
+ * Checks if class is a non-static inner one
+ *
+ * @param clazz Class to Check
+ * @return True if static, false otherwise
+ */
+ public static boolean isNonMemberInnerClass(Class<?> clazz)
+ {
+ return clazz.isMemberClass() && !isStatic(clazz);
+ }
+
+ /**
+ * Gets a constructor with matching parameter types
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param parameterTypes The parameter types
+ * @return The matching constructor. Null is returned if none is found
+ */
+ public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ try
+ {
+ return clazz.getDeclaredConstructor(parameterTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error accessing constructor (with parameters " + parameterTypes + ") of " + clazz, e);
+ }
+ }
+
+ /**
+ * Gets all methods with a given annotation
+ *
+ * @param clazz The class the examine
+ * @param annotationType The annotation type to search for
+ * @return A list of matching methods. An empty list is returned if no
+ * matches are found
+ */
+ public static List<Method> getMethods(Class<?> clazz, Class<? extends Annotation> annotationType)
+ {
+ List<Method> methods = new ArrayList<Method>();
+ for (Method method : clazz.getMethods())
+ {
+ if (method.isAnnotationPresent(annotationType))
+ {
+ methods.add(method);
+ }
+ }
+ return methods;
+ }
+
+ /**
+ * Gets all constructors with a given annotation
+ *
+ * @param <T> The type of the class
+ * @param clazz The class
+ * @param annotationType The annotation type
+ * @return A list of matching constructors. An empty list is returned if no
+ * matches are found
+ */
+ public static <T> List<Constructor<T>> getAnnotatedConstructors(Class<? extends T> clazz, Class<? extends Annotation> annotationType)
+ {
+ List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
+ for (Constructor<?> constructor : clazz.getConstructors())
+ {
+ if (constructor.isAnnotationPresent(annotationType))
+ {
+ @SuppressWarnings("unchecked")
+ Constructor<T> c = (Constructor<T>) constructor;
+ constructors.add(c);
+ }
+ }
+ return constructors;
+ }
+
+ /**
+ * Gets constructors with a given annotated parameter
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param parameterAnnotationType The parameter annotation type
+ * @return A list of matching constructors. An empty list is returned if no
+ * matches are found
+ */
+ public static <T> List<Constructor<T>> getConstructorsForAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> parameterAnnotationType)
+ {
+ List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
+ for (Constructor<?> constructor : clazz.getConstructors())
+ {
+ for (Annotation[] annotations : constructor.getParameterAnnotations())
+ {
+ for (Annotation annotation : annotations)
+ {
+ if (annotation.annotationType().equals(parameterAnnotationType))
+ {
+ @SuppressWarnings("unchecked")
+ Constructor<T> c = (Constructor<T>) constructor;
+ constructors.add(c);
+ }
+ }
+ }
+ }
+ return constructors;
+ }
+
+ /**
+ * Gets constructors with a given meta-annotated parameter
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param metaAnnotationType The parameter meta-annotation type
+ * @return A list of matching constructors. An empty list is returned if no
+ * matches are found
+ */
+ public static <T> List<Constructor<T>> getConstructorsForMetaAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> metaAnnotationType)
+ {
+ List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
+ for (Constructor<?> constructor : clazz.getConstructors())
+ {
+ for (Annotation[] annotations : constructor.getParameterAnnotations())
+ {
+ for (Annotation annotation : annotations)
+ {
+ if (annotation.annotationType().isAnnotationPresent(metaAnnotationType))
+ {
+ @SuppressWarnings("unchecked")
+ Constructor<T> c = (Constructor<T>) constructor;
+ constructors.add(c);
+ }
+ }
+ }
+ }
+ return constructors;
+ }
+
+ /**
+ * Checks if all annotations types are in a given set of annotations
+ *
+ * @param annotations The annotation set
+ * @param annotationTypes The annotation types to match
+ * @return True if match, false otherwise
+ */
+ public static boolean annotationTypeSetMatches(Set<Class<? extends Annotation>> annotations, Class<? extends Annotation>... annotationTypes)
+ {
+ List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
+ annotationTypeList.addAll(Arrays.asList(annotationTypes));
+ for (Class<? extends Annotation> annotation : annotations)
+ {
+ if (annotationTypeList.contains(annotation))
+ {
+ annotationTypeList.remove(annotation);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return annotationTypeList.size() == 0;
+ }
+
+ /**
+ * Checks if all annotations are in a given set of annotations
+ *
+ * @param annotations The annotation set
+ * @param annotationTypes The annotations to match
+ * @return True if match, false otherwise
+ */
+ public static boolean annotationSetMatches(Set<Annotation> annotations, Class<? extends Annotation>... annotationTypes)
+ {
+ List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
+ annotationTypeList.addAll(Arrays.asList(annotationTypes));
+ for (Annotation annotation : annotations)
+ {
+ if (annotationTypeList.contains(annotation.annotationType()))
+ {
+ annotationTypeList.remove(annotation.annotationType());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return annotationTypeList.size() == 0;
+ }
+
+ /**
+ * Gets the actual type arguments of a class
+ *
+ * @param clazz The class to examine
+ * @return The type arguments
+ */
+ public static Type[] getActualTypeArguments(Class<?> clazz)
+ {
+ if (clazz.getGenericSuperclass() instanceof ParameterizedType)
+ {
+ return ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments();
+ }
+ else
+ {
+ return new Type[0];
+ }
+ }
+
+ /**
+ * Checks if raw type is array type
+ *
+ * @param rawType The raw type to check
+ * @return True if array, false otherwise
+ */
+ public static boolean isArrayType(Class<?> rawType)
+ {
+ return rawType.isArray();
+ }
+
+ /**
+ * Checks if type is parameterized type
+ *
+ * @param type The type to check
+ * @return True if parameterized, false otherwise
+ */
+ public static boolean isParameterizedType(Class<?> type)
+ {
+ return type.getTypeParameters().length > 0;
+ }
+
+ /**
+ * Invokes a method and wraps exceptions
+ *
+ * @param method The method to invoke
+ * @param instance The instance to invoke on
+ * @param parameters The parameters
+ * @return The return value
+ */
+ public static Object invokeAndWrap(Method method, Object instance, Object... parameters)
+ {
+ try
+ {
+ method.setAccessible(true);
+ return method.invoke(instance, parameters);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ }
+
+ /**
+ * Gets value of a field and wraps exceptions
+ *
+ * @param field The field to set on
+ * @param target The instance to set on
+ * @return The value to set
+ */
+ public static Object getAndWrap(Field field, Object target)
+ {
+ try
+ {
+ return field.get(target);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ExecutionException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ExecutionException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ }
+ }
+
+ /**
+ * Looks up a method in the type hierarchy of an instance
+ *
+ * @param method The method to look for
+ * @param instance The instance to start from
+ * @return The method found, or an NoSuchMethodException if it is not found
+ */
+ public static Method lookupMethod(Method method, Object instance)
+ {
+ for (Class<? extends Object> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass())
+ {
+ try
+ {
+ Method targetMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ if (!targetMethod.isAccessible())
+ {
+ targetMethod.setAccessible(true);
+ }
+ return targetMethod;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // Expected, nothing to see here.
+ }
+ }
+ throw new IllegalArgumentException("Method " + method.getName() + " not implemented by instance");
+ }
+
+ /**
+ * Indicates if an instance is a Javassist proxy
+ *
+ * @param instance The instance to examine
+ * @return True if proxy, false otherwise
+ */
+ public static boolean isProxy(Object instance)
+ {
+ return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
+ }
+
+ /**
+ * Gets the type hierarchy for a class
+ *
+ * A recursive function that adds the class to the set of type and then calls
+ * itself with the suprerclass as paramater until the top of the hierarchy is
+ * reached. For each steps, adds all interfaces of the class to the set.
+ * Since the data structure is a set, duplications are eliminated
+ *
+ * @param clazz The class to examine
+ * @return The set of classes and interfaces in the hierarchy
+ * @see #getTypeHierachy(Class, Set)
+ */
+ public static Set<Class<?>> getTypeHierachy(Class<?> clazz)
+ {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ getTypeHierachy(clazz, classes);
+ return classes;
+ }
+
+ /**
+ * Gets the flattened type hierarchy for a class, including all super classes
+ * and the entire interface type hierarchy
+ *
+ * @param clazz the class to examine
+ * @param classes the set of types
+ */
+ public static void getTypeHierachy(Class<?> clazz, Set<? super Class<?>> classes)
+ {
+ if (clazz != null)
+ {
+ classes.add(clazz);
+ getTypeHierachy(clazz.getSuperclass(), classes);
+ for (Class<?> c : clazz.getInterfaces())
+ {
+ getTypeHierachy(c, classes);
+ }
+ }
+ }
+
+ /**
+ * Checks the bindingType to make sure the annotation was declared properly
+ * as a binding type (annotated with @BindingType).
+ *
+ * @param bindingType The binding type to check
+ * @return true only if the annotation is really a binding type
+ */
+ public static boolean isBindingType(Annotation bindingType)
+ {
+ boolean isBindingAnnotation = false;
+ if (bindingType.annotationType().isAnnotationPresent(BindingType.class))
+ {
+ isBindingAnnotation = true;
+ }
+ return isBindingAnnotation;
+ }
+
+ public static boolean isSerializable(Class<?> clazz)
+ {
+ return getTypeHierachy(clazz).contains(Serializable.class) || clazz.isPrimitive();
+ }
+
+}
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy (from rev 1287, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy)
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml
===================================================================
--- ri/trunk/webbeans-ri/unit-tests.xml 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,47 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="Web Beans RI" verbose="1" >
-
- <test name="Web Beans RI">
- <groups>
- <run>
-<!--
- <exclude name="specialization" />
- <exclude name="deployment" />
- <exclude name="disposalMethod" />
-
- <exclude name="observerMethod" />
- <exclude name="deferredEvent" />
- <exclude name="ejb3" />
- <exclude name="webservice" />
- <exclude name="annotationDefinition" />
- <exclude name="webbeansxml" />
- <exclude name="el" />
- <exclude name="jms" />
- <exclude name="interceptors" />
- <exclude name="decorators" />
- <exclude name="servlet" />
-
- <exclude name="passivation" />
- <exclude name="singletons" />
- <exclude name="ejbjarxml" />
- <exclude name="beanDestruction" />
- <exclude name="commonAnnotations" />
--->
- <exclude name="stub" />
- <exclude name="broken" />
- </run>
- </groups>
- <packages>
- <package name="org.jboss.webbeans.test.examples" />
- <package name="org.jboss.webbeans.test.unit.bootstrap" />
- <package name="org.jboss.webbeans.test.unit.context" />
- <package name="org.jboss.webbeans.test.unit.definition" />
- <package name="org.jboss.webbeans.test.unit.event" />
- <package name="org.jboss.webbeans.test.unit.implementation" />
- <package name="org.jboss.webbeans.test.unit.lookup" />
- <package name="org.jboss.webbeans.test.unit.lookup.circular" />
- </packages>
- </test>
-
-</suite>
\ No newline at end of file
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml (from rev 1287, ri/trunk/webbeans-ri/unit-tests.xml)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri/unit-tests.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,49 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="Web Beans RI" verbose="1" >
+
+ <test name="Web Beans RI">
+ <groups>
+ <run>
+<!--
+ <exclude name="specialization" />
+ <exclude name="deployment" />
+ <exclude name="disposalMethod" />
+
+ <exclude name="observerMethod" />
+ <exclude name="deferredEvent" />
+ <exclude name="ejb3" />
+ <exclude name="webservice" />
+ <exclude name="annotationDefinition" />
+ <exclude name="webbeansxml" />
+ <exclude name="el" />
+ <exclude name="jms" />
+ <exclude name="interceptors" />
+ <exclude name="decorators" />
+ <exclude name="servlet" />
+
+ <exclude name="passivation" />
+ <exclude name="singletons" />
+ <exclude name="ejbjarxml" />
+ <exclude name="beanDestruction" />
+ <exclude name="commonAnnotations" />
+-->
+ <exclude name="stub" />
+ <exclude name="broken" />
+ </run>
+ </groups>
+ <packages>
+ <package name="org.jboss.webbeans.test.examples" />
+ <package name="org.jboss.webbeans.test.unit.bootstrap" />
+ <package name="org.jboss.webbeans.test.unit.context" />
+ <package name="org.jboss.webbeans.test.unit.definition" />
+ <package name="org.jboss.webbeans.test.unit.event" />
+ <package name="org.jboss.webbeans.test.unit.implementation" />
+ <package name="org.jboss.webbeans.test.unit.implementation.proxy" />
+ <package name="org.jboss.webbeans.test.unit.implementation.exceptions" />
+ <package name="org.jboss.webbeans.test.unit.lookup" />
+ <package name="org.jboss.webbeans.test.unit.lookup.circular" />
+ </packages>
+ </test>
+
+</suite>
\ No newline at end of file
Deleted: ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml
===================================================================
--- ri/trunk/webbeans-ri-spi/pom.xml 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -1,42 +0,0 @@
-<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>parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-ri-spi</artifactId>
- <name>Web Beans RI Service Provider Interfaces</name>
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- <classifier>jdk15</classifier>
- </dependency>
-
- <dependency>
- <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- </dependency>
-
- </dependencies>
-
- <build>
- <defaultGoal>install</defaultGoal>
- </build>
-
-</project>
\ No newline at end of file
Copied: ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml (from rev 1291, ri/trunk/webbeans-ri-spi/pom.xml)
===================================================================
--- ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml (rev 0)
+++ ri/tags/1.0.0.ALPHA2/webbeans-ri-spi/pom.xml 2009-01-29 16:36:52 UTC (rev 1292)
@@ -0,0 +1,42 @@
+<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>parent</artifactId>
+ <groupId>org.jboss.webbeans</groupId>
+ <version>1.0.0.ALPHA2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri-spi</artifactId>
+ <name>Web Beans RI Service Provider Interfaces</name>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+
+</project>
\ No newline at end of file
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1291 - in ri/trunk: webbeans-api and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 11:36:41 -0500 (Thu, 29 Jan 2009)
New Revision: 1291
Modified:
ri/trunk/pom.xml
ri/trunk/webbeans-api/pom.xml
ri/trunk/webbeans-ri-spi/pom.xml
Log:
[maven-release-plugin] prepare release 1.0.0.ALPHA2
Modified: ri/trunk/pom.xml
===================================================================
--- ri/trunk/pom.xml 2009-01-29 16:35:16 UTC (rev 1290)
+++ ri/trunk/pom.xml 2009-01-29 16:36:41 UTC (rev 1291)
@@ -3,7 +3,7 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.ALPHA2</version>
<name>Web Beans</name>
<url>http://www.seamframework.org/WebBeans</url>
@@ -415,9 +415,9 @@
</licenses>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri</developerConnection>
- <url>http://fisheye.jboss.org/browse/WebBeans/ri</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.ALPHA2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.ALPHA2</developerConnection>
+ <url>http://fisheye.jboss.org/browse/WebBeans/ri/tags/1.0.0.ALPHA2</url>
</scm>
<distributionManagement>
Modified: ri/trunk/webbeans-api/pom.xml
===================================================================
--- ri/trunk/webbeans-api/pom.xml 2009-01-29 16:35:16 UTC (rev 1290)
+++ ri/trunk/webbeans-api/pom.xml 2009-01-29 16:36:41 UTC (rev 1291)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.ALPHA2</version>
</parent>
<groupId>org.jboss.webbeans</groupId>
Modified: ri/trunk/webbeans-ri-spi/pom.xml
===================================================================
--- ri/trunk/webbeans-ri-spi/pom.xml 2009-01-29 16:35:16 UTC (rev 1290)
+++ ri/trunk/webbeans-ri-spi/pom.xml 2009-01-29 16:36:41 UTC (rev 1291)
@@ -2,7 +2,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.ALPHA2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1290 - ri/trunk.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 11:35:16 -0500 (Thu, 29 Jan 2009)
New Revision: 1290
Modified:
ri/trunk/pom.xml
Log:
disable impl module to release api
Modified: ri/trunk/pom.xml
===================================================================
--- ri/trunk/pom.xml 2009-01-29 16:16:59 UTC (rev 1289)
+++ ri/trunk/pom.xml 2009-01-29 16:35:16 UTC (rev 1290)
@@ -73,7 +73,7 @@
<modules>
<module>webbeans-api</module>
- <module>webbeans-ri</module>
+<!-- <module>webbeans-ri</module>-->
<module>webbeans-ri-spi</module>
</modules>
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1289 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 11:16:59 -0500 (Thu, 29 Jan 2009)
New Revision: 1289
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Farm.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Horse.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Stable.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java
Log:
broken test for dependent object destruction
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java 2009-01-29 15:55:29 UTC (rev 1288)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java 2009-01-29 16:16:59 UTC (rev 1289)
@@ -535,11 +535,19 @@
* destroy all dependent objects of a Web Bean instance when the instance is
* destroyed,
*/
- @Test(groups = { "stub", "contexts", "beanDestruction" })
+ @Test(groups = { "broken", "contexts", "beanDestruction" })
@SpecAssertion(section = "8.3.2")
public void testDestroyingParentDestroysDependents()
{
- assert false;
+ deployBeans(Farm.class, Horse.class, Stable.class);
+ assert manager.resolveByType(Farm.class).size() == 1;
+ Bean<Farm> farmBean = manager.resolveByType(Farm.class).iterator().next();
+ Farm farm = manager.getInstanceByType(Farm.class);
+ Stable.destroyed = false;
+ Horse.destroyed = false;
+ farmBean.destroy(farm);
+ assert Stable.destroyed;
+ assert Horse.destroyed;
}
/**
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Farm.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Farm.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Farm.java 2009-01-29 16:16:59 UTC (rev 1289)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.tck.unit.context.dependent;
+
+import javax.context.RequestScoped;
+import javax.inject.Current;
+
+@RequestScoped
+public class Farm
+{
+
+ @Current Stable stable;
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Farm.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Horse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Horse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Horse.java 2009-01-29 16:16:59 UTC (rev 1289)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.tck.unit.context.dependent;
+
+import javax.annotation.PreDestroy;
+
+class Horse
+{
+
+ public static boolean destroyed;
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ destroyed = true;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Horse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Stable.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Stable.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Stable.java 2009-01-29 16:16:59 UTC (rev 1289)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.tck.unit.context.dependent;
+
+import javax.annotation.PreDestroy;
+import javax.inject.Current;
+
+class Stable
+{
+
+ @Current Horse horse;
+
+ public static boolean destroyed;
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ destroyed = true;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/Stable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1288 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 10:55:29 -0500 (Thu, 29 Jan 2009)
New Revision: 1288
Modified:
doc/trunk/reference/en-US/master.xml
Log:
Note the name change
Modified: doc/trunk/reference/en-US/master.xml
===================================================================
--- doc/trunk/reference/en-US/master.xml 2009-01-29 15:48:43 UTC (rev 1287)
+++ doc/trunk/reference/en-US/master.xml 2009-01-29 15:55:29 UTC (rev 1288)
@@ -6,6 +6,18 @@
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <preface>
+ <title>Note</title>
+ <para>
+ JSR-299 has recently changed it's name from "Web Beans" to "Java
+ Contexts and Dependency Injection". The reference guide still refers
+ to JSR-299 as "Web Beans" and the JSR-299 Reference Implementation as
+ the "Web Beans RI". Other documentation, blogs, forum posts etc. may
+ use the new nomenclature, including the new name for the JSR-299
+ Reference Implementation - "Web Beans".
+ </para>
+ </preface>
+
<toc/>
<part>
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1287 - examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 10:48:43 -0500 (Thu, 29 Jan 2009)
New Revision: 1287
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/Foo.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/ProxyTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/FooConsumer.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/Generator.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/NumberConsumer.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/SerializableFoo.java
Modified:
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/readme.txt
ri/trunk/dist/readme.txt
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/webbeans-ri/unit-tests.xml
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
Log:
WBRI-122, tests for passivation and associated fixes
Modified: examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-01-29 15:31:43 UTC (rev 1286)
+++ examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -22,7 +22,7 @@
private int smallest;
@MaxNumber
- private transient int maxNumber;
+ private int maxNumber;
private int biggest;
private int remainingGuesses;
Modified: examples/trunk/readme.txt
===================================================================
--- examples/trunk/readme.txt 2009-01-29 15:31:43 UTC (rev 1286)
+++ examples/trunk/readme.txt 2009-01-29 15:48:43 UTC (rev 1287)
@@ -1,4 +1,4 @@
-The Web Beans RI currently comes with a two examples, webbeans-numberguess (a
+Web Beans currently comes with a two examples, webbeans-numberguess (a
war example) and webbeans-translator (an EJB example). Before running the
examples, you'll need to ensure your server supports Web Beans.
Modified: ri/trunk/dist/readme.txt
===================================================================
--- ri/trunk/dist/readme.txt 2009-01-29 15:31:43 UTC (rev 1286)
+++ ri/trunk/dist/readme.txt 2009-01-29 15:48:43 UTC (rev 1287)
@@ -1,14 +1,14 @@
-Web Beans RI
+Web Beans
------------
-Web Beans (JSR-299) is a new Java standard for dependency injection and
-contextual lifecycle management.
+Java Contexts and Dependency Injection (JSR-299) is a new Java standard for
+dependency injection and contextual lifecycle management. Web Beans is the
+reference implementation of JSR-299.
This distribution, as a whole, is licensed under the terms of the FSF Lesser Gnu
Public License (see lgpl.txt). Parts of it are licensed under the Apache Public
-License (see apl.txt). In particular, the Web Beans API and the Web Beans RI
-runtimes are licensed under the APL. At least these parts are licensed under the
-APL:
+License (see apl.txt). In particular, the API and the Web Beans runtime are
+licensed under the APL. At least these parts are licensed under the APL:
* src/webbeans-ri/main/**/*
* src/webbeans-api/main/**/*
@@ -20,12 +20,12 @@
This distribution consists of:
doc/
- -- The Web Beans Reference guide, take a look at doc/en/html/index.html for
- getting started using Web Beans and the Web Beans RI
+ -- The Reference guide, take a look at doc/en/html/index.html for getting
+ started using Web Beans and the facilities offered by JSR-299.
examples/
- -- The Web Beans RI examples, the examples are described in more detail in
- the reference guide
+ -- The Web Beans examples, the examples are described in more detail in the
+ reference guide
jboss-as/
-- Installer for JBoss AS, change into this directory, and run ant update
@@ -35,9 +35,8 @@
-- Libraries for building the examples
lib/webbeans
- -- The Web Beans RI and API jars, for use outside of JBoss AS
+ -- The Web Beans and API jars, for use outside of JBoss AS
src/
- -- The sources of the Web Beans RI, including src/webbeans-api,
- src/webbeans-ri and src/reference. To build the sources, just type mvn in
- the subdirectory.
+ -- The sources of Web Beans, including src/webbeans-api, src/webbeans-ri and
+ src/reference. To build the sources, just type mvn in the subdirectory.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-29 15:31:43 UTC (rev 1286)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -17,6 +17,7 @@
package org.jboss.webbeans.bean;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Arrays;
@@ -109,6 +110,8 @@
// The Web Beans manager
protected ManagerImpl manager;
+ protected boolean _serializable;
+
/**
* Constructor
*
@@ -145,6 +148,7 @@
checkDeploymentType();
initScopeType();
initTypes();
+ initSerializable();
initProxyable();
checkRequiredTypesImplemented();
}
@@ -507,9 +511,13 @@
@Override
public boolean isSerializable()
{
- // TODO: OK?
- return true;
+ return _serializable;
}
+
+ protected void initSerializable()
+ {
+ _serializable = isPrimitive() || getTypes().contains(Serializable.class);
+ }
/**
* Gets a string representation
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 15:31:43 UTC (rev 1286)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -204,7 +204,7 @@
{
if (injectionPoint.getMember() instanceof Field)
{
- if (!Reflections.isTransient(injectionPoint.getMember()) || !isSerializable())
+ if (!Reflections.isTransient(injectionPoint.getMember()) && !Reflections.isSerializable(instance.getClass()))
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
}
@@ -280,6 +280,12 @@
return;
}
}
+
+ @Override
+ protected void initSerializable()
+ {
+ _serializable = true;
+ }
/**
* Gets the receiver of the product
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-01-29 15:31:43 UTC (rev 1286)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -555,7 +555,7 @@
public static boolean isSerializable(Class<?> clazz)
{
- return getTypeHierachy(clazz).contains(Serializable.class);
+ return getTypeHierachy(clazz).contains(Serializable.class) || clazz.isPrimitive();
}
}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/Foo.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/Foo.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/Foo.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.unit.implementation.proxy;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.RequestScoped;
+
+@Named
+@RequestScoped
+class Foo implements Serializable
+{
+
+ public String getMsg()
+ {
+ return "Hi";
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/ProxyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/ProxyTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/ProxyTest.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.unit.implementation.proxy;
+
+import org.jboss.webbeans.test.unit.AbstractTest;
+import org.testng.annotations.Test;
+
+public class ProxyTest extends AbstractTest
+{
+
+ @Test(description="WBRI-122")
+ public void testImplementationClassImplementsSerializable()
+ {
+ deployBeans(Foo.class);
+ manager.getInstanceByName("foo");
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/proxy/ProxyTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/unit-tests.xml
===================================================================
--- ri/trunk/webbeans-ri/unit-tests.xml 2009-01-29 15:31:43 UTC (rev 1286)
+++ ri/trunk/webbeans-ri/unit-tests.xml 2009-01-29 15:48:43 UTC (rev 1287)
@@ -39,6 +39,8 @@
<package name="org.jboss.webbeans.test.unit.definition" />
<package name="org.jboss.webbeans.test.unit.event" />
<package name="org.jboss.webbeans.test.unit.implementation" />
+ <package name="org.jboss.webbeans.test.unit.implementation.proxy" />
+ <package name="org.jboss.webbeans.test.unit.implementation.exceptions" />
<package name="org.jboss.webbeans.test.unit.lookup" />
<package name="org.jboss.webbeans.test.unit.lookup.circular" />
</packages>
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/FooConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/FooConsumer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/FooConsumer.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.unit.context.passivating;
+
+import javax.context.RequestScoped;
+import javax.inject.Current;
+
+@RequestScoped
+class FooConsumer
+{
+
+ @Current SerializableFoo foo;
+
+ public void ping(){};
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/FooConsumer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/Generator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/Generator.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/Generator.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.tck.unit.context.passivating;
+
+
+import java.io.Serializable;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Produces;
+
+@ApplicationScoped
+class Generator implements Serializable
+{
+
+ private static final long serialVersionUID = -7213673465118041882L;
+
+ private int number = 100;
+
+ @Produces int getNumber()
+ {
+ return number;
+ }
+
+ @Produces SerializableFoo getFoo()
+ {
+ return new SerializableFoo();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/Generator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/NumberConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/NumberConsumer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/NumberConsumer.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.unit.context.passivating;
+
+import javax.context.RequestScoped;
+import javax.inject.Current;
+
+@RequestScoped
+class NumberConsumer
+{
+
+ @Current int number;
+
+ public void ping(){};
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/NumberConsumer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-01-29 15:31:43 UTC (rev 1286)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -47,6 +47,20 @@
{
createSimpleBean(Jyvaskyla.class);
}
+
+ @Test @SpecAssertion(section="8.4")
+ public void testInjectionOfDependentSerializableProductIntoNormalBean()
+ {
+ deployBeans(Generator.class, NumberConsumer.class);
+ manager.getInstanceByType(NumberConsumer.class).ping();
+ }
+
+ @Test @SpecAssertion(section="8.4")
+ public void testInjectionOfDependentPrimitiveProductIntoNormalBean()
+ {
+ deployBeans(Generator.class, FooConsumer.class);
+ manager.getInstanceByType(FooConsumer.class).ping();
+ }
/**
* the Web Bean declares a passivating scope type, and context passivation
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/SerializableFoo.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/SerializableFoo.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/SerializableFoo.java 2009-01-29 15:48:43 UTC (rev 1287)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.unit.context.passivating;
+
+import java.io.Serializable;
+
+public class SerializableFoo implements Serializable
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/SerializableFoo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1286 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 10:31:43 -0500 (Thu, 29 Jan 2009)
New Revision: 1286
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java
Log:
Java5 compatibility
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java 2009-01-29 14:58:35 UTC (rev 1285)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java 2009-01-29 15:31:43 UTC (rev 1286)
@@ -12,7 +12,6 @@
this.stringValue = value;
}
- @Override
public String value()
{
return this.stringValue;
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1285 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 09:58:35 -0500 (Thu, 29 Jan 2009)
New Revision: 1285
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
Log:
Put the serializability check in the right place!
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 14:40:51 UTC (rev 1284)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 14:58:35 UTC (rev 1285)
@@ -200,11 +200,11 @@
{
return;
}
- if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()) && !isSerializable())
+ if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()))
{
if (injectionPoint.getMember() instanceof Field)
{
- if (!Reflections.isTransient(injectionPoint.getMember()))
+ if (!Reflections.isTransient(injectionPoint.getMember()) || !isSerializable())
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
}
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1284 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-29 09:40:51 -0500 (Thu, 29 Jan 2009)
New Revision: 1284
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
Log:
check if the product is serializable!
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 13:33:26 UTC (rev 1283)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-29 14:40:51 UTC (rev 1284)
@@ -200,13 +200,13 @@
{
return;
}
- if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()))
+ if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean()) && !isSerializable())
{
if (injectionPoint.getMember() instanceof Field)
{
if (!Reflections.isTransient(injectionPoint.getMember()))
{
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans");
+ throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
}
}
else if (injectionPoint.getMember() instanceof Method)
15 years, 11 months
[webbeans-commits] Webbeans SVN: r1283 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-01-29 08:33:26 -0500 (Thu, 29 Jan 2009)
New Revision: 1283
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeA.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeABinding.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeB.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeBBinding.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeC.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
Log:
Added a few more test implementations for EventTest and fixed a bug with observer resolution.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-29 10:11:32 UTC (rev 1282)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -24,6 +24,7 @@
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -228,6 +229,11 @@
throw new IllegalArgumentException("Not a binding type " + annotation);
}
}
+ HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(Arrays.asList(bindings));
+ if (bindingAnnotations.size() < bindings.length)
+ {
+ throw new DuplicateBindingTypeException("Duplicate binding types: " + bindings);
+ }
for (Type type : element.getActualTypeArguments())
{
if (type instanceof WildcardType)
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeA.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeA.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeA.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface BindingTypeA
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeA.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeABinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeABinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeABinding.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,5 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import javax.inject.AnnotationLiteral;
+
+public class BindingTypeABinding extends AnnotationLiteral<BindingTypeA> implements BindingTypeA {}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeABinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeB.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeB.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeB.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface BindingTypeB
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeBBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeBBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeBBinding.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,5 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import javax.inject.AnnotationLiteral;
+
+public class BindingTypeBBinding extends AnnotationLiteral<BindingTypeB> implements BindingTypeB {}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeBBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeC.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeC.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeC.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface BindingTypeC
+{
+ public String value();
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeC.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.tck.unit.event;
+
+import javax.inject.AnnotationLiteral;
+
+public class BindingTypeCBinding extends AnnotationLiteral<BindingTypeC> implements BindingTypeC
+{
+
+ private String stringValue;
+
+ public BindingTypeCBinding(String value)
+ {
+ this.stringValue = value;
+ }
+
+ @Override
+ public String value()
+ {
+ return this.stringValue;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/BindingTypeCBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java 2009-01-29 10:11:32 UTC (rev 1282)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java 2009-01-29 13:33:26 UTC (rev 1283)
@@ -25,7 +25,7 @@
* @author Nicklas Karlsson
* @author David Allen
*
- * Spec version: PRD2
+ * Spec version: PRD2
*/
public class EventTest extends AbstractTest
{
@@ -67,6 +67,16 @@
}
}
+ public static class AnotherListObserver implements Observer<ArrayList<Integer>>
+ {
+ public boolean wasNotified = false;
+
+ public void notify(ArrayList<Integer> event)
+ {
+ wasNotified = true;
+ }
+ }
+
public static class AnObserverWithException implements Observer<AnEventType>
{
public boolean wasNotified = false;
@@ -848,25 +858,41 @@
assert false;
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.7")
public void testEventObjectContainsTypeVariablesWhenResolvingFails()
{
- assert false;
+ eventObjectContainsTypeVariables(new ArrayList<String>());
}
- @Test(groups = { "stub", "events" })
+ private <E> void eventObjectContainsTypeVariables(ArrayList<E> eventToFire)
+ {
+ @SuppressWarnings("unused")
+ Set<?> resolvedObservers = manager.resolveObservers(eventToFire);
+ }
+
+ @Test(groups = { "broken", "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.7")
public void testEventObjectContainsWildcardsWhenResolvingFails()
{
- assert false;
+ eventObjectContainsWildcards(new ArrayList<String>());
}
- @Test(groups = { "stub", "events" })
+ private void eventObjectContainsWildcards(ArrayList<? extends Object> eventToFire)
+ {
+ @SuppressWarnings("unused")
+ //TODO There does not seem to be a way to get wildcarded types pass through
+ Set<?> resolvedObservers = manager.resolveObservers(eventToFire);
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.7")
public void testDuplicateBindingTypesWhenResolvingFails()
{
- assert false;
+ AnObserver observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class, new BindingTypeABinding());
+ @SuppressWarnings("unused")
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new BindingTypeABinding(), new BindingTypeABinding());
}
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@@ -893,34 +919,48 @@
assert emptyObserverSet.isEmpty();
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "broken", "events" })
@SpecAssertion(section = "7.7")
public void testResolvingChecksTypeParameters()
{
AListObserver observer = new AListObserver();
+ AnotherListObserver anotherObserver = new AnotherListObserver();
manager.addObserver(observer, new TypeLiteral<ArrayList<String>>()
{
});
- Set<Observer<ArrayList<String>>> resolvedObservers = manager.resolveObservers(new ArrayList<String>(), new AnimalStereotypeAnnotationLiteral());
- assert !resolvedObservers.isEmpty();
+ manager.addObserver(anotherObserver, new TypeLiteral<ArrayList<Integer>>()
+ {
+ });
+ Set<Observer<ArrayList<String>>> resolvedObservers = manager.resolveObservers(new ArrayList<String>());
+ assert resolvedObservers.size() == 1;
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.7")
public void testResolvingChecksBindingTypes()
{
- assert false;
+ AnObserver observer = new AnObserver();
+ AnObserver anotherObserver = new AnObserver();
+ manager.addObserver(observer, AnEventType.class, new BindingTypeABinding());
+ manager.addObserver(anotherObserver, AnEventType.class, new BindingTypeBBinding());
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new BindingTypeABinding());
+ assert resolvedObservers.size() == 1;
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.7")
public void testResolvingChecksBindingTypeMembers()
{
- assert false;
+ AnObserver observer = new AnObserver();
+ AnObserver anotherObserver = new AnObserver();
+ manager.addObserver(observer, AnEventType.class, new BindingTypeCBinding("first-observer"));
+ manager.addObserver(anotherObserver, AnEventType.class, new BindingTypeCBinding("second-observer"));
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new BindingTypeCBinding("first-observer"));
+ assert resolvedObservers.size() == 1;
}
- @Test
- @SpecAssertion(section = "???")
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.")
public void testNonStaticObserverMethodNotInherited()
{
deployBeans(LazyFarmer.class);
15 years, 11 months