[jboss-cvs] JBossAS SVN: r75914 - in projects/ejb3/tags: jboss-ejb3-core-0.1.8 and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 16 07:06:37 EDT 2008
Author: ALRubinger
Date: 2008-07-16 07:06:36 -0400 (Wed, 16 Jul 2008)
New Revision: 75914
Added:
projects/ejb3/tags/jboss-ejb3-core-0.1.8/
projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
Removed:
projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java
projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
Log:
[maven-release-plugin] copy for tag jboss-ejb3-core-0.1.8
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8 (from rev 75881, projects/ejb3/trunk/core)
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,566 +0,0 @@
-<!--
- vi:ts=2:sw=2:expandtab
--->
-<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 -->
- <parent>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-build</artifactId>
- <version>0.13.10-SNAPSHOT</version>
- <relativePath>../build/pom.xml</relativePath>
- </parent>
-
- <!-- POM Model Version -->
- <modelVersion>4.0.0</modelVersion>
-
- <!-- Artifact Information -->
- <artifactId>jboss-ejb3-core</artifactId>
- <packaging>jar</packaging>
- <version>0.1.8-SNAPSHOT</version>
- <name>JBoss EJB 3.0 Core</name>
- <url>http://labs.jboss.com/jbossejb3</url>
- <description>JBoss EJB 3.0 Core</description>
-
- <repositories>
- <!-- APIviz repository -->
- <repository>
- <id>apiviz.release</id>
- <name>APIviz releases</name>
- <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
- <releases>
-
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <!-- Properties -->
-
- <properties>
- <version.org.jboss.jboss-as>5.0.0.Beta4</version.org.jboss.jboss-as>
- </properties>
-
- <!-- Build Information -->
- <build>
-
- <plugins>
-
- <!-- Assembly Plugin -->
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-1</version>
- <executions>
- <execution>
- <id>make-assembly</id><!-- this is used for inheritance merges -->
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- JBoss EJB3 Client JAR -->
- <descriptors>
- <descriptor>jboss-ejb3-client.xml</descriptor>
- </descriptors>
- <attach>true</attach>
- </configuration>
- <inherited>false</inherited>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
-<!--
- <executions>
- <execution>
- <id>attach-javadoc</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
--->
- <configuration>
- <doclet>net.gleamynode.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>net.gleamynode.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.0.3</version>
- </docletArtifact>
-<!--
- <aggregate>true</aggregate>
- <encoding>UTF-8</encoding>
- <locale>en_US</locale>
--->
- </configuration>
- </plugin>
-
- </plugins>
-
- </build>
-
- <!-- Dependencies -->
-
- <dependencies>
-
- <!-- Because AOP doesn't declare a proper dependency -->
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.7.1.GA</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.soap</groupId>
- <artifactId>saaj-api</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossjta</artifactId>
- <version>4.3.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- <!-- To actually run SimpleTransactionService -->
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossts-common</artifactId>
- <version>4.3.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.6.ga</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.3.1.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.3.2.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-javaee</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-server-manager</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-transaction-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>2.0.0.Beta13</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.naming</groupId>
- <artifactId>jnpserver</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop-aspects</artifactId>
- </dependency>
-
- <!-- used in the basicbootstrap-beans.xml -->
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop-deployer-jdk50</artifactId>
- <version>2.0.0.CR10</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <!-- not used anywhere else -->
- <version>2.1.1.GA</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-javaee</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-aspects-test</artifactId>
- <version>1.0.0.Beta1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-remoting-aspects</artifactId>
- <version>1.0.1.CR2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-client</artifactId>
- <version>1.1.0.CR1</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-remoting-aspects</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-server-api</artifactId>
- <version>1.1.0.CR1</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-pojo</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-async</artifactId>
- <version>0.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-cache</artifactId>
- <version>0.13.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-common</artifactId>
- <version>0.1.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-security</artifactId>
- <version>0.13.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>0.4</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api-impl</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-interceptors</artifactId>
- <version>0.13.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-metadata</artifactId>
- <version>0.12.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-test</artifactId>
- <version>0.1.2-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-transactions</artifactId>
- <version>0.13.2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded</artifactId>
- <version>beta3</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jacc-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jca-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jms-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
- </dependency>
-
- <!-- those needs to be removed - EJBTHREE-1340 -->
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-main</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-system</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-system-jmx</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-mbeans</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-test</artifactId>
- </exclusion>
- </exclusions>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-j2se</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- this needs to be removed - EJBTHREE-1343 -->
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>${version.org.jboss.jboss-as}</version>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-remoting</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-metadata</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-security</artifactId>
- </exclusion>
- </exclusions>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.jpa</groupId>
- <artifactId>jboss-jpa-deployers</artifactId>
- <version>0.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- <version>2.0.2.CR5</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- <version>2.0.2.CR5</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>quartz</groupId>
- <artifactId>quartz</artifactId>
- <version>1.6.0</version>
- </dependency>
-
- <dependency>
- <groupId>trove</groupId>
- <artifactId>trove</artifactId>
- </dependency>
-
- </dependencies>
-</project>
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml (from rev 75913, projects/ejb3/trunk/core/pom.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/pom.xml 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,572 @@
+<!--
+ vi:ts=2:sw=2:expandtab
+-->
+<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 -->
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-build</artifactId>
+ <version>0.13.10</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+
+ <!-- POM Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Information -->
+ <artifactId>jboss-ejb3-core</artifactId>
+ <packaging>jar</packaging>
+ <version>0.1.8</version>
+ <name>JBoss EJB 3.0 Core</name>
+ <url>http://labs.jboss.com/jbossejb3</url>
+ <description>JBoss EJB 3.0 Core</description>
+
+ <repositories>
+ <!-- APIviz repository -->
+ <repository>
+ <id>apiviz.release</id>
+ <name>APIviz releases</name>
+ <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
+ <releases>
+
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <!-- Properties -->
+
+ <properties>
+ <version.org.jboss.jboss-as>5.0.0.Beta4</version.org.jboss.jboss-as>
+ </properties>
+
+ <!-- Build Information -->
+ <build>
+
+ <plugins>
+
+ <!-- Assembly Plugin -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-1</version>
+ <executions>
+ <execution>
+ <id>make-assembly</id><!-- this is used for inheritance merges -->
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- JBoss EJB3 Client JAR -->
+ <descriptors>
+ <descriptor>jboss-ejb3-client.xml</descriptor>
+ </descriptors>
+ <attach>true</attach>
+ </configuration>
+ <inherited>false</inherited>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+<!--
+ <executions>
+ <execution>
+ <id>attach-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+-->
+ <configuration>
+ <doclet>net.gleamynode.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>net.gleamynode.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.0.3</version>
+ </docletArtifact>
+<!--
+ <aggregate>true</aggregate>
+ <encoding>UTF-8</encoding>
+ <locale>en_US</locale>
+-->
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <!-- Dependencies -->
+
+ <dependencies>
+
+ <!-- Because AOP doesn't declare a proper dependency -->
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.7.1.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossjta</artifactId>
+ <version>4.3.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- To actually run SimpleTransactionService -->
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossts-common</artifactId>
+ <version>4.3.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.6.ga</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.2.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-javaee</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-transaction-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.0.0.Beta13</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnpserver</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop-aspects</artifactId>
+ </dependency>
+
+ <!-- used in the basicbootstrap-beans.xml -->
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop-deployer-jdk50</artifactId>
+ <version>2.0.0.CR10</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <!-- not used anywhere else -->
+ <version>2.1.1.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-javaee</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-aspects-test</artifactId>
+ <version>1.0.0.Beta1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-remoting-aspects</artifactId>
+ <version>1.0.1.CR2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-client</artifactId>
+ <version>1.1.0.CR1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-remoting-aspects</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-api</artifactId>
+ <version>1.1.0.CR1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-pojo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-async</artifactId>
+ <version>0.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-cache</artifactId>
+ <version>0.13.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-common</artifactId>
+ <version>0.1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-security</artifactId>
+ <version>0.13.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api</artifactId>
+ <version>0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api-impl</artifactId>
+ <version>0.4.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-interceptors</artifactId>
+ <version>0.13.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-metadata</artifactId>
+ <version>0.12.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-test</artifactId>
+ <version>0.1.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-transactions</artifactId>
+ <version>0.13.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.embedded</groupId>
+ <artifactId>jboss-embedded</artifactId>
+ <version>beta3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jacc-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jca-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jms-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-servlet-api</artifactId>
+ </dependency>
+
+ <!-- those needs to be removed - EJBTHREE-1340 -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-main</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-mbeans</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-j2se</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- this needs to be removed - EJBTHREE-1343 -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${version.org.jboss.jboss-as}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-security</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jpa</groupId>
+ <artifactId>jboss-jpa-deployers</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi</artifactId>
+ <version>2.0.2.CR5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>2.0.2.CR5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>trove</groupId>
+ <artifactId>trove</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-core-0.1.8</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-core-0.1.8</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-core-0.1.8</url>
+ </scm>
+</project>
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,697 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import javax.ejb.RemoteHome;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
-import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
-import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
-import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public abstract class BaseSessionProxyFactory implements SessionProxyFactory, Externalizable
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class);
-
- private static final String JNDI_NAME_SUFFIX_PROXY_FACTORY = "/ProxyFactory";
-
- private SessionSpecContainer container;
- protected String containerGuid;
- protected String containerClusterUid;
- protected boolean isClustered = false;
- protected String jndiName;
-
- /**
- * Proxy Constructor for the Business Interfaces' Proxy
- */
- protected Constructor<?> businessProxyConstructor;
-
- /**
- * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
- */
- protected Constructor<?> ejb21ProxyConstructor;
-
- private static final String METHOD_PREFIX_EJB21_CREATE = "create";
-
- public BaseSessionProxyFactory()
- {
- }
-
- protected BaseSessionProxyFactory(SessionSpecContainer container)
- {
- assert container != null : "container is null";
-
- setContainer(container);
- }
-
- public Object createHomeProxy()
- {
- throw new RuntimeException("NYI");
- }
-
- /**
- * Creates the Proxy constructors
- */
- protected void createProxyConstructors() throws Exception
- {
- // Obtain this bean class' CL
- ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
-
- // Create business proxy constructor
- Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
- this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
-
- // Create EJB21 proxy constructor
- Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
- if (ejb21Interfaces != null)
- {
- this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl);
- }
-
-
- /* plain jdk
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
- final Class<?>[] constructorParams =
- {InvocationHandler.class};
- businessProxyConstructor = proxyClass.getConstructor(constructorParams);
-
- */
-
- /* javassist */
- /*
- proxyFactory = new javassist.util.proxy.ProxyFactory()
- {
- @Override
- protected ClassLoader getClassLoader()
- {
- return container.getBeanClass().getClassLoader();
- }
- };
- proxyFactory.setInterfaces(interfaces);
- proxyFactory.setSuperclass(JavassistProxy.class);
- proxyClass = proxyFactory.createClass();
- proxyConstructor = proxyClass.getConstructor((Class[]) null);
- */
-
- /* cglib */
- /*
- proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
- final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class};
- proxyConstructor = proxyClass.getConstructor(constructorParams);
- */
- }
-
- protected void bindProxy(Object proxy) throws NamingException
- {
- try
- {
- //TODO Dev
-// // Bind the Proxy Factory if not yet bound
-// try
-// {
-// // Check if bound yet
-// Util.lookup(this.getJndiNameProxyFactory(), this.getClass());
-// }
-// // Proxy factory is not yet bound
-// catch(NameNotFoundException nnfe)
-// {
-// // Bind Proxy Factory
-// log.debug("Binding proxy factory " + this.toString() + " for " + this.getContainer().getEjbName()
-// + " in JNDI at " + this.getJndiNameProxyFactory());
-// Util.rebind(this.getContainer().getInitialContext(), this.getJndiNameProxyFactory(), this);
-// }
-// // Unexpected Exception
-// catch (Exception e)
-// {
-// throw new RuntimeException(e);
-// }
-
- // Bind the proxy itself
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName());
- Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy);
-
- // Bind a proxy per business interface
- //TODO This ugly block should be using polymorphism, but I'll allow it as the proxy mechanism
- // is going to be replaced entirely by EJB3 Proxy soon
- JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) container.getXml();
- BusinessRemotesMetaData remotes = smd.getBusinessRemotes();
- BusinessLocalsMetaData locals = smd.getBusinessLocals();
- Set<String> businessInterfaces = new HashSet<String>();
- boolean isLocal = this.isLocal();
- if (!isLocal)
- {
- if (remotes != null)
- {
- businessInterfaces.addAll(remotes);
- }
- }
- else
- {
- if (locals != null)
- {
- businessInterfaces.addAll(locals);
- }
- }
- for (String businessInterface : businessInterfaces)
- {
- String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessInterface);
- log.debug("Binding proxy for " + getContainer().getEjbName() + ", interface " + businessInterface
- + " in JNDI at " + jndiName);
- if(Proxy.isProxyClass(proxy.getClass()))
- {
- for(Class<?> in : proxy.getClass().getInterfaces())
- {
- log.debug("Proxy Interface for JNDI Name " + jndiName + ": " + in);
- }
- }
- Util.rebind(this.getContainer().getInitialContext(), jndiName, proxy);
- }
-
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind session proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName());
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- protected abstract boolean isLocal();
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- protected abstract boolean bindHomeAndBusinessTogether();
-
- protected Object constructProxyBusiness(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- protected Object constructEjb21Proxy(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Construct a new Proxy of the specified type using the
- * specified handler as argument to the Constructor
- *
- * @param handler
- * @param specType
- * @return
- */
- protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType)
- {
- // Initialize
- Object obj = null;
-
- try
- {
- // Business Proxy
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- obj = this.businessProxyConstructor.newInstance(handler);
- }
- // EJBObject/EJBLocalObject
- else if (specType.equals(SpecificationInterfaceType.EJB21))
- {
- // If there's no EJB21 View
- if (this.ejb21ProxyConstructor == null)
- {
- throw new IllegalStateException(
- "EJB3 Specification Violation Section 4.3.3: \""
- + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method.");
- }
-
- obj = this.ejb21ProxyConstructor.newInstance(handler);
- }
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- throw new RuntimeException(t);
- }
-
- // Ensure Proxy object was created
- assert obj != null : "Proxy Object must not be null";
-
- // Return
- return obj;
- }
-
-
- protected void setContainer(SessionSpecContainer container)
- {
- this.container = container;
- this.containerGuid = Ejb3Registry.guid(container);
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.isClustered = container.isClustered();
- }
-
- protected SessionSpecContainer getContainer()
- {
- if (container == null)
- {
- container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (container == null && isClustered)
- container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
- }
-
- return container;
- }
-
- /**
- * Obtains interfaces to be used in the business proxy
- *
- * @return
- */
- protected Class<?>[] getInterfacesForBusinessProxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- /**
- * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined
- *
- * @return
- */
- protected Class<?>[] getInterfacesForEjb21Proxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Returns an array of interfaces to be used for the proxy;
- * will return null if none are defined.
- *
- * @param accessType
- * @param specType
- * @return
- */
- private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
- {
-
- // Initialize
- Set<Class<?>> interfaces = new HashSet<Class<?>>();
- SessionContainer container = this.getContainer();
-
- // Initialize array of interfaces
- Set<Class<?>> intfs = new HashSet<Class<?>>();
-
- // If Local
- if (accessType.equals(ProxyAccessType.LOCAL))
- {
-
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container)));
-
- // If binding home with local business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
- }
- // If EJBLocalObject
- else
- {
- // Add local interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBLocalObject
- intfs.add(EJBLocalObject.class);
- }
- }
- // If remote
- else
- {
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container)));
-
- // If binding home with remote business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
-
- }
- // If EJBObject
- else
- {
- // Add remote interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBObject
- intfs.add(EJBObject.class);
- }
- }
-
- // Add all interfaces
- for (Class<?> interfaze : intfs)
- {
- interfaces.add(interfaze);
- }
-
- // Add JBossProxy
- interfaces.add(JBossProxy.class);
-
- // Return
- return interfaces.toArray(new Class[]
- {});
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- protected abstract ProxyAccessType getProxyAccessType();
-
- protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- abstract protected Handle createHandle();
-
- protected HomeHandle getHomeHandle()
- {
- EJBContainer ejbContainer = (EJBContainer)container;
-
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
-
- return homeHandle;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- protected abstract Class<?> getHomeType();
-
- protected final String getJndiName()
- {
- return this.jndiName;
- }
-
- public final String getJndiNameProxyFactory()
- {
- return this.getJndiName() + BaseSessionProxyFactory.JNDI_NAME_SUFFIX_PROXY_FACTORY;
- }
-
- protected EJBMetaData getEjbMetaData()
- {
- Class<?> remote = null;
- Class<?> home = null;
- Class<?> pkClass = Object.class;
- HomeHandleImpl homeHandle = null;
-
- EJBContainer ejbContainer = (EJBContainer)container;
-
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer());
- if (remotes != null && remotes.length > 0)
- {
- remote = remotes[0];
- }
- RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class);
- if (homeAnnotation != null)
- home = homeAnnotation.value();
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding());
-
- EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle);
-
- return metadata;
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- containerGuid = in.readUTF();
- containerClusterUid = in.readUTF();
- isClustered = in.readBoolean();
-
- if (getContainer() == null)
- throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeUTF(containerGuid);
- out.writeUTF(containerClusterUid);
- out.writeBoolean(isClustered);
- }
-
- /**
- * Ensures that an EJB 2.1 view is complete; the following rules apply:
- *
- * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined.
- * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined.
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateCompleteEjb21View(Class<?> home, Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure specified home is EJBHome or EJBLocalHome
- assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home)));
-
- // Ensure all interfaces passed are either EJBObject or EJBLocalObject
- for (Class<?> localOrRemoteInterface : localOrRemoteInterfaces)
- {
- assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class
- .isAssignableFrom(localOrRemoteInterface));
- }
-
- // If home is defined and there are no local/remote interfaces
- if (home != null && localOrRemoteInterfaces.length == 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home"
- + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/"
- + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized");
- }
-
- // If local/remote interfaces are defined, but no remote home
- if (home == null && localOrRemoteInterfaces.length != 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName()
- + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized");
- }
- }
-
- /**
- * Validates that the specified EJB2.1 Home interface returns only
- * valid remote/local interfaces from "create<METHOD>" methods. If no
- * home is defined, the method will return without further checks
- *
- * @param home
- */
- protected void validateHomeReturnsNoBusinessInterfaces(Class<?> home)
- {
- // Only perform if home is defined; otherwise no EJB2.1 view
- if(home==null)
- {
- return;
- }
-
- // Sanity checks
- assert EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home) : "Specified home interface, "
- + home.getName() + ", must be of type " + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName();
- assert home.isInterface() : "Specified home interface, " + home.getName() + " is not an interface.";
-
- // Initialize
- Set<Method> creates = new HashSet<Method>();
-
- // Obtain all "create<METHOD>" methods
- Method[] all = home.getDeclaredMethods();
-
- // For each method
- for (Method method : all)
- {
- // If a "create<METHOD>" method
- if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE))
- {
- // Add to the Set of Creates
- creates.add(method);
- }
- }
-
- // For all "create<METHOD>" methods
- for (Method create : creates)
- {
- // Init
- boolean isLocal = true;
-
- // Set as remote if applicable
- if (EJBHome.class.isAssignableFrom(home))
- {
- isLocal = false;
- }
-
- // If local (EJBLocalHome)
- if (isLocal)
- {
- // Validate return type is local interface
- if (!EJBLocalObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.10: "
- + "The return type for a create<METHOD> method must be"
- + " the session bean's local interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- // If remote (EJBHome)
- else
- {
- // Validate return type is remote interface
- if (!EJBObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.8: "
- + "The return type for a create<METHOD> method "
- + "must be the session bean’s remote interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- }
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateEjb21Views(Class<?> home,Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure EJB2.1 Views are complete (EJBTHREE-1075)
- this.validateCompleteEjb21View(home, localOrRemoteInterfaces);
-
- // Ensure EJB2.1 Home returns only local/remote interfaces
- this.validateHomeReturnsNoBusinessInterfaces(home);
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- */
- protected abstract void validateEjb21Views();
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,702 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
+import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
+import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public abstract class BaseSessionProxyFactory implements SessionProxyFactory, Externalizable
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class);
+
+ private static final String JNDI_NAME_SUFFIX_PROXY_FACTORY = "/ProxyFactory";
+
+ private SessionSpecContainer container;
+ protected String containerGuid;
+ protected String containerClusterUid;
+ protected boolean isClustered = false;
+ protected String jndiName;
+
+ /**
+ * Proxy Constructor for the Business Interfaces' Proxy
+ */
+ protected Constructor<?> businessProxyConstructor;
+
+ /**
+ * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
+ */
+ protected Constructor<?> ejb21ProxyConstructor;
+
+ private static final String METHOD_PREFIX_EJB21_CREATE = "create";
+
+ public BaseSessionProxyFactory()
+ {
+ }
+
+ protected BaseSessionProxyFactory(SessionSpecContainer container)
+ {
+ assert container != null : "container is null";
+
+ setContainer(container);
+ }
+
+ public Object createHomeProxy()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ /**
+ * Creates the Proxy constructors
+ */
+ protected void createProxyConstructors() throws Exception
+ {
+ // Obtain this bean class' CL
+ ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
+
+ // Create business proxy constructor
+ Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
+ this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
+
+ // Create EJB21 proxy constructor
+ Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
+ if (ejb21Interfaces != null)
+ {
+ this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl);
+ }
+
+
+ /* plain jdk
+ Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
+ final Class<?>[] constructorParams =
+ {InvocationHandler.class};
+ businessProxyConstructor = proxyClass.getConstructor(constructorParams);
+
+ */
+
+ /* javassist */
+ /*
+ proxyFactory = new javassist.util.proxy.ProxyFactory()
+ {
+ @Override
+ protected ClassLoader getClassLoader()
+ {
+ return container.getBeanClass().getClassLoader();
+ }
+ };
+ proxyFactory.setInterfaces(interfaces);
+ proxyFactory.setSuperclass(JavassistProxy.class);
+ proxyClass = proxyFactory.createClass();
+ proxyConstructor = proxyClass.getConstructor((Class[]) null);
+ */
+
+ /* cglib */
+ /*
+ proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
+ final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class};
+ proxyConstructor = proxyClass.getConstructor(constructorParams);
+ */
+ }
+
+ protected void bindProxy(Object proxy) throws NamingException
+ {
+ try
+ {
+ //TODO Dev
+// // Bind the Proxy Factory if not yet bound
+// try
+// {
+// // Check if bound yet
+// Util.lookup(this.getJndiNameProxyFactory(), this.getClass());
+// }
+// // Proxy factory is not yet bound
+// catch(NameNotFoundException nnfe)
+// {
+// // Bind Proxy Factory
+// log.debug("Binding proxy factory " + this.toString() + " for " + this.getContainer().getEjbName()
+// + " in JNDI at " + this.getJndiNameProxyFactory());
+// Util.rebind(this.getContainer().getInitialContext(), this.getJndiNameProxyFactory(), this);
+// }
+// // Unexpected Exception
+// catch (Exception e)
+// {
+// throw new RuntimeException(e);
+// }
+
+ // Bind the proxy itself
+ log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName());
+ Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy);
+
+ // Bind a proxy per business interface
+ //TODO This ugly block should be using polymorphism, but I'll allow it as the proxy mechanism
+ // is going to be replaced entirely by EJB3 Proxy soon
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) container.getXml();
+ BusinessRemotesMetaData remotes = smd.getBusinessRemotes();
+ BusinessLocalsMetaData locals = smd.getBusinessLocals();
+ Set<String> businessInterfaces = new HashSet<String>();
+ boolean isLocal = this.isLocal();
+ if (!isLocal)
+ {
+ if (remotes != null)
+ {
+ businessInterfaces.addAll(remotes);
+ }
+ }
+ else
+ {
+ if (locals != null)
+ {
+ businessInterfaces.addAll(locals);
+ }
+ }
+ for (String businessInterface : businessInterfaces)
+ {
+ String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessInterface);
+ log.debug("Binding proxy for " + getContainer().getEjbName() + ", interface " + businessInterface
+ + " in JNDI at " + jndiName);
+ if (Proxy.isProxyClass(proxy.getClass()))
+ {
+ for (Class<?> in : proxy.getClass().getInterfaces())
+ {
+ log.debug("Proxy Interface for JNDI Name " + jndiName + ": " + in);
+ }
+ }
+ Util.rebind(this.getContainer().getInitialContext(), jndiName, proxy);
+ }
+
+
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind session proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName());
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+
+ /**
+ * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
+ * is in place, but this keeps us moving forward easily.
+ *
+ * @deprecated Hack
+ * @return
+ */
+ @Deprecated
+ protected boolean isLocal()
+ {
+ return false;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ protected abstract boolean bindHomeAndBusinessTogether();
+
+ protected Object constructProxyBusiness(InvocationHandler handler)
+ {
+ // Return
+ return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS);
+ }
+
+ protected Object constructEjb21Proxy(InvocationHandler handler)
+ {
+ // Return
+ return this.constructProxy(handler, SpecificationInterfaceType.EJB21);
+ }
+
+ /**
+ * Construct a new Proxy of the specified type using the
+ * specified handler as argument to the Constructor
+ *
+ * @param handler
+ * @param specType
+ * @return
+ */
+ protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType)
+ {
+ // Initialize
+ Object obj = null;
+
+ try
+ {
+ // Business Proxy
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ obj = this.businessProxyConstructor.newInstance(handler);
+ }
+ // EJBObject/EJBLocalObject
+ else if (specType.equals(SpecificationInterfaceType.EJB21))
+ {
+ // If there's no EJB21 View
+ if (this.ejb21ProxyConstructor == null)
+ {
+ throw new IllegalStateException(
+ "EJB3 Specification Violation Section 4.3.3: \""
+ + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method.");
+ }
+
+ obj = this.ejb21ProxyConstructor.newInstance(handler);
+ }
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if (t instanceof RuntimeException)
+ throw (RuntimeException) t;
+ throw new RuntimeException(t);
+ }
+
+ // Ensure Proxy object was created
+ assert obj != null : "Proxy Object must not be null";
+
+ // Return
+ return obj;
+ }
+
+
+ protected void setContainer(SessionSpecContainer container)
+ {
+ this.container = container;
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.containerClusterUid = Ejb3Registry.clusterUid(container);
+ this.isClustered = container.isClustered();
+ }
+
+ protected SessionSpecContainer getContainer()
+ {
+ if (container == null)
+ {
+ container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid);
+
+ if (container == null && isClustered)
+ container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
+ }
+
+ return container;
+ }
+
+ /**
+ * Obtains interfaces to be used in the business proxy
+ *
+ * @return
+ */
+ protected Class<?>[] getInterfacesForBusinessProxy()
+ {
+ return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS);
+ }
+
+ /**
+ * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined
+ *
+ * @return
+ */
+ protected Class<?>[] getInterfacesForEjb21Proxy()
+ {
+ return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
+ }
+
+ /**
+ * Returns an array of interfaces to be used for the proxy;
+ * will return null if none are defined.
+ *
+ * @param accessType
+ * @param specType
+ * @return
+ */
+ private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
+ {
+
+ // Initialize
+ Set<Class<?>> interfaces = new HashSet<Class<?>>();
+ SessionContainer container = this.getContainer();
+
+ // Initialize array of interfaces
+ Set<Class<?>> intfs = new HashSet<Class<?>>();
+
+ // If Local
+ if (accessType.equals(ProxyAccessType.LOCAL))
+ {
+
+ // If business
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container)));
+
+ // If binding home with local business
+ if(this.bindHomeAndBusinessTogether())
+ {
+ Class<?> home = this.getHomeType();
+ if (home != null)
+ {
+ intfs.add(home);
+ }
+ }
+ }
+ // If EJBLocalObject
+ else
+ {
+ // Add local interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
+
+ // If no interfaces
+ if (intfs.size() == 0)
+ {
+ return null;
+ }
+
+ // Add EJBLocalObject
+ intfs.add(EJBLocalObject.class);
+ }
+ }
+ // If remote
+ else
+ {
+ // If business
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container)));
+
+ // If binding home with remote business
+ if(this.bindHomeAndBusinessTogether())
+ {
+ Class<?> home = this.getHomeType();
+ if (home != null)
+ {
+ intfs.add(home);
+ }
+ }
+
+ }
+ // If EJBObject
+ else
+ {
+ // Add remote interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
+
+ // If no interfaces
+ if (intfs.size() == 0)
+ {
+ return null;
+ }
+
+ // Add EJBObject
+ intfs.add(EJBObject.class);
+ }
+ }
+
+ // Add all interfaces
+ for (Class<?> interfaze : intfs)
+ {
+ interfaces.add(interfaze);
+ }
+
+ // Add JBossProxy
+ interfaces.add(JBossProxy.class);
+
+ // Return
+ return interfaces.toArray(new Class[]
+ {});
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ protected abstract ProxyAccessType getProxyAccessType();
+
+ protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
+ {
+ proxy.setHandle(this.createHandle());
+ proxy.setHomeHandle(getHomeHandle());
+ proxy.setEjbMetaData(getEjbMetaData());
+ }
+
+ abstract protected Handle createHandle();
+
+ protected HomeHandle getHomeHandle()
+ {
+ EJBContainer ejbContainer = (EJBContainer)container;
+
+ HomeHandleImpl homeHandle = null;
+
+ RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
+
+ return homeHandle;
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ protected abstract Class<?> getHomeType();
+
+ protected final String getJndiName()
+ {
+ return this.jndiName;
+ }
+
+ public final String getJndiNameProxyFactory()
+ {
+ return this.getJndiName() + BaseSessionProxyFactory.JNDI_NAME_SUFFIX_PROXY_FACTORY;
+ }
+
+ protected EJBMetaData getEjbMetaData()
+ {
+ Class<?> remote = null;
+ Class<?> home = null;
+ Class<?> pkClass = Object.class;
+ HomeHandleImpl homeHandle = null;
+
+ EJBContainer ejbContainer = (EJBContainer)container;
+
+ Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer());
+ if (remotes != null && remotes.length > 0)
+ {
+ remote = remotes[0];
+ }
+ RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class);
+ if (homeAnnotation != null)
+ home = homeAnnotation.value();
+ RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding());
+
+ EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle);
+
+ return metadata;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ containerGuid = in.readUTF();
+ containerClusterUid = in.readUTF();
+ isClustered = in.readBoolean();
+
+ if (getContainer() == null)
+ throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(containerGuid);
+ out.writeUTF(containerClusterUid);
+ out.writeBoolean(isClustered);
+ }
+
+ /**
+ * Ensures that an EJB 2.1 view is complete; the following rules apply:
+ *
+ * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined.
+ * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined.
+ *
+ * @param home
+ * @param localOrRemoteInterfaces
+ * @throws RuntimeException
+ */
+ protected void validateCompleteEjb21View(Class<?> home, Class<?>[] localOrRemoteInterfaces) throws RuntimeException
+ {
+ // Ensure specified home is EJBHome or EJBLocalHome
+ assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home)));
+
+ // Ensure all interfaces passed are either EJBObject or EJBLocalObject
+ for (Class<?> localOrRemoteInterface : localOrRemoteInterfaces)
+ {
+ assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class
+ .isAssignableFrom(localOrRemoteInterface));
+ }
+
+ // If home is defined and there are no local/remote interfaces
+ if (home != null && localOrRemoteInterfaces.length == 0)
+ {
+ throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home"
+ + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/"
+ + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized");
+ }
+
+ // If local/remote interfaces are defined, but no remote home
+ if (home == null && localOrRemoteInterfaces.length != 0)
+ {
+ throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName()
+ + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized");
+ }
+ }
+
+ /**
+ * Validates that the specified EJB2.1 Home interface returns only
+ * valid remote/local interfaces from "create<METHOD>" methods. If no
+ * home is defined, the method will return without further checks
+ *
+ * @param home
+ */
+ protected void validateHomeReturnsNoBusinessInterfaces(Class<?> home)
+ {
+ // Only perform if home is defined; otherwise no EJB2.1 view
+ if(home==null)
+ {
+ return;
+ }
+
+ // Sanity checks
+ assert EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home) : "Specified home interface, "
+ + home.getName() + ", must be of type " + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName();
+ assert home.isInterface() : "Specified home interface, " + home.getName() + " is not an interface.";
+
+ // Initialize
+ Set<Method> creates = new HashSet<Method>();
+
+ // Obtain all "create<METHOD>" methods
+ Method[] all = home.getDeclaredMethods();
+
+ // For each method
+ for (Method method : all)
+ {
+ // If a "create<METHOD>" method
+ if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE))
+ {
+ // Add to the Set of Creates
+ creates.add(method);
+ }
+ }
+
+ // For all "create<METHOD>" methods
+ for (Method create : creates)
+ {
+ // Init
+ boolean isLocal = true;
+
+ // Set as remote if applicable
+ if (EJBHome.class.isAssignableFrom(home))
+ {
+ isLocal = false;
+ }
+
+ // If local (EJBLocalHome)
+ if (isLocal)
+ {
+ // Validate return type is local interface
+ if (!EJBLocalObject.class.isAssignableFrom(create.getReturnType()))
+ {
+ throw new RuntimeException("EJB 3 Core Specification Section 4.6.10: "
+ + "The return type for a create<METHOD> method must be"
+ + " the session bean's local interface type. " + home.getName() + " has method "
+ + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
+ }
+ }
+ // If remote (EJBHome)
+ else
+ {
+ // Validate return type is remote interface
+ if (!EJBObject.class.isAssignableFrom(create.getReturnType()))
+ {
+ throw new RuntimeException("EJB 3 Core Specification Section 4.6.8: "
+ + "The return type for a create<METHOD> method "
+ + "must be the session bean’s remote interface type. " + home.getName() + " has method "
+ + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
+ }
+ }
+ }
+ }
+
+ /**
+ * Validates that any EJB2.1 Views associated with this ProxyFactory
+ * are valid
+ *
+ * @param home
+ * @param localOrRemoteInterfaces
+ * @throws RuntimeException
+ */
+ protected void validateEjb21Views(Class<?> home,Class<?>[] localOrRemoteInterfaces) throws RuntimeException
+ {
+ // Ensure EJB2.1 Views are complete (EJBTHREE-1075)
+ this.validateCompleteEjb21View(home, localOrRemoteInterfaces);
+
+ // Ensure EJB2.1 Home returns only local/remote interfaces
+ this.validateHomeReturnsNoBusinessInterfaces(home);
+ }
+
+ /**
+ * Validates that any EJB2.1 Views associated with this ProxyFactory
+ * are valid
+ */
+ protected abstract void validateEjb21Views();
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,1037 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Local;
-import javax.ejb.LocalHome;
-import javax.ejb.Remote;
-import javax.ejb.RemoteHome;
-import javax.jws.WebService;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.KernelAbstraction;
-import org.jboss.ejb3.KernelAbstractionFactory;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.LocalHomeBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.annotation.RemoteHomeBinding;
-import org.jboss.ejb3.annotation.impl.LocalImpl;
-import org.jboss.ejb3.annotation.impl.RemoteImpl;
-import org.jboss.ejb3.common.lang.ClassHelper;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossEnterpriseBeanJndiNameResolver;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ProxyFactoryHelper
-{
- private static final Logger log = Logger.getLogger(ProxyFactoryHelper.class);
-
- private static String getEndpointInterface(Container container)
- {
- WebService ws = (javax.jws.WebService) ((EJBContainer) container).resolveAnnotation(javax.jws.WebService.class);
- if (ws != null)
- {
- return ws.endpointInterface();
- }
- return null;
- }
-
- /**
- *
- * @param container
- * @return the local interfaces of the container or an empty array
- */
- public static Class<?>[] getLocalAndBusinessLocalInterfaces(Container container)
- {
- // Initialize
- Set<Class<?>> localAndBusinessLocalInterfaces = new HashSet<Class<?>>();
-
- // Obtain Bean Class
- Class<?> beanClass = container.getBeanClass();
-
- // Obtain @Local
- Local localAnnotation = ((EJBContainer) container).getAnnotation(Local.class);
-
- // Obtain @LocalHome
- LocalHome localHomeAnnotation = ((EJBContainer) container).getAnnotation(LocalHome.class);
-
- // Obtain @Remote
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
-
- // Obtain Remote and Business Remote interfaces
- Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
-
- // Obtain all business interfaces from the bean class
- Set<Class<?>> businessInterfacesImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(beanClass);
-
- // Obtain all business interfaces directly implemented by the bean class (not including supers)
- Set<Class<?>> businessInterfacesDirectlyImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(
- beanClass, false);
-
- // Determine whether Stateful or Stateless
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // EJBTHREE-1127
- // Determine local interface from return value of "create" in Local Home
- if (localHomeAnnotation != null)
- {
- localAndBusinessLocalInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(localHomeAnnotation
- .value(), isStateless));
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
-
- // EJBTHREE-1062
- // EJB 3 Core Specification 4.6.6
- // If bean class implements a single interface, that interface is assumed to be the
- // business interface of the bean. This business interface will be a local interface unless the
- // interface is designated as a remote business interface by use of the Remote
- // annotation on the bean class or interface or by means of the deployment descriptor.
- if (businessInterfacesDirectlyImplementedByBeanClass.size() == 1 && localAndBusinessLocalInterfaces.size() == 0)
- {
- // Obtain the implemented interface
- Class<?> singleInterface = businessInterfacesDirectlyImplementedByBeanClass.iterator().next();
-
- // If not explicitly marked as @Remote, and is a valid business interface
- if (remoteAnnotation == null && singleInterface.getAnnotation(Remote.class) == null)
- {
- // Return the implemented interface, adding to the container
- Class<?>[] returnValue = new Class[]
- {singleInterface};
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
-
- // @Local was defined
- if (localAnnotation != null)
- {
- // If @Local has no value or empty value
- if (localAnnotation.value() == null || localAnnotation.value().length == 0)
- {
- // If @Local is defined with no value and there are no business interfaces
- if (businessInterfacesImplementedByBeanClass.size() == 0)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
- // If more than one business interface is directly implemented by the bean class
- else if (businessInterfacesImplementedByBeanClass.size() > 1)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfacesImplementedByBeanClass);
- }
- // JIRA EJBTHREE-1062
- // EJB 3 4.6.6
- // If the bean class implements only one business interface, that
- //interface is exposed as local business if not denoted as @Remote
- else
- {
- // If not explicitly marked as @Remote
- if (remoteAnnotation == null)
- {
- // Return the implemented interface and add to container
- Class<?>[] returnValue = businessInterfacesImplementedByBeanClass.toArray(new Class<?>[]
- {});
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
- }
- // @Local has value
- else
- {
- // For each of the interfaces in @Local.value
- for (Class<?> clazz : localAnnotation.value())
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
- }
- }
-
- // If local interfaces have been defined/discovered
- if (localAndBusinessLocalInterfaces.size() > 0)
- {
- // Check to ensure @Local and @Remote are not defined on the same interface
- // EJBTHREE-751
- for (Class<?> remoteInterface : remoteAndBusinessRemoteInterfaces)
- {
- for (Class<?> localInterface : localAndBusinessLocalInterfaces)
- {
- if (localInterface.equals(remoteInterface))
- {
- throw new RuntimeException("@Remote and @Local may not both be specified on the same interface \""
- + remoteInterface.toString() + "\" per EJB3 Spec 4.6.6, Bullet 5.4");
- }
- }
- }
-
- // Return local interfaces, first adding to the container
- Class<?>[] rtn = localAndBusinessLocalInterfaces.toArray(new Class<?>[]
- {});
- localAnnotation = new LocalImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, localAnnotation);
- return rtn;
- }
- // If no local interfaces have been defined/discovered
- else
- {
- // Obtain WS Endpoint
- String endpoint = ProxyFactoryHelper.getEndpointInterface(container);
-
- // If neither WS Endpoint or remotes are defined
- if (remoteAndBusinessRemoteInterfaces.length == 0 && endpoint == null)
- throw new RuntimeException(
- "Bean Class "
- + beanClass.getName()
- + " has no local, webservice, or remote interfaces defined and does not implement at least one business interface: "
- + container.getEjbName());
-
- }
-
- // No local or business local interfaces discovered
- return new Class<?>[]
- {};
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
- {
- // Obtain all business interfaces implemented by this bean class and its superclasses
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and, optionally, its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @param includeSupers Whether or not to include superclasses of the specified beanClass in this check
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
- {
- // Obtain all business interfaces implemented by this bean class and optionally, its superclass
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
- {
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces,
- boolean includeSupers)
- {
- /*
- * 4.6.6:
- * The following interfaces are excluded when determining whether the bean class has
- * more than one interface: java.io.Serializable; java.io.Externalizable;
- * any of the interfaces defined by the javax.ejb package.
- */
- for (Class<?> intf : beanClass.getInterfaces())
- {
- if (intf.equals(java.io.Externalizable.class))
- continue;
- if (intf.equals(java.io.Serializable.class))
- continue;
- if (intf.getName().startsWith("javax.ejb"))
- continue;
-
- // FIXME Other aop frameworks might add other interfaces, this should really be configurable
- if (intf.getName().startsWith("org.jboss.aop"))
- continue;
-
- interfaces.add(intf);
- }
-
- // If there's no superclass, or we shouldn't check the superclass, return
- if (!includeSupers || beanClass.getSuperclass() == null)
- {
- return interfaces;
- }
- else
- {
- // Include any superclasses' interfaces
- return getBusinessInterfaces(beanClass.getSuperclass(), interfaces);
- }
- }
-
- public static Class<?> getLocalHomeInterface(Container container)
- {
- LocalHome li = ((EJBContainer) container).getAnnotation(javax.ejb.LocalHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static Class<?> getRemoteHomeInterface(Container container)
- {
- RemoteHome li = ((EJBContainer) container).getAnnotation(javax.ejb.RemoteHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static boolean publishesInterface(Container container, Class<?> businessInterface)
- {
- if (!(container instanceof SessionContainer))
- return false;
- Class<?>[] remotes = getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> intf : remotes)
- {
- if (intf.getName().equals(businessInterface.getName()))
- return true;
- }
-
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- return true;
- }
- }
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- return true;
- }
- }
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Obtains the JNDI name for the specified container; may either be explicitly-defined by
- * annotation / XML or will otherwise default to the configured JNDI Binding Policy
- *
- * @param container
- * @param businessInterface
- * @return
- */
- public static String getJndiName(EJBContainer container, Class<?> businessInterface)
- {
- assert container != null : "container is null";
- assert businessInterface != null : "businessInterface is null";
-
- // Initialize to defaults of remote and not home
- String jndiName = null;
-
- // Determine if remote
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> clazz : remotes)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @RemoteBindings
- RemoteBindings bindings = ((EJBContainer) container).getAnnotation(RemoteBindings.class);
- if (bindings != null)
- {
- // Encountered, return
- return bindings.value()[0].jndiBinding();
- }
- // Check for declared @RemoteBinding
- RemoteBinding binding = ((EJBContainer) container).getAnnotation(RemoteBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // Determine if remote home
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- // Check for declared @RemoteHomeBinding
- RemoteHomeBinding binding = ((EJBContainer) container).getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // Determine if local and home
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- // Check for declared @LocalHomeBinding
- LocalHomeBinding binding = ((EJBContainer) container).getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // Determine if local
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @LocalBinding
- LocalBinding binding = ((EJBContainer) container).getAnnotation(LocalBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // If JNDI Name has not been explicitly specified, use policy
- if (jndiName == null)
- {
- // Log
- log.debug("JNDI name has not been explicitly set for EJB " + container.getEjbName() + ", interface "
- + businessInterface.getName());
-
- // Set JNDI name
- jndiName = JbossEnterpriseBeanJndiNameResolver.resolveJndiName(container.getXml(), businessInterface.getName());
- }
-
- // Return
- return jndiName;
- }
-
- /**
- * Returns all local interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, true);
- }
-
- /**
- * Returns all remote interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, true);
- }
-
- /**
- * Returns all local business interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and not extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, false);
- }
-
- /**
- * Returns all remote business interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and not extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, false);
- }
-
- /**
- * Returns an subset of the specified array of interfaces either
- * assignable to or not assignable to the specified class, depending
- * upon the flag "assignable"
- *
- * @param interfaces
- * @param clazz
- * @param assignable
- * @return
- */
- private static Class<?>[] getInterfacesAssignableFromClass(Class<?>[] interfaces, Class<?> clazz, boolean assignable)
- {
- // Initialize
- List<Class<?>> subset = new ArrayList<Class<?>>();
-
- // For all interfaces
- for (Class<?> interfaze : interfaces)
- {
- // If we want assignable classes only
- if (assignable && clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
-
- // If we want classes not assignable only
- if (!assignable && !clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
- }
-
- // Return
- return subset.toArray(new Class<?>[]
- {});
- }
-
- /**
- * Returns all remote and remote business interfaces in the specified container,
- * designated by @Remote or in ejb-jar.xml as "remote" or "business-remote"
- *
- * @param container
- * @return the remote interfaces of the container or an empty array
- */
- public static Class<?>[] getRemoteAndBusinessRemoteInterfaces(Container container)
- {
- // Initialize
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
- RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class);
- Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>();
- Class<?> beanClass = container.getBeanClass();
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // Obtain business interfaces
- Class<?>[] businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(beanClass).toArray(new Class[]
- {});
-
- // EJBTHREE-1127
- // Determine remote interface from return value of "create" in Remote Home
- if (remoteHomeAnnotation != null)
- {
- remoteAndRemoteBusinessInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(
- remoteHomeAnnotation.value(), isStateless));
- }
-
- // If @Remote is not defined
- if (remoteAnnotation == null)
- {
- // For each of the business interfaces
- for (Class<?> clazz : businessInterfaces)
- {
- // If @Remote is on the business interface
- if (clazz.isAnnotationPresent(Remote.class))
- {
- // Add to the list of remotes
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- }
- // @Remote was defined
- else
- {
- // @Remote declares interfaces, add these
- if (remoteAnnotation.value().length > 0)
- {
- for (Class<?> clazz : remoteAnnotation.value())
- {
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- // @Remote is empty
- else
- {
- // No business interfaces were defined on the bean
- if (businessInterfaces.length == 0)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
-
- // More than one default interface, cannot be marked as @Remote
- else if (businessInterfaces.length > 1)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfaces);
- }
- // Only one default interface, mark as @Remote and return
- else
- {
- Class<?>[] rtn =
- {(Class<?>) businessInterfaces[0]};
- remoteAnnotation = new RemoteImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, remoteAnnotation);
- return rtn;
- }
- }
- }
-
- // If remotes were found
- if (remoteAndRemoteBusinessInterfaces.size() > 0)
- {
- // Set interfaces and return
- Class<?>[] remotesArray = remoteAndRemoteBusinessInterfaces
- .toArray(new Class[remoteAndRemoteBusinessInterfaces.size()]);
- remoteAnnotation = new RemoteImpl(remotesArray);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Remote.class, remoteAnnotation);
- return remoteAnnotation.value();
- }
- // No remotes were found
- else
- {
- return new Class<?>[]
- {};
- }
- }
-
- /**
- * Obtains the return types declared by the "create" methods for the specified home interface.
- *
- * @param homeInterface
- * @param isStateless Flag to indicate whether this is for a Stateful or Stateless container
- * @return
- */
- private static Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface, boolean isStateless)
- {
- // Ensure we've been passed a Home or LocalHome interface (Developers only)
- assert (EJBHome.class.isAssignableFrom(homeInterface) || EJBLocalHome.class.isAssignableFrom(homeInterface));
-
- // Ensure we've been passed a Home or LocalHome interface (End-User)
- if (!EJBHome.class.isAssignableFrom(homeInterface) && !EJBLocalHome.class.isAssignableFrom(homeInterface))
- {
- throw new RuntimeException("Declared EJB 2.1 Home Interface " + homeInterface.getName() + " does not extend "
- + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName()
- + " as required by EJB 3.0 Core Specification 4.6.8 and 4.6.10");
- }
-
- // Initialize
- Set<Class<?>> types = new HashSet<Class<?>>();
- List<Method> createMethods = null;
-
- // If for a Stateless Container
- if (isStateless)
- {
- // Initialize error message
- String specViolationErrorMessage = "EJB 3.0 Specification Violation (4.6.8 Bullet 4, 4.6.10 Bullet 4): \""
- + "A stateless session bean must define exactly one create method with no arguments." + "\"; found in "
- + homeInterface.getName();
-
- // Get all methods with signature "create"
- createMethods = new ArrayList<Method>();
- try
- {
- createMethods.add(homeInterface.getMethod("create", new Class<?>[]
- {}));
- }
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
-
- // Ensure only one create method is defined
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- if (createMethods.size() > 1)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
- }
- else
- {
- // Obtain all "create<METHOD>" methods
- createMethods = ClassHelper.getAllMethodsByPrefix(homeInterface, "create");
- }
- if (createMethods.size() == 0)
- {
- throw new RuntimeException("EJB 3.0 Core Specification Violation (4.6.8 Bullet 5): EJB2.1 Home Interface "
- + homeInterface + " does not declare a \'create<METHOD>\' method");
- }
-
- // Add all return types
- for (Method method : createMethods)
- {
- types.add(method.getReturnType());
- }
-
- // Return
- return types;
- }
-
- public static String getClientBindUrl(RemoteBinding binding) throws Exception
- {
- String clientBindUrl = binding.clientBindUrl();
- if (clientBindUrl.trim().length() == 0)
- {
- if (binding.invokerName()!=null && binding.invokerName().trim().length() != 0)
- {
- try
- {
- ObjectName connectionON = new ObjectName(binding.invokerName());
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- else
- {
- try
- {
- ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find default InvokerLocator. Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- }
- else if (clientBindUrl.indexOf("0.0.0.0") != -1)
- {
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- ObjectName query = new ObjectName("jboss.remoting:type=Connector,handler=ejb3,*");
- Set mbeanSet = kernelAbstraction.getMBeans(query);
-
- URI targetUri = new URI(clientBindUrl);
- Iterator mbeans = mbeanSet.iterator();
- while (mbeans.hasNext())
- {
- ObjectInstance invokerInstance = (ObjectInstance)mbeans.next();
- ObjectName invokerName = invokerInstance.getObjectName();
- String invokerLocator = (String)kernelAbstraction.getAttribute(invokerName, "InvokerLocator");
- URI uri = new URI(invokerLocator);
-
- if (uri.getScheme().equals(targetUri.getScheme()) && uri.getPort() == targetUri.getPort())
- {
- return invokerLocator;
- }
- }
- }
-
- if (clientBindUrl == null)
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
-
- return clientBindUrl;
- }
-
- /**
- * Create a Proxy Constructor for the specified interfaces, using the specified CL
- *
- * @param interfaces
- * @param cl
- * @return
- * @throws Exception
- */
- public static Constructor<?> createProxyConstructor(Class<?>[] interfaces, ClassLoader cl) throws Exception
- {
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(cl, interfaces);
- return proxyClass.getConstructor(InvocationHandler.class);
- }
-
- public static String getHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- RemoteHomeBinding binding = container.getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use metadata
- String jndiName = JbossSessionBeanJndiNameResolver.resolveRemoteHomeJndiName((JBossSessionBeanMetaData) container
- .getXml());
- return jndiName;
- }
-
- public static String getLocalHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- LocalHomeBinding binding = container.getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use metadata
- String jndiName = JbossSessionBeanJndiNameResolver.resolveLocalHomeJndiName((JBossSessionBeanMetaData) container
- .getXml());
- return jndiName;
- }
-
- public static String getLocalJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getLocalJndiName(container, true);
- }
-
- private static String getLocalJndiName(EJBContainer container, boolean conflictCheck)
- {
- // See if local binding is explicitly-defined
- LocalBinding localBinding = container.getAnnotation(LocalBinding.class);
-
- // If none specified
- if (localBinding == null)
- {
- // Get JNDI name from metadata
- String name = JbossSessionBeanJndiNameResolver
- .resolveLocalBusinessDefaultJndiName((JBossSessionBeanMetaData) container.getXml());
-
- // If we should check for naming conflict
- if (conflictCheck){
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- // Return
- return name;
- }
- // Local Binding was explicitly-specified, use it
- else
- {
- return localBinding.jndiBinding();
- }
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, boolean check)
- {
- RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
-
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding);
- }
-
- private static void checkForJndiNamingConflict(EJBContainer container)
- {
- if (container.getAnnotation(Local.class) != null)
- {
- JBossSessionBeanMetaData md = (JBossSessionBeanMetaData) container.getXml();
- String localJndiName = JbossSessionBeanJndiNameResolver.resolveLocalBusinessDefaultJndiName(md);
- String remoteJndiName = JbossSessionBeanJndiNameResolver.resolveRemoteBusinessDefaultJndiName(md);
- String ejbName = container.getEjbName();
- if ((localJndiName.equals(remoteJndiName)))
- {
- throw new javax.ejb.EJBException("Conflict between default jndi name " + remoteJndiName
- + " for both remote and local for ejb-name:" + ejbName + ", bean class=" + container.getBeanClass());
- }
-
- }
- }
-
- private static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding, boolean conflictCheck)
- {
- // Initialize
- String jndiName = null;
-
- // If binding is not defined
- if (binding == null || binding.jndiBinding() == null || binding.jndiBinding().trim().equals(""))
- {
- // Use the default
- jndiName = getDefaultRemoteBusinessJndiName(container);
-
- // If we should check for a naming conflict
- if (conflictCheck)
- {
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- }
- // Binding is explicitly-defined
- else
- {
- // use it
- jndiName = binding.jndiBinding();
- }
-
- // Return
- return jndiName;
- }
-
- public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
- {
- // Return the policy's default remote name for this summary
- return JbossSessionBeanJndiNameResolver.resolveRemoteBusinessDefaultJndiName((JBossSessionBeanMetaData) container
- .getXml());
- }
-
- /*
- * Commented out; not used
- */
-// /**
-// * Obtains the JNDI Binding Policy for the specified container
-// *
-// * @param container
-// * @author ALR
-// * @return
-// */
-// private static DefaultJndiBindingPolicy getJndiBindingPolicy(EJBContainer container)
-// {
-// // Attempt to obtain the binding policy from annotation repo
-// JndiBindingPolicy bindingPolicy = container.getAnnotation(JndiBindingPolicy.class);
-//
-// // Initialize
-// Class<? extends DefaultJndiBindingPolicy> policy = null;
-//
-// // If policy is defined
-// if (bindingPolicy != null){
-// // Use it
-// policy = bindingPolicy.policy();
-// }
-// // No policy defined
-// else
-// {
-// // Use default policy
-// Class<? extends DefaultJndiBindingPolicy> policyClass = BasicJndiBindingPolicy.class;
-// // Log warning
-// log.warn("No default JNDI Binding Policy Defined (see ejb3-interceptors-aop.xml for example); defaulting to "
-// + policyClass.getName());
-// policy = policyClass;
-// }
-//
-// // Log
-// log.debug("Obtaining JNDI name from policy " + policy.getName());
-//
-// try
-// {
-// // Instanciate the policy and return
-// return policy.newInstance();
-// }
-// catch (InstantiationException e)
-// {
-// throw new RuntimeException("Could not instanciate JNDI Binding Policy: " + policy.getName(), e);
-// }
-// catch (IllegalAccessException e)
-// {
-// throw new RuntimeException(e);
-// }
-// }
-//
-// private static EjbDeploymentSummary getDeploymentSummaryFromContainer(EJBContainer container)
-// {
-// // Construct Deployment Summary
-// DeploymentSummary dsummary = new DeploymentSummary();
-// dsummary.setDeploymentName(container.getDeployment().getName());
-// DeploymentScope scope = container.getDeployment().getEar();
-// if (scope != null)
-// {
-// dsummary.setDeploymentScopeBaseName(scope.getBaseName());
-// }
-//
-// // Construct EjbDeploymetSummary
-// EjbDeploymentSummary summary = new EjbDeploymentSummary(container.getXml(),dsummary);
-//
-// // Return
-// return summary;
-// }
-}
\ No newline at end of file
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,985 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.jws.WebService;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.KernelAbstraction;
+import org.jboss.ejb3.KernelAbstractionFactory;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.LocalHomeBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+import org.jboss.ejb3.annotation.impl.LocalImpl;
+import org.jboss.ejb3.annotation.impl.RemoteImpl;
+import org.jboss.ejb3.common.lang.ClassHelper;
+import org.jboss.ejb3.service.ServiceContainer;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.stateful.StatefulContainer;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class ProxyFactoryHelper
+{
+ private static final Logger log = Logger.getLogger(ProxyFactoryHelper.class);
+
+ private static String getEndpointInterface(Container container)
+ {
+ WebService ws = (javax.jws.WebService) ((EJBContainer) container).resolveAnnotation(javax.jws.WebService.class);
+ if (ws != null)
+ {
+ return ws.endpointInterface();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param container
+ * @return the local interfaces of the container or an empty array
+ */
+ public static Class<?>[] getLocalAndBusinessLocalInterfaces(Container container)
+ {
+ // Initialize
+ Set<Class<?>> localAndBusinessLocalInterfaces = new HashSet<Class<?>>();
+
+ // Obtain Bean Class
+ Class<?> beanClass = container.getBeanClass();
+
+ // Obtain @Local
+ Local localAnnotation = ((EJBContainer) container).getAnnotation(Local.class);
+
+ // Obtain @LocalHome
+ LocalHome localHomeAnnotation = ((EJBContainer) container).getAnnotation(LocalHome.class);
+
+ // Obtain @Remote
+ Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
+
+ // Obtain Remote and Business Remote interfaces
+ Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
+
+ // Obtain all business interfaces from the bean class
+ Set<Class<?>> businessInterfacesImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(beanClass);
+
+ // Obtain all business interfaces directly implemented by the bean class (not including supers)
+ Set<Class<?>> businessInterfacesDirectlyImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(
+ beanClass, false);
+
+ // Determine whether Stateful or Stateless
+ boolean isStateless = (container instanceof StatelessContainer) ? true : false;
+
+ // EJBTHREE-1127
+ // Determine local interface from return value of "create" in Local Home
+ if (localHomeAnnotation != null)
+ {
+ localAndBusinessLocalInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(localHomeAnnotation
+ .value(), isStateless));
+ }
+
+ // For each of the business interfaces implemented by the bean class
+ for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
+ {
+ // If @Local is on the interface
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+ }
+
+ // EJBTHREE-1062
+ // EJB 3 Core Specification 4.6.6
+ // If bean class implements a single interface, that interface is assumed to be the
+ // business interface of the bean. This business interface will be a local interface unless the
+ // interface is designated as a remote business interface by use of the Remote
+ // annotation on the bean class or interface or by means of the deployment descriptor.
+ if (businessInterfacesDirectlyImplementedByBeanClass.size() == 1 && localAndBusinessLocalInterfaces.size() == 0)
+ {
+ // Obtain the implemented interface
+ Class<?> singleInterface = businessInterfacesDirectlyImplementedByBeanClass.iterator().next();
+
+ // If not explicitly marked as @Remote, and is a valid business interface
+ if (remoteAnnotation == null && singleInterface.getAnnotation(Remote.class) == null)
+ {
+ // Return the implemented interface, adding to the container
+ Class<?>[] returnValue = new Class[]
+ {singleInterface};
+ Local li = new LocalImpl(returnValue);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
+ return returnValue;
+ }
+ }
+
+ // @Local was defined
+ if (localAnnotation != null)
+ {
+ // If @Local has no value or empty value
+ if (localAnnotation.value() == null || localAnnotation.value().length == 0)
+ {
+ // If @Local is defined with no value and there are no business interfaces
+ if (businessInterfacesImplementedByBeanClass.size() == 0)
+ {
+ throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
+ + " and there are no valid business interfaces");
+ }
+ // If more than one business interface is directly implemented by the bean class
+ else if (businessInterfacesImplementedByBeanClass.size() > 1)
+ {
+ throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
+ + " with more than one default interface " + businessInterfacesImplementedByBeanClass);
+ }
+ // JIRA EJBTHREE-1062
+ // EJB 3 4.6.6
+ // If the bean class implements only one business interface, that
+ //interface is exposed as local business if not denoted as @Remote
+ else
+ {
+ // If not explicitly marked as @Remote
+ if (remoteAnnotation == null)
+ {
+ // Return the implemented interface and add to container
+ Class<?>[] returnValue = businessInterfacesImplementedByBeanClass.toArray(new Class<?>[]
+ {});
+ Local li = new LocalImpl(returnValue);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
+ return returnValue;
+ }
+ }
+ }
+ // @Local has value
+ else
+ {
+ // For each of the interfaces in @Local.value
+ for (Class<?> clazz : localAnnotation.value())
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+
+ // For each of the business interfaces implemented by the bean class
+ for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
+ {
+ // If @Local is on the interface
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+ }
+ }
+ }
+
+ // If local interfaces have been defined/discovered
+ if (localAndBusinessLocalInterfaces.size() > 0)
+ {
+ // Check to ensure @Local and @Remote are not defined on the same interface
+ // EJBTHREE-751
+ for (Class<?> remoteInterface : remoteAndBusinessRemoteInterfaces)
+ {
+ for (Class<?> localInterface : localAndBusinessLocalInterfaces)
+ {
+ if (localInterface.equals(remoteInterface))
+ {
+ throw new RuntimeException("@Remote and @Local may not both be specified on the same interface \""
+ + remoteInterface.toString() + "\" per EJB3 Spec 4.6.6, Bullet 5.4");
+ }
+ }
+ }
+
+ // Return local interfaces, first adding to the container
+ Class<?>[] rtn = localAndBusinessLocalInterfaces.toArray(new Class<?>[]
+ {});
+ localAnnotation = new LocalImpl(rtn);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, localAnnotation);
+ return rtn;
+ }
+ // If no local interfaces have been defined/discovered
+ else
+ {
+ // Obtain WS Endpoint
+ String endpoint = ProxyFactoryHelper.getEndpointInterface(container);
+
+ // If neither WS Endpoint or remotes are defined
+ if (remoteAndBusinessRemoteInterfaces.length == 0 && endpoint == null)
+ throw new RuntimeException(
+ "Bean Class "
+ + beanClass.getName()
+ + " has no local, webservice, or remote interfaces defined and does not implement at least one business interface: "
+ + container.getEjbName());
+
+ }
+
+ // No local or business local interfaces discovered
+ return new Class<?>[]
+ {};
+ }
+
+ /**
+ * Resolve the potential business interfaces on an enterprise bean.
+ * Returns all interfaces implemented by this class and its supers which
+ * are potentially a business interface.
+ *
+ * Note: for normal operation call container.getBusinessInterfaces().
+ *
+ * @param beanClass the EJB implementation class
+ * @return a list of potential business interfaces
+ * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
+ */
+ public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
+ {
+ // Obtain all business interfaces implemented by this bean class and its superclasses
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
+ }
+
+ /**
+ * Resolve the potential business interfaces on an enterprise bean.
+ * Returns all interfaces implemented by this class and, optionally, its supers which
+ * are potentially a business interface.
+ *
+ * Note: for normal operation call container.getBusinessInterfaces().
+ *
+ * @param beanClass the EJB implementation class
+ * @param includeSupers Whether or not to include superclasses of the specified beanClass in this check
+ * @return a list of potential business interfaces
+ * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
+ */
+ public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
+ {
+ // Obtain all business interfaces implemented by this bean class and optionally, its superclass
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
+ }
+
+ private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
+ {
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
+ }
+
+ private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces,
+ boolean includeSupers)
+ {
+ /*
+ * 4.6.6:
+ * The following interfaces are excluded when determining whether the bean class has
+ * more than one interface: java.io.Serializable; java.io.Externalizable;
+ * any of the interfaces defined by the javax.ejb package.
+ */
+ for (Class<?> intf : beanClass.getInterfaces())
+ {
+ if (intf.equals(java.io.Externalizable.class))
+ continue;
+ if (intf.equals(java.io.Serializable.class))
+ continue;
+ if (intf.getName().startsWith("javax.ejb"))
+ continue;
+
+ // FIXME Other aop frameworks might add other interfaces, this should really be configurable
+ if (intf.getName().startsWith("org.jboss.aop"))
+ continue;
+
+ interfaces.add(intf);
+ }
+
+ // If there's no superclass, or we shouldn't check the superclass, return
+ if (!includeSupers || beanClass.getSuperclass() == null)
+ {
+ return interfaces;
+ }
+ else
+ {
+ // Include any superclasses' interfaces
+ return getBusinessInterfaces(beanClass.getSuperclass(), interfaces);
+ }
+ }
+
+ public static Class<?> getLocalHomeInterface(Container container)
+ {
+ LocalHome li = ((EJBContainer) container).getAnnotation(javax.ejb.LocalHome.class);
+ if (li != null)
+ return li.value();
+ return null;
+ }
+
+ public static Class<?> getRemoteHomeInterface(Container container)
+ {
+ RemoteHome li = ((EJBContainer) container).getAnnotation(javax.ejb.RemoteHome.class);
+ if (li != null)
+ return li.value();
+ return null;
+ }
+
+ public static boolean publishesInterface(Container container, Class<?> businessInterface)
+ {
+ if (!(container instanceof SessionContainer))
+ return false;
+ Class<?>[] remotes = getRemoteAndBusinessRemoteInterfaces(container);
+ for (Class<?> intf : remotes)
+ {
+ if (intf.getName().equals(businessInterface.getName()))
+ return true;
+ }
+
+ Class<?> remoteHome = getRemoteHomeInterface(container);
+ if (remoteHome != null)
+ {
+ if (businessInterface.getName().equals(remoteHome.getName()))
+ {
+ return true;
+ }
+ }
+ Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
+ for (Class<?> clazz : locals)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ return true;
+ }
+ }
+ Class<?> localHome = getLocalHomeInterface(container);
+ if (localHome != null)
+ {
+ if (businessInterface.getName().equals(localHome.getName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Obtains the JNDI name for the specified container; may either be explicitly-defined by
+ * annotation / XML or will otherwise default to the configured JNDI Binding Policy
+ *
+ * @param container
+ * @param businessInterface
+ * @return
+ */
+ public static String getJndiName(EJBContainer container, Class<?> businessInterface)
+ {
+ assert container != null : "container is null";
+ assert businessInterface != null : "businessInterface is null";
+
+ // Initialize to defaults of remote and not home
+ String jndiName = null;
+ boolean isHome = false;
+ boolean isLocal = false;
+
+ // Determine if remote
+ Class<?>[] remotes = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
+ for (Class<?> clazz : remotes)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ // Check for declared @RemoteBindings
+ RemoteBindings bindings = ((EJBContainer) container).getAnnotation(RemoteBindings.class);
+ if (bindings != null)
+ {
+ // Encountered, return
+ return bindings.value()[0].jndiBinding();
+ }
+ // Check for declared @RemoteBinding
+ RemoteBinding binding = ((EJBContainer) container).getAnnotation(RemoteBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+ }
+ }
+
+ // Determine if remote home
+ Class<?> remoteHome = getRemoteHomeInterface(container);
+ if (remoteHome != null)
+ {
+ if (businessInterface.getName().equals(remoteHome.getName()))
+ {
+ // Check for declared @RemoteHomeBinding
+ RemoteHomeBinding binding = ((EJBContainer) container).getAnnotation(RemoteHomeBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set home for policy
+ isHome = true;
+ }
+ }
+
+ // Determine if local and home
+ Class<?> localHome = getLocalHomeInterface(container);
+ if (localHome != null)
+ {
+ if (businessInterface.getName().equals(localHome.getName()))
+ {
+ // Check for declared @LocalHomeBinding
+ LocalHomeBinding binding = ((EJBContainer) container).getAnnotation(LocalHomeBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set local and home for policy
+ isHome = true;
+ isLocal = true;
+ }
+ }
+
+ // Determine if local
+ Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
+ for (Class<?> clazz : locals)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ // Check for declared @LocalBinding
+ LocalBinding binding = ((EJBContainer) container).getAnnotation(LocalBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set local for policy
+ isLocal = true;
+ }
+ }
+
+ // If JNDI Name has not been explicitly specified, use policy
+ if (jndiName == null)
+ {
+ // Log
+ log.debug("JNDI name has not been explicitly set for EJB " + container.getEjbName() + ", interface "
+ + businessInterface.getName());
+
+ // Set JNDI name
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) container.getXml();
+ jndiName = smd.getJndiName();
+ }
+
+ // Return
+ return jndiName;
+ }
+
+ /**
+ * Returns all local interfaces in the specified container; interfaces
+ * marked as "local" via either annotation or XML and extending EJBLocalObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getLocalInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, true);
+ }
+
+ /**
+ * Returns all remote interfaces in the specified container; interfaces
+ * marked as "remote" via either annotation or XML and extending EJBObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getRemoteInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, true);
+ }
+
+ /**
+ * Returns all local business interfaces in the specified container; interfaces
+ * marked as "local" via either annotation or XML and not extending EJBLocalObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getLocalBusinessInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, false);
+ }
+
+ /**
+ * Returns all remote business interfaces in the specified container; interfaces
+ * marked as "remote" via either annotation or XML and not extending EJBObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getRemoteBusinessInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, false);
+ }
+
+ /**
+ * Returns an subset of the specified array of interfaces either
+ * assignable to or not assignable to the specified class, depending
+ * upon the flag "assignable"
+ *
+ * @param interfaces
+ * @param clazz
+ * @param assignable
+ * @return
+ */
+ private static Class<?>[] getInterfacesAssignableFromClass(Class<?>[] interfaces, Class<?> clazz, boolean assignable)
+ {
+ // Initialize
+ List<Class<?>> subset = new ArrayList<Class<?>>();
+
+ // For all interfaces
+ for (Class<?> interfaze : interfaces)
+ {
+ // If we want assignable classes only
+ if (assignable && clazz.isAssignableFrom(interfaze))
+ {
+ subset.add(interfaze);
+ }
+
+ // If we want classes not assignable only
+ if (!assignable && !clazz.isAssignableFrom(interfaze))
+ {
+ subset.add(interfaze);
+ }
+ }
+
+ // Return
+ return subset.toArray(new Class<?>[]
+ {});
+ }
+
+ /**
+ * Returns all remote and remote business interfaces in the specified container,
+ * designated by @Remote or in ejb-jar.xml as "remote" or "business-remote"
+ *
+ * @param container
+ * @return the remote interfaces of the container or an empty array
+ */
+ public static Class<?>[] getRemoteAndBusinessRemoteInterfaces(Container container)
+ {
+ // Initialize
+ Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
+ RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class);
+ Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>();
+ Class<?> beanClass = container.getBeanClass();
+ boolean isStateless = (container instanceof StatelessContainer) ? true : false;
+
+ // Obtain business interfaces
+ Class<?>[] businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(beanClass).toArray(new Class[]
+ {});
+
+ // EJBTHREE-1127
+ // Determine remote interface from return value of "create" in Remote Home
+ if (remoteHomeAnnotation != null)
+ {
+ remoteAndRemoteBusinessInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(
+ remoteHomeAnnotation.value(), isStateless));
+ }
+
+ // If @Remote is not defined
+ if (remoteAnnotation == null)
+ {
+ // For each of the business interfaces
+ for (Class<?> clazz : businessInterfaces)
+ {
+ // If @Remote is on the business interface
+ if (clazz.isAnnotationPresent(Remote.class))
+ {
+ // Add to the list of remotes
+ remoteAndRemoteBusinessInterfaces.add(clazz);
+ }
+ }
+ }
+ // @Remote was defined
+ else
+ {
+ // @Remote declares interfaces, add these
+ if (remoteAnnotation.value().length > 0)
+ {
+ for (Class<?> clazz : remoteAnnotation.value())
+ {
+ remoteAndRemoteBusinessInterfaces.add(clazz);
+ }
+ }
+ // @Remote is empty
+ else
+ {
+ // No business interfaces were defined on the bean
+ if (businessInterfaces.length == 0)
+ {
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " and there are no valid business interfaces");
+ }
+
+ // More than one default interface, cannot be marked as @Remote
+ else if (businessInterfaces.length > 1)
+ {
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " with more than one default interface " + businessInterfaces);
+ }
+ // Only one default interface, mark as @Remote and return
+ else
+ {
+ Class<?>[] rtn =
+ {(Class<?>) businessInterfaces[0]};
+ remoteAnnotation = new RemoteImpl(rtn);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, remoteAnnotation);
+ return rtn;
+ }
+ }
+ }
+
+ // If remotes were found
+ if (remoteAndRemoteBusinessInterfaces.size() > 0)
+ {
+ // Set interfaces and return
+ Class<?>[] remotesArray = remoteAndRemoteBusinessInterfaces
+ .toArray(new Class[remoteAndRemoteBusinessInterfaces.size()]);
+ remoteAnnotation = new RemoteImpl(remotesArray);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Remote.class, remoteAnnotation);
+ return remoteAnnotation.value();
+ }
+ // No remotes were found
+ else
+ {
+ return new Class<?>[]
+ {};
+ }
+ }
+
+ /**
+ * Obtains the return types declared by the "create" methods for the specified home interface.
+ *
+ * @param homeInterface
+ * @param isStateless Flag to indicate whether this is for a Stateful or Stateless container
+ * @return
+ */
+ private static Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface, boolean isStateless)
+ {
+ // Ensure we've been passed a Home or LocalHome interface (Developers only)
+ assert (EJBHome.class.isAssignableFrom(homeInterface) || EJBLocalHome.class.isAssignableFrom(homeInterface));
+
+ // Ensure we've been passed a Home or LocalHome interface (End-User)
+ if (!EJBHome.class.isAssignableFrom(homeInterface) && !EJBLocalHome.class.isAssignableFrom(homeInterface))
+ {
+ throw new RuntimeException("Declared EJB 2.1 Home Interface " + homeInterface.getName() + " does not extend "
+ + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName()
+ + " as required by EJB 3.0 Core Specification 4.6.8 and 4.6.10");
+ }
+
+ // Initialize
+ Set<Class<?>> types = new HashSet<Class<?>>();
+ List<Method> createMethods = null;
+
+ // If for a Stateless Container
+ if (isStateless)
+ {
+ // Initialize error message
+ String specViolationErrorMessage = "EJB 3.0 Specification Violation (4.6.8 Bullet 4, 4.6.10 Bullet 4): \""
+ + "A stateless session bean must define exactly one create method with no arguments." + "\"; found in "
+ + homeInterface.getName();
+
+ // Get all methods with signature "create"
+ createMethods = new ArrayList<Method>();
+ try
+ {
+ createMethods.add(homeInterface.getMethod("create", new Class<?>[]
+ {}));
+ }
+ // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
+ // EJBTHREE-1156
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(specViolationErrorMessage);
+ }
+
+ // Ensure only one create method is defined
+ // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
+ // EJBTHREE-1156
+ if (createMethods.size() > 1)
+ {
+ throw new RuntimeException(specViolationErrorMessage);
+ }
+ }
+ else
+ {
+ // Obtain all "create<METHOD>" methods
+ createMethods = ClassHelper.getAllMethodsByPrefix(homeInterface, "create");
+ }
+ if (createMethods.size() == 0)
+ {
+ throw new RuntimeException("EJB 3.0 Core Specification Violation (4.6.8 Bullet 5): EJB2.1 Home Interface "
+ + homeInterface + " does not declare a \'create<METHOD>\' method");
+ }
+
+ // Add all return types
+ for (Method method : createMethods)
+ {
+ types.add(method.getReturnType());
+ }
+
+ // Return
+ return types;
+ }
+
+ public static String getClientBindUrl(RemoteBinding binding) throws Exception
+ {
+ String clientBindUrl = binding.clientBindUrl();
+ if (clientBindUrl.trim().length() == 0)
+ {
+ if (binding.invokerName()!=null && binding.invokerName().trim().length() != 0)
+ {
+ try
+ {
+ ObjectName connectionON = new ObjectName(binding.invokerName());
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
+ }
+ else
+ {
+ try
+ {
+ ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find default InvokerLocator. Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
+ }
+ }
+ else if (clientBindUrl.indexOf("0.0.0.0") != -1)
+ {
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ ObjectName query = new ObjectName("jboss.remoting:type=Connector,handler=ejb3,*");
+ Set mbeanSet = kernelAbstraction.getMBeans(query);
+
+ URI targetUri = new URI(clientBindUrl);
+ Iterator mbeans = mbeanSet.iterator();
+ while (mbeans.hasNext())
+ {
+ ObjectInstance invokerInstance = (ObjectInstance)mbeans.next();
+ ObjectName invokerName = invokerInstance.getObjectName();
+ String invokerLocator = (String)kernelAbstraction.getAttribute(invokerName, "InvokerLocator");
+ URI uri = new URI(invokerLocator);
+
+ if (uri.getScheme().equals(targetUri.getScheme()) && uri.getPort() == targetUri.getPort())
+ {
+ return invokerLocator;
+ }
+ }
+ }
+
+ if (clientBindUrl == null)
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+
+ return clientBindUrl;
+ }
+
+ /**
+ * Create a Proxy Constructor for the specified interfaces, using the specified CL
+ *
+ * @param interfaces
+ * @param cl
+ * @return
+ * @throws Exception
+ */
+ public static Constructor<?> createProxyConstructor(Class<?>[] interfaces, ClassLoader cl) throws Exception
+ {
+ Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(cl, interfaces);
+ return proxyClass.getConstructor(InvocationHandler.class);
+ }
+
+ public static String getHomeJndiName(EJBContainer container)
+ {
+ // Use explicitly-specified binding, if defined
+ RemoteHomeBinding binding = container.getAnnotation(RemoteHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData)container.getXml();
+ String jndiName = smd.getHomeJndiName();
+ return jndiName;
+ }
+
+ public static String getLocalHomeJndiName(EJBContainer container)
+ {
+ // Use explicitly-specified binding, if defined
+ LocalHomeBinding binding = container.getAnnotation(LocalHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ // Use Default JNDI Binding Policy
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData)container.getXml();
+ String jndiName = smd.getLocalHomeJndiName();
+ return jndiName;
+ }
+
+ public static String getLocalJndiName(EJBContainer container)
+ {
+ return ProxyFactoryHelper.getLocalJndiName(container, true);
+ }
+
+ private static String getLocalJndiName(EJBContainer container, boolean conflictCheck)
+ {
+ // See if local binding is explicitly-defined
+ LocalBinding localBinding = container.getAnnotation(LocalBinding.class);
+
+ // If none specified
+ if (localBinding == null || localBinding.jndiBinding() != null || localBinding.jndiBinding().trim().length() == 0)
+ {
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData)container.getXml();
+ String name = smd.getLocalJndiName();
+
+ // If we should check for naming conflict
+ if (conflictCheck){
+ // Check
+ ProxyFactoryHelper.checkForJndiNamingConflict(container);
+ }
+
+ // Return
+ return name;
+ }
+ // Local Binding was explicitly-specified, use it
+ else
+ {
+ return localBinding.jndiBinding();
+ }
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container)
+ {
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, true);
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container, boolean check)
+ {
+ RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
+
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding);
+ }
+
+ private static void checkForJndiNamingConflict(EJBContainer container)
+ {
+ if (container.getAnnotation(Local.class) != null)
+ {
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData)container.getXml();
+ String localJndiName = smd.getLocalJndiName();
+ String remoteJndiName = smd.getJndiName();
+ String ejbName = container.getEjbName();
+ if (localJndiName != null)
+ {
+ if (localJndiName.equals(remoteJndiName) || localJndiName.startsWith(remoteJndiName + "/"))
+ throw new javax.ejb.EJBException("Conflict between default jndi name " + remoteJndiName
+ + " for both remote and local for ejb-name:" + ejbName + ", bean class="
+ + container.getBeanClass() + "\nLocal JNDI Name: " + localJndiName + "\nRemote JNDI Name: "
+ + remoteJndiName);
+ }
+ }
+ }
+
+ private static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding)
+ {
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding, true);
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding, boolean conflictCheck)
+ {
+ // Initialize
+ String jndiName = null;
+
+ // If binding is not defined
+ if (binding == null || binding.jndiBinding() == null || binding.jndiBinding().trim().equals(""))
+ {
+ // Use the default
+ jndiName = getDefaultRemoteBusinessJndiName(container);
+
+ // If we should check for a naming conflict
+ if (conflictCheck)
+ {
+ // Check
+ ProxyFactoryHelper.checkForJndiNamingConflict(container);
+ }
+
+ }
+ // Binding is explicitly-defined
+ else
+ {
+ // use it
+ jndiName = binding.jndiBinding();
+ }
+
+ // Return
+ return jndiName;
+ }
+
+ public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
+ {
+ JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData)container.getXml();
+ String jndiName = smd.getJndiName();
+ return jndiName;
+ }
+}
\ No newline at end of file
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateful;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory
-{
- // Class Members
-
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
-
- public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
-
- /**
- * Do not call, only for externalizable
- */
- protected BaseStatefulProxyFactory()
- {
- super();
- }
-
- public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- public void init() throws Exception
- {
- // Ensure EJB2.1 View is Complete
- this.validateEjb21Views();
-
- // Create the Proxy Constructors
- this.createProxyConstructors();
- }
-
- public void start() throws Exception
- {
- this.init();
-
- // Bind the Proxy Factory
- //Context ctx = getContainer().getInitialContext();
- //Name name = ctx.getNameParser("").parse(jndiName);
- //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
- //String atom = name.get(name.size() - 1);
- RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
- Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
-// try
-// {
-// log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
-// Util.rebind(ctx, atom, ref);
-// }
-// catch (NamingException e)
-// {
-// NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
-// + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
-// namingException.setRootCause(e);
-// throw namingException;
-// }
-
- this.bindProxy(ref);
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected final void initializeJndiName() {};
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- try
- {
- init();
- }
- catch(Exception e)
- {
- log.error(e.getMessage(), e);
- throw new IOException(e.getMessage());
- }
- this.jndiName = in.readUTF();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeUTF(jndiName);
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateful;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory
+{
+ // Class Members
+
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
+
+ public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
+
+ /**
+ * Do not call, only for externalizable
+ */
+ protected BaseStatefulProxyFactory()
+ {
+ super();
+ }
+
+ public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName)
+ {
+ super(container);
+
+ assert jndiName != null : "jndiName is null";
+
+ this.jndiName = jndiName;
+ }
+
+ public void init() throws Exception
+ {
+ // Ensure EJB2.1 View is Complete
+ this.validateEjb21Views();
+
+ // Create the Proxy Constructors
+ this.createProxyConstructors();
+ }
+
+ public void start() throws Exception
+ {
+ this.init();
+
+ // Bind the Proxy Factory
+ //Context ctx = getContainer().getInitialContext();
+ //Name name = ctx.getNameParser("").parse(jndiName);
+ //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
+ //String atom = name.get(name.size() - 1);
+ RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
+ Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
+// try
+// {
+// log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
+// Util.rebind(ctx, atom, ref);
+// }
+// catch (NamingException e)
+// {
+// NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
+// + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
+// namingException.setRootCause(e);
+// throw namingException;
+// }
+
+ this.bindProxy(ref);
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(getContainer().getInitialContext(), jndiName);
+ }
+
+ protected final void initializeJndiName() {};
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ try
+ {
+ init();
+ }
+ catch(Exception e)
+ {
+ log.error(e.getMessage(), e);
+ throw new IOException(e.getMessage());
+ }
+ this.jndiName = in.readUTF();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeUTF(jndiName);
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,206 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateful;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * BaseStatefulRemoteProxyFactory
- *
- * Common base for factories generating remoting-enabled
- * proxies (ie. remote and clustering)
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
-{
- // Class Members
-
- private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class);
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, JbossSessionBeanJndiNameResolver
- .resolveRemoteBusinessDefaultJndiName((JBossSessionBeanMetaData) container.getXml()));
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- Object id = getContainer().createSession();
- return this.createProxyBusiness(id, businessInterfaceType);
- }
-
- public Object createProxyBusiness(Object id, String businessInterfaceType)
- {
- return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulRemoteProxyInvocationHandler proxy = new StatefulRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
- .getAdvisor(), null), this.getLocator(), id, businessInterfaceType);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- this.getContainer();
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- protected StatefulHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21(null);
- return this.createHandle(proxy);
- }
-
- protected StatefulHandleRemoteImpl createHandle(EJBObject proxy)
- {
- StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
- return handle;
- }
-
- public EJBObject createProxyEjb21(String businessInterfaceType)
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id, businessInterfaceType);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21(Object id, String businessInterfaceType)
- {
- // Cast explicitly to catch improper proxies
- return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateful;
+
+import javax.ejb.EJBObject;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * BaseStatefulRemoteProxyFactory
+ *
+ * Common base for factories generating remoting-enabled
+ * proxies (ie. remote and clustering)
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
+{
+ // Class Members
+
+ private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class);
+
+ // Instance Members
+
+ private RemoteBinding binding;
+
+ private InvokerLocator locator;
+
+ // Constructor
+ public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, ProxyFactoryHelper.getRemoteBusinessJndiName(container));
+
+ this.binding = binding;
+
+ try
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ this.locator = new InvokerLocator(clientBindUrl);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Required Implementations
+
+ @Override
+ protected ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.REMOTE;
+ }
+
+ @Override
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyBusiness(id, businessInterfaceType);
+ }
+
+ public Object createProxyBusiness(Object id, String businessInterfaceType)
+ {
+ return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
+ // Specifications
+
+ abstract String getStackNameInterceptors();
+
+ // Functional Methods
+
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ SessionSpecContainer container = this.getContainer();
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
+ String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
+ return homeJndiName.equals(remoteBusinessJndiName);
+ }
+
+ protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ String stackName = this.getStackNameInterceptors();
+ RemoteBinding binding = this.getBinding();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulRemoteProxyInvocationHandler proxy = new StatefulRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
+ .getAdvisor(), null), this.getLocator(), id, businessInterfaceType);
+
+ if(type.equals(SpecificationInterfaceType.EJB21))
+ {
+ this.getContainer();
+ return this.constructEjb21Proxy(proxy);
+ }
+ else
+ {
+ return this.constructProxyBusiness(proxy);
+ }
+ }
+
+ @Override
+ protected StatefulHandleRemoteImpl createHandle()
+ {
+ EJBObject proxy = this.createProxyEjb21(null);
+ return this.createHandle(proxy);
+ }
+
+ protected StatefulHandleRemoteImpl createHandle(EJBObject proxy)
+ {
+ StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
+ return handle;
+ }
+
+ public EJBObject createProxyEjb21(String businessInterfaceType)
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyEjb21(id, businessInterfaceType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBObject> T createProxyEjb21(Object id, String businessInterfaceType)
+ {
+ // Cast explicitly to catch improper proxies
+ return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ }
+
+ // Accessors / Mutators
+
+ RemoteBinding getBinding()
+ {
+ assert this.binding!=null : "RemoteBinding has not been initialized";
+ return this.binding;
+ }
+
+ InvokerLocator getLocator()
+ {
+ assert this.locator!=null : "InvokerLocator has not been initialized";
+ return this.locator;
+ }
+
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,314 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateful;
-
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aspects.remoting.ClusterChooserInterceptor;
-import org.jboss.aspects.remoting.ClusteredPojiProxy;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulClusteredInvocationHandler;
-import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.client.loadbalance.RoundRobin;
-import org.jboss.ha.client.loadbalance.aop.FirstAvailable;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HAPartitionLocator;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulClusterProxyFactory extends BaseStatefulRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatefulClusterProxyFactory.class);
-
- private static String STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatefulSessionClientInterceptors";
-
- private Clustered clustered;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private String partitionName;
- private HAPartition partition;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
-
- public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.clustered = clustered;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return false;
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.REMOTE;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- // Not Supported
- return false;
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
-
- }
-
- public void start() throws Exception
- {
- this.init();
-
- InvokerLocator locator = this.getLocator();
- SessionContainer container = this.getContainer();
- partitionName = container.getPartitionName();
- proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
- drm = partition.getDistributedReplicantManager();
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new FirstAvailable();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
-
- // Set up the proxy to ourself. Needs to be clustered so it can load
- // balance requests (EJBTHREE-1375). We use the home load balance policy.
-
- LoadBalancePolicy factoryLBP = null;
- if (clustered.homeLoadBalancePolicy() == null || clustered.homeLoadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- factoryLBP = new RoundRobin();
- }
- else
- {
- String policyClass = clustered.homeLoadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- factoryLBP = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
-
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- Interceptor[] interceptors = { new ClusteredIsLocalInterceptor(),
- new ClusterChooserInterceptor(),
- InvokeRemoteInterceptor.singleton
- };
-
- // We can use the same FamilyWrapper as we use for the bean
- ClusteredPojiProxy proxy = new ClusteredPojiProxy(targetId, locator, interceptors, wrapper,
- factoryLBP, partitionName, null);
- Object factoryProxy = Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful cluster proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- @Override
- protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
- .getAdvisor(), null), this.wrapper, this.lbPolicy, partitionName, getLocator(), id, businessInterfaceType);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- return this.constructEjb21Proxy(handler);
- }
- else
- {
- return this.constructProxyBusiness(handler);
- }
- }
-
- public void stop() throws Exception
- {
- Dispatcher.singleton.unregisterTarget(getTargetId());
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- this.getContainer().getClusterFamilies().remove(proxyFamilyName);
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- super.stop();
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- String partition = ((SessionContainer) getContainer()).getPartitionName();
- return jndiName + PROXY_FACTORY_NAME + "@" + partition;
- }
-
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList targets = new ArrayList(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,301 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateful;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aspects.remoting.ClusterChooserInterceptor;
+import org.jboss.aspects.remoting.ClusteredPojiProxy;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulClusteredInvocationHandler;
+import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
+import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.ha.client.loadbalance.RoundRobin;
+import org.jboss.ha.client.loadbalance.aop.FirstAvailable;
+import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
+import org.jboss.ha.framework.server.HATarget;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class StatefulClusterProxyFactory extends BaseStatefulRemoteProxyFactory
+ implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
+{
+ private static final Logger log = Logger.getLogger(StatefulClusterProxyFactory.class);
+
+ private static String STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatefulSessionClientInterceptors";
+
+ private Clustered clustered;
+ private DistributedReplicantManager drm;
+ private HATarget hatarget;
+ private String proxyFamilyName;
+ private String partitionName;
+ private HAPartition partition;
+ private LoadBalancePolicy lbPolicy;
+ private FamilyWrapper wrapper;
+
+ public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
+ {
+ super(container, binding);
+
+ assert clustered != null : "clustered is null";
+
+ this.clustered = clustered;
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ // Not Supported
+ return null;
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ @Override
+ protected ProxyAccessType getProxyAccessType(){
+ return ProxyAccessType.REMOTE;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ // Not Supported
+ return false;
+ }
+
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+
+ }
+
+ public void start() throws Exception
+ {
+ this.init();
+
+ InvokerLocator locator = this.getLocator();
+ SessionContainer container = this.getContainer();
+ partitionName = container.getPartitionName();
+ proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
+ partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
+ drm = partition.getDistributedReplicantManager();
+ hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
+ ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
+ container.getClusterFamilies().put(proxyFamilyName, hatarget);
+
+ if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
+ {
+ lbPolicy = new FirstAvailable();
+ }
+ else
+ {
+ String policyClass = clustered.loadBalancePolicy();
+ try
+ {
+ RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
+ Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
+ policyClass = policy.getName();
+ }
+ catch (LoadBalancePolicyNotRegisteredException e){}
+
+ lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
+ .newInstance();
+ }
+ wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
+
+ drm.registerListener(proxyFamilyName, this);
+
+ super.start();
+
+ // Set up the proxy to ourself. Needs to be clustered so it can load
+ // balance requests (EJBTHREE-1375). We use the home load balance policy.
+
+ LoadBalancePolicy factoryLBP = null;
+ if (clustered.homeLoadBalancePolicy() == null || clustered.homeLoadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
+ {
+ factoryLBP = new RoundRobin();
+ }
+ else
+ {
+ String policyClass = clustered.homeLoadBalancePolicy();
+ try
+ {
+ RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
+ Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
+ policyClass = policy.getName();
+ }
+ catch (LoadBalancePolicyNotRegisteredException e){}
+
+ factoryLBP = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
+ .newInstance();
+ }
+
+ Class<?>[] interfaces = {ProxyFactory.class};
+ String targetId = getTargetId();
+ Interceptor[] interceptors = { new ClusteredIsLocalInterceptor(),
+ new ClusterChooserInterceptor(),
+ InvokeRemoteInterceptor.singleton
+ };
+
+ // We can use the same FamilyWrapper as we use for the bean
+ ClusteredPojiProxy proxy = new ClusteredPojiProxy(targetId, locator, interceptors, wrapper,
+ factoryLBP, partitionName, null);
+ Object factoryProxy = Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful cluster proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
+ Dispatcher.singleton.registerTarget(targetId, this);
+
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+ @Override
+ protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ String stackName = this.getStackNameInterceptors();
+ RemoteBinding binding = this.getBinding();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
+ .getAdvisor(), null), this.wrapper, this.lbPolicy, partitionName, getLocator(), id, businessInterfaceType);
+
+ if(type.equals(SpecificationInterfaceType.EJB21))
+ {
+ return this.constructEjb21Proxy(handler);
+ }
+ else
+ {
+ return this.constructProxyBusiness(handler);
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ Dispatcher.singleton.unregisterTarget(getTargetId());
+ hatarget.destroy();
+ drm.unregisterListener(proxyFamilyName, this);
+ this.getContainer().getClusterFamilies().remove(proxyFamilyName);
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ super.stop();
+ }
+
+ /**
+ * @return unique name for this proxy factory
+ */
+ protected String getTargetId()
+ {
+ assert jndiName != null : "jndiName is null";
+ String partition = ((SessionContainer) getContainer()).getPartitionName();
+ return jndiName + PROXY_FACTORY_NAME + "@" + partition;
+ }
+
+ public synchronized void replicantsChanged (String key,
+ List newReplicants,
+ int newReplicantsViewId,
+ boolean merge)
+ {
+ try
+ {
+ // Update the FamilyClusterInfo with the new targets
+ ArrayList targets = new ArrayList(newReplicants);
+ wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,245 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateful;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.rmi.dgc.VMID;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.LocalHome;
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalHomeProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.proxy.ejb.handle.StatefulHandleImpl;
-import org.jboss.util.NotImplementedException;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
-{
- private VMID vmid = Ejb3Registry.getVMID();
-
- /**
- * Do not call, only for externalizable
- */
- public StatefulLocalProxyFactory()
- {
- super();
- }
-
- public StatefulLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return true;
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.LOCAL;
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @LocalHome
- LocalHome localHome = container.getAnnotation(LocalHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
- .getLocalInterfaces(container));
-
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()).equals(this.jndiName);
- }
-
- public void start() throws Exception
- {
- super.start();
-
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, this);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful local proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
-
- SessionContainer statefulContainer = (SessionContainer) getContainer();
- LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Class<?>[] interfaces =
- {localHome.value()};
- Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(statefulContainer.getBeanClass().getClassLoader(),
- interfaces, new StatefulLocalHomeProxyInvocationHandler(statefulContainer));
- Util.rebind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer),
- homeProxy);
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- SessionContainer statefulContainer = this.getContainer();
- LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer));
- }
- }
-
- public Object createProxyBusiness()
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- Object id = sfsb.createSession();
- return this.createProxyBusiness(id);
- }
-
- public EJBLocalObject createProxyEjb21(String businessInterfaceType)
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id, businessInterfaceType);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- return this.createProxyBusiness(null, businessInterfaceType);
- }
-
- public Object createProxyBusiness(Object id)
- {
- return this.createProxyBusiness(id, null);
- }
-
- public Object createProxyBusiness(Object id, String businessInterfaceType)
- {
- return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21(Object id, String businessInterfaceType)
- {
- return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, null);
- }
-
- private Object createProxy(Object id, SpecificationInterfaceType type, String businessInterfaceType)
- {
- StatefulLocalProxyInvocationHandler proxy = new StatefulLocalProxyInvocationHandler(this.getContainer(), id,
- vmid, businessInterfaceType);
- return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
- .constructEjb21Proxy(proxy);
- }
-
- public Object createProxy(Class<?>[] initTypes, Object[] initValues)
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- Object id = sfsb.createSession(initTypes, initValues);
- return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, null);
- }
-
- public Object createProxyEjb21(Class<?>[] initTypes, Object[] initValues, String businessInterfaceType)
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- Object id = sfsb.createSession(initTypes, initValues);
- return this.createProxyEjb21(id, businessInterfaceType);
- }
-
- protected StatefulHandleImpl createHandle()
- {
- throw new NotImplementedException("NYI");
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- vmid = (VMID)in.readObject();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(vmid);
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateful;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.rmi.dgc.VMID;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.LocalHome;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalHomeProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.proxy.ejb.handle.StatefulHandleImpl;
+import org.jboss.util.NotImplementedException;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
+{
+ private VMID vmid = Ejb3Registry.getVMID();
+
+ /**
+ * Do not call, only for externalizable
+ */
+ public StatefulLocalProxyFactory()
+ {
+ super();
+ }
+
+ public StatefulLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
+ {
+ super(container, ProxyFactoryHelper.getLocalJndiName(container));
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ @Override
+ protected ProxyAccessType getProxyAccessType(){
+ return ProxyAccessType.LOCAL;
+ }
+
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @LocalHome
+ LocalHome localHome = container.getAnnotation(LocalHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
+ .getLocalInterfaces(container));
+
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ String localHomeJndiName = ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer());
+ if(localHomeJndiName!=null)
+ {
+ return localHomeJndiName.equals(this.jndiName);
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
+ * is in place, but this keeps us moving forward easily.
+ *
+ * @deprecated Hack
+ * @return
+ */
+ @Deprecated
+ protected boolean isLocal()
+ {
+ return true;
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, this);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful local proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+
+ SessionContainer statefulContainer = (SessionContainer) getContainer();
+ LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Class<?>[] interfaces =
+ {localHome.value()};
+ Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(statefulContainer.getBeanClass().getClassLoader(),
+ interfaces, new StatefulLocalHomeProxyInvocationHandler(statefulContainer));
+ Util.rebind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer),
+ homeProxy);
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ SessionContainer statefulContainer = this.getContainer();
+ LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Util.unbind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer));
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ Object id = sfsb.createSession();
+ return this.createProxyBusiness(id);
+ }
+
+ public EJBLocalObject createProxyEjb21(String businessInterfaceType)
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyEjb21(id, businessInterfaceType);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this.createProxyBusiness(null, businessInterfaceType);
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ return this.createProxyBusiness(id, null);
+ }
+
+ public Object createProxyBusiness(Object id, String businessInterfaceType)
+ {
+ return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBLocalObject> T createProxyEjb21(Object id, String businessInterfaceType)
+ {
+ return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, null);
+ }
+
+ private Object createProxy(Object id, SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ StatefulLocalProxyInvocationHandler proxy = new StatefulLocalProxyInvocationHandler(this.getContainer(), id,
+ vmid, businessInterfaceType);
+ return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
+ .constructEjb21Proxy(proxy);
+ }
+
+ public Object createProxy(Class<?>[] initTypes, Object[] initValues)
+ {
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ Object id = sfsb.createSession(initTypes, initValues);
+ return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, null);
+ }
+
+ public Object createProxyEjb21(Class<?>[] initTypes, Object[] initValues, String businessInterfaceType)
+ {
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ Object id = sfsb.createSession(initTypes, initValues);
+ return this.createProxyEjb21(id, businessInterfaceType);
+ }
+
+ protected StatefulHandleImpl createHandle()
+ {
+ throw new NotImplementedException("NYI");
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ vmid = (VMID)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(vmid);
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,197 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateful;
-
-import java.lang.reflect.Proxy;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.aspects.remoting.PojiProxy;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulHomeRemoteProxyInvocationHandler;
-import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
-
- public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return false;
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
- log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- SessionSpecContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer);
- log.debug("Binding home proxy at " + homeJndiName);
- Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- Dispatcher.singleton.unregisterTarget(getTargetId());
-
- SessionContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- super.stop();
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulHomeRemoteProxyInvocationHandler proxy = new StatefulHomeRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(
- getContainer().getAdvisor(), null), this.getLocator());
-
- setEjb21Objects(proxy);
- Class<?>[] intfs = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- return jndiName + PROXY_FACTORY_NAME;
- }
-
- protected Object createPojiProxy(Object oid, Class<?>[] interfaces, String uri) throws Exception
- {
- InvokerLocator locator = new InvokerLocator(uri);
- Interceptor[] interceptors = {IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
- return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
-
- }
-
-
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateful;
+
+import java.lang.reflect.Proxy;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.aspects.remoting.PojiProxy;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulHomeRemoteProxyInvocationHandler;
+import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
+
+ private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
+
+ public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ Class<?>[] interfaces = {ProxyFactory.class};
+ String targetId = getTargetId();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
+ log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
+ Dispatcher.singleton.registerTarget(targetId, this);
+
+ SessionSpecContainer statefulContainer = this.getContainer();
+ RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndBusinessTogether())
+ {
+ Object homeProxy = createHomeProxy(remoteHome.value());
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer);
+ log.debug("Binding home proxy at " + homeJndiName);
+ Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy);
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ Dispatcher.singleton.unregisterTarget(getTargetId());
+
+ SessionContainer statefulContainer = this.getContainer();
+ RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndBusinessTogether())
+ {
+ Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
+ }
+ super.stop();
+ }
+
+ public Object createHomeProxy(Class<?> homeInterface)
+ {
+ try
+ {
+ String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ RemoteBinding binding = this.getBinding();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulHomeRemoteProxyInvocationHandler proxy = new StatefulHomeRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(
+ getContainer().getAdvisor(), null), this.getLocator());
+
+ setEjb21Objects(proxy);
+ Class<?>[] intfs = {homeInterface};
+ return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
+ {
+ proxy.setHandle(this.createHandle());
+ proxy.setHomeHandle(getHomeHandle());
+ proxy.setEjbMetaData(getEjbMetaData());
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+ /**
+ * @return unique name for this proxy factory
+ */
+ protected String getTargetId()
+ {
+ assert jndiName != null : "jndiName is null";
+ return jndiName + PROXY_FACTORY_NAME;
+ }
+
+ protected Object createPojiProxy(Object oid, Class<?>[] interfaces, String uri) throws Exception
+ {
+ InvokerLocator locator = new InvokerLocator(uri);
+ Interceptor[] interceptors = {IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
+ PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
+ return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
+
+ }
+
+
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,144 +0,0 @@
-package org.jboss.ejb3.proxy.factory.stateless;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
-import org.jboss.remoting.InvokerLocator;
-
-public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
-{
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, JbossSessionBeanJndiNameResolver
- .resolveRemoteBusinessDefaultJndiName((JBossSessionBeanMetaData) container.getXml()));
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected final ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected final void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container)
- {
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
- }
-
- public Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
- {
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(),
- stack.createInterceptors(getContainer().getAdvisor(), null), locator, businessInterfaceType);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- public final StatelessHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21(null);
- StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy);
- return handle;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21(String businessInterfaceType)
- {
- // Cast explicitly to catch improper proxies
- return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,141 @@
+package org.jboss.ejb3.proxy.factory.stateless;
+
+import javax.ejb.EJBObject;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
+import org.jboss.remoting.InvokerLocator;
+
+public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
+{
+
+ // Instance Members
+
+ private RemoteBinding binding;
+
+ private InvokerLocator locator;
+
+ // Constructor
+ public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, ProxyFactoryHelper.getRemoteBusinessJndiName(container));
+
+ this.binding = binding;
+
+ try
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ this.locator = new InvokerLocator(clientBindUrl);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Required Implementations
+
+ @Override
+ protected final ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.REMOTE;
+ }
+
+ @Override
+ protected final void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+ }
+
+ // Specifications
+
+ abstract String getStackNameInterceptors();
+
+ // Functional Methods
+
+ protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container)
+ {
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
+ String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
+ return homeJndiName.equals(remoteBusinessJndiName);
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
+ public Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ String stackName = this.getStackNameInterceptors();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(),
+ stack.createInterceptors(getContainer().getAdvisor(), null), locator, businessInterfaceType);
+
+ if(type.equals(SpecificationInterfaceType.EJB21))
+ {
+ return this.constructEjb21Proxy(proxy);
+ }
+ else
+ {
+ return this.constructProxyBusiness(proxy);
+ }
+ }
+
+ @Override
+ public final StatelessHandleRemoteImpl createHandle()
+ {
+ EJBObject proxy = this.createProxyEjb21(null);
+ StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy);
+ return handle;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBObject> T createProxyEjb21(String businessInterfaceType)
+ {
+ // Cast explicitly to catch improper proxies
+ return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ // Accessors / Mutators
+
+ RemoteBinding getBinding()
+ {
+ assert this.binding!=null : "RemoteBinding has not been initialized";
+ return this.binding;
+ }
+
+ InvokerLocator getLocator()
+ {
+ assert this.locator!=null : "InvokerLocator has not been initialized";
+ return this.locator;
+ }
+
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,217 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateless;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessClusteredInvocationHandler;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.client.loadbalance.RandomRobin;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HAPartitionLocator;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessClusterProxyFactory extends BaseStatelessRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
-
- private static final String STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatelessSessionClientInterceptors";
-
- private RemoteBinding binding;
- private Clustered clustered;
- private InvokerLocator locator;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
- private Object proxy;
-
- public StatelessClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.binding = binding;
- this.clustered = clustered;
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return false;
- }
-
- public void start() throws Exception
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- StatelessContainer container = (StatelessContainer) getContainer();
- String partitionName = container.getPartitionName();
- proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
- drm = partition.getDistributedReplicantManager();
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
-
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new RandomRobin();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
- }
-
- public void stop() throws Exception
- {
- super.stop();
- proxy = null;
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
- }
-
- public Object createProxyBusiness(String businessInterfaceClassName)
- {
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- /*
- Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
- return proxyConstructor.newInstance(args);
- */
- String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
-
- proxy = constructProxy(new StatelessClusteredInvocationHandler(getContainer(), stack.createInterceptors(
- getContainer().getAdvisor(), null), wrapper, lbPolicy, partitionName, getLocator(), businessInterfaceClassName),
- SpecificationInterfaceType.EJB30_BUSINESS);
- return proxy;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether(){
- // Not Supported
- return false;
- }
-
- @SuppressWarnings("unchecked")
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList<Object> targets = new ArrayList<Object>(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
-
- // Rebind the proxy as the old one has been serialized
- if (proxy != null)
- bindProxy(proxy);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateless;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessClusteredInvocationHandler;
+import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.ha.client.loadbalance.RandomRobin;
+import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
+import org.jboss.ha.framework.server.HATarget;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessClusterProxyFactory extends BaseStatelessRemoteProxyFactory
+ implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
+{
+ private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
+
+ private static final String STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatelessSessionClientInterceptors";
+
+ private RemoteBinding binding;
+ private Clustered clustered;
+ private InvokerLocator locator;
+ private DistributedReplicantManager drm;
+ private HATarget hatarget;
+ private String proxyFamilyName;
+ private LoadBalancePolicy lbPolicy;
+ private FamilyWrapper wrapper;
+ private Object proxy;
+
+ public StatelessClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
+ {
+ super(container, binding);
+
+ assert clustered != null : "clustered is null";
+
+ this.binding = binding;
+ this.clustered = clustered;
+ }
+
+ public void start() throws Exception
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
+ locator = new InvokerLocator(clientBindUrl);
+ StatelessContainer container = (StatelessContainer) getContainer();
+ String partitionName = container.getPartitionName();
+ proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
+ drm = partition.getDistributedReplicantManager();
+ hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
+ ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
+
+ container.getClusterFamilies().put(proxyFamilyName, hatarget);
+
+ if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
+ {
+ lbPolicy = new RandomRobin();
+ }
+ else
+ {
+ String policyClass = clustered.loadBalancePolicy();
+ try
+ {
+ RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
+ Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
+ policyClass = policy.getName();
+ }
+ catch (LoadBalancePolicyNotRegisteredException e){}
+
+ lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
+ .newInstance();
+ }
+ wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
+
+ drm.registerListener(proxyFamilyName, this);
+
+ super.start();
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ proxy = null;
+ hatarget.destroy();
+ drm.unregisterListener(proxyFamilyName, this);
+ ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceClassName)
+ {
+ String stackName = this.getStackNameInterceptors();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ /*
+ Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
+ return proxyConstructor.newInstance(args);
+ */
+ String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
+
+ proxy = constructProxy(new StatelessClusteredInvocationHandler(getContainer(), stack.createInterceptors(
+ getContainer().getAdvisor(), null), wrapper, lbPolicy, partitionName, getLocator(), businessInterfaceClassName),
+ SpecificationInterfaceType.EJB30_BUSINESS);
+ return proxy;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether(){
+ // Not Supported
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public synchronized void replicantsChanged (String key,
+ List newReplicants,
+ int newReplicantsViewId,
+ boolean merge)
+ {
+ try
+ {
+ // Update the FamilyClusterInfo with the new targets
+ ArrayList<Object> targets = new ArrayList<Object>(newReplicants);
+ wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
+
+ // Rebind the proxy as the old one has been serialized
+ if (proxy != null)
+ bindProxy(proxy);
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ // Not Supported
+ return null;
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,172 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateless;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.LocalHome;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessLocalProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
-
- public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
- {
- super(container, JbossSessionBeanJndiNameResolver
- .resolveLocalBusinessDefaultJndiName((JBossSessionBeanMetaData) container.getXml()));
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
- }
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.LOCAL;
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return true;
- }
-
-
- protected void validateEjb21Views(){
-
- EJBContainer container = this.getContainer();
-
- LocalHome localHome = container.getAnnotation(LocalHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
- .getLocalInterfaces(container));
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()).equals(jndiName);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- SessionSpecContainer statelessContainer = getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Class<?>[] interfaces =
- {localHome.value()};
- Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
- interfaces, new StatelessLocalProxyInvocationHandler(getContainer(), null));
- Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
- }
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- return this
- .constructProxyBusiness(new StatelessLocalProxyInvocationHandler(getContainer(), businessInterfaceType));
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21(String businessInterfaceType)
- {
- return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- private Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
- {
- StatelessLocalProxyInvocationHandler proxy = new StatelessLocalProxyInvocationHandler(this.getContainer(),
- businessInterfaceType);
- return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
- .constructEjb21Proxy(proxy);
- }
-
- @Override
- protected StatelessHandleRemoteImpl createHandle()
- {
- // Local beans have no Handle
- //TODO Rework the contract such that this method does not need to be
- // defined for local proxy factories
- return null;
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateless;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.LocalHome;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessLocalProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
+
+ public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
+ {
+ super(container, ProxyFactoryHelper.getLocalJndiName(container));
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
+ }
+
+ @Override
+ protected ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.LOCAL;
+ }
+
+
+ protected void validateEjb21Views(){
+
+ EJBContainer container = this.getContainer();
+
+ LocalHome localHome = container.getAnnotation(LocalHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
+ .getLocalInterfaces(container));
+ }
+
+ /**
+ * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
+ * is in place, but this keeps us moving forward easily.
+ *
+ * @deprecated Hack
+ * @return
+ */
+ @Deprecated
+ @Override
+ protected boolean isLocal()
+ {
+ return true;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ String localHomeJndiName = ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer());
+ if(localHomeJndiName!=null)
+ {
+ return localHomeJndiName.equals(jndiName);
+ }
+ return false;
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ SessionSpecContainer statelessContainer = getContainer();
+ LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Class<?>[] interfaces =
+ {localHome.value()};
+ Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
+ interfaces, new StatelessLocalProxyInvocationHandler(getContainer(), null));
+ Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy);
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ super.stop();
+ SessionSpecContainer statelessContainer = this.getContainer();
+ LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this
+ .constructProxyBusiness(new StatelessLocalProxyInvocationHandler(getContainer(), businessInterfaceType));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBLocalObject> T createProxyEjb21(String businessInterfaceType)
+ {
+ return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ private Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ StatelessLocalProxyInvocationHandler proxy = new StatelessLocalProxyInvocationHandler(this.getContainer(),
+ businessInterfaceType);
+ return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
+ .constructEjb21Proxy(proxy);
+ }
+
+ @Override
+ protected StatelessHandleRemoteImpl createHandle()
+ {
+ // Local beans have no Handle
+ //TODO Rework the contract such that this method does not need to be
+ // defined for local proxy factories
+ return null;
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,161 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.factory.stateless;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors";
-
- public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
- }
-
- public void init() throws Exception
- {
- super.init();
- }
-
- /**
- * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy
- * is in place, but this keeps us moving forward easily.
- *
- * @deprecated Hack
- * @return
- */
- @Deprecated
- protected boolean isLocal()
- {
- return false;
- }
-
- public void start() throws Exception
- {
- super.start();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer()))
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer());
- try
- {
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
- Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
-
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- InvokerLocator locator = this.getLocator();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), stack
- .createInterceptors(getContainer().getAdvisor(), null), locator, null);
- setEjb21Objects(proxy);
- Class<?>[] interfaces = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (from rev 75882, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.factory.stateless;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
+
+ private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors";
+
+ public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ SessionSpecContainer container = this.getContainer();
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
+ if(homeJndiName!=null)
+ {
+ return homeJndiName.equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public void init() throws Exception
+ {
+ super.init();
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+ RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer()))
+ {
+ Object homeProxy = createHomeProxy(remoteHome.value());
+ String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer());
+ try
+ {
+ log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
+ Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ SessionSpecContainer statelessContainer = this.getContainer();
+ RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer))
+ {
+ Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
+ }
+ }
+
+ public Object createHomeProxy(Class<?> homeInterface)
+ {
+ try
+ {
+ String stackName = this.getStackNameInterceptors();
+ RemoteBinding binding = this.getBinding();
+ InvokerLocator locator = this.getLocator();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), stack
+ .createInterceptors(getContainer().getAdvisor(), null), locator, null);
+ setEjb21Objects(proxy);
+ Class<?>[] interfaces = {homeInterface};
+ return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml
===================================================================
--- projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,474 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<aop xmlns="urn:jboss:aop-beans:1.0">
- <interceptor class="org.jboss.aspects.remoting.InvokeRemoteInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.security.client.SecurityClientInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.aspects.tx.ClientTxPropagationInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.remoting.IsLocalInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.aspects.remoting.ClusterChooserInterceptor" scope="PER_VM"/>
-
- <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor" scope="PER_VM"/>
-
- <stack name="ServiceClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="AsynchronousStatelessSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="AsynchronousStatefulSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="StatelessSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="StatefulSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="ClusteredStatelessSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <stack name="ClusteredStatefulSessionClientInterceptors">
- <interceptor-ref name="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
- </stack>
-
- <interceptor class="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.asynchronous.AsynchronousInterceptor" scope="PER_CLASS"/>
- <interceptor class="org.jboss.ejb3.ENCPropagationInterceptor" scope="PER_VM"/>
- <interceptor name="Basic Authorization" factory="org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/>
- <interceptor name="JACC Authorization" factory="org.jboss.ejb3.security.JaccAuthorizationInterceptorFactory" scope="PER_CLASS"/>
- <interceptor factory="org.jboss.ejb3.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/>
- <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
- <interceptor class="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.stateful.StatefulInstanceInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.service.ServiceSingletonInterceptor" scope="PER_VM"/>
- <interceptor class="org.jboss.ejb3.cache.StatefulReplicationInterceptor" scope="PER_VM"/>
- <interceptor factory="org.jboss.ejb3.stateful.StatefulRemoveFactory" scope="PER_CLASS_JOINPOINT"/>
- <interceptor factory="org.jboss.ejb3.tx.BMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
- <interceptor factory="org.jboss.ejb3.tx.CMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
- <!-- interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/ -->
- <interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/>
- <interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/>
- <interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
- <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
-
- <!--
- INTERCEPTORS
- -->
-
- <aspect name="InjectInterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InjectInterceptorsFactory" scope="PER_JOINPOINT"/>
- <aspect name="InterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InterceptorsFactory" scope="PER_INSTANCE"/>
- <aspect name="InvocationContextInterceptor" class="org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor" scope="PER_VM"/>
-
- <!-- TODO: this is actually the bootstrap container -->
- <domain name="Intercepted Bean">
- <pointcut name="beanAroundInvokeCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.AroundInvoke(..))"/>
- <pointcut name="beanPostConstructCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.PostConstruct(..))"/>
- <pointcut name="beanPreDestroyCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.PreDestroy(..))"/>
-
- <pointcut name="beanLifecycleCallbackMethods" expr="beanAroundInvokeCallbackMethods OR beanPostConstructCallbackMethods OR beanPreDestroyCallbackMethods"/>
-
- <!-- Prepare for dynamic AOP -->
- <!-- TODO: optimize, we only need managed objects (and interceptors!) to be aspectized -->
- <!-- prepare expr="all(*) AND has(@org.jboss.ejb3.interceptors.ManagedObject->new(..))"/ -->
- <!-- TODO: let's see if we can do without
- <prepare expr="all(*)"/>
- -->
-
- <!-- Setup AOP interceptors based on spec interceptors -->
- <bind pointcut="construction(@org.jboss.ejb3.interceptors.ManagedObject->new(..))">
- <!-- interceptor-ref name="LoggingInterceptor"/ -->
- <!-- TODO: we don't need invocation context here -->
- <!-- TODO: we do until we've seperated the post constructs -->
- <advice name="setup" aspect="InvocationContextInterceptor"/>
- <advice name="invoke" aspect="InterceptorsFactory"/>
- </bind>
-
- <!-- Lifecycle Event Callbacks (EJB 3 12.4) -->
-
- <!-- TODO: for now handled in EJBContainer.invokePostConstruct until injection is refactored
- <bind pointcut="construction(@org.jboss.ejb3.interceptors.ManagedObject->new(..))">
- <advice name="setup" aspect="InvocationContextInterceptor"/>
- <advice name="postConstruct" aspect="InjectInterceptorsFactory"/>
- </bind>
- -->
-
- <!-- this is the usual way, now we move it into the other domains, because the
- invocation of EJB interceptors must be the last in the chain
- <bind pointcut="execution(* @org.jboss.ejb3.interceptors.ManagedObject->*(..)) AND !beanLifecycleCallbackMethods">
- <advice name="setup" aspect="InvocationContextInterceptor"/>
- <advice name="fillMethod" aspect="InvocationContextInterceptor"/>
- <advice name="aroundInvoke" aspect="InjectInterceptorsFactory"/>
- </bind>
- -->
- <stack name="EJBInterceptors">
- <advice name="setup" aspect="InvocationContextInterceptor"/>
- <advice name="fillMethod" aspect="InvocationContextInterceptor"/>
- <advice name="aroundInvoke" aspect="InjectInterceptorsFactory"/>
- </stack>
-
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor"/>
- </bind>
- </domain>
-
-
-
- <domain name="Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="Basic Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
- <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="JACC Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="JACC Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
- <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="Base Stateful Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="Basic Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
- <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- </bind>
- <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
- </bind>
-
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
- <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
- </bind>
-
- <bind pointcut="execution(public * *->*(..))">
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
-
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
- <!-- NON Clustered cache configuration -->
- <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.Cache ("SimpleStatefulCache")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.PersistenceManager) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.PersistenceManager ("StatefulSessionFilePersistenceManager")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.CacheConfig (maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
- </annotation>
-
- <!-- Clustered cache configuration -->
- <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
- </annotation>
- </domain>
-
- <domain name="JACC Stateful Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="JACC Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
- <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- </bind>
- <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
- <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
-
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
- <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
-
- <!-- NON Clustered cache configuration -->
- <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.Cache ("SimpleStatefulCache")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.PersistenceManager) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.PersistenceManager ("StatefulSessionFilePersistenceManager")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND !class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.CacheConfig (maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
- </annotation>
-
- <!-- Clustered cache configuration -->
- <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND class(@org.jboss.ejb3.annotation.Clustered)">
- @org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
- </annotation>
- </domain>
-
- <domain name="Embedded Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
- <!-- NON Clustered cache configuration -->
- <annotation expr="!class(@org.jboss.ejb3.annotation.Cache)">
- @org.jboss.ejb3.annotation.Cache ("NoPassivationCache")
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
-
- </domain>
-
- <domain name="Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <!-- TODO: Authorization? -->
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="Consumer Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- </bind>
- <bind pointcut="execution(public * *->*(..)) AND (has(* *->@org.jboss.ejb3.annotation.CurrentMessage(..)) OR hasfield(* *->@org.jboss.ejb3.annotation.CurrentMessage))">
- <interceptor-ref name="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
- @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
- </annotation>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="Service Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- </bind>
- <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="Basic Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- </bind>
- <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
- <domain name="JACC Service Bean" extends="Intercepted Bean" inheritBindings="true">
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- </bind>
- <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
- <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
- <interceptor-ref name="Basic Authorization"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
- </bind>
- <bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
- <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
- </bind>
- <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
- <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
- <stack-ref name="EJBInterceptors"/>
- </bind>
- <annotation expr="!class(@org.jboss.ejb3.annotation.JndiBindingPolicy)">
- @org.jboss.ejb3.annotation.JndiBindingPolicy (policy=org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy.class)
- </annotation>
- </domain>
-
-</aop>
\ No newline at end of file
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml (from rev 75882, projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/main/resources/ejb3-interceptors-aop.xml 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,447 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <interceptor class="org.jboss.aspects.remoting.InvokeRemoteInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.security.client.SecurityClientInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.aspects.tx.ClientTxPropagationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.remoting.IsLocalInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.aspects.remoting.ClusterChooserInterceptor" scope="PER_VM"/>
+
+ <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor" scope="PER_VM"/>
+
+ <stack name="ServiceClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="AsynchronousStatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="AsynchronousStatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="StatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="StatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="ClusteredStatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="ClusteredStatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.client.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <interceptor class="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.asynchronous.AsynchronousInterceptor" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.ENCPropagationInterceptor" scope="PER_VM"/>
+ <interceptor name="Basic Authorization" factory="org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor name="JACC Authorization" factory="org.jboss.ejb3.security.JaccAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.ejb3.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateful.StatefulInstanceInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.service.ServiceSingletonInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.cache.StatefulReplicationInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.stateful.StatefulRemoveFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.tx.BMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.tx.CMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+ <!-- interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/ -->
+ <interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
+
+ <!--
+ INTERCEPTORS
+ -->
+
+ <aspect name="InjectInterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InjectInterceptorsFactory" scope="PER_JOINPOINT"/>
+ <aspect name="InterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InterceptorsFactory" scope="PER_INSTANCE"/>
+ <aspect name="InvocationContextInterceptor" class="org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor" scope="PER_VM"/>
+
+ <!-- TODO: this is actually the bootstrap container -->
+ <domain name="Intercepted Bean">
+ <pointcut name="beanAroundInvokeCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.AroundInvoke(..))"/>
+ <pointcut name="beanPostConstructCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.PostConstruct(..))"/>
+ <pointcut name="beanPreDestroyCallbackMethods" expr="execution(* @org.jboss.ejb3.interceptors.ManagedObject->@javax.interceptor.PreDestroy(..))"/>
+
+ <pointcut name="beanLifecycleCallbackMethods" expr="beanAroundInvokeCallbackMethods OR beanPostConstructCallbackMethods OR beanPreDestroyCallbackMethods"/>
+
+ <!-- Prepare for dynamic AOP -->
+ <!-- TODO: optimize, we only need managed objects (and interceptors!) to be aspectized -->
+ <!-- prepare expr="all(*) AND has(@org.jboss.ejb3.interceptors.ManagedObject->new(..))"/ -->
+ <!-- TODO: let's see if we can do without
+ <prepare expr="all(*)"/>
+ -->
+
+ <!-- Setup AOP interceptors based on spec interceptors -->
+ <bind pointcut="construction(@org.jboss.ejb3.interceptors.ManagedObject->new(..))">
+ <!-- interceptor-ref name="LoggingInterceptor"/ -->
+ <!-- TODO: we don't need invocation context here -->
+ <!-- TODO: we do until we've seperated the post constructs -->
+ <advice name="setup" aspect="InvocationContextInterceptor"/>
+ <advice name="invoke" aspect="InterceptorsFactory"/>
+ </bind>
+
+ <!-- Lifecycle Event Callbacks (EJB 3 12.4) -->
+
+ <!-- TODO: for now handled in EJBContainer.invokePostConstruct until injection is refactored
+ <bind pointcut="construction(@org.jboss.ejb3.interceptors.ManagedObject->new(..))">
+ <advice name="setup" aspect="InvocationContextInterceptor"/>
+ <advice name="postConstruct" aspect="InjectInterceptorsFactory"/>
+ </bind>
+ -->
+
+ <!-- this is the usual way, now we move it into the other domains, because the
+ invocation of EJB interceptors must be the last in the chain
+ <bind pointcut="execution(* @org.jboss.ejb3.interceptors.ManagedObject->*(..)) AND !beanLifecycleCallbackMethods">
+ <advice name="setup" aspect="InvocationContextInterceptor"/>
+ <advice name="fillMethod" aspect="InvocationContextInterceptor"/>
+ <advice name="aroundInvoke" aspect="InjectInterceptorsFactory"/>
+ </bind>
+ -->
+ <stack name="EJBInterceptors">
+ <advice name="setup" aspect="InvocationContextInterceptor"/>
+ <advice name="fillMethod" aspect="InvocationContextInterceptor"/>
+ <advice name="aroundInvoke" aspect="InjectInterceptorsFactory"/>
+ </stack>
+
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor"/>
+ </bind>
+ </domain>
+
+
+
+ <domain name="Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="JACC Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="JACC Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Base Stateful Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
+ </bind>
+
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
+ </bind>
+
+ <bind pointcut="execution(public * *->*(..))">
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.Cache ("SimpleStatefulCache")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.PersistenceManager) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.PersistenceManager ("StatefulSessionFilePersistenceManager")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.CacheConfig (maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
+ </annotation>
+
+ <!-- Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
+ </annotation>
+ </domain>
+
+ <domain name="JACC Stateful Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="JACC Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
+ </annotation>
+
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.Cache ("SimpleStatefulCache")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.PersistenceManager) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.PersistenceManager ("StatefulSessionFilePersistenceManager")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND !class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.CacheConfig (maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
+ </annotation>
+
+ <!-- Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache")
+ </annotation>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND class(@org.jboss.ejb3.annotation.Clustered)">
+ @org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
+ </annotation>
+ </domain>
+
+ <domain name="Embedded Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Cache)">
+ @org.jboss.ejb3.annotation.Cache ("NoPassivationCache")
+ </annotation>
+
+ </domain>
+
+ <domain name="Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <!-- TODO: Authorization? -->
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Consumer Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND (has(* *->@org.jboss.ejb3.annotation.CurrentMessage(..)) OR hasfield(* *->@org.jboss.ejb3.annotation.CurrentMessage))">
+ <interceptor-ref name="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.ejb3.annotation.Pool)">
+ @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Service Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ </bind>
+ <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ </domain>
+
+ <domain name="JACC Service Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ </bind>
+ <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
+ <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ </domain>
+
+</aop>
\ No newline at end of file
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.core.test.stateless.unit;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-
-import org.jboss.aop.Domain;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
-import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
-import org.jboss.ejb3.core.test.stateless.MyStateless;
-import org.jboss.ejb3.core.test.stateless.MyStatelessBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
-import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
-import org.jboss.ejb3.test.common.MetaDataHelper;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.junit.Test;
-
-/**
- * This test is just to get some coverage in StatelessContainer.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class StatelessContainerTestCase extends AbstractEJB3TestCase
-{
- @Test
- public void test1() throws Throwable
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- System.out.println(cl.getResource("jndi.properties"));
- String beanClassname = MyStatelessBean.class.getName();
- String ejbName = MyStatelessBean.class.getSimpleName();
- Domain domain = getDomain("Stateless Bean");
- Hashtable<?,?> ctxProperties = null;
- Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
- JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatelessBean.class);
- StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
-
- // TODO: wickedness
- container.instantiated();
-
- // Register the Container in ObjectStore (MC)
-// String serviceName = "jboss.ejb3:name=MyStatelessBean,service=EJB3";
-// AbstractBeanMetaData bmd = new AbstractBeanMetaData(serviceName, StatelessContainer.class.getName());
-// bootstrap.getKernel().getController().install(bmd, container);
- String containerName = container.getName();
- Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
-
-
- InitialContext ctx = new InitialContext();
- System.out.println("ctx = " + ctx);
- Enumeration<?> i = container.getInitialContext().list("MyStatelessBean");
- while(i.hasMoreElements())
- {
- System.out.println(" " + i.nextElement());
- }
- MyStateless bean = (MyStateless) ctx.lookup("MyStatelessBean/local");
-
- String actual = bean.sayHi("Me");
- assertEquals("Hi Me", actual);
-
- getBootstrap().getKernel().getController().uninstall(containerName);
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java (from rev 75882, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/core/test/stateless/unit/StatelessContainerTestCase.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.stateless.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+
+import org.jboss.aop.Domain;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.stateless.MyStateless;
+import org.jboss.ejb3.core.test.stateless.MyStatelessBean;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
+import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
+import org.jboss.ejb3.test.common.MetaDataHelper;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.junit.Test;
+
+/**
+ * This test is just to get some coverage in StatelessContainer.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class StatelessContainerTestCase extends AbstractEJB3TestCase
+{
+ @Test
+ public void test1() throws Throwable
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ System.out.println(cl.getResource("jndi.properties"));
+ String beanClassname = MyStatelessBean.class.getName();
+ String ejbName = MyStatelessBean.class.getSimpleName();
+ Domain domain = getDomain("Stateless Bean");
+ Hashtable<?,?> ctxProperties = null;
+ Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
+ JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatelessBean.class);
+ StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
+
+ // TODO: wickedness
+ container.instantiated();
+
+ // Register the Container in ObjectStore (MC)
+// String serviceName = "jboss.ejb3:name=MyStatelessBean,service=EJB3";
+// AbstractBeanMetaData bmd = new AbstractBeanMetaData(serviceName, StatelessContainer.class.getName());
+// bootstrap.getKernel().getController().install(bmd, container);
+ String containerName = container.getName();
+ Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
+
+
+ InitialContext ctx = new InitialContext();
+ System.out.println("ctx = " + ctx);
+ //System.out.println(" " + container.getInitialContext().list("MyStatelessBean").next());
+ MyStateless bean = (MyStateless) ctx.lookup("MyStatelessBean/local");
+
+ String actual = bean.sayHi("Me");
+ assertEquals("Hi Me", actual);
+
+ getBootstrap().getKernel().getController().uninstall(containerName);
+ }
+}
Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java 2008-07-16 09:57:50 UTC (rev 75881)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -1,132 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.test.cachepassivation.unit;
-
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.naming.InitialContext;
-
-import junit.framework.TestCase;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Domain;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.cache.persistence.PersistenceManagerFactory;
-import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
-import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
-import org.jboss.ejb3.stateful.StatefulBeanContext;
-import org.jboss.ejb3.test.cachepassivation.MockBean;
-import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
-import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
-import org.jboss.ejb3.test.cachepassivation.MockStatefulContainer;
-import org.jboss.ejb3.test.cachepassivation.MyStatefulSessionFilePersistenceManagerFactory;
-import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
-import org.jboss.naming.JavaCompInitializer;
-import org.jnp.server.SingletonNamingServer;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class CachePassivationUnitTestCase extends TestCase
-{
- public void test1() throws Exception
- {
- new SingletonNamingServer();
-
- Hashtable ctxProperties = new Hashtable();
- ctxProperties.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
- ctxProperties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
-
- JavaCompInitializer initializer = new JavaCompInitializer();
- initializer.setInitialContextProperties(ctxProperties);
- initializer.start();
-
- DummyTransactionManager tm = new DummyTransactionManager();
- InitialContext ic = new InitialContext(ctxProperties);
- ic.bind("java:/TransactionManager", tm);
-
- EmbeddedTestMcBootstrap bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
- Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- String beanClassName = MockBean.class.getName();
- String ejbName = "MockBean";
- Domain domain = new Domain(new AspectManager(), "Test", false);
- Map<String, Class<? extends PersistenceManagerFactory>> factories = new HashMap<String, Class<? extends PersistenceManagerFactory>>();
- factories.put("MyStatefulSessionFilePersistenceManager", MyStatefulSessionFilePersistenceManagerFactory.class);
- PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry = new PersistenceManagerFactoryRegistry();
- persistenceManagerFactoryRegistry.setFactories(factories);
- Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
- deployment.setPersistenceManagerFactoryRegistry(persistenceManagerFactoryRegistry);
- MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, domain, ctxProperties, deployment);
- container.instantiated();
- container.processMetadata();
- System.out.println("injectors = " + container.getInjectors());
- Ejb3Registry.register(container);
- try
- {
- container.create();
- container.setJaccContextId("none");
- container.start();
-
- Object id = container.createSession();
-
- StatefulBeanContext ctx = container.getCache().get(id, false);
-
- System.out.println("inUse = " + ctx.isInUse());
- MockBean bean = (MockBean) ctx.getInstance();
- System.out.println(bean.ctx);
- ctx.setInUse(false);
- ctx = null;
-
- synchronized (MockBean.notification)
- {
- MockBean.notification.wait(5000);
- }
- Thread.sleep(500);
-
- ctx = container.getCache().get(id, false);
- bean = (MockBean) ctx.getInstance();
-
- String a = ctx.getEJBContext().toString();
- String b = bean.ctx.toString();
- System.out.println(ctx.getEJBContext());
- System.out.println(bean.ctx);
- assertTrue(a.regionMatches(a.indexOf('{'), b, b.indexOf('{'), a.length() - a.indexOf('{')));
- }
- finally
- {
- bootstrap.shutdown();
-// container.stop();
-// container.destroy();
-// Ejb3Registry.unregister(container);
- }
- }
-}
Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java (from rev 75882, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.8/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java 2008-07-16 11:06:36 UTC (rev 75914)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.cachepassivation.unit;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+
+import junit.framework.TestCase;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.cache.transaction.DummyTransactionManager;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.cache.persistence.PersistenceManagerFactory;
+import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.stateful.StatefulBeanContext;
+import org.jboss.ejb3.test.cachepassivation.MockBean;
+import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
+import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
+import org.jboss.ejb3.test.cachepassivation.MockStatefulContainer;
+import org.jboss.ejb3.test.cachepassivation.MyStatefulSessionFilePersistenceManagerFactory;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.naming.JavaCompInitializer;
+import org.jnp.server.SingletonNamingServer;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CachePassivationUnitTestCase extends TestCase
+{
+ public void test1() throws Exception
+ {
+ new SingletonNamingServer();
+
+ Hashtable ctxProperties = new Hashtable();
+ ctxProperties.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
+ ctxProperties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+
+ JavaCompInitializer initializer = new JavaCompInitializer();
+ initializer.setInitialContextProperties(ctxProperties);
+ initializer.start();
+
+ DummyTransactionManager tm = new DummyTransactionManager();
+ InitialContext ic = new InitialContext(ctxProperties);
+ ic.bind("java:/TransactionManager", tm);
+
+ EmbeddedTestMcBootstrap bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
+ Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class<?> beanClass = MockBean.class;
+ String beanClassName = beanClass.getName();
+ String ejbName = beanClass.getSimpleName();
+ Domain domain = new Domain(new AspectManager(), "Test", false);
+ Map<String, Class<? extends PersistenceManagerFactory>> factories = new HashMap<String, Class<? extends PersistenceManagerFactory>>();
+ factories.put("MyStatefulSessionFilePersistenceManager", MyStatefulSessionFilePersistenceManagerFactory.class);
+ PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry = new PersistenceManagerFactoryRegistry();
+ persistenceManagerFactoryRegistry.setFactories(factories);
+ Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
+ deployment.setPersistenceManagerFactoryRegistry(persistenceManagerFactoryRegistry);
+ MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, domain, ctxProperties, deployment);
+ container.instantiated();
+ container.processMetadata();
+ System.out.println("injectors = " + container.getInjectors());
+ Ejb3Registry.register(container);
+ try
+ {
+ container.create();
+ container.setJaccContextId("none");
+ container.start();
+
+ Object id = container.createSession();
+
+ StatefulBeanContext ctx = container.getCache().get(id, false);
+
+ System.out.println("inUse = " + ctx.isInUse());
+ MockBean bean = (MockBean) ctx.getInstance();
+ System.out.println(bean.ctx);
+ ctx.setInUse(false);
+ ctx = null;
+
+ synchronized (MockBean.notification)
+ {
+ MockBean.notification.wait(5000);
+ }
+ Thread.sleep(500);
+
+ ctx = container.getCache().get(id, false);
+ bean = (MockBean) ctx.getInstance();
+
+ String a = ctx.getEJBContext().toString();
+ String b = bean.ctx.toString();
+ System.out.println(ctx.getEJBContext());
+ System.out.println(bean.ctx);
+ assertTrue(a.regionMatches(a.indexOf('{'), b, b.indexOf('{'), a.length() - a.indexOf('{')));
+ }
+ finally
+ {
+ bootstrap.shutdown();
+// container.stop();
+// container.destroy();
+// Ejb3Registry.unregister(container);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list