[jboss-cvs] JBossAS SVN: r76905 - in projects/ejb3/tags: jboss-ejb3-core-0.1.11 and 20 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 11 00:04:06 EDT 2008


Author: ALRubinger
Date: 2008-08-11 00:04:05 -0400 (Mon, 11 Aug 2008)
New Revision: 76905

Added:
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml
Removed:
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml
   projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml
Log:
[maven-release-plugin]  copy for tag jboss-ejb3-core-0.1.11

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11 (from rev 76857, projects/ejb3/trunk/core)

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -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</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.11-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.CR4</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.CR4</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.5</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.3</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss.ejb3</groupId>
-      <artifactId>jboss-ejb3-metadata</artifactId>
-      <version>0.12.2</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.3</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.1</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.11/pom.xml (from rev 76904, projects/ejb3/trunk/core/pom.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/pom.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,577 @@
+<!--
+  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.13</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.11</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>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.cluster</groupId>
+      <artifactId>jboss-ha-client</artifactId>
+      <version>1.1.0.CR4</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.CR4</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.5</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.3</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-metadata</artifactId>
+      <version>0.12.2</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-proxy</artifactId>
+      <version>0.1.0</version>
+    </dependency>
+   
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-test</artifactId>
+      <version>0.1.3</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-transactions</artifactId>
+      <version>0.13.3</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.1</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.11</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-core-0.1.11</developerConnection>
+    <url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-core-0.1.11</url>
+  </scm>
+</project>

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,116 +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;
-
-import java.util.Hashtable;
-import javax.ejb.TimerService;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.pool.Pool;
-import org.jboss.ejb3.statistics.InvocationStatistics;
-
-/**
- * Comment
- * 
- * A container is optionally associated with a security manager. If it is
- * the container is running in secured mode, if not the container is running
- * in unchecked mode.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface Container
-{
-   String ENC_CTX_NAME = "java:comp";
-
-   // TODO: Wolf: I don't like this, why the '?', and why the public method
-   /**
-    * Create a bean context for use in a pool.
-    * @return   a ready to use bean context
-    */
-   BeanContext<?> createBeanContext();
-   
-   Object getMBean();
-   
-   Class getBeanClass();
-
-   String getEjbName();
-
-   ObjectName getObjectName();
-
-   TimerService getTimerService();
-
-   /**
-    * This method is called by EJBTimerServiceImpl to re-establish a persistent timer.
-    */
-   TimerService getTimerService(Object pKey);
-
-   Pool getPool();
-
-   void invokePostConstruct(BeanContext beanContext, Object[] params);
-
-   void invokePreDestroy(BeanContext beanContext);
-
-   void invokePostActivate(BeanContext beanContext);
-
-   void invokePrePassivate(BeanContext beanContext);
-
-   void invokeInit(Object bean, Class[] initTypes, Object[] initValues);
-
-   BeanContext<?> peekContext();
-   
-   BeanContext<?> popContext();
-   
-   void pushContext(BeanContext<?> ctx);
-   
-   public void create() throws Exception;
-
-   public void start() throws Exception;
-
-   public void stop() throws Exception;
-
-   public void destroy() throws Exception;
-
-   InitialContext getInitialContext();
-
-   Hashtable getInitialContextProperties();
-
-   Context getEnc();
-
-   void processMetadata();
-
-   DependencyPolicy getDependencyPolicy();
-   
-   InvocationStatistics getInvokeStats();
-   
-   /**
-    * Get the security manager associated with a container.
-    * 
-    * @param    type   the type to cast to
-    * @return   the security manager or null if there is no manager associated
-    */
-   <T> T getSecurityManager(Class<T> type);
-   
-   boolean isClustered();
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Container.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.util.Hashtable;
+import javax.ejb.TimerService;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.pool.Pool;
+import org.jboss.ejb3.statistics.InvocationStatistics;
+
+/**
+ * Comment
+ * 
+ * A container is optionally associated with a security manager. If it is
+ * the container is running in secured mode, if not the container is running
+ * in unchecked mode.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface Container
+{
+   String ENC_CTX_NAME = "java:comp";
+
+   // TODO: Wolf: I don't like this, why the '?', and why the public method
+   /**
+    * Create a bean context for use in a pool.
+    * @return   a ready to use bean context
+    */
+   BeanContext<?> createBeanContext();
+   
+   Object getMBean();
+   
+   Class getBeanClass();
+
+   String getEjbName();
+   
+   String getName();
+
+   ObjectName getObjectName();
+
+   TimerService getTimerService();
+
+   /**
+    * This method is called by EJBTimerServiceImpl to re-establish a persistent timer.
+    */
+   TimerService getTimerService(Object pKey);
+
+   Pool getPool();
+
+   void invokePostConstruct(BeanContext beanContext, Object[] params);
+
+   void invokePreDestroy(BeanContext beanContext);
+
+   void invokePostActivate(BeanContext beanContext);
+
+   void invokePrePassivate(BeanContext beanContext);
+
+   void invokeInit(Object bean, Class[] initTypes, Object[] initValues);
+
+   BeanContext<?> peekContext();
+   
+   BeanContext<?> popContext();
+   
+   void pushContext(BeanContext<?> ctx);
+   
+   public void create() throws Exception;
+
+   public void start() throws Exception;
+
+   public void stop() throws Exception;
+
+   public void destroy() throws Exception;
+
+   InitialContext getInitialContext();
+
+   Hashtable getInitialContextProperties();
+
+   Context getEnc();
+
+   void processMetadata();
+
+   DependencyPolicy getDependencyPolicy();
+   
+   InvocationStatistics getInvokeStats();
+   
+   /**
+    * Get the security manager associated with a container.
+    * 
+    * @param    type   the type to cast to
+    * @return   the security manager or null if there is no manager associated
+    */
+   <T> T getSecurityManager(Class<T> type);
+   
+   boolean isClustered();
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,1549 +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;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.EJBContext;
-import javax.ejb.EJBException;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.TimedObject;
-import javax.ejb.Timeout;
-import javax.ejb.Timer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.LinkRef;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.jboss.aop.Advisor;
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.annotation.AnnotationRepository;
-import org.jboss.aop.joinpoint.ConstructionInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.ejb.AllowedOperationsAssociation;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.defaults.PoolDefaults;
-import org.jboss.ejb3.aop.BeanContainer;
-import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
-import org.jboss.ejb3.entity.PersistenceUnitDeployment;
-import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
-import org.jboss.ejb3.interceptor.InterceptorInjector;
-import org.jboss.ejb3.interceptors.aop.LifecycleCallbacks;
-import org.jboss.ejb3.interceptors.container.ManagedObjectAdvisor;
-import org.jboss.ejb3.interceptors.direct.DirectContainer;
-import org.jboss.ejb3.interceptors.direct.IndirectContainer;
-import org.jboss.ejb3.javaee.JavaEEComponent;
-import org.jboss.ejb3.javaee.JavaEEComponentHelper;
-import org.jboss.ejb3.javaee.JavaEEModule;
-import org.jboss.ejb3.pool.Pool;
-import org.jboss.ejb3.pool.PoolFactory;
-import org.jboss.ejb3.pool.PoolFactoryRegistry;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.security.SecurityDomainManager;
-import org.jboss.ejb3.statistics.InvocationStatistics;
-import org.jboss.ejb3.tx.UserTransactionImpl;
-import org.jboss.injection.DependsHandler;
-import org.jboss.injection.EJBHandler;
-import org.jboss.injection.EncInjector;
-import org.jboss.injection.ExtendedInjectionContainer;
-import org.jboss.injection.InjectionHandler;
-import org.jboss.injection.InjectionUtil;
-import org.jboss.injection.Injector;
-import org.jboss.injection.JndiInjectHandler;
-import org.jboss.injection.PersistenceContextHandler;
-import org.jboss.injection.PersistenceUnitHandler;
-import org.jboss.injection.ResourceHandler;
-import org.jboss.injection.WebServiceRefHandler;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.spec.InterceptorMetaData;
-import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
-import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
-import org.jboss.metadata.javaee.spec.Environment;
-import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.util.naming.Util;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class EJBContainer implements Container, IndirectContainer<EJBContainer, DirectContainer<EJBContainer>>, ExtendedInjectionContainer, JavaEEComponent
-{
-   private static final Logger log = Logger.getLogger(EJBContainer.class);
-
-   private String name;
-   
-   private BeanContainer beanContainer;
-   
-   private DirectContainer<EJBContainer> directContainer;
-   
-   protected EjbEncFactory encFactory = new DefaultEjbEncFactory();
-
-   protected Pool pool;
-
-   protected String ejbName;
-
-   protected ObjectName objectName;
-
-   protected int defaultConstructorIndex;
-
-   protected String beanClassName;
-   
-   private Class<?> beanClass;
-
-   protected ClassLoader classloader;
-
-   // for performance there is an array.
-   protected List<Injector> injectors = new ArrayList<Injector>();
-
-   protected Context enc;
-
-//   protected LifecycleInterceptorHandler callbackHandler;
-
-   protected Hashtable initialContextProperties;
-
-   protected Map<String, EncInjector> encInjectors = new HashMap<String, EncInjector>();
-
-   protected JBossEnterpriseBeanMetaData xml;
-   protected JBossAssemblyDescriptorMetaData assembly;
-
-   protected Map<String, Map<AccessibleObject, Injector>> encInjections = new HashMap<String, Map<AccessibleObject, Injector>>();
-
-//   protected List<InterceptorInfo> classInterceptors = new ArrayList<InterceptorInfo>();
-//
-//   protected LinkedHashSet<InterceptorInfo> applicableInterceptors;
-
-   private HashMap<Class<?>, InterceptorInjector> interceptorInjectors = new HashMap<Class<?>, InterceptorInjector>();
-
-   private Ejb3Deployment deployment;
-
-   private DependencyPolicy dependencyPolicy;
-
-   private String jaccContextId;
-
-   protected HashMap invokedMethod = new HashMap();
-
-   protected InvocationStatistics invokeStats = new InvocationStatistics();
-   
-   private String partitionName;
-   
-   private List<Class<?>> businessInterfaces;
-   
-   private ThreadLocalStack<BeanContext<?>> currentBean = new ThreadLocalStack<BeanContext<?>>();
-   
-   protected boolean reinitialize = false;
-   
-   // To support clean startup/shutdown
-   private ReadWriteLock containerLock = new ReentrantReadWriteLock();
-   
-   /**
-    * @param name                  Advisor name
-    * @param manager               Domain to get interceptor bindings from
-    * @param cl                    the EJB's classloader
-    * @param beanClassName
-    * @param ejbName
-    * @param ctxProperties
-    * @param interceptorRepository
-    * @param deployment
-    * @param beanMetaData           the meta data for this bean or null
-    */
-
-   public EJBContainer(String name, Domain domain, ClassLoader cl,
-                       String beanClassName, String ejbName, Hashtable ctxProperties,
-                       Ejb3Deployment deployment, JBossEnterpriseBeanMetaData beanMetaData) throws ClassNotFoundException
-   {
-      assert name != null : "name is null";
-      assert deployment != null : "deployment is null";
-      
-      this.name = name;
-      this.deployment = deployment;
-      this.beanClassName = beanClassName;
-      this.classloader = cl;
-      this.xml = beanMetaData;
-         
-      this.beanClass = classloader.loadClass(beanClassName);
-      
-      // We can't type cast the direct container, because we just loaded the beanClass
-      // so assuming we have an object is a safe bet.
-      this.beanContainer = new BeanContainer(this);
-      
-      this.ejbName = ejbName;
-      
-      // Because interceptors will query back the EJBContainer for annotations
-      // we must have set beanContainer first and then do the advisor. 
-      try
-      {
-         beanContainer.initialize(ejbName, domain, beanClass, beanMetaData, cl); 
-      }
-      catch(Exception e)
-      {
-         throw new RuntimeException("failed to initialize bean container ",e);
-      }
-      String on = createObjectName(ejbName);
-     
-      try
-      {
-         objectName = new ObjectName(on);
-      }
-      catch (MalformedObjectNameException e)
-      {
-         throw new RuntimeException("failed to create object name for: " + on, e);
-      }
-      
-      //annotations = new AnnotationRepositoryToMetaData(this);
-      
-      initialContextProperties = ctxProperties;
-      try
-      {
-         Util.createSubcontext(getEnc(), "env");
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-      bindORB();
-      bindEJBContext();
-      
-      this.dependencyPolicy = deployment.createDependencyPolicy(this);
-   }
-
-   private void bindEJBContext()
-   {
-      try 
-      {
-         Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
-         ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
-         ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
-         ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
-         Util.rebind(getEnc(), "EJBContext", ref);
-      }
-      catch (NamingException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-   private void bindORB()
-   {
-      try
-      {
-         Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
-      }
-      catch(NamingException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-   public abstract BeanContext<?> createBeanContext();
-   
-   public String createObjectName(String ejbName)
-   {
-      return JavaEEComponentHelper.createObjectName(deployment, ejbName);
-   }
-   
-   /**
-    * Do not call, for BeanContainer.
-    * @throws IllegalAccessException 
-    * @throws InstantiationException 
-    */
-   public Object createInterceptor(Class<?> interceptorClass) throws InstantiationException, IllegalAccessException
-   {
-      Object instance = interceptorClass.newInstance();
-      InterceptorInjector interceptorInjector = interceptorInjectors.get(interceptorClass);
-      assert interceptorInjector != null : "interceptorInjector not found for " + interceptorClass;
-      interceptorInjector.inject(null, instance);
-      return instance;
-   }
-   
-   public String createObjectName(String unitName, String ejbName)
-   {
-      return JavaEEComponentHelper.createObjectName(deployment, unitName, ejbName);
-   }
-   
-   // TODO: re-evaluate this exposure
-   @Deprecated
-   public Advisor getAdvisor()
-   {
-      return beanContainer._getAdvisor();
-   }
-
-   /*
-    * TODO: re-evalute this exposure
-    */
-   @Deprecated
-   public AnnotationRepository getAnnotations()
-   {
-      return beanContainer.getAnnotationRepository();
-   }
-
-   protected BeanContainer getBeanContainer()
-   {
-      return beanContainer;
-   }
-   
-   /**
-    * 
-    * @return   the bean class of this container
-    * @deprecated   use getBeanClass
-    */
-   public Class<?> getClazz()
-   {
-      return getBeanClass();
-   }
-   
-   @SuppressWarnings("unchecked")
-   public static <C extends EJBContainer> C getEJBContainer(Advisor advisor)
-   {
-      try
-      {
-         return (C) ((ManagedObjectAdvisor<Object, BeanContainer>) advisor).getContainer().getEJBContainer();
-      }
-      catch(ClassCastException e)
-      {
-         throw new ClassCastException(e.getMessage() + " using " + advisor);
-      }
-   }
-   
-   public String getName()
-   {
-      return name;
-   }
-   
-   public void pushContext(BeanContext<?> beanContext)
-   {
-      currentBean.push(beanContext);
-   }
-   
-   /**
-    * Makes sure that EJB's ENC is available
-    * Delegates to whatever implementation is used to push the ENC of the EJB
-    * onto the stack
-    *
-    */
-   protected void pushEnc()
-   {
-      encFactory.pushEnc(this);
-   }
-
-   public BeanContext<?> peekContext()
-   {
-      BeanContext<?> ctx = currentBean.get();
-      assert ctx != null : "ctx is null";
-      return ctx;
-   }
-   
-   public BeanContext<?> popContext()
-   {
-      return currentBean.pop();
-   }
-   
-   /**
-    * Pops EJB's ENC from the stack.  Delegates to whatever implementation
-    * is used to pop the EJB's ENC from the stock
-    *
-    */
-   protected void popEnc()
-   {
-      encFactory.popEnc(this);
-   }
-   
-   public Environment getEnvironmentRefGroup()
-   {
-      return xml;
-   }
-
-   public List<Injector> getInjectors()
-   {
-      return injectors;
-   }
-
-
-   public String getJaccContextId()
-   {
-      return jaccContextId;
-   }
-
-   /**
-    * Do not call, used by BeanContainer.
-    * @return
-    */
-   public List<Method> getVirtualMethods()
-   {
-      return null;
-   }
-   
-   public void setJaccContextId(String jaccContextId)
-   {
-      this.jaccContextId = jaccContextId;
-   }
-   
-   public VirtualFile getRootFile()
-   {
-      return getDeploymentUnit().getRootFile();
-   }
-   
-   /**
-    * Return all the business interfaces implemented by this bean.
-    * 
-    * Available after the meta data has been processed.
-    * 
-    * @return   an array of business interfaces or empty if no interface is provided
-    */
-   public List<Class<?>> getBusinessInterfaces()
-   {
-      if(businessInterfaces == null) throw new IllegalStateException("businessInterfaces not yet initialized");
-      return businessInterfaces;
-   }
-      
-   public String getDeploymentQualifiedName()
-   {
-      return objectName.getCanonicalName();
-   }
-   
-   /**
-    * Returns a String identifier for this bean that is qualified by the
-    * deployment, and hence should be unique across deployments. Name is of the 
-    * form "ear=foo.ear,jar=foo.jar,name=Bar", where "Bar" is the value 
-    * returned by {@link #getEjbName()}. The "ear=foo.ear" portion is ommitted 
-    * if the bean is not packaged in an ear.
-    */
-   public String getDeploymentPropertyListString()
-   {
-      return objectName.getCanonicalKeyPropertyListString();
-   }
-   
-   public DeploymentUnit getDeploymentUnit()
-   {
-      return deployment.getDeploymentUnit();
-   }
-
-   public Ejb3Deployment getDeployment()
-   {
-      return deployment;
-   }
-
-   public DependencyPolicy getDependencyPolicy()
-   {
-      return dependencyPolicy;
-   }
-
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
-   {
-      return beanContainer.isAnnotationPresent(annotationType);
-   }
-   
-   /**
-    * Is the method a business method of this container.
-    * 
-    * @param businessMethod     the method in question
-    * @return   true if so, otherwise false
-    */
-   public boolean isBusinessMethod(Method businessMethod)
-   {
-      for(Class<?> businessInterface : getBusinessInterfaces())
-      {
-         for(Method method : businessInterface.getMethods())
-         {
-            if(isCallable(method, businessMethod))
-               return true;
-         }
-      }
-      return false;
-   }
-   
-   /**
-    * Can method definition method be used to call method other.
-    * For example if the method is defined in an interface it can be used to call a method
-    * in a class.
-    * 
-    * @param method
-    * @param other
-    * @return
-    */
-   private static boolean isCallable(Method method, Method other)
-   {
-      if ((method.getDeclaringClass().isAssignableFrom(other.getDeclaringClass())) && (method.getName().equals(other.getName())))
-      {
-         if (!method.getReturnType().equals(other.getReturnType()))
-            return false;
-         Class<?>[] params1 = method.getParameterTypes();
-         Class<?>[] params2 = other.getParameterTypes();
-         if (params1.length == params2.length)
-         {
-            for (int i = 0; i < params1.length; i++)
-            {
-               if (params1[i] != params2[i])
-                  return false;
-            }
-            return true;
-         }
-      }
-      return false;
-   }   
-   
-   /**
-    * introspects EJB container to find all dependencies
-    * and initialize any extra metadata.
-    * <p/>
-    * This must be called before container is registered with any microcontainer
-    *
-    * @param dependencyPolicy
-    */
-   public void processMetadata()
-   {
-      // XML must be done first so that any annotation overrides are initialized
-      
-      // todo injection handlers should be pluggable from XML
-      Collection<InjectionHandler<Environment>> handlers = this.deployment.getHandlers();
-      if(handlers == null)
-      {
-         handlers = new ArrayList<InjectionHandler<Environment>>();
-         handlers.add(new EJBHandler<Environment>());
-         handlers.add(new DependsHandler<Environment>());
-         handlers.add(new JndiInjectHandler<Environment>());
-         handlers.add(new PersistenceContextHandler<Environment>());
-         handlers.add(new PersistenceUnitHandler<Environment>());
-         handlers.add(new ResourceHandler<Environment>());
-         handlers.add(new WebServiceRefHandler<Environment>());
-      }
-
-      ClassLoader old = Thread.currentThread().getContextClassLoader();
-      Thread.currentThread().setContextClassLoader(classloader);
-      try
-      {
-         // EJB container's XML must be processed before interceptor's as it may override interceptor's references
-         for (InjectionHandler<Environment> handler : handlers) handler.loadXml(xml, this);
-
-         Map<AccessibleObject, Injector> tmp = InjectionUtil.processAnnotations(this, handlers, getBeanClass());
-         injectors.addAll(tmp.values());
-
-         /*
-         initialiseInterceptors();
-         */
-         for (Class<?> interceptorClass : beanContainer.getInterceptorClasses())
-         {
-            InterceptorMetaData interceptorMetaData = findInterceptor(interceptorClass);
-            if(interceptorMetaData == null)
-               continue;
-            
-            for (InjectionHandler<Environment> handler : handlers)
-            {
-               handler.loadXml(interceptorMetaData, this);
-            }
-         }
-         for (Class<?> interceptorClass : beanContainer.getInterceptorClasses())
-         {
-            Map<AccessibleObject, Injector> injections = InjectionUtil.processAnnotations(this, handlers, interceptorClass);
-            InterceptorInjector injector = new InterceptorInjector(injections);
-            interceptorInjectors.put(interceptorClass, injector);
-         }
-
-         // When @WebServiceRef is not used service-ref won't be processed
-         // In this case we process them late
-         if(xml != null && xml.getServiceReferences() != null)
-         {
-            for(ServiceReferenceMetaData sref : xml.getServiceReferences())
-            {
-               // FIXME: fix WS metadata
-               /*
-               if(!sref.isProcessed())
-               {
-                  try
-                  {
-                     String name = sref.getServiceRefName();
-                     String encName = "env/" + name;
-                     Context encCtx = getEnc();
-
-                     UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
-                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, getClassloader(), sref);
-
-                  }
-                  catch (Exception e)
-                  {
-                     log.error("Failed to bind service-ref", e);
-                  }
-               }
-               */
-            }
-         }
-         
-         // EJBTHREE-1025
-         this.checkForDuplicateLocalAndRemoteInterfaces();
-         
-         for(Class<?> businessInterface : getBusinessInterfaces())
-            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(businessInterface);
-         
-         Class localHomeInterface = ProxyFactoryHelper.getLocalHomeInterface(this);
-         if(localHomeInterface != null)
-            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(localHomeInterface);
-         
-         Class remoteHomeInterface = ProxyFactoryHelper.getRemoteHomeInterface(this);
-         if(remoteHomeInterface != null)
-            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(remoteHomeInterface);
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(old);
-      }
-   }
-   
-   /**
-    * Ensures that the bean does not implement any one interface as both @Local and @Remote
-    *
-    * @throws EJBException If the bean does implements any one interface as both @Local and @Remote
-    */
-   protected void checkForDuplicateLocalAndRemoteInterfaces() throws EJBException
-   {
-      // Initialize issue used in Error Message
-      String issue = "(EJBTHREE-1025)";
-
-      // Obtain annotations, if found
-      Local local = (Local) resolveAnnotation(Local.class);
-      Remote remote = (Remote) resolveAnnotation(Remote.class);
-
-      // If either local or remote is unspecified, return safely - there can be no overlap
-      if (local == null || remote == null)
-      {
-         return;
-      }
-
-      // Ensure "value" attribute of both local and remote are not blank
-      if (local.value().length < 1 && local.value().length < 1)
-      {
-         throw new EJBException("Cannot designate both " + Local.class.getName() + " and " + Remote.class.getName()
-               + " annotations without 'value' attribute on " + this.getEjbName() + ". " + issue);
-      }
-
-      // Iterate through local and remote interfaces, ensuring any one interface is not being used for both local and remote exposure
-      for (Class<?> localClass : local.value())
-      {
-         for (Class<?> remoteClass : remote.value())
-         {
-            if (localClass.equals(remoteClass))
-            {
-               throw new EJBException("Cannot designate " + localClass.getName() + " as both " + Local.class.getName()
-                     + " and " + Remote.class.getName() + " on " + this.getEjbName() + ". " + issue);
-            }
-         }
-      }
-   }
-
-   public JBossEnterpriseBeanMetaData getXml()
-   {
-      return xml;
-   }
-
-   public JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
-   {
-      return assembly;
-   }
-
-   // FIXME: remove
-   @Deprecated
-   public void setAssemblyDescriptor(JBossAssemblyDescriptorMetaData assembly)
-   {
-      this.assembly = assembly;
-   }
-
-   protected abstract List<Class<?>> resolveBusinessInterfaces();
-   
-   public InterceptorInfoRepository getInterceptorRepository()
-   {
-      throw new RuntimeException("invalid");
-   }
-   
-   public Map<String, EncInjector> getEncInjectors()
-   {
-      return encInjectors;
-   }
-
-   public ClassLoader getClassloader()
-   {
-      return classloader;
-   }
-
-   public InitialContext getInitialContext()
-   {
-      try
-      {
-         return InitialContextFactory.getInitialContext(initialContextProperties);
-      }
-      catch (NamingException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public Map<String, Map<AccessibleObject, Injector>> getEncInjections()
-   {
-      return encInjections;
-   }
-
-   public Context getEnc()
-   {
-      if (enc == null)
-      {
-         enc = encFactory.getEnc(this);
-      }
-      return enc;
-   }
-
-   public Hashtable getInitialContextProperties()
-   {
-      return initialContextProperties;
-   }
-
-   public ObjectName getObjectName()
-   {
-      return objectName;
-   }
-
-   public String getEjbName()
-   {
-      return ejbName;
-   }
-
-   public String getBeanClassName()
-   {
-      return beanClassName;
-   }
-
-   public Class<?> getBeanClass()
-   {
-      return beanClass;
-   }
-
-   public Pool getPool()
-   {
-      return pool;
-   }
-   
-   /**
-    * Gets the name of the cluster partition with which this container is
-    * associated. Not available until <code>EJBContainer.start()</code>
-    * is completed.
-    * 
-    * @return the name of the cluster partition with which this container is
-    *         associated, or <code>null</code> if the container is not clustered
-    */
-   public String getPartitionName()
-   {
-      if (partitionName == null)
-         this.findPartitionName();
-      return partitionName;
-   }
-
-   protected Object construct()
-   {
-      /*
-      try
-      {
-         return beanContainer.construct();
-      }
-      catch (SecurityException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (NoSuchMethodException e)
-      {
-         throw new RuntimeException(e);
-      }
-      */
-      try
-      {
-         return beanClass.newInstance();
-      }
-      catch (InstantiationException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (IllegalAccessException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-   protected void reinitialize()
-   {
-      // FIXME: is this correct?
-      beanContainer.reinitializeAdvisor();
-      
-      /*
-      initClassMetaDataBindingsList();
-      adviceBindings.clear();
-      doesHaveAspects = false;
-      constructorInfos = null;
-      rebuildInterceptors();
-      */
-      
-      bindEJBContext();
-      
-      reinitialize = false;
-   }
-
-   public void create() throws Exception
-   {
-      // Lock until start()
-      this.getContainerLock().lock();
-      /*
-      initializeClassContainer();
-      for (int i = 0; i < constructors.length; i++)
-      {
-         if (constructors[i].getParameterTypes().length == 0)
-         {
-            defaultConstructorIndex = i;
-            break;
-         }
-      }
-      */
-   }
-
-   public final void start() throws Exception
-   {
-      this.lockedStart();
-      
-      this.getContainerLock().unlock();
-   }
-   
-   // Everything must be done in start to make sure all dependencies have been satisfied
-   protected void lockedStart() throws Exception
-   {
-      if (reinitialize)
-         reinitialize();
-       
-      initializePool();
-
-      for (EncInjector injector : encInjectors.values())
-      {
-         injector.inject(this);   
-      }
-      
-      // creating of injector array should come after injection into ENC as an ENC injector
-      // may add additional injectors into the injector list.  An example is an extended persistence
-      // context which mush be created and added to the SFSB bean context.
-
-      Injector[] injectors2 = injectors.toArray(new Injector[injectors.size()]);
-      if (pool != null) pool.setInjectors(injectors2);
-
-//      createCallbackHandler();
-      
-      // If we're clustered, find our partition name
-      findPartitionName();
-      
-      log.info("STARTED EJB: " + beanClass.getName() + " ejbName: " + ejbName);
-   }
-
-   public final void stop() throws Exception
-   {
-      this.getContainerLock().lockInterruptibly();
-      
-      this.lockedStop();
-   }
-   
-   protected void lockedStop() throws Exception
-   {
-      reinitialize = true;
-      
-      //encFactory.cleanupEnc(this);
-      
-      if (pool != null)
-      {
-         pool.destroy();
-         pool = null;
-      }
-      
-      injectors = new ArrayList<Injector>();
-      encInjectors = new HashMap<String, EncInjector>();
-      
-      InitialContextFactory.close(enc, this.initialContextProperties);
-      enc = null; 
-      
-      log.info("STOPPED EJB: " + beanClass.getName() + " ejbName: " + ejbName);
-   }
-
-   public void destroy() throws Exception
-   {
-      encFactory.cleanupEnc(this);
-      
-      // TODO: clean up BeanContainer?
-      //super.cleanup();
-   }
-
-   @SuppressWarnings("unchecked")
-   public <T> T getSecurityManager(Class<T> type)
-   {
-      try
-      {
-         InitialContext ctx = getInitialContext();
-         SecurityDomain securityAnnotation = (SecurityDomain) resolveAnnotation(SecurityDomain.class);
-         if (securityAnnotation != null && securityAnnotation.value().length() > 0)
-         {
-            return (T) SecurityDomainManager.getSecurityManager(securityAnnotation.value(),ctx);
-         }
-         return null;
-      }
-      catch (NamingException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-   protected Method getTimeoutCallback(NamedMethodMetaData timeoutMethodMetaData, Class<?> beanClass)
-   {
-      JBossEnterpriseBeanMetaData metaData = xml;
-      if(metaData != null)
-      {
-         if(timeoutMethodMetaData != null)
-         {
-            String methodName = timeoutMethodMetaData.getMethodName();
-            try
-            {
-               return beanClass.getMethod(methodName, Timer.class);
-            }
-            catch (SecurityException e)
-            {
-               throw new RuntimeException(e);
-            }
-            catch (NoSuchMethodException e)
-            {
-               throw new RuntimeException("No method " + methodName + "(javax.ejb.Timer timer) found on bean " + ejbName, e);
-            }
-         }
-      }
-      
-      if(TimedObject.class.isAssignableFrom(beanClass))
-      {
-         try
-         {
-            return TimedObject.class.getMethod("ejbTimeout", Timer.class);
-         }
-         catch (SecurityException e)
-         {
-            throw new RuntimeException(e);
-         }
-         catch (NoSuchMethodException e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-      
-      if(metaData != null)
-      {  
-         // TODO: cross cutting concern
-         if(metaData.getEjbJarMetaData().isMetadataComplete())
-            return null;
-      }
-      
-      for (Method method : beanClass.getMethods())
-      {
-         if (getAnnotation(Timeout.class, method) != null)
-         {
-            if (Modifier.isPublic(method.getModifiers()) &&
-                  method.getReturnType().equals(Void.TYPE) &&
-                  method.getParameterTypes().length == 1 &&
-                  method.getParameterTypes()[0].equals(Timer.class))
-            {
-               // TODO: check for multiples
-               return method;
-            }
-            else
-            {
-               throw new RuntimeException("@Timeout method " + method + " must have signature: void <METHOD>(javax.ejb.Timer timer) (EJB3 18.2.2)");
-            }
-         }
-      }
-      
-      return null;
-   }
-   
-   protected void initializePool() throws Exception
-   {
-      org.jboss.ejb3.annotation.Pool poolAnnotation = getAnnotation(org.jboss.ejb3.annotation.Pool.class);
-      if (poolAnnotation == null)
-         throw new IllegalStateException("No pool annotation");
-      String registeredPoolName = poolAnnotation.value();
-      // EJBTHREE-1119
-      if(registeredPoolName==null||registeredPoolName.trim().equals(""))
-      {
-         // Default the Pool Implementation
-         registeredPoolName = PoolDefaults.POOL_IMPLEMENTATION_THREADLOCAL;
-      }
-      int maxSize = poolAnnotation.maxSize();
-      long timeout = poolAnnotation.timeout();
-      PoolFactoryRegistry registry = deployment.getPoolFactoryRegistry();
-      PoolFactory factory = registry.getPoolFactory(registeredPoolName);
-      pool = factory.createPool();
-      pool.initialize(this, maxSize, timeout);
-
-      resolveInjectors();
-      pool.setInjectors(injectors.toArray(new Injector[injectors.size()]));
-   }
-
-   /**
-    * Note that this method is a WIP.
-    * 
-    * @param beanContext
-    * @param callbackAnnotationClass    on of PostConstruct, PreDestroy, PostActivate or PrePassivate
-    */
-   protected void invokeCallback(BeanContext<?> beanContext, Class<? extends Annotation> callbackAnnotationClass)
-   {
-      try
-      {
-         // Do lifecycle callbacks
-         List<Class<?>> lifecycleInterceptorClasses = beanContainer.getInterceptorRegistry().getLifecycleInterceptorClasses();
-         Advisor advisor = getAdvisor();
-         Interceptor interceptors[] = LifecycleCallbacks.createLifecycleCallbackInterceptors(advisor, lifecycleInterceptorClasses, beanContext, callbackAnnotationClass);
-         
-         Constructor<?> constructor = beanClass.getConstructor();
-         Object initargs[] = null;
-         ConstructionInvocation invocation = new ConstructionInvocation(interceptors, constructor, initargs);
-         invocation.setAdvisor(advisor);
-         invocation.setTargetObject(beanContext.getInstance());
-         invocation.invokeNext();
-      }
-      catch(Throwable t)
-      {
-         throw new RuntimeException(t);
-      }
-   }
-   
-   public void invokePostConstruct(BeanContext<?> beanContext)
-   {
-      // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on
-      AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_EJB_CREATE);
-      try
-      {
-         invokeCallback(beanContext, PostConstruct.class);
-      }
-      finally
-      {
-         AllowedOperationsAssociation.popInMethodFlag();
-      }
-   }
-
-   @Deprecated
-   public void invokePostConstruct(BeanContext beanContext, Object[] params)
-   {
-      invokePostConstruct(beanContext);
-   }
-
-   public void invokePreDestroy(BeanContext beanContext)
-   {
-      // This is the correct way to destroy an instance, do
-      // not call invokeCallback here.
-      beanContainer.destroy(beanContext);
-   }
-
-   public void invokePostActivate(BeanContext beanContext)
-   {
-      throw new RuntimeException("PostActivate not implemented for container");
-   }
-
-   public void invokePrePassivate(BeanContext beanContext)
-   {
-      throw new RuntimeException("PrePassivate not implemented for container");
-   }
-
-   public void invokeInit(Object bean, Class[] initParameterTypes,
-                          Object[] initParameterValues)
-   {
-      // do nothing, only useful on a stateful session bean
-   }
-
-   public static final String MANAGED_ENTITY_MANAGER_FACTORY = "ManagedEntityManagerFactory";
-
-   public static final String ENTITY_MANAGER_FACTORY = "EntityManagerFactory";
-
-   protected void resolveInjectors() throws Exception
-   {
-      pushEnc();
-      try
-      {
-         Thread.currentThread().setContextClassLoader(classloader);
-         try
-         {
-            Util.rebind(getEnc(), "UserTransaction", new UserTransactionImpl());
-         }
-         catch (NamingException e)
-         {
-            NamingException namingException = new NamingException("Could not bind user transaction for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "UserTransaction");
-            namingException.setRootCause(e);
-            throw namingException;
-         }
-         try
-         {
-            Util.rebind(getEnc(), "TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
-            log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
-         }
-         catch (NamingException e)
-         {
-            NamingException namingException = new NamingException("Could not bind TransactionSynchronizationRegistry for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "TransactionSynchronizationRegistry");
-            namingException.setRootCause(e);
-            throw namingException;
-         }
-      }
-      finally
-      {
-         popEnc();
-      }
-   }
-
-   /*
-   protected void createCallbackHandler()
-   {
-      try
-      {
-         callbackHandler = new LifecycleInterceptorHandler(this,
-                 getHandledCallbacks());
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Error creating callback handler for bean "
-                 + beanClassName, e);
-      }
-   }
-   */
-
-   protected Class[] getHandledCallbacks()
-   {
-      return new Class[]
-              {PostConstruct.class, PreDestroy.class, Timeout.class};
-   }
-
-   // TODO: once injection is finalized this method will disappear
-   private InterceptorMetaData findInterceptor(Class<?> interceptorClass)
-   {
-      if(xml == null)
-         return null;
-      JBossMetaData ejbJarMetaData = xml.getEjbJarMetaData();
-      if(ejbJarMetaData == null)
-         return null;
-      InterceptorsMetaData interceptors = ejbJarMetaData.getInterceptors();
-      if(interceptors == null)
-         return null;
-      for(InterceptorMetaData interceptorMetaData : interceptors)
-      {
-         if(interceptorMetaData.getInterceptorClass().equals(interceptorClass.getName()))
-            return interceptorMetaData;
-      }
-      return null;
-   }
-   
-   protected void findPartitionName()
-   {
-      Clustered clustered = (Clustered) getAnnotation(Clustered.class);
-      if (clustered == null)
-      {
-         partitionName = null;
-         return;
-      }
-      
-      String value = clustered.partition();
-      try
-      {
-         String replacedValue = StringPropertyReplacer.replaceProperties(value);
-         if (value != replacedValue)
-         {            
-            log.debug("Replacing @Clustered partition attribute " + value + " with " + replacedValue);
-            value = replacedValue;
-         }
-      }
-      catch (Exception e)
-      {
-         log.warn("Unable to replace @Clustered partition attribute " + value + 
-                  ". Caused by " + e.getClass() + " " + e.getMessage());         
-      }
-      
-      partitionName = value;
-   }
-
-   public <T> T getBusinessObject(BeanContext<?> beanContext, Class<T> businessInterface) throws IllegalStateException
-   {
-      throw new IllegalStateException("Not implemented");
-   }
-
-   public Object getInvokedBusinessInterface(BeanContext beanContext) throws IllegalStateException
-   {
-      throw new IllegalStateException("Not implemented");
-   }
-
-   protected Object getInvokedInterface(Method method)
-   {
-      Remote remoteAnnotation = (Remote) resolveAnnotation(Remote.class);
-      if (remoteAnnotation != null)
-      {
-         Class[] remotes = remoteAnnotation.value();
-         for (int i = 0; i < remotes.length; ++i)
-         {
-            try
-            {
-               remotes[i].getMethod(method.getName(), method.getParameterTypes());
-               return remotes[i];
-            }
-            catch (NoSuchMethodException e)
-            {
-            }
-         }
-      }
-
-      Local localAnnotation = (Local) resolveAnnotation(Local.class);
-      if (localAnnotation != null)
-      {
-         Class[] locals = localAnnotation.value();
-         for (int i = 0; i < locals.length; ++i)
-         {
-            Method[] interfaceMethods = locals[i].getMethods();
-            for (int j = 0; j < interfaceMethods.length; ++j)
-            {
-               if (interfaceMethods[j].equals(method))
-                  return locals[i];
-            }
-         }
-      }
-
-      return null;
-   }
-
-   // todo these method overrides for aop are for performance reasons
-   private Class loadPublicAnnotation(String annotation)
-   {
-      try
-      {
-         Class ann = classloader.loadClass(annotation);
-         if (!ann.isAnnotation()) return null;
-         Retention retention = (Retention) ann.getAnnotation(Retention.class);
-         if (retention != null && retention.value() == RetentionPolicy.RUNTIME) return ann;
-
-      }
-      catch (ClassNotFoundException ignored)
-      {
-      }
-      return null;
-   }
-
-   /*
-   @Override
-   public boolean hasAnnotation(Class tgt, String annotation)
-   {
-      if (annotations.hasClassAnnotation(annotation)) return true;
-      if (tgt == null) return false;
-      try
-      {
-         Class ann = loadPublicAnnotation(annotation);
-         // it is metadata or CLASS annotation
-         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(tgt, annotation);
-         return tgt.isAnnotationPresent(ann);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-   }
-
-
-   @Override
-   public boolean hasAnnotation(Method m, String annotation)
-   {
-      if (annotations.hasAnnotation(m, annotation)) return true;
-      try
-      {
-         Class ann = loadPublicAnnotation(annotation);
-         // it is metadata or CLASS annotation
-         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
-         return m.isAnnotationPresent(ann);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-   }
-
-   @Override
-   public boolean hasAnnotation(Field m, String annotation)
-   {
-      if (annotations.hasAnnotation(m, annotation)) return true;
-      try
-      {
-         Class ann = loadPublicAnnotation(annotation);
-         // it is metadata or CLASS annotation
-         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
-         return m.isAnnotationPresent(ann);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-   }
-
-   @Override
-   public boolean hasAnnotation(Constructor m, String annotation)
-   {
-      if (annotations.hasAnnotation(m, annotation)) return true;
-      try
-      {
-         Class ann = loadPublicAnnotation(annotation);
-         // it is metadata or CLASS annotation
-         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
-         return m.isAnnotationPresent(ann);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-   }
-   */
-   
-   public Container resolveEjbContainer(String link, Class businessIntf)
-   {
-      return deployment.getEjbContainer(link, businessIntf);
-   }
-
-   public Container resolveEjbContainer(Class businessIntf) throws NameNotFoundException
-   {
-      return deployment.getEjbContainer(businessIntf);
-   }
-
-   public String resolveMessageDestination(String link)
-   {
-      return deployment.resolveMessageDestination(link);
-   }
-   
-   public String resolvePersistenceUnitSupplier(String unitName)
-   {
-      return getDeployment().resolvePersistenceUnitSupplier(unitName);
-   }
-   
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
-   {
-      if (this.getAnnotations().isDisabled(annotationType))
-         return null;
-      
-      return beanContainer.getAnnotation(annotationType);
-   }
-   
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz)
-   {
-      return beanContainer.getAnnotation(clazz, annotationType);
-   }
-
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Method method)
-   {
-      return beanContainer.getAnnotation(annotationType, clazz, method);
-   }
-   
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Method method)
-   {
-      if (this.getAnnotations().isDisabled(method, annotationType))
-         return null;
-      
-      return beanContainer.getAnnotation(annotationType, method);
-   }
-
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Field field)
-   {
-      return beanContainer.getAnnotation(annotationType, clazz, field);
-   }
-   
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Field field)
-   {
-      return beanContainer.getAnnotation(annotationType, field);
-   }
-   
-   /**
-    * @deprecated use getAnnotation
-    */
-   @SuppressWarnings("unchecked")
-   public Object resolveAnnotation(Class annotationType)
-   {
-      return getAnnotation(annotationType);
-   }
-   
-   /**
-    * @deprecated use getAnnotation
-    */
-   @SuppressWarnings("unchecked")
-   public Object resolveAnnotation(Field field, Class annotationType)
-   {
-      return getAnnotation(annotationType, field);
-   }
-   
-   /**
-    * @deprecated use getAnnotation
-    */
-   @SuppressWarnings("unchecked")
-   public Object resolveAnnotation(Method method, Class annotationType)
-   {
-      return getAnnotation(annotationType, method);
-   }
-   
-   /**
-    * @deprecated this is going to be gone soon
-    */
-   @SuppressWarnings("unchecked")
-   public Object resolveAnnotation(Method m, Class[] annotationChoices)
-   {
-      Object value = null;
-      int i = 0;
-      while (value == null && i < annotationChoices.length){
-         value = resolveAnnotation(m, annotationChoices[i++]);
-      }
-      
-      return value;
-   }
-
-   public String getIdentifier()
-   {
-      return getEjbName();
-   }
-
-   public String getDeploymentDescriptorType()
-   {
-      return "ejb-jar.xml";
-   }
-
-   public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
-   {
-      return deployment.getPersistenceUnitDeployment(unitName);
-   }
-
-   public String getEjbJndiName(Class businessInterface) throws NameNotFoundException
-   {
-      return deployment.getEjbJndiName(businessInterface);
-   }
-
-   public String getEjbJndiName(String link, Class businessInterface)
-   {
-      return deployment.getEjbJndiName(link, businessInterface);
-   }
-   
-   public InvocationStatistics getInvokeStats()
-   {
-      return invokeStats;
-   }
-
-   @Deprecated
-   protected MethodInfo getMethodInfo(Method method)
-   {
-      long hash = MethodHashing.calculateHash(method);
-      MethodInfo info = getAdvisor().getMethodInfo(hash);
-      if (info == null)
-      {
-         throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
-      }
-      return info;
-   }
-   
-   public boolean isClustered()
-   {
-      return false;
-   }
-   
-   public JavaEEModule getModule()
-   {
-      return deployment;
-   }
-   
-   public abstract boolean hasJNDIBinding(String jndiName);
-   
-   /**
-    * After XML processing has been done this allows the container
-    * to further initialize the meta data.
-    */
-   public void instantiated()
-   {
-      this.businessInterfaces = resolveBusinessInterfaces();
-      
-      // Before we start to process annotations, make sure we also have the ones from interceptors-aop.
-      // FIXME: because of the flaked life cycle of an EJBContainer (we add annotations after it's been
-      // constructed), we must reinitialize the whole thing. 
-      beanContainer.reinitializeAdvisor();
-   }
-   
-   public void setDirectContainer(DirectContainer<EJBContainer> container)
-   {
-      this.directContainer = container;
-   }
-   
-   protected Method getNonBridgeMethod(Method bridgeMethod)
-   {
-      Class clazz = bridgeMethod.getDeclaringClass();
-      Method[] methods = clazz.getMethods();
-      for (Method method : methods)
-      {
-         if (!method.isBridge() && method.getParameterTypes().length == bridgeMethod.getParameterTypes().length)
-         {
-            return method;
-         }
-      }
-      
-      return bridgeMethod;
-   }
-   
-   public Lock getInvocationLock()
-   {
-      return this.containerLock.readLock();
-   }
-   
-   private Lock getContainerLock()
-   {
-      return this.containerLock.writeLock();
-   }
-   
-   public String toString()
-   {
-      return getObjectName().getCanonicalName();
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,1548 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.TimedObject;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.LinkRef;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.annotation.AnnotationRepository;
+import org.jboss.aop.joinpoint.ConstructionInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.ejb.AllowedOperationsAssociation;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.defaults.PoolDefaults;
+import org.jboss.ejb3.aop.BeanContainer;
+import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
+import org.jboss.ejb3.entity.PersistenceUnitDeployment;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.ejb3.interceptor.InterceptorInjector;
+import org.jboss.ejb3.interceptors.aop.LifecycleCallbacks;
+import org.jboss.ejb3.interceptors.container.ManagedObjectAdvisor;
+import org.jboss.ejb3.interceptors.direct.DirectContainer;
+import org.jboss.ejb3.interceptors.direct.IndirectContainer;
+import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.ejb3.javaee.JavaEEComponentHelper;
+import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.pool.Pool;
+import org.jboss.ejb3.pool.PoolFactory;
+import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.security.SecurityDomainManager;
+import org.jboss.ejb3.statistics.InvocationStatistics;
+import org.jboss.ejb3.tx.UserTransactionImpl;
+import org.jboss.injection.DependsHandler;
+import org.jboss.injection.EJBHandler;
+import org.jboss.injection.EncInjector;
+import org.jboss.injection.ExtendedInjectionContainer;
+import org.jboss.injection.InjectionHandler;
+import org.jboss.injection.InjectionUtil;
+import org.jboss.injection.Injector;
+import org.jboss.injection.JndiInjectHandler;
+import org.jboss.injection.PersistenceContextHandler;
+import org.jboss.injection.PersistenceUnitHandler;
+import org.jboss.injection.ResourceHandler;
+import org.jboss.injection.WebServiceRefHandler;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.util.naming.Util;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class EJBContainer implements Container, IndirectContainer<EJBContainer, DirectContainer<EJBContainer>>, ExtendedInjectionContainer, JavaEEComponent
+{
+   private static final Logger log = Logger.getLogger(EJBContainer.class);
+
+   private String name;
+   
+   private BeanContainer beanContainer;
+   
+   private DirectContainer<EJBContainer> directContainer;
+   
+   protected EjbEncFactory encFactory = new DefaultEjbEncFactory();
+
+   protected Pool pool;
+
+   protected String ejbName;
+
+   protected ObjectName objectName;
+
+   protected int defaultConstructorIndex;
+
+   protected String beanClassName;
+   
+   private Class<?> beanClass;
+
+   protected ClassLoader classloader;
+
+   // for performance there is an array.
+   protected List<Injector> injectors = new ArrayList<Injector>();
+
+   protected Context enc;
+
+//   protected LifecycleInterceptorHandler callbackHandler;
+
+   protected Hashtable initialContextProperties;
+
+   protected Map<String, EncInjector> encInjectors = new HashMap<String, EncInjector>();
+
+   protected JBossEnterpriseBeanMetaData xml;
+   protected JBossAssemblyDescriptorMetaData assembly;
+
+   protected Map<String, Map<AccessibleObject, Injector>> encInjections = new HashMap<String, Map<AccessibleObject, Injector>>();
+
+//   protected List<InterceptorInfo> classInterceptors = new ArrayList<InterceptorInfo>();
+//
+//   protected LinkedHashSet<InterceptorInfo> applicableInterceptors;
+
+   private HashMap<Class<?>, InterceptorInjector> interceptorInjectors = new HashMap<Class<?>, InterceptorInjector>();
+
+   private Ejb3Deployment deployment;
+
+   private DependencyPolicy dependencyPolicy;
+
+   private String jaccContextId;
+
+   protected InvocationStatistics invokeStats = new InvocationStatistics();
+   
+   private String partitionName;
+   
+   private List<Class<?>> businessInterfaces;
+   
+   private ThreadLocalStack<BeanContext<?>> currentBean = new ThreadLocalStack<BeanContext<?>>();
+   
+   protected boolean reinitialize = false;
+   
+   // To support clean startup/shutdown
+   private ReadWriteLock containerLock = new ReentrantReadWriteLock();
+   
+   /**
+    * @param name                  Advisor name
+    * @param manager               Domain to get interceptor bindings from
+    * @param cl                    the EJB's classloader
+    * @param beanClassName
+    * @param ejbName
+    * @param ctxProperties
+    * @param interceptorRepository
+    * @param deployment
+    * @param beanMetaData           the meta data for this bean or null
+    */
+
+   public EJBContainer(String name, Domain domain, ClassLoader cl,
+                       String beanClassName, String ejbName, Hashtable ctxProperties,
+                       Ejb3Deployment deployment, JBossEnterpriseBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      assert name != null : "name is null";
+      assert deployment != null : "deployment is null";
+      
+      this.name = name;
+      this.deployment = deployment;
+      this.beanClassName = beanClassName;
+      this.classloader = cl;
+      this.xml = beanMetaData;
+         
+      this.beanClass = classloader.loadClass(beanClassName);
+      
+      // We can't type cast the direct container, because we just loaded the beanClass
+      // so assuming we have an object is a safe bet.
+      this.beanContainer = new BeanContainer(this);
+      
+      this.ejbName = ejbName;
+      
+      // Because interceptors will query back the EJBContainer for annotations
+      // we must have set beanContainer first and then do the advisor. 
+      try
+      {
+         beanContainer.initialize(ejbName, domain, beanClass, beanMetaData, cl);
+      }
+      catch(Exception e)
+      {
+         throw new RuntimeException("failed to initialize bean container ",e);
+      }
+      String on = createObjectName(ejbName);
+     
+      try
+      {
+         objectName = new ObjectName(on);
+      }
+      catch (MalformedObjectNameException e)
+      {
+         throw new RuntimeException("failed to create object name for: " + on, e);
+      }
+      
+      //annotations = new AnnotationRepositoryToMetaData(this);
+      
+      initialContextProperties = ctxProperties;
+      try
+      {
+         Util.createSubcontext(getEnc(), "env");
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+      bindORB();
+      bindEJBContext();
+      
+      this.dependencyPolicy = deployment.createDependencyPolicy(this);
+   }
+
+   private void bindEJBContext()
+   {
+      try 
+      {
+         Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
+         ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
+         ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
+         ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
+         Util.rebind(getEnc(), "EJBContext", ref);
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   private void bindORB()
+   {
+      try
+      {
+         Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
+      }
+      catch(NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   public abstract BeanContext<?> createBeanContext();
+   
+   public String createObjectName(String ejbName)
+   {
+      return JavaEEComponentHelper.createObjectName(deployment, ejbName);
+   }
+   
+   /**
+    * Do not call, for BeanContainer.
+    * @throws IllegalAccessException 
+    * @throws InstantiationException 
+    */
+   public Object createInterceptor(Class<?> interceptorClass) throws InstantiationException, IllegalAccessException
+   {
+      Object instance = interceptorClass.newInstance();
+      InterceptorInjector interceptorInjector = interceptorInjectors.get(interceptorClass);
+      assert interceptorInjector != null : "interceptorInjector not found for " + interceptorClass;
+      interceptorInjector.inject(null, instance);
+      return instance;
+   }
+   
+   public String createObjectName(String unitName, String ejbName)
+   {
+      return JavaEEComponentHelper.createObjectName(deployment, unitName, ejbName);
+   }
+   
+   // TODO: re-evaluate this exposure
+   @Deprecated
+   public Advisor getAdvisor()
+   {
+      return beanContainer._getAdvisor();
+   }
+
+   /*
+    * TODO: re-evalute this exposure
+    */
+   @Deprecated
+   public AnnotationRepository getAnnotations()
+   {
+      return beanContainer.getAnnotationRepository();
+   }
+
+   protected BeanContainer getBeanContainer()
+   {
+      return beanContainer;
+   }
+   
+   /**
+    * 
+    * @return   the bean class of this container
+    * @deprecated   use getBeanClass
+    */
+   public Class<?> getClazz()
+   {
+      return getBeanClass();
+   }
+   
+   @SuppressWarnings("unchecked")
+   public static <C extends EJBContainer> C getEJBContainer(Advisor advisor)
+   {
+      try
+      {
+         return (C) ((ManagedObjectAdvisor<Object, BeanContainer>) advisor).getContainer().getEJBContainer();
+      }
+      catch(ClassCastException e)
+      {
+         throw new ClassCastException(e.getMessage() + " using " + advisor);
+      }
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void pushContext(BeanContext<?> beanContext)
+   {
+      currentBean.push(beanContext);
+   }
+   
+   /**
+    * Makes sure that EJB's ENC is available
+    * Delegates to whatever implementation is used to push the ENC of the EJB
+    * onto the stack
+    *
+    */
+   protected void pushEnc()
+   {
+      encFactory.pushEnc(this);
+   }
+
+   public BeanContext<?> peekContext()
+   {
+      BeanContext<?> ctx = currentBean.get();
+      assert ctx != null : "ctx is null";
+      return ctx;
+   }
+   
+   public BeanContext<?> popContext()
+   {
+      return currentBean.pop();
+   }
+   
+   /**
+    * Pops EJB's ENC from the stack.  Delegates to whatever implementation
+    * is used to pop the EJB's ENC from the stock
+    *
+    */
+   protected void popEnc()
+   {
+      encFactory.popEnc(this);
+   }
+   
+   public Environment getEnvironmentRefGroup()
+   {
+      return xml;
+   }
+
+   public List<Injector> getInjectors()
+   {
+      return injectors;
+   }
+
+
+   public String getJaccContextId()
+   {
+      return jaccContextId;
+   }
+
+   /**
+    * Do not call, used by BeanContainer.
+    * @return
+    */
+   public List<Method> getVirtualMethods()
+   {
+      return null;
+   }
+   
+   public void setJaccContextId(String jaccContextId)
+   {
+      this.jaccContextId = jaccContextId;
+   }
+   
+   public VirtualFile getRootFile()
+   {
+      return getDeploymentUnit().getRootFile();
+   }
+   
+   /**
+    * Return all the business interfaces implemented by this bean.
+    * 
+    * Available after the meta data has been processed.
+    * 
+    * @return   an array of business interfaces or empty if no interface is provided
+    */
+   public List<Class<?>> getBusinessInterfaces()
+   {
+      if(businessInterfaces == null) throw new IllegalStateException("businessInterfaces not yet initialized");
+      return businessInterfaces;
+   }
+      
+   public String getDeploymentQualifiedName()
+   {
+      return objectName.getCanonicalName();
+   }
+   
+   /**
+    * Returns a String identifier for this bean that is qualified by the
+    * deployment, and hence should be unique across deployments. Name is of the 
+    * form "ear=foo.ear,jar=foo.jar,name=Bar", where "Bar" is the value 
+    * returned by {@link #getEjbName()}. The "ear=foo.ear" portion is ommitted 
+    * if the bean is not packaged in an ear.
+    */
+   public String getDeploymentPropertyListString()
+   {
+      return objectName.getCanonicalKeyPropertyListString();
+   }
+   
+   public DeploymentUnit getDeploymentUnit()
+   {
+      return deployment.getDeploymentUnit();
+   }
+
+   public Ejb3Deployment getDeployment()
+   {
+      return deployment;
+   }
+
+   public DependencyPolicy getDependencyPolicy()
+   {
+      return dependencyPolicy;
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return beanContainer.isAnnotationPresent(annotationType);
+   }
+   
+   /**
+    * Is the method a business method of this container.
+    * 
+    * @param businessMethod     the method in question
+    * @return   true if so, otherwise false
+    */
+   public boolean isBusinessMethod(Method businessMethod)
+   {
+      for(Class<?> businessInterface : getBusinessInterfaces())
+      {
+         for(Method method : businessInterface.getMethods())
+         {
+            if(isCallable(method, businessMethod))
+               return true;
+         }
+      }
+      return false;
+   }
+   
+   /**
+    * Can method definition method be used to call method other.
+    * For example if the method is defined in an interface it can be used to call a method
+    * in a class.
+    * 
+    * @param method
+    * @param other
+    * @return
+    */
+   private static boolean isCallable(Method method, Method other)
+   {
+      if ((method.getDeclaringClass().isAssignableFrom(other.getDeclaringClass())) && (method.getName().equals(other.getName())))
+      {
+         if (!method.getReturnType().equals(other.getReturnType()))
+            return false;
+         Class<?>[] params1 = method.getParameterTypes();
+         Class<?>[] params2 = other.getParameterTypes();
+         if (params1.length == params2.length)
+         {
+            for (int i = 0; i < params1.length; i++)
+            {
+               if (params1[i] != params2[i])
+                  return false;
+            }
+            return true;
+         }
+      }
+      return false;
+   }   
+   
+   /**
+    * introspects EJB container to find all dependencies
+    * and initialize any extra metadata.
+    * <p/>
+    * This must be called before container is registered with any microcontainer
+    *
+    * @param dependencyPolicy
+    */
+   public void processMetadata()
+   {
+      // XML must be done first so that any annotation overrides are initialized
+      
+      // todo injection handlers should be pluggable from XML
+      Collection<InjectionHandler<Environment>> handlers = this.deployment.getHandlers();
+      if(handlers == null)
+      {
+         handlers = new ArrayList<InjectionHandler<Environment>>();
+         handlers.add(new EJBHandler<Environment>());
+         handlers.add(new DependsHandler<Environment>());
+         handlers.add(new JndiInjectHandler<Environment>());
+         handlers.add(new PersistenceContextHandler<Environment>());
+         handlers.add(new PersistenceUnitHandler<Environment>());
+         handlers.add(new ResourceHandler<Environment>());
+         handlers.add(new WebServiceRefHandler<Environment>());
+      }
+
+      ClassLoader old = Thread.currentThread().getContextClassLoader();
+      Thread.currentThread().setContextClassLoader(classloader);
+      try
+      {
+         // EJB container's XML must be processed before interceptor's as it may override interceptor's references
+         for (InjectionHandler<Environment> handler : handlers) handler.loadXml(xml, this);
+
+         Map<AccessibleObject, Injector> tmp = InjectionUtil.processAnnotations(this, handlers, getBeanClass());
+         injectors.addAll(tmp.values());
+
+         /*
+         initialiseInterceptors();
+         */
+         for (Class<?> interceptorClass : beanContainer.getInterceptorClasses())
+         {
+            InterceptorMetaData interceptorMetaData = findInterceptor(interceptorClass);
+            if(interceptorMetaData == null)
+               continue;
+            
+            for (InjectionHandler<Environment> handler : handlers)
+            {
+               handler.loadXml(interceptorMetaData, this);
+            }
+         }
+         for (Class<?> interceptorClass : beanContainer.getInterceptorClasses())
+         {
+            Map<AccessibleObject, Injector> injections = InjectionUtil.processAnnotations(this, handlers, interceptorClass);
+            InterceptorInjector injector = new InterceptorInjector(injections);
+            interceptorInjectors.put(interceptorClass, injector);
+         }
+
+         // When @WebServiceRef is not used service-ref won't be processed
+         // In this case we process them late
+         if(xml != null && xml.getServiceReferences() != null)
+         {
+            for(ServiceReferenceMetaData sref : xml.getServiceReferences())
+            {
+               // FIXME: fix WS metadata
+               /*
+               if(!sref.isProcessed())
+               {
+                  try
+                  {
+                     String name = sref.getServiceRefName();
+                     String encName = "env/" + name;
+                     Context encCtx = getEnc();
+
+                     UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
+                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, getClassloader(), sref);
+
+                  }
+                  catch (Exception e)
+                  {
+                     log.error("Failed to bind service-ref", e);
+                  }
+               }
+               */
+            }
+         }
+         
+         // EJBTHREE-1025
+         this.checkForDuplicateLocalAndRemoteInterfaces();
+         
+         for(Class<?> businessInterface : getBusinessInterfaces())
+            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(businessInterface);
+         
+         Class localHomeInterface = ProxyFactoryHelper.getLocalHomeInterface(this);
+         if(localHomeInterface != null)
+            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(localHomeInterface);
+         
+         Class remoteHomeInterface = ProxyFactoryHelper.getRemoteHomeInterface(this);
+         if(remoteHomeInterface != null)
+            ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(remoteHomeInterface);
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(old);
+      }
+   }
+   
+   /**
+    * Ensures that the bean does not implement any one interface as both @Local and @Remote
+    *
+    * @throws EJBException If the bean does implements any one interface as both @Local and @Remote
+    */
+   protected void checkForDuplicateLocalAndRemoteInterfaces() throws EJBException
+   {
+      // Initialize issue used in Error Message
+      String issue = "(EJBTHREE-1025)";
+
+      // Obtain annotations, if found
+      Local local = (Local) resolveAnnotation(Local.class);
+      Remote remote = (Remote) resolveAnnotation(Remote.class);
+
+      // If either local or remote is unspecified, return safely - there can be no overlap
+      if (local == null || remote == null)
+      {
+         return;
+      }
+
+      // Ensure "value" attribute of both local and remote are not blank
+      if (local.value().length < 1 && local.value().length < 1)
+      {
+         throw new EJBException("Cannot designate both " + Local.class.getName() + " and " + Remote.class.getName()
+               + " annotations without 'value' attribute on " + this.getEjbName() + ". " + issue);
+      }
+
+      // Iterate through local and remote interfaces, ensuring any one interface is not being used for both local and remote exposure
+      for (Class<?> localClass : local.value())
+      {
+         for (Class<?> remoteClass : remote.value())
+         {
+            if (localClass.equals(remoteClass))
+            {
+               throw new EJBException("Cannot designate " + localClass.getName() + " as both " + Local.class.getName()
+                     + " and " + Remote.class.getName() + " on " + this.getEjbName() + ". " + issue);
+            }
+         }
+      }
+   }
+
+   public JBossEnterpriseBeanMetaData getXml()
+   {
+      return xml;
+   }
+
+   public JBossAssemblyDescriptorMetaData getAssemblyDescriptor()
+   {
+      return assembly;
+   }
+
+   // FIXME: remove
+   @Deprecated
+   public void setAssemblyDescriptor(JBossAssemblyDescriptorMetaData assembly)
+   {
+      this.assembly = assembly;
+   }
+
+   protected abstract List<Class<?>> resolveBusinessInterfaces();
+   
+   public InterceptorInfoRepository getInterceptorRepository()
+   {
+      throw new RuntimeException("invalid");
+   }
+   
+   public Map<String, EncInjector> getEncInjectors()
+   {
+      return encInjectors;
+   }
+
+   public ClassLoader getClassloader()
+   {
+      return classloader;
+   }
+
+   public InitialContext getInitialContext()
+   {
+      try
+      {
+         return InitialContextFactory.getInitialContext(initialContextProperties);
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public Map<String, Map<AccessibleObject, Injector>> getEncInjections()
+   {
+      return encInjections;
+   }
+
+   public Context getEnc()
+   {
+      if (enc == null)
+      {
+         enc = encFactory.getEnc(this);
+      }
+      return enc;
+   }
+
+   public Hashtable getInitialContextProperties()
+   {
+      return initialContextProperties;
+   }
+
+   public ObjectName getObjectName()
+   {
+      return objectName;
+   }
+
+   public String getEjbName()
+   {
+      return ejbName;
+   }
+
+   public String getBeanClassName()
+   {
+      return beanClassName;
+   }
+
+   public Class<?> getBeanClass()
+   {
+      return beanClass;
+   }
+
+   public Pool getPool()
+   {
+      return pool;
+   }
+   
+   /**
+    * Gets the name of the cluster partition with which this container is
+    * associated. Not available until <code>EJBContainer.start()</code>
+    * is completed.
+    * 
+    * @return the name of the cluster partition with which this container is
+    *         associated, or <code>null</code> if the container is not clustered
+    */
+   public String getPartitionName()
+   {
+      if (partitionName == null)
+         this.findPartitionName();
+      return partitionName;
+   }
+
+   protected Object construct()
+   {
+      /*
+      try
+      {
+         return beanContainer.construct();
+      }
+      catch (SecurityException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (NoSuchMethodException e)
+      {
+         throw new RuntimeException(e);
+      }
+      */
+      try
+      {
+         return beanClass.newInstance();
+      }
+      catch (InstantiationException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   protected void reinitialize()
+   {
+      // FIXME: is this correct?
+      beanContainer.reinitializeAdvisor();
+      
+      /*
+      initClassMetaDataBindingsList();
+      adviceBindings.clear();
+      doesHaveAspects = false;
+      constructorInfos = null;
+      rebuildInterceptors();
+      */
+      
+      bindEJBContext();
+      
+      reinitialize = false;
+   }
+
+   public void create() throws Exception
+   {
+      // Lock until start()
+      this.getContainerLock().lock();
+      /*
+      initializeClassContainer();
+      for (int i = 0; i < constructors.length; i++)
+      {
+         if (constructors[i].getParameterTypes().length == 0)
+         {
+            defaultConstructorIndex = i;
+            break;
+         }
+      }
+      */
+   }
+
+   public final void start() throws Exception
+   {
+      this.lockedStart();
+      
+      this.getContainerLock().unlock();
+   }
+   
+   // Everything must be done in start to make sure all dependencies have been satisfied
+   protected void lockedStart() throws Exception
+   {
+      if (reinitialize)
+         reinitialize();
+       
+      initializePool();
+
+      for (EncInjector injector : encInjectors.values())
+      {
+         injector.inject(this);   
+      }
+      
+      // creating of injector array should come after injection into ENC as an ENC injector
+      // may add additional injectors into the injector list.  An example is an extended persistence
+      // context which mush be created and added to the SFSB bean context.
+
+      Injector[] injectors2 = injectors.toArray(new Injector[injectors.size()]);
+      if (pool != null) pool.setInjectors(injectors2);
+
+//      createCallbackHandler();
+      
+      // If we're clustered, find our partition name
+      findPartitionName();
+      
+      log.info("STARTED EJB: " + beanClass.getName() + " ejbName: " + ejbName);
+   }
+
+   public final void stop() throws Exception
+   {
+      this.getContainerLock().lockInterruptibly();
+      
+      this.lockedStop();
+   }
+   
+   protected void lockedStop() throws Exception
+   {
+      reinitialize = true;
+      
+      //encFactory.cleanupEnc(this);
+      
+      if (pool != null)
+      {
+         pool.destroy();
+         pool = null;
+      }
+      
+      injectors = new ArrayList<Injector>();
+      encInjectors = new HashMap<String, EncInjector>();
+      
+      InitialContextFactory.close(enc, this.initialContextProperties);
+      enc = null; 
+      
+      log.info("STOPPED EJB: " + beanClass.getName() + " ejbName: " + ejbName);
+   }
+
+   public void destroy() throws Exception
+   {
+      encFactory.cleanupEnc(this);
+      
+      // TODO: clean up BeanContainer?
+      //super.cleanup();
+   }
+
+   @SuppressWarnings("unchecked")
+   public <T> T getSecurityManager(Class<T> type)
+   {
+      try
+      {
+         InitialContext ctx = getInitialContext();
+         SecurityDomain securityAnnotation = (SecurityDomain) resolveAnnotation(SecurityDomain.class);
+         if (securityAnnotation != null && securityAnnotation.value().length() > 0)
+         {
+            return (T) SecurityDomainManager.getSecurityManager(securityAnnotation.value(),ctx);
+         }
+         return null;
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   protected Method getTimeoutCallback(NamedMethodMetaData timeoutMethodMetaData, Class<?> beanClass)
+   {
+      JBossEnterpriseBeanMetaData metaData = xml;
+      if(metaData != null)
+      {
+         if(timeoutMethodMetaData != null)
+         {
+            String methodName = timeoutMethodMetaData.getMethodName();
+            try
+            {
+               return beanClass.getMethod(methodName, Timer.class);
+            }
+            catch (SecurityException e)
+            {
+               throw new RuntimeException(e);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException("No method " + methodName + "(javax.ejb.Timer timer) found on bean " + ejbName, e);
+            }
+         }
+      }
+      
+      if(TimedObject.class.isAssignableFrom(beanClass))
+      {
+         try
+         {
+            return TimedObject.class.getMethod("ejbTimeout", Timer.class);
+         }
+         catch (SecurityException e)
+         {
+            throw new RuntimeException(e);
+         }
+         catch (NoSuchMethodException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      
+      if(metaData != null)
+      {  
+         // TODO: cross cutting concern
+         if(metaData.getEjbJarMetaData().isMetadataComplete())
+            return null;
+      }
+      
+      for (Method method : beanClass.getMethods())
+      {
+         if (getAnnotation(Timeout.class, method) != null)
+         {
+            if (Modifier.isPublic(method.getModifiers()) &&
+                  method.getReturnType().equals(Void.TYPE) &&
+                  method.getParameterTypes().length == 1 &&
+                  method.getParameterTypes()[0].equals(Timer.class))
+            {
+               // TODO: check for multiples
+               return method;
+            }
+            else
+            {
+               throw new RuntimeException("@Timeout method " + method + " must have signature: void <METHOD>(javax.ejb.Timer timer) (EJB3 18.2.2)");
+            }
+         }
+      }
+      
+      return null;
+   }
+   
+   protected void initializePool() throws Exception
+   {
+      org.jboss.ejb3.annotation.Pool poolAnnotation = getAnnotation(org.jboss.ejb3.annotation.Pool.class);
+      if (poolAnnotation == null)
+         throw new IllegalStateException("No pool annotation");
+      String registeredPoolName = poolAnnotation.value();
+      // EJBTHREE-1119
+      if(registeredPoolName==null||registeredPoolName.trim().equals(""))
+      {
+         // Default the Pool Implementation
+         registeredPoolName = PoolDefaults.POOL_IMPLEMENTATION_THREADLOCAL;
+      }
+      int maxSize = poolAnnotation.maxSize();
+      long timeout = poolAnnotation.timeout();
+      PoolFactoryRegistry registry = deployment.getPoolFactoryRegistry();
+      PoolFactory factory = registry.getPoolFactory(registeredPoolName);
+      pool = factory.createPool();
+      pool.initialize(this, maxSize, timeout);
+
+      resolveInjectors();
+      pool.setInjectors(injectors.toArray(new Injector[injectors.size()]));
+   }
+
+   /**
+    * Note that this method is a WIP.
+    * 
+    * @param beanContext
+    * @param callbackAnnotationClass    on of PostConstruct, PreDestroy, PostActivate or PrePassivate
+    */
+   protected void invokeCallback(BeanContext<?> beanContext, Class<? extends Annotation> callbackAnnotationClass)
+   {
+      try
+      {
+         // Do lifecycle callbacks
+         List<Class<?>> lifecycleInterceptorClasses = beanContainer.getInterceptorRegistry().getLifecycleInterceptorClasses();
+         Advisor advisor = getAdvisor();
+         Interceptor interceptors[] = LifecycleCallbacks.createLifecycleCallbackInterceptors(advisor, lifecycleInterceptorClasses, beanContext, callbackAnnotationClass);
+         
+         Constructor<?> constructor = beanClass.getConstructor();
+         Object initargs[] = null;
+         ConstructionInvocation invocation = new ConstructionInvocation(interceptors, constructor, initargs);
+         invocation.setAdvisor(advisor);
+         invocation.setTargetObject(beanContext.getInstance());
+         invocation.invokeNext();
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException(t);
+      }
+   }
+   
+   public void invokePostConstruct(BeanContext<?> beanContext)
+   {
+      // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on
+      AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_EJB_CREATE);
+      try
+      {
+         invokeCallback(beanContext, PostConstruct.class);
+      }
+      finally
+      {
+         AllowedOperationsAssociation.popInMethodFlag();
+      }
+   }
+
+   @Deprecated
+   public void invokePostConstruct(BeanContext beanContext, Object[] params)
+   {
+      invokePostConstruct(beanContext);
+   }
+
+   public void invokePreDestroy(BeanContext beanContext)
+   {
+      // This is the correct way to destroy an instance, do
+      // not call invokeCallback here.
+      beanContainer.destroy(beanContext);
+   }
+
+   public void invokePostActivate(BeanContext beanContext)
+   {
+      throw new RuntimeException("PostActivate not implemented for container");
+   }
+
+   public void invokePrePassivate(BeanContext beanContext)
+   {
+      throw new RuntimeException("PrePassivate not implemented for container");
+   }
+
+   public void invokeInit(Object bean, Class[] initParameterTypes,
+                          Object[] initParameterValues)
+   {
+      // do nothing, only useful on a stateful session bean
+   }
+
+   public static final String MANAGED_ENTITY_MANAGER_FACTORY = "ManagedEntityManagerFactory";
+
+   public static final String ENTITY_MANAGER_FACTORY = "EntityManagerFactory";
+
+   protected void resolveInjectors() throws Exception
+   {
+      pushEnc();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(classloader);
+         try
+         {
+            Util.rebind(getEnc(), "UserTransaction", new UserTransactionImpl());
+         }
+         catch (NamingException e)
+         {
+            NamingException namingException = new NamingException("Could not bind user transaction for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "UserTransaction");
+            namingException.setRootCause(e);
+            throw namingException;
+         }
+         try
+         {
+            Util.rebind(getEnc(), "TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
+            log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
+         }
+         catch (NamingException e)
+         {
+            NamingException namingException = new NamingException("Could not bind TransactionSynchronizationRegistry for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "TransactionSynchronizationRegistry");
+            namingException.setRootCause(e);
+            throw namingException;
+         }
+      }
+      finally
+      {
+         popEnc();
+      }
+   }
+
+   /*
+   protected void createCallbackHandler()
+   {
+      try
+      {
+         callbackHandler = new LifecycleInterceptorHandler(this,
+                 getHandledCallbacks());
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Error creating callback handler for bean "
+                 + beanClassName, e);
+      }
+   }
+   */
+
+   protected Class[] getHandledCallbacks()
+   {
+      return new Class[]
+              {PostConstruct.class, PreDestroy.class, Timeout.class};
+   }
+
+   // TODO: once injection is finalized this method will disappear
+   private InterceptorMetaData findInterceptor(Class<?> interceptorClass)
+   {
+      if(xml == null)
+         return null;
+      JBossMetaData ejbJarMetaData = xml.getEjbJarMetaData();
+      if(ejbJarMetaData == null)
+         return null;
+      InterceptorsMetaData interceptors = ejbJarMetaData.getInterceptors();
+      if(interceptors == null)
+         return null;
+      for(InterceptorMetaData interceptorMetaData : interceptors)
+      {
+         if(interceptorMetaData.getInterceptorClass().equals(interceptorClass.getName()))
+            return interceptorMetaData;
+      }
+      return null;
+   }
+   
+   protected void findPartitionName()
+   {
+      Clustered clustered = (Clustered) getAnnotation(Clustered.class);
+      if (clustered == null)
+      {
+         partitionName = null;
+         return;
+      }
+      
+      String value = clustered.partition();
+      try
+      {
+         String replacedValue = StringPropertyReplacer.replaceProperties(value);
+         if (value != replacedValue)
+         {            
+            log.debug("Replacing @Clustered partition attribute " + value + " with " + replacedValue);
+            value = replacedValue;
+         }
+      }
+      catch (Exception e)
+      {
+         log.warn("Unable to replace @Clustered partition attribute " + value + 
+                  ". Caused by " + e.getClass() + " " + e.getMessage());         
+      }
+      
+      partitionName = value;
+   }
+
+   public <T> T getBusinessObject(BeanContext<?> beanContext, Class<T> businessInterface) throws IllegalStateException
+   {
+      throw new IllegalStateException("Not implemented");
+   }
+
+   public Object getInvokedBusinessInterface(BeanContext beanContext) throws IllegalStateException
+   {
+      throw new IllegalStateException("Not implemented");
+   }
+
+   protected Object getInvokedInterface(Method method)
+   {
+      Remote remoteAnnotation = (Remote) resolveAnnotation(Remote.class);
+      if (remoteAnnotation != null)
+      {
+         Class[] remotes = remoteAnnotation.value();
+         for (int i = 0; i < remotes.length; ++i)
+         {
+            try
+            {
+               remotes[i].getMethod(method.getName(), method.getParameterTypes());
+               return remotes[i];
+            }
+            catch (NoSuchMethodException e)
+            {
+            }
+         }
+      }
+
+      Local localAnnotation = (Local) resolveAnnotation(Local.class);
+      if (localAnnotation != null)
+      {
+         Class[] locals = localAnnotation.value();
+         for (int i = 0; i < locals.length; ++i)
+         {
+            Method[] interfaceMethods = locals[i].getMethods();
+            for (int j = 0; j < interfaceMethods.length; ++j)
+            {
+               if (interfaceMethods[j].equals(method))
+                  return locals[i];
+            }
+         }
+      }
+
+      return null;
+   }
+
+   // todo these method overrides for aop are for performance reasons
+   private Class loadPublicAnnotation(String annotation)
+   {
+      try
+      {
+         Class ann = classloader.loadClass(annotation);
+         if (!ann.isAnnotation()) return null;
+         Retention retention = (Retention) ann.getAnnotation(Retention.class);
+         if (retention != null && retention.value() == RetentionPolicy.RUNTIME) return ann;
+
+      }
+      catch (ClassNotFoundException ignored)
+      {
+      }
+      return null;
+   }
+
+   /*
+   @Override
+   public boolean hasAnnotation(Class tgt, String annotation)
+   {
+      if (annotations.hasClassAnnotation(annotation)) return true;
+      if (tgt == null) return false;
+      try
+      {
+         Class ann = loadPublicAnnotation(annotation);
+         // it is metadata or CLASS annotation
+         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(tgt, annotation);
+         return tgt.isAnnotationPresent(ann);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+      }
+   }
+
+
+   @Override
+   public boolean hasAnnotation(Method m, String annotation)
+   {
+      if (annotations.hasAnnotation(m, annotation)) return true;
+      try
+      {
+         Class ann = loadPublicAnnotation(annotation);
+         // it is metadata or CLASS annotation
+         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
+         return m.isAnnotationPresent(ann);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+      }
+   }
+
+   @Override
+   public boolean hasAnnotation(Field m, String annotation)
+   {
+      if (annotations.hasAnnotation(m, annotation)) return true;
+      try
+      {
+         Class ann = loadPublicAnnotation(annotation);
+         // it is metadata or CLASS annotation
+         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
+         return m.isAnnotationPresent(ann);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+      }
+   }
+
+   @Override
+   public boolean hasAnnotation(Constructor m, String annotation)
+   {
+      if (annotations.hasAnnotation(m, annotation)) return true;
+      try
+      {
+         Class ann = loadPublicAnnotation(annotation);
+         // it is metadata or CLASS annotation
+         if (ann == null) return AnnotationElement.isAnyAnnotationPresent(m, annotation);
+         return m.isAnnotationPresent(ann);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+      }
+   }
+   */
+   
+   public Container resolveEjbContainer(String link, Class businessIntf)
+   {
+      return deployment.getEjbContainer(link, businessIntf);
+   }
+
+   public Container resolveEjbContainer(Class businessIntf) throws NameNotFoundException
+   {
+      return deployment.getEjbContainer(businessIntf);
+   }
+
+   public String resolveMessageDestination(String link)
+   {
+      return deployment.resolveMessageDestination(link);
+   }
+   
+   public String resolvePersistenceUnitSupplier(String unitName)
+   {
+      return getDeployment().resolvePersistenceUnitSupplier(unitName);
+   }
+   
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      if (this.getAnnotations().isDisabled(annotationType))
+         return null;
+      
+      return beanContainer.getAnnotation(annotationType);
+   }
+   
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz)
+   {
+      return beanContainer.getAnnotation(clazz, annotationType);
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Method method)
+   {
+      return beanContainer.getAnnotation(annotationType, clazz, method);
+   }
+   
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Method method)
+   {
+      if (this.getAnnotations().isDisabled(method, annotationType))
+         return null;
+      
+      return beanContainer.getAnnotation(annotationType, method);
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Field field)
+   {
+      return beanContainer.getAnnotation(annotationType, clazz, field);
+   }
+   
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Field field)
+   {
+      return beanContainer.getAnnotation(annotationType, field);
+   }
+   
+   /**
+    * @deprecated use getAnnotation
+    */
+   @SuppressWarnings("unchecked")
+   public Object resolveAnnotation(Class annotationType)
+   {
+      return getAnnotation(annotationType);
+   }
+   
+   /**
+    * @deprecated use getAnnotation
+    */
+   @SuppressWarnings("unchecked")
+   public Object resolveAnnotation(Field field, Class annotationType)
+   {
+      return getAnnotation(annotationType, field);
+   }
+   
+   /**
+    * @deprecated use getAnnotation
+    */
+   @SuppressWarnings("unchecked")
+   public Object resolveAnnotation(Method method, Class annotationType)
+   {
+      return getAnnotation(annotationType, method);
+   }
+   
+   /**
+    * @deprecated this is going to be gone soon
+    */
+   @SuppressWarnings("unchecked")
+   public Object resolveAnnotation(Method m, Class[] annotationChoices)
+   {
+      Object value = null;
+      int i = 0;
+      while (value == null && i < annotationChoices.length){
+         value = resolveAnnotation(m, annotationChoices[i++]);
+      }
+      
+      return value;
+   }
+
+   public String getIdentifier()
+   {
+      return getEjbName();
+   }
+
+   public String getDeploymentDescriptorType()
+   {
+      return "ejb-jar.xml";
+   }
+
+   public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
+   {
+      return deployment.getPersistenceUnitDeployment(unitName);
+   }
+
+   public String getEjbJndiName(Class businessInterface) throws NameNotFoundException
+   {
+      return deployment.getEjbJndiName(businessInterface);
+   }
+
+   public String getEjbJndiName(String link, Class businessInterface)
+   {
+      return deployment.getEjbJndiName(link, businessInterface);
+   }
+   
+   public InvocationStatistics getInvokeStats()
+   {
+      return invokeStats;
+   }
+
+   @Deprecated
+   protected MethodInfo getMethodInfo(Method method)
+   {
+      long hash = MethodHashing.calculateHash(method);
+      MethodInfo info = getAdvisor().getMethodInfo(hash);
+      if (info == null)
+      {
+         throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
+      }
+      return info;
+   }
+   
+   public boolean isClustered()
+   {
+      return false;
+   }
+   
+   public JavaEEModule getModule()
+   {
+      return deployment;
+   }
+   
+   public abstract boolean hasJNDIBinding(String jndiName);
+   
+   /**
+    * After XML processing has been done this allows the container
+    * to further initialize the meta data.
+    */
+   public void instantiated()
+   {
+      this.businessInterfaces = resolveBusinessInterfaces();
+      
+      // Before we start to process annotations, make sure we also have the ones from interceptors-aop.
+      // FIXME: because of the flaked life cycle of an EJBContainer (we add annotations after it's been
+      // constructed), we must reinitialize the whole thing. 
+      beanContainer.reinitializeAdvisor();
+   }
+   
+   public void setDirectContainer(DirectContainer<EJBContainer> container)
+   {
+      this.directContainer = container;
+   }
+   
+   protected Method getNonBridgeMethod(Method bridgeMethod)
+   {
+      Class clazz = bridgeMethod.getDeclaringClass();
+      Method[] methods = clazz.getMethods();
+      for (Method method : methods)
+      {
+         if (!method.isBridge() && method.getParameterTypes().length == bridgeMethod.getParameterTypes().length)
+         {
+            return method;
+         }
+      }
+      
+      return bridgeMethod;
+   }
+   
+   public Lock getInvocationLock()
+   {
+      return this.containerLock.readLock();
+   }
+   
+   private Lock getContainerLock()
+   {
+      return this.containerLock.writeLock();
+   }
+   
+   public String toString()
+   {
+      return getObjectName().getCanonicalName();
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,947 +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;
-
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javassist.bytecode.ClassFile;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.persistence.Entity;
-import javax.security.jacc.PolicyConfiguration;
-
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.ejb3.cache.CacheFactoryRegistry;
-import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
-import org.jboss.ejb3.common.lang.ClassHelper;
-import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
-import org.jboss.ejb3.enc.MessageDestinationResolver;
-import org.jboss.ejb3.entity.PersistenceUnitDeployment;
-import org.jboss.ejb3.entity.SecondLevelCacheUtil;
-import org.jboss.ejb3.javaee.JavaEEApplication;
-import org.jboss.ejb3.javaee.JavaEEComponent;
-import org.jboss.ejb3.javaee.JavaEEComponentHelper;
-import org.jboss.ejb3.javaee.JavaEEModule;
-import org.jboss.ejb3.metadata.JBossSessionGenericWrapper;
-import org.jboss.ejb3.pool.PoolFactoryRegistry;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.injection.InjectionHandler;
-import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanGenericWrapper;
-import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.javaee.spec.Environment;
-import org.jboss.metadata.javaee.spec.MessageDestinationsMetaData;
-import org.jboss.metadata.jpa.spec.PersistenceMetaData;
-import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
-import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * An EjbModule represents a collection of beans that are deployed as a unit.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public abstract class Ejb3Deployment extends ServiceMBeanSupport
-  implements JavaEEModule, Ejb3DeploymentMBean
-{
-   private static final Logger log = Logger.getLogger(Ejb3Deployment.class);
-
-   public static final String ACTUAL_ENTITY_MANAGER_FACTORY_CONTEXT = "java:/ActualEntityManagerFactories";
-
-   public static final String MANAGED_ENTITY_FACTORY_CONTEXT = "java:/managedEntityFactories";
-
-   private JBossMetaData metaData;
-   
-   private PersistenceMetaData persistenceUnitsMetaData;
-
-   protected DeploymentUnit unit;
-
-   protected LinkedHashMap<ObjectName, Container> ejbContainers = new LinkedHashMap<ObjectName, Container>();
-
-   private boolean processPersistenceUnits = true;
-   protected boolean hasEntities;
-
-   protected List<String> explicitEntityClasses = new ArrayList<String>();
-
-   protected List<PersistenceUnitDeployment> persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
-
-   protected String defaultSLSBDomain = "Stateless Bean";
-
-   protected String defaultSFSBDomain = "Stateful Bean";
-
-   protected String defaultMDBDomain = "Message Driven Bean";
-
-   protected String defaultConsumerDomain = "Consumer Bean";
-
-   protected String defaultServiceDomain = "Service Bean";
-
-   protected InitialContext initialContext;
-
-   protected KernelAbstraction kernelAbstraction;
-
-   // used for @Management interfaces
-   protected MBeanServer mbeanServer;
-
-   protected DeploymentScope deploymentScope;
-
-   protected EjbModulePersistenceUnitResolver persistenceUnitResolver;
-
-   protected MessageDestinationResolver messageDestinationResolver;
-   protected CacheFactoryRegistry cacheFactoryRegistry;
-   protected RemoteProxyFactoryRegistry remoteProxyFactoryRegistry;
-   protected PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry;
-   protected PoolFactoryRegistry poolFactoryRegistry;
-   
-   protected ObjectName objectName;
-   
-   protected boolean reinitialize = false;
-
-   private org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit;
-   
-   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
-
-   @Deprecated
-   public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceMetaData persistenceUnitsMetaData)
-   {
-      assert unit != null : "unit is null";
-      
-      this.unit = unit;
-      this.deploymentScope = deploymentScope;
-      this.metaData = metaData;
-      this.persistenceUnitsMetaData = persistenceUnitsMetaData;
-      try
-      {
-         initialContext = InitialContextFactory.getInitialContext(unit.getJndiProperties());
-      }
-      catch (NamingException e)
-      {
-         throw new RuntimeException(e);
-      }
-      persistenceUnitResolver = new EjbModulePersistenceUnitResolver(persistenceUnitDeployments, deploymentScope, ejbContainers);
-      MessageDestinationsMetaData destinations = null;
-      if (metaData != null && metaData.getAssemblyDescriptor() != null)
-         destinations = metaData.getAssemblyDescriptor().getMessageDestinations();
-      messageDestinationResolver = new MessageDestinationResolver(deploymentScope, destinations);
-   }
-   
-   /**
-    * Do not deploy persistence unit anymore.
-    * 
-    * @param deploymentUnit
-    * @param unit
-    * @param deploymentScope
-    * @param metaData
-    */
-   public Ejb3Deployment(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit, DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData)
-   {
-      this(unit, deploymentScope, metaData, null);
-      
-      assert deploymentUnit != null : "deploymentUnit is null";
-      
-      this.deploymentUnit = deploymentUnit;
-   }
-
-   public JavaEEApplication getApplication()
-   {
-      return deploymentScope;
-   }
-
-   public DeploymentScope getEar()
-   {
-      return deploymentScope;
-   }
-
-   public KernelAbstraction getKernelAbstraction()
-   {
-      return kernelAbstraction;
-   }
-
-   public MBeanServer getMbeanServer()
-   {
-      return mbeanServer;
-   }
-
-   public void setMbeanServer(MBeanServer mbeanServer)
-   {
-      this.mbeanServer = mbeanServer;
-   }
-
-   public DeploymentUnit getDeploymentUnit()
-   {
-      return unit;
-   }
-
-   public String getDefaultSLSBDomain()
-   {
-      return defaultSLSBDomain;
-   }
-
-   public CacheFactoryRegistry getCacheFactoryRegistry()
-   {
-      return cacheFactoryRegistry;
-   }
-   public void setCacheFactoryRegistry(CacheFactoryRegistry registry)
-   {
-      this.cacheFactoryRegistry = registry;
-   }
-
-   public RemoteProxyFactoryRegistry getRemoteProxyFactoryRegistry()
-   {
-      return remoteProxyFactoryRegistry;
-   }
-   public void setRemoteProxyFactoryRegistry(RemoteProxyFactoryRegistry registry)
-   {
-      this.remoteProxyFactoryRegistry = registry;
-   }
-
-   public PersistenceManagerFactoryRegistry getPersistenceManagerFactoryRegistry()
-   {
-      return persistenceManagerFactoryRegistry;
-   }
-   public void setPersistenceManagerFactoryRegistry(PersistenceManagerFactoryRegistry registry)
-   {
-      this.persistenceManagerFactoryRegistry = registry;
-   }
-   
-   @Inject
-   public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver resolver)
-   {
-      this.persistenceUnitDependencyResolver = resolver;
-   }
-   
-   public PoolFactoryRegistry getPoolFactoryRegistry()
-   {
-      return poolFactoryRegistry;
-   }
-   public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
-   {
-      this.poolFactoryRegistry = poolFactoryRegistry;
-   }
-
-   public void setProcessPersistenceUnits(boolean b)
-   {
-      this.processPersistenceUnits = b;
-   }
-   
-   /**
-    * Returns a partial MBean attribute name of the form
-    * ",ear=foo.ear,jar=foo.jar"
-    *
-    * @return
-    */
-   public String getScopeKernelName()
-   {
-      String scopedKernelName = "";
-      if (deploymentScope != null)
-         scopedKernelName += ",ear=" + deploymentScope.getShortName();
-      scopedKernelName += ",jar=" + unit.getShortName();
-      return scopedKernelName;
-   }
-
-   /**
-    * The default AOP domain for stateless session beans
-    *
-    * @param defaultSLSBDomain
-    */
-   public void setDefaultSLSBDomain(String defaultSLSBDomain)
-   {
-      this.defaultSLSBDomain = defaultSLSBDomain;
-   }
-
-   public String getDefaultSFSBDomain()
-   {
-      return defaultSFSBDomain;
-   }
-
-   public String getDefaultConsumerDomain()
-   {
-      return defaultConsumerDomain;
-   }
-
-   /**
-    * The default stateful session bean aspect domain
-    *
-    * @param defaultSFSBDomain
-    */
-   public void setDefaultSFSBDomain(String defaultSFSBDomain)
-   {
-      this.defaultSFSBDomain = defaultSFSBDomain;
-   }
-
-   public String getDefaultMDBDomain()
-   {
-      return defaultMDBDomain;
-   }
-
-   /**
-    * The default AOP domain for message driven beans.
-    *
-    * @param defaultMDBDomain
-    */
-   public void setDefaultMDBDomain(String defaultMDBDomain)
-   {
-      this.defaultMDBDomain = defaultMDBDomain;
-   }
-
-   public String getDefaultServiceDomain()
-   {
-      return defaultServiceDomain;
-   }
-
-   /**
-    * default AOP domain for service beans.
-    *
-    * @param defaultServiceDomain
-    */
-   public void setDefaultServiceDomain(String defaultServiceDomain)
-   {
-      this.defaultServiceDomain = defaultServiceDomain;
-   }
-
-   protected String getJaccContextId()
-   {
-      return unit.getShortName();
-   }
-
-   /**
-    * Get the deployment ejb container for the given ejb name.
-    * 
-    * @param ejbName the deployment unique ejb name
-    * @return the ejb container if found, null otherwise
-    * @throws IllegalStateException if the ejbName cannot be used to
-    *    for the container name.
-    */
-   public EJBContainer getEjbContainerForEjbName(String ejbName)
-   {
-      String ejbObjectName = JavaEEComponentHelper.createObjectName(this, ejbName);
-      EJBContainer container = null;
-      ObjectName ejbON;
-      try
-      {
-         ejbON = new ObjectName(ejbObjectName);
-      }
-      catch (Exception e)
-      {
-         throw new IllegalStateException("Failed to ", e);
-      }
-      container = (EJBContainer) ejbContainers.get(ejbON);
-      return container;
-   }
-
-   public Container getContainer(ObjectName name)
-   {
-      return (Container) ejbContainers.get(name);
-   }
-
-   public java.util.Map getEjbContainers()
-   {
-      return ejbContainers;
-   }
-
-   public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
-   {
-      return persistenceUnitResolver.getPersistenceUnitDeployment(unitName);
-   }
-
-   public PersistenceUnitDeployment getPersistenceUnitDeploymentInternal(String unitName)
-   {
-      return persistenceUnitResolver.getPersistenceUnitDeploymentInternal(unitName);
-   }
-
-   public List<PersistenceUnitDeployment> getPersistenceUnitDeployments()
-   {
-      return persistenceUnitDeployments;
-   }
-
-
-   public EJBContainer getEjbContainer(String ejbLink, Class businessIntf)
-   {
-      String relativePath = unit.getRelativePath();
-      EJBContainer container = deploymentScope.getEjbContainer(ejbLink, businessIntf, relativePath);
-      return container;
-   }
-
-   public String getEjbJndiName(String ejbLink, Class businessIntf)
-   {
-      EJBContainer container = getEjbContainer(ejbLink, businessIntf);
-      String jndiName = ProxyFactoryHelper.getJndiName(container, businessIntf);
-      return jndiName;
-   }
-   public String getEjbJndiName(Class businessIntf)
-      throws NameNotFoundException
-   {
-      EJBContainer container = getEjbContainer(businessIntf);
-      String jndiName = ProxyFactoryHelper.getJndiName(container, businessIntf);
-      return jndiName;
-   }
-
-   public EJBContainer getEjbContainer(Class businessIntf) throws NameNotFoundException
-   {
-      String relativePath = unit.getRelativePath();
-      return deploymentScope.getEjbContainer(businessIntf, relativePath);
-   }
-
-   protected void processEJBContainerMetadata(Container container) throws Exception
-   {
-      log.trace("Process EJB container metadata " + container);
-      ObjectName on = container.getObjectName();
-      ejbContainers.put(on, container);
-      container.processMetadata();
-   }
-   
-   protected void registerDeployment() throws Exception
-   {
-      String on = "jboss.j2ee:jar=" + this.getName() + ",service=EJB3";
-      if (metaData != null && metaData.getEnterpriseBeans() != null && metaData.getEnterpriseBeans().getEjbJarMetaData() != null)
-      {
-         String jmxName = metaData.getEnterpriseBeans().getEjbJarMetaData().getJmxName();
-         if (jmxName != null && jmxName.trim().length() > 0)
-            on = jmxName;
-      } 
-     
-      objectName = new ObjectName(on);
-      
-      mbeanServer.registerMBean(this, objectName);
-   }
-   
-   protected void unregisterDeployment()
-   {
-      try
-      {
-         mbeanServer.unregisterMBean(objectName);
-      }
-      catch (Exception e)
-      {
-         log.debug("error trying to stop ejb deployment", e);
-      }
-   }
-
-   protected void registerEJBContainer(Container container) throws Exception
-   {
-      ObjectName on = container.getObjectName();
-      String name = on.getCanonicalName();
-      DependencyPolicy dependsPolicy = container.getDependencyPolicy();
-      dependsPolicy.addDependency("jboss.ejb:service=EJBTimerService");
-      kernelAbstraction.install(name, dependsPolicy, unit, container);
-      mbeanServer.registerMBean(container.getMBean(), on);
-      log.debug("Bound ejb3 container " + name);
-   }
-
-   protected abstract PolicyConfiguration createPolicyConfiguration() throws Exception;
-
-   protected abstract void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit);
-
-   /**
-    * Return the container injection handler collection. If not specified(null)
-    * a default handler collection will be created.
-    * @return the injection handler collection to use, null if the container
-    *    should use a default setup.
-    */
-   protected Collection<InjectionHandler<Environment>> getHandlers()
-   {
-      return null;
-   }
-
-   /**
-    * Create all EJB containers and Persistence Units
-    * The only things that should be initialized is metadata that does not need access to any
-    * other deployment.  This is because we want the entire EAR to be initialized so that we do not
-    * have to guess on dependencies MBean names.  This is because of the silly scoping rules for persistence units
-    * and EJBs.
-    *
-    * @throws Exception
-    */
-   public void create() throws Exception
-   {
-      try
-      {
-         long start = System.currentTimeMillis();
-
-         //pc = createPolicyConfiguration();
-
-         deploy();
-
-         initializePersistenceUnits();
-         
-         registerDeployment();
-
-         log.debug("EJB3 deployment time took: " + (System.currentTimeMillis() - start));
-      }
-      catch (Exception e)
-      {
-         try
-         {
-            destroy();
-         }
-         catch (Exception ignored)
-         {
-            // ignore
-         }
-         throw e;
-      }
-   }
-   
-   protected void reinitialize() throws Exception
-   {
-      initializePersistenceUnits();
-      reinitialize = false;
-   }
-
-   public void start() throws Exception
-   {
-      try
-      {
-         if (reinitialize)
-            reinitialize();
-         
-         startPersistenceUnits();
-
-         for (Object o : ejbContainers.values())
-         {
-            Container con = (Container) o;
-            processEJBContainerMetadata(con);
-         }
-
-         for (Object o : ejbContainers.values())
-         {
-            Container con = (Container) o;
-            registerEJBContainer(con);
-         }
-
-         //putJaccInService(pc, unit);
-      }
-      catch (Exception ex)
-      {
-         try
-         {
-            stop();
-            destroy();
-         }
-         catch (Exception ignored)
-         {
-         }
-         throw ex;
-      }
-   }
-   
-   public void stop() //throws Exception
-   {
-      for (ObjectName on : ejbContainers.keySet())
-      {
-         try
-         {
-            mbeanServer.unregisterMBean(on);
-            kernelAbstraction.uninstall(on.getCanonicalName());
-         }
-         catch (Exception e)
-         {
-            log.debug("error trying to stop ejb container", e);
-         }
-      }
-      stopPersistenceUnits();
-      
-      reinitialize = true;
-   }
-
-   protected void deploy() throws Exception
-   {
-      if(metaData == null || !metaData.isMetadataComplete())
-      {
-         Ejb3HandlerFactory factory = Ejb3HandlerFactory.getInstance(this);
-         // Scan and deploy
-         if (unit.getUrl() != null)
-            deployUrl(factory);
-   
-         // Deploy any classes that have been explicitly marked
-         if (unit.getClasses() != null)
-         {
-            for (Class explicit : unit.getClasses())
-            {
-               if (explicit.isAnnotationPresent(Entity.class))
-               {
-                  continue;
-               }
-               String name = explicit.getName().replace('.', '/') + ".class";
-               InputStream stream = explicit.getClassLoader().getResourceAsStream(name);
-               deployElement(stream, factory, initialContext);
-            }
-         }
-      }
-
-      // Deploy the beans from the descriptor
-      deployBeansFromLib(initialContext);
-   }
-
-   protected void deployUrl(Ejb3HandlerFactory factory) throws Exception
-   {
-      // make sure we are not deploying ejbs from client jar
-      List<VirtualFile> clientDescriptors = unit.getResources(new org.jboss.ejb3.ClientDescriptorFileFilter());
-
-      if (clientDescriptors.size() > 0)
-         return;
-
-      InitialContext ctx = initialContext;
-      // need to look into every entry in the archive to see if anybody has tags
-      // defined.
-      List<VirtualFile> classes = unit.getResources(new org.jboss.ejb3.ClassFileFilter());
-      for (VirtualFile classFile : classes)
-      {
-         InputStream stream = classFile.openStream();
-         deployElement(stream, factory, ctx);
-      }
-   }
-
-   protected void deployElement(InputStream stream, Ejb3HandlerFactory factory, InitialContext ctx) throws Exception
-   {
-      DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream));
-      ClassFile cf = null;
-      try
-      {
-         cf = new ClassFile(dstream);
-      }
-      finally
-      {
-         dstream.close();
-         stream.close();
-      }
-
-      deployElement(factory, cf, ctx);
-
-   }
-
-   protected void deployBeansFromLib(InitialContext ctx) throws Exception
-   {
-      JBossMetaData dd = getMetaData();
-      if (dd != null)
-      {
-         Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(this, dd);
-         handler.setCtxProperties(unit.getJndiProperties());
-
-         Map<String, Container> localContainers = new HashMap<String, Container>();
-         Iterator<Container> containerIterator = ejbContainers.values().iterator();
-         while (containerIterator.hasNext())
-         {
-            Container container = containerIterator.next();
-            localContainers.put(container.getEjbName(), container);
-         }
-
-         List<Container> containers = handler.getContainers(this, localContainers);
-         for (Container con : containers)
-         {
-            // EJBContainer has finished with all metadata initialization from XML files and such.
-            // this is really a hook to do some processing after XML has been set up and before
-            // and processing of dependencies and such.
-            ((EJBContainer) con).instantiated();
-            this.ejbContainers.put(con.getObjectName(), con);
-            Ejb3Registry.register(con);
-         }
-      }
-   }
-
-   protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx) throws Exception
-   {
-      Ejb3Handler handler = factory.createHandler(cf);
-      handler.setCtxProperties(unit.getJndiProperties());
-
-      if (handler.isEjb() || handler.isJBossBeanType())
-      {
-         List<Container> containers = handler.getContainers(cf, this);
-         for (Container con : containers)
-         {
-            // EJBContainer has finished with all metadata initialization from XML files and such.
-            // this is really a hook to do some processing after XML has been set up and before
-            // and processing of dependencies and such.
-            try
-            {
-               ((EJBContainer) con).instantiated();
-               this.ejbContainers.put(con.getObjectName(), con);
-               Ejb3Registry.register(con);
-            }
-            catch (Throwable t)
-            {
-               throw new DeploymentException(
-                     "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t);
-            }
-         }
-      }
-   }
-
-   protected void initializePersistenceUnits() throws Exception
-   {
-      hasEntities = persistenceUnitsMetaData != null && processPersistenceUnits;
-
-      if (!hasEntities)
-         return;
-
-      if (unit.getClasses() != null)
-      {
-         for (Class<?> explicit : unit.getClasses())
-         {
-            if (explicit.isAnnotationPresent(Entity.class))
-            {
-               explicitEntityClasses.add(explicit.getName());
-            }
-         }
-      }
-
-      // scope the unitName if this is an ejb archive
-      // todo revert to this: List<PersistenceMetadata> persistenceMetadata = PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap(), new EJB3DTDEntityResolver());
-      List<PersistenceUnitMetaData> pumds = persistenceUnitsMetaData.getPersistenceUnits();
-      for (PersistenceUnitMetaData metaData : pumds)
-      {
-         String earShortName = deploymentScope == null ? null : deploymentScope.getShortName();
-         boolean isScoped = ejbContainers.size() > 0;
-
-         Map<String, String> properties = metaData.getProperties();
-         if (properties == null)
-         {
-            properties = new HashMap<String, String>();
-            metaData.setProperties(properties);
-         }
-         // Ensure 2nd level cache entries are segregated from other deployments
-         String cache_prefix = properties.get(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX);
-         if (cache_prefix == null)
-         {
-            // Create a region_prefix for the 2nd level cache to ensure
-            // deployments are segregated
-            String jarName = isScoped ? unit.getShortName() : null;
-            cache_prefix = SecondLevelCacheUtil.createCacheRegionPrefix(earShortName, jarName, metaData.getName());
-            properties.put(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX, cache_prefix);
-         }
-         PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, metaData, earShortName, unit.getShortName(), isScoped);
-         PersistenceUnitRegistry.register(deployment);
-         persistenceUnitDeployments.add(deployment);
-      }
-   }
-
-   public abstract DependencyPolicy createDependencyPolicy(JavaEEComponent component);
-
-   protected void startPersistenceUnits()
-   {
-      if (persistenceUnitDeployments == null)
-         return;
-
-      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
-      {
-         if (entityDeployment != null)
-         {
-            DependencyPolicy policy = createDependencyPolicy(entityDeployment);
-            entityDeployment.addDependencies(policy);
-            kernelAbstraction.install(entityDeployment.getKernelName(), policy, unit, entityDeployment);
-         }
-      }
-   }
-
-   protected void stopPersistenceUnits()
-   {
-      if (persistenceUnitDeployments == null)
-         return;
-
-      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
-      {
-         try
-         {
-            PersistenceUnitRegistry.unregister(entityDeployment);
-            if (entityDeployment != null)
-            {
-               kernelAbstraction.uninstall(entityDeployment.getKernelName());
-            }
-         }
-         catch (Exception e)
-         {
-            log.debug("error trying to shut down persistence unit", e);
-         }
-      }
-      
-      persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
-
-   }
-
-   
-
-   public void destroy() //throws Exception
-   {
-      try
-      {
-         undeploy();
-         
-         unregisterDeployment();
-      } 
-      catch (Exception e)
-      {
-         log.debug("error trying to destroy ejb deployment", e);
-      }
-   }
-
-   private void undeploy()
-   {
-      for (Container container : ejbContainers.values())
-      {
-         Ejb3Registry.unregister(container);
-      }
-   }
-
-   //   /**
-   //    * Get the jndi name of a message destination.
-   //    * 
-   //    * @param name   the name of the message destination
-   //    * @return       the jndi name
-   //    */
-   //   private String getMessageDestination(String name)
-   //   {
-   //      EjbJarDD dd;
-   //      // FIXME: Why isn't dd stored somewhere?
-   //      try
-   //      {
-   //         dd = EjbJarDDObjectFactory.parse(getDeploymentUnit().getEjbJarXml());
-   //         dd = JBossDDObjectFactory.parse(getDeploymentUnit().getJbossXml(), dd);
-   //      }
-   //      catch(IOException e)
-   //      {
-   //         throw new RuntimeException(e);
-   //      }
-   //      catch(JBossXBException e)
-   //      {
-   //         throw new RuntimeException(e);
-   //      }
-   //
-   //      AssemblyDescriptor ad = dd.getAssemblyDescriptor();
-   //      if(ad == null)
-   //         throw new IllegalStateException("No assembly descriptor found in '" + getName() + "'");
-   //      MessageDestination md = ad.findMessageDestination(name);
-   //      if(md == null)
-   //         throw new IllegalStateException("No message destination '" + name + "' found in '" + getName() + "'");
-   //      String jndiName = md.getJndiName();
-   //      if(jndiName == null)
-   //         throw new IllegalStateException("No jndi name specified for message destination '" + name + "' in '" + getName() + "'");
-   //      return jndiName;
-   //   }
-
-   public String resolveMessageDestination(String link)
-   {
-      //      // FIXME: this is a copy of DeploymentEjbResolver
-      //      int hashIndex = link.indexOf('#');
-      //      if (hashIndex != -1)
-      //      {
-      //         if (deploymentScope == null)
-      //         {
-      //            log.warn("ejb link '" + link + "' is relative, but no deployment scope found");
-      //            return null;
-      //         }
-      //         String relativePath = link.substring(0, hashIndex);
-      //         Ejb3Deployment dep = deploymentScope.findRelativeDeployment(relativePath);
-      //         if (dep == null)
-      //         {
-      //            log.warn("can't find a deployment for path '" + relativePath + "' of ejb link '" + link + "'");
-      //            return null;
-      //         }
-      //         String name = link.substring(hashIndex + 1);
-      //         return dep.getMessageDestination(name);
-      //      }
-      //      return getMessageDestination(link);
-      return messageDestinationResolver.resolveMessageDestination(link);
-   }
-
-   protected String resolvePersistenceUnitSupplier(String persistenceUnitName)
-   {
-      return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName);
-   }
-   
-   public MessageDestinationResolver getMessageDestinationResolver()
-   {
-      return messageDestinationResolver;
-   }
-
-   /**
-    * Do not call, for use in Ejb3Handler.
-    * 
-    * @param <B>
-    * @param ejbName
-    * @param enterpriseBeanMetaDataClass
-    * @return
-    */
-   protected <B extends JBossEnterpriseBeanMetaData> B getEnterpriseBeanMetaData(String ejbName, Class<B> enterpriseBeanMetaDataClass)
-   {
-      if(metaData == null)
-         return null;
-      
-      JBossEnterpriseBeanMetaData result = metaData.getEnterpriseBean(ejbName);
-      
-      // FIXME: EJBTHREE-1227: temporary workaround for JBCTS-756
-      // see also org.jboss.ejb3.metadata.JBossSessionGenericWrapper
-      if(result instanceof JBossGenericBeanMetaData)
-      {
-         log.warn("FIXME: EJBTHREE-1227: JBossGenericBeanMetaData found for '" + ejbName + "' instead of " + enterpriseBeanMetaDataClass);
-         if(enterpriseBeanMetaDataClass.equals(JBossSessionBeanMetaData.class))
-         {
-            result = new JBossSessionGenericWrapper((JBossGenericBeanMetaData) result);
-         }
-         else if(enterpriseBeanMetaDataClass.equals(JBossMessageDrivenBeanMetaData.class))
-         {
-            result = new JBossMessageDrivenBeanGenericWrapper((JBossGenericBeanMetaData) result);
-         }
-         else
-         {
-            throw new IllegalStateException("Can't find a generic bean meta data wrapper for " + enterpriseBeanMetaDataClass);
-         }
-      }
-      
-      return ClassHelper.cast(enterpriseBeanMetaDataClass, result);
-   }
-   
-   /**
-    * Get the meta data associated with this deployment or null if none.
-    * 
-    * @return   meta data or null
-    */
-   public JBossMetaData getMetaData()
-   {
-      return metaData;
-   }
-
-   public String getName()
-   {
-      return unit.getShortName();
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,948 @@
+/*
+ * 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;
+
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javassist.bytecode.ClassFile;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.persistence.Entity;
+import javax.security.jacc.PolicyConfiguration;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.ejb3.cache.CacheFactoryRegistry;
+import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
+import org.jboss.ejb3.common.lang.ClassHelper;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
+import org.jboss.ejb3.enc.MessageDestinationResolver;
+import org.jboss.ejb3.entity.PersistenceUnitDeployment;
+import org.jboss.ejb3.entity.SecondLevelCacheUtil;
+import org.jboss.ejb3.javaee.JavaEEApplication;
+import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.ejb3.javaee.JavaEEComponentHelper;
+import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.metadata.JBossSessionGenericWrapper;
+import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.injection.InjectionHandler;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanGenericWrapper;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.MessageDestinationsMetaData;
+import org.jboss.metadata.jpa.spec.PersistenceMetaData;
+import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An EjbModule represents a collection of beans that are deployed as a unit.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public abstract class Ejb3Deployment extends ServiceMBeanSupport
+  implements JavaEEModule, Ejb3DeploymentMBean
+{
+   private static final Logger log = Logger.getLogger(Ejb3Deployment.class);
+
+   public static final String ACTUAL_ENTITY_MANAGER_FACTORY_CONTEXT = "java:/ActualEntityManagerFactories";
+
+   public static final String MANAGED_ENTITY_FACTORY_CONTEXT = "java:/managedEntityFactories";
+
+   private JBossMetaData metaData;
+   
+   private PersistenceMetaData persistenceUnitsMetaData;
+
+   protected DeploymentUnit unit;
+
+   protected LinkedHashMap<ObjectName, Container> ejbContainers = new LinkedHashMap<ObjectName, Container>();
+
+   private boolean processPersistenceUnits = true;
+   protected boolean hasEntities;
+
+   protected List<String> explicitEntityClasses = new ArrayList<String>();
+
+   protected List<PersistenceUnitDeployment> persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
+
+   protected String defaultSLSBDomain = "Stateless Bean";
+
+   protected String defaultSFSBDomain = "Stateful Bean";
+
+   protected String defaultMDBDomain = "Message Driven Bean";
+
+   protected String defaultConsumerDomain = "Consumer Bean";
+
+   protected String defaultServiceDomain = "Service Bean";
+
+   protected InitialContext initialContext;
+
+   protected KernelAbstraction kernelAbstraction;
+
+   // used for @Management interfaces
+   protected MBeanServer mbeanServer;
+
+   protected DeploymentScope deploymentScope;
+
+   protected EjbModulePersistenceUnitResolver persistenceUnitResolver;
+
+   protected MessageDestinationResolver messageDestinationResolver;
+   protected CacheFactoryRegistry cacheFactoryRegistry;
+   protected RemoteProxyFactoryRegistry remoteProxyFactoryRegistry;
+   protected PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry;
+   protected PoolFactoryRegistry poolFactoryRegistry;
+   
+   protected ObjectName objectName;
+   
+   protected boolean reinitialize = false;
+
+   private org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit;
+   
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+
+   @Deprecated
+   public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceMetaData persistenceUnitsMetaData)
+   {
+      assert unit != null : "unit is null";
+      
+      this.unit = unit;
+      this.deploymentScope = deploymentScope;
+      this.metaData = metaData;
+      this.persistenceUnitsMetaData = persistenceUnitsMetaData;
+      try
+      {
+         initialContext = InitialContextFactory.getInitialContext(unit.getJndiProperties());
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+      persistenceUnitResolver = new EjbModulePersistenceUnitResolver(persistenceUnitDeployments, deploymentScope, ejbContainers);
+      MessageDestinationsMetaData destinations = null;
+      if (metaData != null && metaData.getAssemblyDescriptor() != null)
+         destinations = metaData.getAssemblyDescriptor().getMessageDestinations();
+      messageDestinationResolver = new MessageDestinationResolver(deploymentScope, destinations);
+   }
+   
+   /**
+    * Do not deploy persistence unit anymore.
+    * 
+    * @param deploymentUnit
+    * @param unit
+    * @param deploymentScope
+    * @param metaData
+    */
+   public Ejb3Deployment(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit, DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData)
+   {
+      this(unit, deploymentScope, metaData, null);
+      
+      assert deploymentUnit != null : "deploymentUnit is null";
+      
+      this.deploymentUnit = deploymentUnit;
+   }
+
+   public JavaEEApplication getApplication()
+   {
+      return deploymentScope;
+   }
+
+   public DeploymentScope getEar()
+   {
+      return deploymentScope;
+   }
+
+   public KernelAbstraction getKernelAbstraction()
+   {
+      return kernelAbstraction;
+   }
+
+   public MBeanServer getMbeanServer()
+   {
+      return mbeanServer;
+   }
+
+   public void setMbeanServer(MBeanServer mbeanServer)
+   {
+      this.mbeanServer = mbeanServer;
+   }
+
+   public DeploymentUnit getDeploymentUnit()
+   {
+      return unit;
+   }
+
+   public String getDefaultSLSBDomain()
+   {
+      return defaultSLSBDomain;
+   }
+
+   public CacheFactoryRegistry getCacheFactoryRegistry()
+   {
+      return cacheFactoryRegistry;
+   }
+   public void setCacheFactoryRegistry(CacheFactoryRegistry registry)
+   {
+      this.cacheFactoryRegistry = registry;
+   }
+
+   public RemoteProxyFactoryRegistry getRemoteProxyFactoryRegistry()
+   {
+      return remoteProxyFactoryRegistry;
+   }
+   public void setRemoteProxyFactoryRegistry(RemoteProxyFactoryRegistry registry)
+   {
+      this.remoteProxyFactoryRegistry = registry;
+   }
+
+   public PersistenceManagerFactoryRegistry getPersistenceManagerFactoryRegistry()
+   {
+      return persistenceManagerFactoryRegistry;
+   }
+   public void setPersistenceManagerFactoryRegistry(PersistenceManagerFactoryRegistry registry)
+   {
+      this.persistenceManagerFactoryRegistry = registry;
+   }
+   
+   @Inject
+   public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver resolver)
+   {
+      this.persistenceUnitDependencyResolver = resolver;
+   }
+   
+   public PoolFactoryRegistry getPoolFactoryRegistry()
+   {
+      return poolFactoryRegistry;
+   }
+   public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
+   {
+      this.poolFactoryRegistry = poolFactoryRegistry;
+   }
+
+   public void setProcessPersistenceUnits(boolean b)
+   {
+      this.processPersistenceUnits = b;
+   }
+   
+   /**
+    * Returns a partial MBean attribute name of the form
+    * ",ear=foo.ear,jar=foo.jar"
+    *
+    * @return
+    */
+   public String getScopeKernelName()
+   {
+      String scopedKernelName = "";
+      if (deploymentScope != null)
+         scopedKernelName += ",ear=" + deploymentScope.getShortName();
+      scopedKernelName += ",jar=" + unit.getShortName();
+      return scopedKernelName;
+   }
+
+   /**
+    * The default AOP domain for stateless session beans
+    *
+    * @param defaultSLSBDomain
+    */
+   public void setDefaultSLSBDomain(String defaultSLSBDomain)
+   {
+      this.defaultSLSBDomain = defaultSLSBDomain;
+   }
+
+   public String getDefaultSFSBDomain()
+   {
+      return defaultSFSBDomain;
+   }
+
+   public String getDefaultConsumerDomain()
+   {
+      return defaultConsumerDomain;
+   }
+
+   /**
+    * The default stateful session bean aspect domain
+    *
+    * @param defaultSFSBDomain
+    */
+   public void setDefaultSFSBDomain(String defaultSFSBDomain)
+   {
+      this.defaultSFSBDomain = defaultSFSBDomain;
+   }
+
+   public String getDefaultMDBDomain()
+   {
+      return defaultMDBDomain;
+   }
+
+   /**
+    * The default AOP domain for message driven beans.
+    *
+    * @param defaultMDBDomain
+    */
+   public void setDefaultMDBDomain(String defaultMDBDomain)
+   {
+      this.defaultMDBDomain = defaultMDBDomain;
+   }
+
+   public String getDefaultServiceDomain()
+   {
+      return defaultServiceDomain;
+   }
+
+   /**
+    * default AOP domain for service beans.
+    *
+    * @param defaultServiceDomain
+    */
+   public void setDefaultServiceDomain(String defaultServiceDomain)
+   {
+      this.defaultServiceDomain = defaultServiceDomain;
+   }
+
+   protected String getJaccContextId()
+   {
+      return unit.getShortName();
+   }
+
+   /**
+    * Get the deployment ejb container for the given ejb name.
+    * 
+    * @param ejbName the deployment unique ejb name
+    * @return the ejb container if found, null otherwise
+    * @throws IllegalStateException if the ejbName cannot be used to
+    *    for the container name.
+    */
+   public EJBContainer getEjbContainerForEjbName(String ejbName)
+   {
+      String ejbObjectName = JavaEEComponentHelper.createObjectName(this, ejbName);
+      EJBContainer container = null;
+      ObjectName ejbON;
+      try
+      {
+         ejbON = new ObjectName(ejbObjectName);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException("Failed to ", e);
+      }
+      container = (EJBContainer) ejbContainers.get(ejbON);
+      return container;
+   }
+
+   public Container getContainer(ObjectName name)
+   {
+      return (Container) ejbContainers.get(name);
+   }
+
+   public java.util.Map getEjbContainers()
+   {
+      return ejbContainers;
+   }
+
+   public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
+   {
+      return persistenceUnitResolver.getPersistenceUnitDeployment(unitName);
+   }
+
+   public PersistenceUnitDeployment getPersistenceUnitDeploymentInternal(String unitName)
+   {
+      return persistenceUnitResolver.getPersistenceUnitDeploymentInternal(unitName);
+   }
+
+   public List<PersistenceUnitDeployment> getPersistenceUnitDeployments()
+   {
+      return persistenceUnitDeployments;
+   }
+
+
+   public EJBContainer getEjbContainer(String ejbLink, Class businessIntf)
+   {
+      String relativePath = unit.getRelativePath();
+      EJBContainer container = deploymentScope.getEjbContainer(ejbLink, businessIntf, relativePath);
+      return container;
+   }
+
+   public String getEjbJndiName(String ejbLink, Class businessIntf)
+   {
+      EJBContainer container = getEjbContainer(ejbLink, businessIntf);
+      String jndiName = ProxyFactoryHelper.getJndiName(container, businessIntf);
+      return jndiName;
+   }
+   public String getEjbJndiName(Class businessIntf)
+      throws NameNotFoundException
+   {
+      EJBContainer container = getEjbContainer(businessIntf);
+      String jndiName = ProxyFactoryHelper.getJndiName(container, businessIntf);
+      return jndiName;
+   }
+
+   public EJBContainer getEjbContainer(Class businessIntf) throws NameNotFoundException
+   {
+      String relativePath = unit.getRelativePath();
+      return deploymentScope.getEjbContainer(businessIntf, relativePath);
+   }
+
+   protected void processEJBContainerMetadata(Container container) throws Exception
+   {
+      log.trace("Process EJB container metadata " + container);
+      ObjectName on = container.getObjectName();
+      ejbContainers.put(on, container);
+      container.processMetadata();
+   }
+   
+   protected void registerDeployment() throws Exception
+   {
+      String on = "jboss.j2ee:jar=" + this.getName() + ",service=EJB3";
+      if (metaData != null && metaData.getEnterpriseBeans() != null && metaData.getEnterpriseBeans().getEjbJarMetaData() != null)
+      {
+         String jmxName = metaData.getEnterpriseBeans().getEjbJarMetaData().getJmxName();
+         if (jmxName != null && jmxName.trim().length() > 0)
+            on = jmxName;
+      } 
+     
+      objectName = new ObjectName(on);
+      
+      mbeanServer.registerMBean(this, objectName);
+   }
+   
+   protected void unregisterDeployment()
+   {
+      try
+      {
+         mbeanServer.unregisterMBean(objectName);
+      }
+      catch (Exception e)
+      {
+         log.debug("error trying to stop ejb deployment", e);
+      }
+   }
+
+   protected void registerEJBContainer(Container container) throws Exception
+   {
+      ObjectName on = container.getObjectName();
+      String name = on.getCanonicalName();
+      DependencyPolicy dependsPolicy = container.getDependencyPolicy();
+      dependsPolicy.addDependency("jboss.ejb:service=EJBTimerService");
+      kernelAbstraction.install(name, dependsPolicy, unit, container);
+      mbeanServer.registerMBean(container.getMBean(), on);
+      log.debug("Bound ejb3 container " + name);
+   }
+
+   protected abstract PolicyConfiguration createPolicyConfiguration() throws Exception;
+
+   protected abstract void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit);
+
+   /**
+    * Return the container injection handler collection. If not specified(null)
+    * a default handler collection will be created.
+    * @return the injection handler collection to use, null if the container
+    *    should use a default setup.
+    */
+   protected Collection<InjectionHandler<Environment>> getHandlers()
+   {
+      return null;
+   }
+
+   /**
+    * Create all EJB containers and Persistence Units
+    * The only things that should be initialized is metadata that does not need access to any
+    * other deployment.  This is because we want the entire EAR to be initialized so that we do not
+    * have to guess on dependencies MBean names.  This is because of the silly scoping rules for persistence units
+    * and EJBs.
+    *
+    * @throws Exception
+    */
+   public void create() throws Exception
+   {
+      try
+      {
+         long start = System.currentTimeMillis();
+
+         //pc = createPolicyConfiguration();
+
+         deploy();
+
+         initializePersistenceUnits();
+         
+         registerDeployment();
+
+         log.debug("EJB3 deployment time took: " + (System.currentTimeMillis() - start));
+      }
+      catch (Exception e)
+      {
+         try
+         {
+            destroy();
+         }
+         catch (Exception ignored)
+         {
+            // ignore
+         }
+         throw e;
+      }
+   }
+   
+   protected void reinitialize() throws Exception
+   {
+      initializePersistenceUnits();
+      reinitialize = false;
+   }
+
+   public void start() throws Exception
+   {
+      try
+      {
+         if (reinitialize)
+            reinitialize();
+         
+         startPersistenceUnits();
+
+         for (Object o : ejbContainers.values())
+         {
+            Container con = (Container) o;
+            processEJBContainerMetadata(con);
+         }
+
+         for (Object o : ejbContainers.values())
+         {
+            Container con = (Container) o;
+            registerEJBContainer(con);
+         }
+
+         //putJaccInService(pc, unit);
+      }
+      catch (Exception ex)
+      {
+         try
+         {
+            stop();
+            destroy();
+         }
+         catch (Exception ignored)
+         {
+         }
+         throw ex;
+      }
+   }
+   
+   public void stop() //throws Exception
+   {
+      for (ObjectName on : ejbContainers.keySet())
+      {
+         try
+         {
+            mbeanServer.unregisterMBean(on);
+            kernelAbstraction.uninstall(on.getCanonicalName());
+         }
+         catch (Exception e)
+         {
+            log.debug("error trying to stop ejb container", e);
+         }
+      }
+      stopPersistenceUnits();
+      
+      reinitialize = true;
+   }
+
+   protected void deploy() throws Exception
+   {
+      if(metaData == null || !metaData.isMetadataComplete())
+      {
+         Ejb3HandlerFactory factory = Ejb3HandlerFactory.getInstance(this);
+         // Scan and deploy
+         if (unit.getUrl() != null)
+            deployUrl(factory);
+   
+         // Deploy any classes that have been explicitly marked
+         if (unit.getClasses() != null)
+         {
+            for (Class explicit : unit.getClasses())
+            {
+               if (explicit.isAnnotationPresent(Entity.class))
+               {
+                  continue;
+               }
+               String name = explicit.getName().replace('.', '/') + ".class";
+               InputStream stream = explicit.getClassLoader().getResourceAsStream(name);
+               deployElement(stream, factory, initialContext);
+            }
+         }
+      }
+
+      // Deploy the beans from the descriptor
+      deployBeansFromLib(initialContext);
+   }
+
+   protected void deployUrl(Ejb3HandlerFactory factory) throws Exception
+   {
+      // make sure we are not deploying ejbs from client jar
+      List<VirtualFile> clientDescriptors = unit.getResources(new org.jboss.ejb3.ClientDescriptorFileFilter());
+
+      if (clientDescriptors.size() > 0)
+         return;
+
+      InitialContext ctx = initialContext;
+      // need to look into every entry in the archive to see if anybody has tags
+      // defined.
+      List<VirtualFile> classes = unit.getResources(new org.jboss.ejb3.ClassFileFilter());
+      for (VirtualFile classFile : classes)
+      {
+         InputStream stream = classFile.openStream();
+         deployElement(stream, factory, ctx);
+      }
+   }
+
+   protected void deployElement(InputStream stream, Ejb3HandlerFactory factory, InitialContext ctx) throws Exception
+   {
+      DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream));
+      ClassFile cf = null;
+      try
+      {
+         cf = new ClassFile(dstream);
+      }
+      finally
+      {
+         dstream.close();
+         stream.close();
+      }
+
+      deployElement(factory, cf, ctx);
+
+   }
+
+   protected void deployBeansFromLib(InitialContext ctx) throws Exception
+   {
+      JBossMetaData dd = getMetaData();
+      if (dd != null)
+      {
+         Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(this, dd);
+         handler.setCtxProperties(unit.getJndiProperties());
+
+         Map<String, Container> localContainers = new HashMap<String, Container>();
+         Iterator<Container> containerIterator = ejbContainers.values().iterator();
+         while (containerIterator.hasNext())
+         {
+            Container container = containerIterator.next();
+            localContainers.put(container.getEjbName(), container);
+         }
+
+         List<Container> containers = handler.getContainers(this, localContainers);
+         for (Container con : containers)
+         {
+            // EJBContainer has finished with all metadata initialization from XML files and such.
+            // this is really a hook to do some processing after XML has been set up and before
+            // and processing of dependencies and such.
+            ((EJBContainer) con).instantiated();
+            this.ejbContainers.put(con.getObjectName(), con);
+            Ejb3Registry.register(con);
+         }
+      }
+   }
+
+   protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx) throws Exception
+   {
+      Ejb3Handler handler = factory.createHandler(cf);
+      handler.setCtxProperties(unit.getJndiProperties());
+
+      if (handler.isEjb() || handler.isJBossBeanType())
+      {
+         List<Container> containers = handler.getContainers(cf, this);
+         for (Container con : containers)
+         {
+            // EJBContainer has finished with all metadata initialization from XML files and such.
+            // this is really a hook to do some processing after XML has been set up and before
+            // and processing of dependencies and such.
+            try
+            {
+               ((EJBContainer) con).instantiated();
+               this.ejbContainers.put(con.getObjectName(), con);
+               Ejb3Registry.register(con);
+            }
+            catch (Throwable t)
+            {
+               throw new DeploymentException(
+                     "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t);
+            }
+         }
+      }
+   }
+
+   protected void initializePersistenceUnits() throws Exception
+   {
+      hasEntities = persistenceUnitsMetaData != null && processPersistenceUnits;
+
+      if (!hasEntities)
+         return;
+
+      if (unit.getClasses() != null)
+      {
+         for (Class<?> explicit : unit.getClasses())
+         {
+            if (explicit.isAnnotationPresent(Entity.class))
+            {
+               explicitEntityClasses.add(explicit.getName());
+            }
+         }
+      }
+
+      // scope the unitName if this is an ejb archive
+      // todo revert to this: List<PersistenceMetadata> persistenceMetadata = PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap(), new EJB3DTDEntityResolver());
+      List<PersistenceUnitMetaData> pumds = persistenceUnitsMetaData.getPersistenceUnits();
+      for (PersistenceUnitMetaData metaData : pumds)
+      {
+         String earShortName = deploymentScope == null ? null : deploymentScope.getShortName();
+         boolean isScoped = ejbContainers.size() > 0;
+
+         Map<String, String> properties = metaData.getProperties();
+         if (properties == null)
+         {
+            properties = new HashMap<String, String>();
+            metaData.setProperties(properties);
+         }
+         // Ensure 2nd level cache entries are segregated from other deployments
+         String cache_prefix = properties.get(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX);
+         if (cache_prefix == null)
+         {
+            // Create a region_prefix for the 2nd level cache to ensure
+            // deployments are segregated
+            String jarName = isScoped ? unit.getShortName() : null;
+            cache_prefix = SecondLevelCacheUtil.createCacheRegionPrefix(earShortName, jarName, metaData.getName());
+            properties.put(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX, cache_prefix);
+         }
+         PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, metaData, earShortName, unit.getShortName(), isScoped);
+         PersistenceUnitRegistry.register(deployment);
+         persistenceUnitDeployments.add(deployment);
+      }
+   }
+
+   public abstract DependencyPolicy createDependencyPolicy(JavaEEComponent component);
+
+   protected void startPersistenceUnits()
+   {
+      if (persistenceUnitDeployments == null)
+         return;
+
+      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
+      {
+         if (entityDeployment != null)
+         {
+            DependencyPolicy policy = createDependencyPolicy(entityDeployment);
+            entityDeployment.addDependencies(policy);
+            kernelAbstraction.install(entityDeployment.getKernelName(), policy, unit, entityDeployment);
+         }
+      }
+   }
+
+   protected void stopPersistenceUnits()
+   {
+      if (persistenceUnitDeployments == null)
+         return;
+
+      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
+      {
+         try
+         {
+            PersistenceUnitRegistry.unregister(entityDeployment);
+            if (entityDeployment != null)
+            {
+               kernelAbstraction.uninstall(entityDeployment.getKernelName());
+            }
+         }
+         catch (Exception e)
+         {
+            log.debug("error trying to shut down persistence unit", e);
+         }
+      }
+      
+      persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
+
+   }
+
+   
+
+   public void destroy() //throws Exception
+   {
+      try
+      {
+         undeploy();
+         
+         unregisterDeployment();
+      } 
+      catch (Exception e)
+      {
+         log.debug("error trying to destroy ejb deployment", e);
+      }
+   }
+
+   private void undeploy()
+   {
+      for (Container container : ejbContainers.values())
+      {
+         Ejb3Registry.unregister(container);
+      }
+   }
+
+   //   /**
+   //    * Get the jndi name of a message destination.
+   //    * 
+   //    * @param name   the name of the message destination
+   //    * @return       the jndi name
+   //    */
+   //   private String getMessageDestination(String name)
+   //   {
+   //      EjbJarDD dd;
+   //      // FIXME: Why isn't dd stored somewhere?
+   //      try
+   //      {
+   //         dd = EjbJarDDObjectFactory.parse(getDeploymentUnit().getEjbJarXml());
+   //         dd = JBossDDObjectFactory.parse(getDeploymentUnit().getJbossXml(), dd);
+   //      }
+   //      catch(IOException e)
+   //      {
+   //         throw new RuntimeException(e);
+   //      }
+   //      catch(JBossXBException e)
+   //      {
+   //         throw new RuntimeException(e);
+   //      }
+   //
+   //      AssemblyDescriptor ad = dd.getAssemblyDescriptor();
+   //      if(ad == null)
+   //         throw new IllegalStateException("No assembly descriptor found in '" + getName() + "'");
+   //      MessageDestination md = ad.findMessageDestination(name);
+   //      if(md == null)
+   //         throw new IllegalStateException("No message destination '" + name + "' found in '" + getName() + "'");
+   //      String jndiName = md.getJndiName();
+   //      if(jndiName == null)
+   //         throw new IllegalStateException("No jndi name specified for message destination '" + name + "' in '" + getName() + "'");
+   //      return jndiName;
+   //   }
+
+   public String resolveMessageDestination(String link)
+   {
+      //      // FIXME: this is a copy of DeploymentEjbResolver
+      //      int hashIndex = link.indexOf('#');
+      //      if (hashIndex != -1)
+      //      {
+      //         if (deploymentScope == null)
+      //         {
+      //            log.warn("ejb link '" + link + "' is relative, but no deployment scope found");
+      //            return null;
+      //         }
+      //         String relativePath = link.substring(0, hashIndex);
+      //         Ejb3Deployment dep = deploymentScope.findRelativeDeployment(relativePath);
+      //         if (dep == null)
+      //         {
+      //            log.warn("can't find a deployment for path '" + relativePath + "' of ejb link '" + link + "'");
+      //            return null;
+      //         }
+      //         String name = link.substring(hashIndex + 1);
+      //         return dep.getMessageDestination(name);
+      //      }
+      //      return getMessageDestination(link);
+      return messageDestinationResolver.resolveMessageDestination(link);
+   }
+
+   protected String resolvePersistenceUnitSupplier(String persistenceUnitName)
+   {
+      return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName);
+   }
+   
+   public MessageDestinationResolver getMessageDestinationResolver()
+   {
+      return messageDestinationResolver;
+   }
+
+   /**
+    * Do not call, for use in Ejb3Handler.
+    * 
+    * @param <B>
+    * @param ejbName
+    * @param enterpriseBeanMetaDataClass
+    * @return
+    */
+   protected <B extends JBossEnterpriseBeanMetaData> B getEnterpriseBeanMetaData(String ejbName, Class<B> enterpriseBeanMetaDataClass)
+   {
+      if(metaData == null)
+         return null;
+      
+      JBossEnterpriseBeanMetaData result = metaData.getEnterpriseBean(ejbName);
+      
+      // FIXME: EJBTHREE-1227: temporary workaround for JBCTS-756
+      // see also org.jboss.ejb3.metadata.JBossSessionGenericWrapper
+      if(result instanceof JBossGenericBeanMetaData)
+      {
+         log.warn("FIXME: EJBTHREE-1227: JBossGenericBeanMetaData found for '" + ejbName + "' instead of " + enterpriseBeanMetaDataClass);
+         if(enterpriseBeanMetaDataClass.equals(JBossSessionBeanMetaData.class))
+         {
+            result = new JBossSessionGenericWrapper((JBossGenericBeanMetaData) result);
+         }
+         else if(enterpriseBeanMetaDataClass.equals(JBossMessageDrivenBeanMetaData.class))
+         {
+            result = new JBossMessageDrivenBeanGenericWrapper((JBossGenericBeanMetaData) result);
+         }
+         else
+         {
+            throw new IllegalStateException("Can't find a generic bean meta data wrapper for " + enterpriseBeanMetaDataClass);
+         }
+      }
+      
+      return ClassHelper.cast(enterpriseBeanMetaDataClass, result);
+   }
+   
+   /**
+    * Get the meta data associated with this deployment or null if none.
+    * 
+    * @return   meta data or null
+    */
+   public JBossMetaData getMetaData()
+   {
+      return metaData;
+   }
+
+   public String getName()
+   {
+      return unit.getShortName();
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,90 +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;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.InvocationHandler;
-
-import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandler
-{
-   private static Logger log = Logger.getLogger(LocalProxyInvocationHandler.class);
-
-   private transient Container container = null;
-
-   protected String containerClusterUid;
-
-   protected String containerGuid;
-
-   protected String proxyName;
-   
-   protected LocalProxyInvocationHandler()
-   {
-   }
-
-   protected LocalProxyInvocationHandler(Container container, String businessInterfaceType)
-   {
-      this.setBusinessInterfaceType(businessInterfaceType);
-      this.container = container;
-      this.containerGuid = Ejb3Registry.guid(container);
-      this.containerClusterUid = Ejb3Registry.clusterUid(container);
-      proxyName = container.getEjbName();
-   }
-
-   protected Container getContainer()
-   {
-      if (container == null)
-         container = Ejb3Registry.findContainer(containerGuid);
-      if (container == null)
-         log.warn("Container " + containerGuid + " is not yet available");
-      return container;
-   }
-
-   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
-   {
-      this.containerGuid = in.readUTF();
-      this.containerClusterUid = in.readUTF();
-      this.proxyName = in.readUTF();
-   }
-
-   public void writeExternal(ObjectOutput out) throws IOException
-   {
-      out.writeUTF(containerGuid);
-      out.writeUTF(containerClusterUid);
-      out.writeUTF(proxyName);
-   }
-
-   public abstract String toString();
-
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationHandler;
+
+import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandlerDeprecated
+{
+   private static Logger log = Logger.getLogger(LocalProxyInvocationHandler.class);
+
+   private transient Container container = null;
+
+   protected String containerClusterUid;
+
+   protected String containerGuid;
+
+   protected String proxyName;
+   
+   protected LocalProxyInvocationHandler()
+   {
+   }
+
+   protected LocalProxyInvocationHandler(Container container, String businessInterfaceType)
+   {
+      this.setBusinessInterfaceType(businessInterfaceType);
+      this.container = container;
+      this.containerGuid = Ejb3Registry.guid(container);
+      this.containerClusterUid = Ejb3Registry.clusterUid(container);
+      proxyName = container.getEjbName();
+   }
+
+   protected Container getContainer()
+   {
+      if (container == null)
+         container = Ejb3Registry.findContainer(containerGuid);
+      if (container == null)
+         log.warn("Container " + containerGuid + " is not yet available");
+      return container;
+   }
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      this.containerGuid = in.readUTF();
+      this.containerClusterUid = in.readUTF();
+      this.proxyName = in.readUTF();
+   }
+
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      out.writeUTF(containerGuid);
+      out.writeUTF(containerClusterUid);
+      out.writeUTF(proxyName);
+   }
+
+   public abstract String toString();
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,433 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * 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.metadata;
-
-import java.lang.reflect.Method;
-import java.util.Set;
-
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.TransactionManagementType;
-
-import org.jboss.metadata.ejb.jboss.ContainerConfigurationMetaData;
-import org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData;
-import org.jboss.metadata.ejb.jboss.InvokerBindingMetaData;
-import org.jboss.metadata.ejb.jboss.InvokerBindingsMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.MethodAttributesMetaData;
-import org.jboss.metadata.ejb.jboss.PoolConfigMetaData;
-import org.jboss.metadata.ejb.spec.ContainerTransactionsMetaData;
-import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
-import org.jboss.metadata.ejb.spec.MethodInterfaceType;
-import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
-import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
-import org.jboss.metadata.javaee.jboss.AnnotationsMetaData;
-import org.jboss.metadata.javaee.jboss.IgnoreDependencyMetaData;
-import org.jboss.metadata.javaee.jboss.JndiRefsMetaData;
-import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
-import org.jboss.metadata.javaee.spec.DescriptionGroupMetaData;
-import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
-import org.jboss.metadata.javaee.spec.Environment;
-import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
-import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
-import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceContextReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceUnitReferenceMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceUnitReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PortComponent;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
-
-/**
- * Create a JBossSessionBeanMetaData from a JBossGenericBeanMetaData for
- * use in merging a JBossGenericBeanMetaData into a JBossSessionBeanMetaData,
- * 
- * TODO: temporary workaround for JBCTS-756
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
- at Deprecated
-public class JBossSessionGenericWrapper extends JBossSessionBeanMetaData
-{
-   private static final long serialVersionUID = 1;
-   private JBossGenericBeanMetaData delegate;
-   public JBossSessionGenericWrapper(JBossGenericBeanMetaData delegate)
-   {
-      this.delegate = delegate;
-   }
-   public Set<String> determineAllDepends()
-   {
-      return delegate.determineAllDepends();
-   }
-   public String determineConfigurationName()
-   {
-      return delegate.determineConfigurationName();
-   }
-   public ContainerConfigurationMetaData determineContainerConfiguration()
-   {
-      return delegate.determineContainerConfiguration();
-   }
-   public InvokerBindingMetaData determineInvokerBinding(String invokerName)
-   {
-      return delegate.determineInvokerBinding(invokerName);
-   }
-   public InvokerBindingsMetaData determineInvokerBindings()
-   {
-      return delegate.determineInvokerBindings();
-   }
-   public String determineLocalJndiName()
-   {
-      return delegate.determineLocalJndiName();
-   }
-   public boolean equals(Object obj)
-   {
-      return delegate.equals(obj);
-   }
-   public AnnotatedEJBReferencesMetaData getAnnotatedEjbReferences()
-   {
-      return delegate.getAnnotatedEjbReferences();
-   }
-   public AnnotationsMetaData getAnnotations()
-   {
-      return delegate.getAnnotations();
-   }
-   public String getAopDomainName()
-   {
-      return delegate.getAopDomainName();
-   }
-   public String getConfigurationName()
-   {
-      return delegate.getConfigurationName();
-   }
-   public String getContainerObjectNameJndiName()
-   {
-      return delegate.getContainerObjectNameJndiName();
-   }
-   public ContainerTransactionsMetaData getContainerTransactions()
-   {
-      return delegate.getContainerTransactions();
-   }
-   public String getDefaultConfigurationName()
-   {
-      return delegate.getDefaultConfigurationName();
-   }
-   public Set<String> getDepends()
-   {
-      return delegate.getDepends();
-   }
-   public DescriptionGroupMetaData getDescriptionGroup()
-   {
-      return delegate.getDescriptionGroup();
-   }
-   public String getEjbClass()
-   {
-      return delegate.getEjbClass();
-   }
-   public JBossMetaData getEjbJarMetaData()
-   {
-      return delegate.getEjbJarMetaData();
-   }
-   public EJBLocalReferenceMetaData getEjbLocalReferenceByName(String name)
-   {
-      return delegate.getEjbLocalReferenceByName(name);
-   }
-   public EJBLocalReferencesMetaData getEjbLocalReferences()
-   {
-      return delegate.getEjbLocalReferences();
-   }
-   public String getEjbName()
-   {
-      return delegate.getEjbName();
-   }
-   public EJBReferenceMetaData getEjbReferenceByName(String name)
-   {
-      return delegate.getEjbReferenceByName(name);
-   }
-   public EJBReferencesMetaData getEjbReferences()
-   {
-      return delegate.getEjbReferences();
-   }
-   public JBossEnterpriseBeansMetaData getEnterpriseBeansMetaData()
-   {
-      return delegate.getEnterpriseBeansMetaData();
-   }
-   public EnvironmentEntriesMetaData getEnvironmentEntries()
-   {
-      return delegate.getEnvironmentEntries();
-   }
-   public EnvironmentEntryMetaData getEnvironmentEntryByName(String name)
-   {
-      return delegate.getEnvironmentEntryByName(name);
-   }
-   public ExcludeListMetaData getExcludeList()
-   {
-      return delegate.getExcludeList();
-   }
-   public String getId()
-   {
-      return delegate.getId();
-   }
-   public IgnoreDependencyMetaData getIgnoreDependency()
-   {
-      return delegate.getIgnoreDependency();
-   }
-   public InvokerBindingsMetaData getInvokerBindings()
-   {
-      return delegate.getInvokerBindings();
-   }
-   public IORSecurityConfigMetaData getIorSecurityConfig()
-   {
-      return delegate.getIorSecurityConfig();
-   }
-   public JBossMetaData getJBossMetaData()
-   {
-      return delegate.getJBossMetaData();
-   }
-   public JBossMetaData getJBossMetaDataWithCheck()
-   {
-      return delegate.getJBossMetaDataWithCheck();
-   }
-   public Environment getJndiEnvironmentRefsGroup()
-   {
-      return delegate.getJndiEnvironmentRefsGroup();
-   }
-   public String getJndiName()
-   {
-      return delegate.getJndiName();
-   }
-   public JndiRefsMetaData getJndiRefs()
-   {
-      return delegate.getJndiRefs();
-   }
-   public String getKey()
-   {
-      return delegate.getKey();
-   }
-   public String getLocalJndiName()
-   {
-      return delegate.getLocalJndiName();
-   }
-   public String getMappedName()
-   {
-      return delegate.getMappedName();
-   }
-   public MessageDestinationReferenceMetaData getMessageDestinationReferenceByName(
-         String name)
-   {
-      return delegate.getMessageDestinationReferenceByName(name);
-   }
-   public MessageDestinationReferencesMetaData getMessageDestinationReferences()
-   {
-      return delegate.getMessageDestinationReferences();
-   }
-   public MethodAttributesMetaData getMethodAttributes()
-   {
-      return delegate.getMethodAttributes();
-   }
-   public MethodPermissionsMetaData getMethodPermissions()
-   {
-      return delegate.getMethodPermissions();
-   }
-   public Set<String> getMethodPermissions(String methodName,
-         Class<?>[] params, MethodInterfaceType interfaceType)
-   {
-      return delegate.getMethodPermissions(methodName, params, interfaceType);
-   }
-   public int getMethodTransactionTimeout(Method method)
-   {
-      return delegate.getMethodTransactionTimeout(method);
-   }
-   public int getMethodTransactionTimeout(String methodName)
-   {
-      return delegate.getMethodTransactionTimeout(methodName);
-   }
-   public TransactionAttributeType getMethodTransactionType(Method m,
-         MethodInterfaceType iface)
-   {
-      return delegate.getMethodTransactionType(m, iface);
-   }
-   public TransactionAttributeType getMethodTransactionType(String methodName,
-         Class<?>[] params, MethodInterfaceType iface)
-   {
-      return delegate.getMethodTransactionType(methodName, params, iface);
-   }
-   public String getName()
-   {
-      return delegate.getName();
-   }
-   public PersistenceContextReferenceMetaData getPersistenceContextReferenceByName(
-         String name)
-   {
-      return delegate.getPersistenceContextReferenceByName(name);
-   }
-   public PersistenceContextReferencesMetaData getPersistenceContextRefs()
-   {
-      return delegate.getPersistenceContextRefs();
-   }
-   public PersistenceUnitReferenceMetaData getPersistenceUnitReferenceByName(
-         String name)
-   {
-      return delegate.getPersistenceUnitReferenceByName(name);
-   }
-   public PersistenceUnitReferencesMetaData getPersistenceUnitRefs()
-   {
-      return delegate.getPersistenceUnitRefs();
-   }
-   public PoolConfigMetaData getPoolConfig()
-   {
-      return delegate.getPoolConfig();
-   }
-   public PortComponent getPortComponent()
-   {
-      return delegate.getPortComponent();
-   }
-   public LifecycleCallbacksMetaData getPostConstructs()
-   {
-      return delegate.getPostConstructs();
-   }
-   public LifecycleCallbacksMetaData getPreDestroys()
-   {
-      return delegate.getPreDestroys();
-   }
-   public ResourceEnvironmentReferenceMetaData getResourceEnvironmentReferenceByName(
-         String name)
-   {
-      return delegate.getResourceEnvironmentReferenceByName(name);
-   }
-   public ResourceEnvironmentReferencesMetaData getResourceEnvironmentReferences()
-   {
-      return delegate.getResourceEnvironmentReferences();
-   }
-   public ResourceReferenceMetaData getResourceReferenceByName(String name)
-   {
-      return delegate.getResourceReferenceByName(name);
-   }
-   public ResourceReferencesMetaData getResourceReferences()
-   {
-      return delegate.getResourceReferences();
-   }
-   public String getSecurityDomain()
-   {
-      return delegate.getSecurityDomain();
-   }
-   public SecurityIdentityMetaData getSecurityIdentity()
-   {
-      return delegate.getSecurityIdentity();
-   }
-   public String getSecurityProxy()
-   {
-      return delegate.getSecurityProxy();
-   }
-   public SecurityRoleMetaData getSecurityRole(String roleName)
-   {
-      return delegate.getSecurityRole(roleName);
-   }
-   public Set<String> getSecurityRolePrincipals(String roleName)
-   {
-      return delegate.getSecurityRolePrincipals(roleName);
-   }
-   public SecurityRoleRefsMetaData getSecurityRoleRefs()
-   {
-      return delegate.getSecurityRoleRefs();
-   }
-   public ServiceReferenceMetaData getServiceReferenceByName(String name)
-   {
-      return delegate.getServiceReferenceByName(name);
-   }
-   public ServiceReferencesMetaData getServiceReferences()
-   {
-      return delegate.getServiceReferences();
-   }
-   public TransactionManagementType getTransactionType()
-   {
-      return delegate.getTransactionType();
-   }
-   public int hashCode()
-   {
-      return delegate.hashCode();
-   }
-   public boolean hasMethodPermissions(String methodName, Class<?>[] params,
-         MethodInterfaceType interfaceType)
-   {
-      return delegate.hasMethodPermissions(methodName, params, interfaceType);
-   }
-   public boolean isBMT()
-   {
-      return delegate.isBMT();
-   }
-   public boolean isCMT()
-   {
-      return delegate.isCMT();
-   }
-   public boolean isConsumer()
-   {
-      return delegate.isConsumer();
-   }
-   public boolean isEntity()
-   {
-      return delegate.isEntity();
-   }
-   public boolean isExceptionOnRollback()
-   {
-      return delegate.isExceptionOnRollback();
-   }
-   public boolean isMessageDriven()
-   {
-      return delegate.isMessageDriven();
-   }
-   public boolean isMethodReadOnly(Method method)
-   {
-      return delegate.isMethodReadOnly(method);
-   }
-   public boolean isMethodReadOnly(String methodName)
-   {
-      return delegate.isMethodReadOnly(methodName);
-   }
-   public boolean isService()
-   {
-      return delegate.isService();
-   }
-   public boolean isSession()
-   {
-      return delegate.isSession();
-   }
-   public boolean isTimerPersistence()
-   {
-      return delegate.isTimerPersistence();
-   }
-
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,429 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.metadata;
+
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagementType;
+
+import org.jboss.metadata.ejb.jboss.ContainerConfigurationMetaData;
+import org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData;
+import org.jboss.metadata.ejb.jboss.InvokerBindingMetaData;
+import org.jboss.metadata.ejb.jboss.InvokerBindingsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.MethodAttributesMetaData;
+import org.jboss.metadata.ejb.jboss.PoolConfigMetaData;
+import org.jboss.metadata.ejb.spec.ContainerTransactionsMetaData;
+import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
+import org.jboss.metadata.ejb.spec.MethodInterfaceType;
+import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
+import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
+import org.jboss.metadata.javaee.jboss.AnnotationsMetaData;
+import org.jboss.metadata.javaee.jboss.IgnoreDependencyMetaData;
+import org.jboss.metadata.javaee.jboss.JndiRefsMetaData;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.DescriptionGroupMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceUnitReferenceMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceUnitReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PortComponent;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
+
+/**
+ * Create a JBossSessionBeanMetaData from a JBossGenericBeanMetaData for
+ * use in merging a JBossGenericBeanMetaData into a JBossSessionBeanMetaData,
+ * 
+ * TODO: temporary workaround for JBCTS-756
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Deprecated
+public class JBossSessionGenericWrapper extends JBossSessionBeanMetaData
+{
+   private static final long serialVersionUID = 1;
+   private JBossGenericBeanMetaData delegate;
+   public JBossSessionGenericWrapper(JBossGenericBeanMetaData delegate)
+   {
+      this.delegate = delegate;
+   }
+   public Set<String> determineAllDepends()
+   {
+      return delegate.determineAllDepends();
+   }
+   public String determineConfigurationName()
+   {
+      return delegate.determineConfigurationName();
+   }
+   public ContainerConfigurationMetaData determineContainerConfiguration()
+   {
+      return delegate.determineContainerConfiguration();
+   }
+   public InvokerBindingMetaData determineInvokerBinding(String invokerName)
+   {
+      return delegate.determineInvokerBinding(invokerName);
+   }
+   public InvokerBindingsMetaData determineInvokerBindings()
+   {
+      return delegate.determineInvokerBindings();
+   }
+   public boolean equals(Object obj)
+   {
+      return delegate.equals(obj);
+   }
+   public AnnotatedEJBReferencesMetaData getAnnotatedEjbReferences()
+   {
+      return delegate.getAnnotatedEjbReferences();
+   }
+   public AnnotationsMetaData getAnnotations()
+   {
+      return delegate.getAnnotations();
+   }
+   public String getAopDomainName()
+   {
+      return delegate.getAopDomainName();
+   }
+   public String getConfigurationName()
+   {
+      return delegate.getConfigurationName();
+   }
+   public String getContainerObjectNameJndiName()
+   {
+      return delegate.getContainerObjectNameJndiName();
+   }
+   public ContainerTransactionsMetaData getContainerTransactions()
+   {
+      return delegate.getContainerTransactions();
+   }
+   public String getDefaultConfigurationName()
+   {
+      return delegate.getDefaultConfigurationName();
+   }
+   public Set<String> getDepends()
+   {
+      return delegate.getDepends();
+   }
+   public DescriptionGroupMetaData getDescriptionGroup()
+   {
+      return delegate.getDescriptionGroup();
+   }
+   public String getEjbClass()
+   {
+      return delegate.getEjbClass();
+   }
+   public JBossMetaData getEjbJarMetaData()
+   {
+      return delegate.getEjbJarMetaData();
+   }
+   public EJBLocalReferenceMetaData getEjbLocalReferenceByName(String name)
+   {
+      return delegate.getEjbLocalReferenceByName(name);
+   }
+   public EJBLocalReferencesMetaData getEjbLocalReferences()
+   {
+      return delegate.getEjbLocalReferences();
+   }
+   public String getEjbName()
+   {
+      return delegate.getEjbName();
+   }
+   public EJBReferenceMetaData getEjbReferenceByName(String name)
+   {
+      return delegate.getEjbReferenceByName(name);
+   }
+   public EJBReferencesMetaData getEjbReferences()
+   {
+      return delegate.getEjbReferences();
+   }
+   public JBossEnterpriseBeansMetaData getEnterpriseBeansMetaData()
+   {
+      return delegate.getEnterpriseBeansMetaData();
+   }
+   public EnvironmentEntriesMetaData getEnvironmentEntries()
+   {
+      return delegate.getEnvironmentEntries();
+   }
+   public EnvironmentEntryMetaData getEnvironmentEntryByName(String name)
+   {
+      return delegate.getEnvironmentEntryByName(name);
+   }
+   public ExcludeListMetaData getExcludeList()
+   {
+      return delegate.getExcludeList();
+   }
+   public String getId()
+   {
+      return delegate.getId();
+   }
+   public IgnoreDependencyMetaData getIgnoreDependency()
+   {
+      return delegate.getIgnoreDependency();
+   }
+   public InvokerBindingsMetaData getInvokerBindings()
+   {
+      return delegate.getInvokerBindings();
+   }
+   public IORSecurityConfigMetaData getIorSecurityConfig()
+   {
+      return delegate.getIorSecurityConfig();
+   }
+   public JBossMetaData getJBossMetaData()
+   {
+      return delegate.getJBossMetaData();
+   }
+   public JBossMetaData getJBossMetaDataWithCheck()
+   {
+      return delegate.getJBossMetaDataWithCheck();
+   }
+   public Environment getJndiEnvironmentRefsGroup()
+   {
+      return delegate.getJndiEnvironmentRefsGroup();
+   }
+   public String getJndiName()
+   {
+      return delegate.getJndiName();
+   }
+   public JndiRefsMetaData getJndiRefs()
+   {
+      return delegate.getJndiRefs();
+   }
+   public String getKey()
+   {
+      return delegate.getKey();
+   }
+   public String getLocalJndiName()
+   {
+      return delegate.getLocalJndiName();
+   }
+   public String getMappedName()
+   {
+      return delegate.getMappedName();
+   }
+   public MessageDestinationReferenceMetaData getMessageDestinationReferenceByName(
+         String name)
+   {
+      return delegate.getMessageDestinationReferenceByName(name);
+   }
+   public MessageDestinationReferencesMetaData getMessageDestinationReferences()
+   {
+      return delegate.getMessageDestinationReferences();
+   }
+   public MethodAttributesMetaData getMethodAttributes()
+   {
+      return delegate.getMethodAttributes();
+   }
+   public MethodPermissionsMetaData getMethodPermissions()
+   {
+      return delegate.getMethodPermissions();
+   }
+   public Set<String> getMethodPermissions(String methodName,
+         Class<?>[] params, MethodInterfaceType interfaceType)
+   {
+      return delegate.getMethodPermissions(methodName, params, interfaceType);
+   }
+   public int getMethodTransactionTimeout(Method method)
+   {
+      return delegate.getMethodTransactionTimeout(method);
+   }
+   public int getMethodTransactionTimeout(String methodName)
+   {
+      return delegate.getMethodTransactionTimeout(methodName);
+   }
+   public TransactionAttributeType getMethodTransactionType(Method m,
+         MethodInterfaceType iface)
+   {
+      return delegate.getMethodTransactionType(m, iface);
+   }
+   public TransactionAttributeType getMethodTransactionType(String methodName,
+         Class<?>[] params, MethodInterfaceType iface)
+   {
+      return delegate.getMethodTransactionType(methodName, params, iface);
+   }
+   public String getName()
+   {
+      return delegate.getName();
+   }
+   public PersistenceContextReferenceMetaData getPersistenceContextReferenceByName(
+         String name)
+   {
+      return delegate.getPersistenceContextReferenceByName(name);
+   }
+   public PersistenceContextReferencesMetaData getPersistenceContextRefs()
+   {
+      return delegate.getPersistenceContextRefs();
+   }
+   public PersistenceUnitReferenceMetaData getPersistenceUnitReferenceByName(
+         String name)
+   {
+      return delegate.getPersistenceUnitReferenceByName(name);
+   }
+   public PersistenceUnitReferencesMetaData getPersistenceUnitRefs()
+   {
+      return delegate.getPersistenceUnitRefs();
+   }
+   public PoolConfigMetaData getPoolConfig()
+   {
+      return delegate.getPoolConfig();
+   }
+   public PortComponent getPortComponent()
+   {
+      return delegate.getPortComponent();
+   }
+   public LifecycleCallbacksMetaData getPostConstructs()
+   {
+      return delegate.getPostConstructs();
+   }
+   public LifecycleCallbacksMetaData getPreDestroys()
+   {
+      return delegate.getPreDestroys();
+   }
+   public ResourceEnvironmentReferenceMetaData getResourceEnvironmentReferenceByName(
+         String name)
+   {
+      return delegate.getResourceEnvironmentReferenceByName(name);
+   }
+   public ResourceEnvironmentReferencesMetaData getResourceEnvironmentReferences()
+   {
+      return delegate.getResourceEnvironmentReferences();
+   }
+   public ResourceReferenceMetaData getResourceReferenceByName(String name)
+   {
+      return delegate.getResourceReferenceByName(name);
+   }
+   public ResourceReferencesMetaData getResourceReferences()
+   {
+      return delegate.getResourceReferences();
+   }
+   public String getSecurityDomain()
+   {
+      return delegate.getSecurityDomain();
+   }
+   public SecurityIdentityMetaData getSecurityIdentity()
+   {
+      return delegate.getSecurityIdentity();
+   }
+   public String getSecurityProxy()
+   {
+      return delegate.getSecurityProxy();
+   }
+   public SecurityRoleMetaData getSecurityRole(String roleName)
+   {
+      return delegate.getSecurityRole(roleName);
+   }
+   public Set<String> getSecurityRolePrincipals(String roleName)
+   {
+      return delegate.getSecurityRolePrincipals(roleName);
+   }
+   public SecurityRoleRefsMetaData getSecurityRoleRefs()
+   {
+      return delegate.getSecurityRoleRefs();
+   }
+   public ServiceReferenceMetaData getServiceReferenceByName(String name)
+   {
+      return delegate.getServiceReferenceByName(name);
+   }
+   public ServiceReferencesMetaData getServiceReferences()
+   {
+      return delegate.getServiceReferences();
+   }
+   public TransactionManagementType getTransactionType()
+   {
+      return delegate.getTransactionType();
+   }
+   public int hashCode()
+   {
+      return delegate.hashCode();
+   }
+   public boolean hasMethodPermissions(String methodName, Class<?>[] params,
+         MethodInterfaceType interfaceType)
+   {
+      return delegate.hasMethodPermissions(methodName, params, interfaceType);
+   }
+   public boolean isBMT()
+   {
+      return delegate.isBMT();
+   }
+   public boolean isCMT()
+   {
+      return delegate.isCMT();
+   }
+   public boolean isConsumer()
+   {
+      return delegate.isConsumer();
+   }
+   public boolean isEntity()
+   {
+      return delegate.isEntity();
+   }
+   public boolean isExceptionOnRollback()
+   {
+      return delegate.isExceptionOnRollback();
+   }
+   public boolean isMessageDriven()
+   {
+      return delegate.isMessageDriven();
+   }
+   public boolean isMethodReadOnly(Method method)
+   {
+      return delegate.isMethodReadOnly(method);
+   }
+   public boolean isMethodReadOnly(String methodName)
+   {
+      return delegate.isMethodReadOnly(methodName);
+   }
+   public boolean isService()
+   {
+      return delegate.isService();
+   }
+   public boolean isSession()
+   {
+      return delegate.isSession();
+   }
+   public boolean isTimerPersistence()
+   {
+      return delegate.isTimerPersistence();
+   }
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,162 +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;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.AsynchProxyInterceptor;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ProxyUtils
-{
-   public final static Class<AsynchProvider> ASYNCH_PROVIDER_CLASS = AsynchProvider.class;
-   public final static long GET_ASYNCHRONOUS;
-   public static final long TO_STRING;
-   public static final long EQUALS;
-   public static final long HASHCODE;
-   public static final Method GET_PRIMARY_KEY;
-   public static final Method GET_HANDLE;
-   public static final Method GET_EJB_HOME;
-   public static final Method IS_IDENTICAL;
-   public static final Method GET_HOME_HANDLE;
-   public static final Method GET_EJB_METADATA;
-   public static final Method REMOVE;
-
-   static
-   {
-      try
-      {
-         Class<?>[] empty = {};
-         
-         Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty);
-         GET_ASYNCHRONOUS = MethodHashing.calculateHash(method);
-         TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty));
-         EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class<?>[]{Object.class}));
-         HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty));
-               
-         GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty);
-         GET_HANDLE = EJBObject.class.getMethod("getHandle", empty);
-         GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty);
-         IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class<?>[] { EJBObject.class });
-         REMOVE = EJBObject.class.getMethod("remove", empty);
-                 
-         GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty);
-         GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty);
-      }
-      catch (NoSuchMethodException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public static boolean isAsynchronous(Class<?>[] infs)
-   {
-      for (int i = 0; i < infs.length; i++)
-      {
-         if (infs[i] == ASYNCH_PROVIDER_CLASS)
-         {
-            return true;
-         }
-      }
-      return false;
-   }
-
-   public static Class<?>[] addAsynchProviderInterface(Class<?>[] infs)
-   {
-      ArrayList<Class<?>> interfaces = new ArrayList<Class<?>>();
-
-      for (int i = 0; i < infs.length; i++)
-      {
-         if (infs[i] == ASYNCH_PROVIDER_CLASS)
-         {
-            //This should not happen
-            continue;
-         }
-         interfaces.add(infs[i]);
-      }
-
-      interfaces.add(ASYNCH_PROVIDER_CLASS);
-      return (Class<?>[]) interfaces.toArray(new Class<?>[interfaces.size()]);
-   }
-
-   public static Interceptor[] addAsynchProxyInterceptor(AsynchMixin mixin, Interceptor[] interceptors)
-   {
-      AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin);
-      Interceptor[] newInterceptors = null;
-      newInterceptors = new Interceptor[interceptors.length + 1];
-      newInterceptors[0] = interceptor;
-      System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length);
-      return newInterceptors;
-   }
-
-   public static void addLocalAsynchronousInfo(MethodInvocation invocation, FutureHolder provider)
-   {
-      if (provider != null)
-      {
-         invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
-         invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
-      }
-   }
-
-   public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
-   {
-      long hash = MethodHashing.calculateHash(m);
-      return handleCallLocally(hash, jbproxy, ih, m, args);
-   }
-
-   public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
-   {
-      if (hash == ProxyUtils.GET_ASYNCHRONOUS)
-      {
-         return ih.getAsynchronousProxy((JBossProxy)jbproxy);
-      }
-      else if (hash == TO_STRING)
-      {
-         return ih.toString();
-      }
-      else if (hash == HASHCODE)
-      {
-         return new Integer(ih.toString().hashCode());
-      }
-      else if (hash == EQUALS)
-      {
-         return new Boolean(ih.toString().equals(args[0].toString()));
-      } 
-      return null;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,162 @@
+/*
+ * 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;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.asynch.AsynchProxyInterceptor;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ProxyUtils
+{
+   public final static Class<AsynchProvider> ASYNCH_PROVIDER_CLASS = AsynchProvider.class;
+   public final static long GET_ASYNCHRONOUS;
+   public static final long TO_STRING;
+   public static final long EQUALS;
+   public static final long HASHCODE;
+   public static final Method GET_PRIMARY_KEY;
+   public static final Method GET_HANDLE;
+   public static final Method GET_EJB_HOME;
+   public static final Method IS_IDENTICAL;
+   public static final Method GET_HOME_HANDLE;
+   public static final Method GET_EJB_METADATA;
+   public static final Method REMOVE;
+
+   static
+   {
+      try
+      {
+         Class<?>[] empty = {};
+         
+         Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty);
+         GET_ASYNCHRONOUS = MethodHashing.calculateHash(method);
+         TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty));
+         EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class<?>[]{Object.class}));
+         HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty));
+               
+         GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty);
+         GET_HANDLE = EJBObject.class.getMethod("getHandle", empty);
+         GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty);
+         IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class<?>[] { EJBObject.class });
+         REMOVE = EJBObject.class.getMethod("remove", empty);
+                 
+         GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty);
+         GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty);
+      }
+      catch (NoSuchMethodException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public static boolean isAsynchronous(Class<?>[] infs)
+   {
+      for (int i = 0; i < infs.length; i++)
+      {
+         if (infs[i] == ASYNCH_PROVIDER_CLASS)
+         {
+            return true;
+         }
+      }
+      return false;
+   }
+
+   public static Class<?>[] addAsynchProviderInterface(Class<?>[] infs)
+   {
+      ArrayList<Class<?>> interfaces = new ArrayList<Class<?>>();
+
+      for (int i = 0; i < infs.length; i++)
+      {
+         if (infs[i] == ASYNCH_PROVIDER_CLASS)
+         {
+            //This should not happen
+            continue;
+         }
+         interfaces.add(infs[i]);
+      }
+
+      interfaces.add(ASYNCH_PROVIDER_CLASS);
+      return (Class<?>[]) interfaces.toArray(new Class<?>[interfaces.size()]);
+   }
+
+   public static Interceptor[] addAsynchProxyInterceptor(AsynchMixin mixin, Interceptor[] interceptors)
+   {
+      AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin);
+      Interceptor[] newInterceptors = null;
+      newInterceptors = new Interceptor[interceptors.length + 1];
+      newInterceptors[0] = interceptor;
+      System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length);
+      return newInterceptors;
+   }
+
+   public static void addLocalAsynchronousInfo(MethodInvocation invocation, FutureHolder provider)
+   {
+      if (provider != null)
+      {
+         invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+         invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
+      }
+   }
+
+   public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args)
+   {
+      long hash = MethodHashing.calculateHash(m);
+      return handleCallLocally(hash, jbproxy, ih, m, args);
+   }
+
+   public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args)
+   {
+      if (hash == ProxyUtils.GET_ASYNCHRONOUS)
+      {
+         return ih.getAsynchronousProxy((JBossProxy)jbproxy);
+      }
+      else if (hash == TO_STRING)
+      {
+         return ih.toString();
+      }
+      else if (hash == HASHCODE)
+      {
+         return new Integer(ih.toString().hashCode());
+      }
+      else if (hash == EQUALS)
+      {
+         return new Boolean(ih.toString().equals(args[0].toString()));
+      } 
+      return null;
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,702 +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.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();
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,714 @@
+/*
+ * 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 String getJndiName()
+   {
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String jndiName = md.determineResolvedJndiName(null);
+      return jndiName;
+   }
+
+   protected String getHomeJndiName()
+   {
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String home = md.getHome();
+      String jndiName = md.determineResolvedJndiName(home);
+      return 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.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,47 +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;
-
-import org.jboss.ejb3.proxy.ProxyFactory;
-
-/**
- * SessionProxyFactory
- * 
- * Contract for a Proxy Factory specific to 
- * operations required by Session implementations
- * 
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface SessionProxyFactory extends ProxyFactory
-{
-   /**
-    * Create an EJB3 Business Proxy with the specified
-    * target business interface name (should be expressed as 
-    * a fully-qualified class name)
-    * 
-    * @param id
-    * @param businessInterfaceName
-    * @return
-    */
-   public Object createProxyBusiness(String businessInterfaceName);
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+import org.jboss.ejb3.proxy.ProxyFactory;
+
+/**
+ * SessionProxyFactory
+ * 
+ * Contract for a Proxy Factory specific to 
+ * operations required by Session implementations
+ * 
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated In favor of EJB3 Proxy
+ */
+ at Deprecated
+public interface SessionProxyFactory extends ProxyFactory
+{
+   /**
+    * Create an EJB3 Business Proxy with the specified
+    * target business interface name (should be expressed as 
+    * a fully-qualified class name)
+    * 
+    * @param id
+    * @param businessInterfaceName
+    * @return
+    */
+   public Object createProxyBusiness(String businessInterfaceName);
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,136 +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.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.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,142 @@
+/*
+ * 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.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);
+      Context ctx = getContainer().getInitialContext();
+      String jndiName = this.getJndiName();
+//      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
+   {
+      String jndiName = this.getJndiName();
+      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());
+      }
+   }
+   
+   @Override
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      super.writeExternal(out);
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,301 +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;
-   }
-   
-   /**
-    * 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.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,304 @@
+/*
+ * 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);
+      String jndiName = this.getJndiName();
+      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);
+      String jndiName = this.getJndiName();
+      Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+      super.stop();
+   }
+
+   /**
+    * @return unique name for this proxy factory
+    */
+   protected String getTargetId()
+   {
+      String jndiName = this.getJndiName();
+      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.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,184 +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);
-   }
-
-   @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.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,187 @@
+/*
+ * 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);
+      String jndiName = this.getJndiName();
+      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
+   {
+      String jndiName = this.getJndiName();
+      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()
+   {  
+      String jndiName = this.getJndiName();
+      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.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -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.stateless;
-
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.session.ProxyAccessType;
-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 BaseStatelessProxyFactory extends org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory implements SessionProxyFactory
-{
-   private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class);
-   
-   public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName)
-   {
-      super(container);
-      
-      assert jndiName != null : "jndiName is null";
-      
-      this.jndiName = jndiName;
-   }
-   
-   /**
-    * Adapt the JDK to cglib.
-    * 
-    * This is a named class because it implements both InvocationHandler and Serializable.
-    */
-   /* TODO: fix EJBTHREE-485 without cglib 
-   private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable
-   {
-      private static final long serialVersionUID = 1L;
-
-      private InvocationHandler delegate;
-      
-      private CGLibInvocationHandlerAdapter(InvocationHandler delegate)
-      {
-         if(delegate == null)
-            throw new IllegalArgumentException("delegate must not be null");
-         this.delegate = delegate;
-      }
-      
-      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-      {
-         return delegate.invoke(proxy, method, args);
-      }
-      
-   }
-   */
-   
-//   /**
-//    * Adapt the InvocationHandler to MethodHandler.
-//    * 
-//    * This is a named class because it implements both MethodHandler and Serializable.
-//    */
-//   private static class MethodHandlerAdapter implements MethodHandler, Serializable
-//   {
-//      private static final long serialVersionUID = 1L;
-//      
-//      private InvocationHandler delegate;
-//      
-//      private MethodHandlerAdapter(InvocationHandler delegate)
-//      {
-//         if(delegate == null)
-//            throw new IllegalArgumentException("delegate must not be null");
-//         this.delegate = delegate;
-//      }
-//      
-//      public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable
-//      {
-//         return delegate.invoke(self, thisMethod, args);
-//      }         
-//   }
-   
-   public void init() throws Exception
-   {
-      this.createProxyConstructors();
-      this.validateEjb21Views();
-   }
-
-   /* for debugging purposes * /
-   private static void describeClass(Class cls) {
-      System.err.println("class " + cls + " has the following:");
-      for(Class i : cls.getInterfaces()) {
-         System.err.println("  interface: " + i);
-      }
-      for(Method m : cls.getDeclaredMethods()) {
-         System.err.println("  method: " + m);
-      }
-      System.err.println("  classloader = " + cls.getClassLoader());
-      if(cls.getSuperclass() != null)
-         describeClass(cls.getSuperclass());
-   }
-   */
-   
-   public void start() throws Exception
-   {
-      init();
-
-      Object proxy = createProxyBusiness();
-      //describeClass(proxy.getClass());
-      bindProxy(proxy);
-   }
-
-   public void stop() throws Exception
-   {
-      Util.unbind(getContainer().getInitialContext(), jndiName);
-   }
-   
-   protected abstract void validateEjb21Views();
-   
-   protected abstract ProxyAccessType getProxyAccessType();
-
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,139 @@
+/*
+ * 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 org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.session.ProxyAccessType;
+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 BaseStatelessProxyFactory extends org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory implements SessionProxyFactory
+{
+   private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class);
+   
+   public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName)
+   {
+      super(container);
+      
+      assert jndiName != null : "jndiName is null";
+      
+      this.jndiName = jndiName;
+   }
+   
+   /**
+    * Adapt the JDK to cglib.
+    * 
+    * This is a named class because it implements both InvocationHandler and Serializable.
+    */
+   /* TODO: fix EJBTHREE-485 without cglib 
+   private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable
+   {
+      private static final long serialVersionUID = 1L;
+
+      private InvocationHandler delegate;
+      
+      private CGLibInvocationHandlerAdapter(InvocationHandler delegate)
+      {
+         if(delegate == null)
+            throw new IllegalArgumentException("delegate must not be null");
+         this.delegate = delegate;
+      }
+      
+      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+      {
+         return delegate.invoke(proxy, method, args);
+      }
+      
+   }
+   */
+   
+//   /**
+//    * Adapt the InvocationHandler to MethodHandler.
+//    * 
+//    * This is a named class because it implements both MethodHandler and Serializable.
+//    */
+//   private static class MethodHandlerAdapter implements MethodHandler, Serializable
+//   {
+//      private static final long serialVersionUID = 1L;
+//      
+//      private InvocationHandler delegate;
+//      
+//      private MethodHandlerAdapter(InvocationHandler delegate)
+//      {
+//         if(delegate == null)
+//            throw new IllegalArgumentException("delegate must not be null");
+//         this.delegate = delegate;
+//      }
+//      
+//      public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable
+//      {
+//         return delegate.invoke(self, thisMethod, args);
+//      }         
+//   }
+   
+   public void init() throws Exception
+   {
+      this.createProxyConstructors();
+      this.validateEjb21Views();
+   }
+
+   /* for debugging purposes * /
+   private static void describeClass(Class cls) {
+      System.err.println("class " + cls + " has the following:");
+      for(Class i : cls.getInterfaces()) {
+         System.err.println("  interface: " + i);
+      }
+      for(Method m : cls.getDeclaredMethods()) {
+         System.err.println("  method: " + m);
+      }
+      System.err.println("  classloader = " + cls.getClassLoader());
+      if(cls.getSuperclass() != null)
+         describeClass(cls.getSuperclass());
+   }
+   */
+   
+   public void start() throws Exception
+   {
+      init();
+
+      Object proxy = createProxyBusiness();
+      //describeClass(proxy.getClass());
+      bindProxy(proxy);
+   }
+
+   public void stop() throws Exception
+   {
+      Util.unbind(getContainer().getInitialContext(), this.getJndiName());
+   }
+   
+   protected abstract void validateEjb21Views();
+   
+   protected abstract ProxyAccessType getProxyAccessType();
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,175 +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.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;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,185 @@
+/*
+ * 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.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;
+   }
+   
+   @Override
+   protected String getJndiName()
+   {
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String jndiName = md.determineLocalJndiName();
+      return jndiName;
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,60 +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.handler;
-
-/**
- * BaseProxyInvocationHandler
- * 
- * Abstract base upon which all Proxy InvocationHandlers
- * may extend
- * 
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- * @deprecated Has moved to EJB3 Proxy Component as ProxyInvocationHandlerBase
- */
- at Deprecated
-public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandler
-{
-   // ------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------||
-   // ------------------------------------------------------------------------------||
-
-   /**
-    * Fully-qualified name of the class targeted either for injection
-    * or casting to support getInvokedBusinessInterface
-    */
-   private String businessInterfaceType;
-
-   // ------------------------------------------------------------------------------||
-   // Accessors / Mutators ---------------------------------------------------------||
-   // ------------------------------------------------------------------------------||
-
-   public String getBusinessInterfaceType()
-   {
-      return businessInterfaceType;
-   }
-
-   protected void setBusinessInterfaceType(String businessInterfaceType)
-   {
-      this.businessInterfaceType = businessInterfaceType;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,60 @@
+/*
+ * 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.handler;
+
+/**
+ * BaseProxyInvocationHandler
+ * 
+ * Abstract base upon which all Proxy InvocationHandlers
+ * may extend
+ * 
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated Has moved to EJB3 Proxy Component as ProxyInvocationHandlerBase
+ */
+ at Deprecated
+public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandlerDeprecated
+{
+   // ------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * Fully-qualified name of the class targeted either for injection
+    * or casting to support getInvokedBusinessInterface
+    */
+   private String businessInterfaceType;
+
+   // ------------------------------------------------------------------------------||
+   // Accessors / Mutators ---------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public String getBusinessInterfaceType()
+   {
+      return businessInterfaceType;
+   }
+
+   protected void setBusinessInterfaceType(String businessInterfaceType)
+   {
+      this.businessInterfaceType = businessInterfaceType;
+   }
+}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,46 @@
+/*
+ * 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.handler;
+
+/**
+ * ProxyInvocationHandler
+ * 
+ * Defines 
+ * 
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: 73407 $
+ * @deprecated Has moved to EJB3 Proxy Component
+ */
+ at Deprecated
+public interface ProxyInvocationHandlerDeprecated
+{
+   /**
+    * For use in hashCode, toString() and equals() *
+    */
+   String toString();
+
+   Object getAsynchronousProxy(Object proxy);
+
+   String getBusinessInterfaceType();
+}
\ No newline at end of file

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,35 +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.handler;
-
-import org.jboss.aop.metadata.SimpleMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoteProxyInvocationHandler extends ProxyInvocationHandler
-{
-   SimpleMetaData getMetaData();
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,35 @@
+/*
+ * 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.handler;
+
+import org.jboss.aop.metadata.SimpleMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface RemoteProxyInvocationHandler extends ProxyInvocationHandlerDeprecated
+{
+   SimpleMetaData getMetaData();
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,104 +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.remoting;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.logging.Logger;
-import org.jboss.serial.io.MarshalledObjectForLocalCalls;
-
-/**
- * Routes the call to the local container, bypassing further client-side
- * interceptors and any remoting layer, if this interceptor was created 
- * in this JVM.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class IsLocalInterceptor implements Interceptor, Serializable
-{
-   private static final long serialVersionUID = 337700910587744646L;
-
-   private static final Logger log = Logger.getLogger(IsLocalInterceptor.class);
-   
-   public static final String GUID = "GUID";
-
-   public static final String IS_LOCAL = "IS_LOCAL";
-   public static final String IS_LOCAL_EXCEPTION = "IS_LOCAL_EXCEPTION";
-   
-   private static final long stamp = System.currentTimeMillis();
-   private long marshalledStamp = stamp;
-
-   public String getName()
-   {
-      return getClass().getName();
-   }
-
-   public Object invoke(Invocation invocation) throws Throwable
-   {
-      if (isLocal())
-      {
-         String guid = (String)invocation.getMetaData(IS_LOCAL, GUID);
-         Container container = Ejb3Registry.getContainer(guid);
-         
-         return invokeLocal(invocation, container);
-      }
-      return invocation.invokeNext();
-   }
-   
-   protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
-   {
-      Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
-      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE);
-      org.jboss.aop.joinpoint.InvocationResponse response = ((SessionContainer) container).dynamicInvoke(null, copy);
-      Map contextInfo = response.getContextInfo();
-      if (contextInfo != null)
-      {
-         MarshalledObjectForLocalCalls wrappedException = (MarshalledObjectForLocalCalls) response.getContextInfo().get(IS_LOCAL_EXCEPTION);
-         if (wrappedException != null)
-         {
-            throw (Throwable) wrappedException.get();
-         }
-      }
-      invocation.setResponseContextInfo(response.getContextInfo());
-      MarshalledObjectForLocalCalls wrapped = (MarshalledObjectForLocalCalls) response.getResponse();
-      Object rtn = null;
-      if (wrapped != null)
-      {
-         rtn = wrapped.get();
-      }
-      return rtn;
-   }
-
-   protected boolean isLocal()
-   {
-      return stamp == marshalledStamp;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,128 @@
+/*
+ * 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.remoting;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.serial.io.MarshalledObjectForLocalCalls;
+
+/**
+ * Routes the call to the local container, bypassing further client-side
+ * interceptors and any remoting layer, if this interceptor was created 
+ * in this JVM.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class IsLocalInterceptor implements Interceptor, Serializable
+{
+   private static final long serialVersionUID = 337700910587744646L;
+
+   private static final Logger log = Logger.getLogger(IsLocalInterceptor.class);
+   
+   public static final String GUID = "GUID";
+
+   public static final String IS_LOCAL = "IS_LOCAL";
+   public static final String IS_LOCAL_EXCEPTION = "IS_LOCAL_EXCEPTION";
+   
+   private static final long stamp = System.currentTimeMillis();
+   private long marshalledStamp = stamp;
+
+   public String getName()
+   {
+      return getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      if (isLocal())
+      {
+         String guid = (String)invocation.getMetaData(IS_LOCAL, GUID);
+         Container container = Ejb3Registry.getContainer(guid);
+         
+         return invokeLocal(invocation, container);
+      }
+      return invocation.invokeNext();
+   }
+   
+   protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
+   {
+      Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
+      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
+      org.jboss.aop.joinpoint.InvocationResponse response = null;
+
+      /*
+       * EJBTHREE-1385
+       * 
+       * Integration of EJB3 Proxy changed the invocation model,
+       * so SessionSpecContainers now are supported via
+       * dynamicInvoke(Invocation), where all other
+       * SessionContainers use the @deprecated
+       * dynamicInvoke(Object,Invocation)
+       */ 
+      if (container instanceof SessionSpecContainer)
+      {
+         SessionSpecContainer ssc = (SessionSpecContainer) container;
+         response = ssc.dynamicInvoke(copy);
+      }
+      else
+      {
+         response = ((SessionContainer) container).dynamicInvoke(null, copy);
+      }
+      
+      
+      Map contextInfo = response.getContextInfo();
+      if (contextInfo != null)
+      {
+         MarshalledObjectForLocalCalls wrappedException = (MarshalledObjectForLocalCalls) response.getContextInfo().get(IS_LOCAL_EXCEPTION);
+         if (wrappedException != null)
+         {
+            throw (Throwable) wrappedException.get();
+         }
+      }
+      invocation.setResponseContextInfo(response.getContextInfo());
+      MarshalledObjectForLocalCalls wrapped = (MarshalledObjectForLocalCalls) response.getResponse();
+      Object rtn = null;
+      if (wrapped != null)
+      {
+         rtn = wrapped.get();
+      }
+      return rtn;
+   }
+
+   protected boolean isLocal()
+   {
+      return stamp == marshalledStamp;
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,644 +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.service;
-
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.List;
-
-import javax.ejb.Handle;
-import javax.ejb.Timer;
-import javax.ejb.TimerService;
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.Management;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.Service;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.proxy.factory.service.ServiceLocalProxyFactory;
-import org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.timerservice.TimedObjectInvoker;
-import org.jboss.ejb3.timerservice.TimerServiceFactory;
-import org.jboss.injection.Injector;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
-import org.jboss.util.NotImplementedException;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceContainer extends SessionContainer implements TimedObjectInvoker
-{
-   ServiceMBeanDelegate delegate;
-   Object singleton;
-   BeanContext beanContext;
-   MBeanServer mbeanServer;
-   ObjectName delegateObjectName;
-   private TimerService timerService;
-   private Object mbean = new ServiceDelegateWrapper(this);
-   
-   @SuppressWarnings("unused")
-   private static final Logger log = Logger.getLogger(ServiceContainer.class);
-
-   public ServiceContainer(MBeanServer server, ClassLoader cl, String beanClassName, String ejbName,
-                           Domain domain, Hashtable ctxProperties,
-                           Ejb3Deployment deployment, JBossServiceBeanMetaData beanMetaData) throws ClassNotFoundException
-   {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
-      this.mbeanServer = server;
-   }
-
-   public void callTimeout(Timer timer) throws Exception
-   {
-      /*
-      Method timeout = callbackHandler.getTimeoutCallback();
-      if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
-      Object[] args = {timer};
-      AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
-      try
-      {
-         localInvoke(timeout, args);
-      }
-      catch(Throwable throwable)
-      {
-         if (throwable instanceof Exception) throw (Exception) throwable;
-         if(throwable instanceof Error) throw (Error) throwable;
-         throw new RuntimeException(throwable);
-      }
-      finally
-      {
-         AllowedOperationsAssociation.popInMethodFlag();
-      }
-      */
-      // FIXME: interceptors
-      throw new RuntimeException("NYI");
-   }
-
-   @Override
-   public BeanContext<?> createBeanContext()
-   {
-      return new ServiceBeanContext(this, singleton);
-   }
-   
-   @Override
-   protected ProxyFactory getProxyFactory(LocalBinding binding)
-   {
-      return new ServiceLocalProxyFactory(this, binding);
-   }
-   
-   @Override
-   protected RemoteProxyFactory getProxyFactory(RemoteBinding binding)
-   {
-      // TODO Implement clustering
-      return new ServiceRemoteProxyFactory(this, binding);
-   }
-   
-   public Object createSession(Class initTypes[], Object initArgs[])
-   {
-//      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
-//         throw new IllegalArgumentException("service bean create method must take no arguments");
-      throw new RuntimeException("NYI");
-   }
-
-   public Object getMBean()
-   {
-      return mbean;
-   }
-   
-   public Object getSingleton()
-   {
-      return singleton;
-   }
-
-   public void create() throws Exception
-   {
-      super.create();
-      
-      // EJBTHREE-655: fire up an instance for use as MBean delegate
-      singleton = super.construct();
-
-      // won't work, before starting the management interface MBean injection must have been done.
-      //registerManagementInterface();
-      
-      invokeOptionalMethod("create");
-   }
-
-   @Override
-   protected List<Class<?>> resolveBusinessInterfaces()
-   {
-      List<Class<?>> interfaces = super.resolveBusinessInterfaces();
-      Management man = (Management) resolveAnnotation(Management.class);
-      if (man != null)
-      {
-         Class iface = man.value();
-         if (iface != null)
-         {
-            interfaces.add(iface);
-         }
-      }
-
-      Class[] implIfaces = getBeanClass().getInterfaces();
-      for (Class<?> iface : implIfaces)
-      {
-         if (iface.getAnnotation(Management.class) != null)
-         {
-            interfaces.add(iface);
-         }
-      }
-      return interfaces;
-   }
-   
-   protected void reinitialize()
-   {
-      super.reinitialize();
-      
-      singleton = super.construct();
- 
-      invokeOptionalMethod("create");
-   }
-   
-   @Override
-   protected void lockedStart() throws Exception
-   {
-      super.lockedStart();
-
-      try
-      {
-         initBeanContext();
-
-         // make sure the timer service is there before injection takes place
-         timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
-
-         injectDependencies(beanContext);
-
-         // TODO: EJBTHREE-655: shouldn't happen here, but in create
-         registerManagementInterface();
-         
-         TimerServiceFactory.getInstance().restoreTimerService(timerService);
-         
-         invokeOptionalMethod("start");
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-         this.lockedStop();
-      }
-   }
-
-   @Override
-   protected void lockedStop() throws Exception
-   {
-      invokeOptionalMethod("stop");
-      
-      if (timerService != null)
-      {
-         TimerServiceFactory.getInstance().removeTimerService(timerService);
-         timerService = null;
-      }
-
-      // TODO: EJBTHREE-655: shouldn't happen here, but in destroy
-      unregisterManagementInterface();
-      
-      singleton = null;
-      beanContext = null;
-      
-      super.lockedStop();
-   }
-
-   public void destroy() throws Exception
-   {
-      invokeOptionalMethod("destroy");
-      
-      //unregisterManagementInterface();
-      
-      super.destroy();
-   }
-
-   public void initializePool() throws Exception
-   {
-      resolveInjectors();
-   }
-
-   public TimerService getTimerService()
-   {
-      return timerService;
-   }
-
-   public TimerService getTimerService(Object pKey)
-   {
-      assert timerService != null : "Timer Service not yet initialized";
-      return timerService;
-   }
-   
-   /**
-    * Invoke a method on the singleton without a specific security or transaction context.
-    * 
-    * @param methodName
-    */
-   private void invokeOptionalMethod(String methodName)
-   {
-      /* EJBTHREE-655 has been postponed
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); 
-      try
-      {
-         Thread.currentThread().setContextClassLoader(classloader);
-         Class parameterTypes[] = { };
-         Method method = clazz.getMethod(methodName, parameterTypes);
-         Object args[] = { };
-         method.invoke(singleton, args);
-      }
-      catch(NoSuchMethodException e)
-      {
-         // ignore
-      }
-      catch (IllegalArgumentException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (IllegalAccessException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (InvocationTargetException e)
-      {
-         throw new RuntimeException(e.getCause());
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-      */
-   }
-   
-   public void invokePostConstruct(BeanContext beanContext, Object[] params)
-   {
-      //Ignore
-   }
-
-   public void invokePreDestroy(BeanContext beanContext)
-   {
-      //Ignore
-   }
-   
-   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
-   {
-      return localInvoke(method, args, provider);
-   }
-   
-   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
-   {
-      // no home interface for Service beans
-      return null;
-   }
-
-   /**
-    * Performs a synchronous local invocation
-    */
-   public Object localInvoke(Method method, Object[] args) throws Throwable
-   {
-      return localInvoke(method, args, null);
-   }
-
-   /**
-    * Performs a synchronous or asynchronous local invocation
-    *
-    * @param provider If null a synchronous invocation, otherwise an asynchronous
-    */
-   public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         invokeStats.callIn();
-         
-         Thread.currentThread().setContextClassLoader(classloader);
-         long hash = MethodHashing.calculateHash(method);
-         MethodInfo info = getAdvisor().getMethodInfo(hash);
-         if (info == null)
-         {
-            throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
-         }
-         EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
-         nextInvocation.setAdvisor(getAdvisor());
-         nextInvocation.setArguments(args);
-
-         nextInvocation = populateInvocation(nextInvocation);
-
-         if (provider != null)
-         {
-            nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
-            nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
-         }
-         return nextInvocation.invokeNext();
-      }
-      finally
-      {
-         if (method != null)
-         {
-            long end = System.currentTimeMillis();
-            long elapsed = end - start;
-            invokeStats.updateStats(method, elapsed);
-         }
-         
-         invokeStats.callOut();
-         
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-   }
-
-   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      EJBContainerInvocation newSi = null;
-      
-      MethodInvocation si = (MethodInvocation) invocation;
-      MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
-      Method method = info.getUnadvisedMethod();
-      try
-      {
-         invokeStats.callIn();
-         
-         Thread.currentThread().setContextClassLoader(classloader);
-         
-         if (info == null)
-         {
-            throw new RuntimeException("Could not resolve beanClass method from proxy call");
-         }
-         newSi = new EJBContainerInvocation(info);
-         newSi.setArguments(si.getArguments());
-         newSi.setMetaData(si.getMetaData());
-         newSi.setAdvisor(getAdvisor());
-
-         newSi = populateInvocation(newSi);
-
-         Object rtn = null;
-         try
-         {
-            rtn = newSi.invokeNext();
-         }
-         catch (Throwable throwable)
-         {
-            return marshallException(invocation, throwable, newSi.getResponseContextInfo());
-         }
-         InvocationResponse response = SessionContainer.marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
-
-         return response;
-      }
-      finally
-      {
-         if (method != null)
-         {
-            long end = System.currentTimeMillis();
-            long elapsed = end - start;
-            invokeStats.updateStats(method, elapsed);
-         }
-         
-         invokeStats.callOut();
-         
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-   }
-
-   protected void initBeanContext() throws RuntimeException
-   {
-      if (beanContext == null)
-      {
-         synchronized(singleton)
-         {
-            if (beanContext == null)
-            {
-               beanContext  = createBeanContext();
-               beanContext.initialiseInterceptorInstances();
-            }
-         }
-      }
-   }
-
-   public BeanContext<?> peekContext()
-   {
-      return beanContext;
-   }
-   
-   @Override
-   protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
-   {
-      invocation.setTargetObject(singleton);
-      invocation.setBeanContext(beanContext);
-      return invocation;
-   }
-
-   protected synchronized void injectDependencies(BeanContext ctx)
-   {
-      if (injectors != null)
-      {
-         try
-         {
-            pushEnc();
-            for (Injector injector : injectors)
-            {
-               injector.inject(ctx);
-            }
-         }
-         finally
-         {
-            popEnc();
-         }
-      }
-   }
-
-   // Dynamic MBean implementation --------------------------------------------------
-
-   public Object getAttribute(String attribute) throws AttributeNotFoundException,
-                                                       MBeanException, ReflectionException
-   {
-      return delegate.getAttribute(attribute);
-   }
-
-   public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
-                                                        InvalidAttributeValueException, MBeanException, ReflectionException
-   {
-      delegate.setAttribute(attribute);
-   }
-
-   public AttributeList getAttributes(String[] attributes)
-   {
-      return delegate.getAttributes(attributes);
-   }
-
-   public AttributeList setAttributes(AttributeList attributes)
-   {
-      return delegate.setAttributes(attributes);
-   }
-
-   public Object invoke(String actionName, Object params[], String signature[])
-           throws MBeanException, ReflectionException
-   {
-      return delegate.invoke(actionName, params, signature);
-   }
-
-   @Override
-   protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object[] args) throws Exception
-   {
-      throw new RuntimeException("NYI");
-   }
-   
-
-   //TODO This shouldn't be required of @Service
-   @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception
-   {
-      throw new NotImplementedException("Invalid for " + ServiceContainer.class.getName());
-   }
-
-   public MBeanInfo getMBeanInfo()
-   {
-      return delegate.getMBeanInfo();
-   }
-
-   public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
-   {
-      ServiceLocalProxyFactory factory = new ServiceLocalProxyFactory(this, binding);
-
-      return factory.createProxyBusiness(id);
-   }
-   
-   public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
-   {
-      ServiceRemoteProxyFactory factory = new ServiceRemoteProxyFactory(this, binding);
-
-      return factory.createProxyBusiness(id);
-   }
-
-   private void registerManagementInterface()
-   {
-      try
-      {
-         Management annotation = (Management)resolveAnnotation(Management.class);
-
-         Class intf = null;
-         if (annotation != null)
-            intf = annotation.value();
-
-         if (intf ==null)
-         {
-            Class[] interfaces = this.getBeanClass().getInterfaces();
-            int interfaceIndex = 0;
-            while (intf == null && interfaceIndex < interfaces.length)
-            {
-               if (interfaces[interfaceIndex].getAnnotation(Management.class) != null)
-                  intf = interfaces[interfaceIndex];
-               else
-                  ++interfaceIndex;
-            }
-         }
-
-         if (intf != null)
-         {
-            if (mbeanServer == null)
-               mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
-
-            if (mbeanServer == null)
-               throw new RuntimeException("There is a @Management interface on " + ejbName + " but the MBeanServer has not been initialized for it");
-
-            Service service = (Service)resolveAnnotation(Service.class);
-
-            String objname = service.objectName();
-            delegateObjectName = (objname == null || objname.equals("")) ?
-                            new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
-
-            delegate = new ServiceMBeanDelegate(mbeanServer, this, intf, delegateObjectName);
-
-            getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
-         }
-         else
-         {
-            Service service = (Service)resolveAnnotation(Service.class);
-            if (service.xmbean().length() > 0)
-            {
-               if (mbeanServer == null)
-                  mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
-
-               if (mbeanServer == null)
-                  throw new RuntimeException(ejbName + "is defined as an XMBean, but the MBeanServer has not been initialized for it");
-
-               String objname = service.objectName();
-               delegateObjectName = (objname == null || objname.equals("")) ?
-                               new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
-
-               delegate = new ServiceMBeanDelegate(mbeanServer, this, service.xmbean(), delegateObjectName);
-
-               getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
-            }
-         }
-         
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Problem registering @Management interface for @Service " + getBeanClass(), e);
-      }
-   }
-
-   private void unregisterManagementInterface() throws InstanceNotFoundException, MBeanRegistrationException
-   {
-      if (delegate != null)
-      {
-         getDeployment().getKernelAbstraction().uninstallMBean(delegateObjectName);
-      }
-   }
-   
-   protected void removeHandle(Handle handle)
-   {
-      throw new RuntimeException("Don't do this");
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,645 @@
+/*
+ * 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.service;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.ejb.Handle;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.Management;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.Service;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.service.ServiceLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.stateful.StatefulContainerInvocation;
+import org.jboss.ejb3.timerservice.TimedObjectInvoker;
+import org.jboss.ejb3.timerservice.TimerServiceFactory;
+import org.jboss.injection.Injector;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceContainer extends SessionContainer implements TimedObjectInvoker
+{
+   ServiceMBeanDelegate delegate;
+   Object singleton;
+   BeanContext beanContext;
+   MBeanServer mbeanServer;
+   ObjectName delegateObjectName;
+   private TimerService timerService;
+   private Object mbean = new ServiceDelegateWrapper(this);
+   
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(ServiceContainer.class);
+
+   public ServiceContainer(MBeanServer server, ClassLoader cl, String beanClassName, String ejbName,
+                           Domain domain, Hashtable ctxProperties,
+                           Ejb3Deployment deployment, JBossServiceBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+      this.mbeanServer = server;
+   }
+
+   public void callTimeout(Timer timer) throws Exception
+   {
+      /*
+      Method timeout = callbackHandler.getTimeoutCallback();
+      if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
+      Object[] args = {timer};
+      AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
+      try
+      {
+         localInvoke(timeout, args);
+      }
+      catch(Throwable throwable)
+      {
+         if (throwable instanceof Exception) throw (Exception) throwable;
+         if(throwable instanceof Error) throw (Error) throwable;
+         throw new RuntimeException(throwable);
+      }
+      finally
+      {
+         AllowedOperationsAssociation.popInMethodFlag();
+      }
+      */
+      // FIXME: interceptors
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public BeanContext<?> createBeanContext()
+   {
+      return new ServiceBeanContext(this, singleton);
+   }
+   
+   @Override
+   protected ProxyFactory getProxyFactory(LocalBinding binding)
+   {
+      return new ServiceLocalProxyFactory(this, binding);
+   }
+   
+   @Override
+   protected RemoteProxyFactory getProxyFactory(RemoteBinding binding)
+   {
+      // TODO Implement clustering
+      return new ServiceRemoteProxyFactory(this, binding);
+   }
+   
+   public Serializable createSession(Class<?> initTypes[], Object initArgs[])
+   {
+//      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
+//         throw new IllegalArgumentException("service bean create method must take no arguments");
+      throw new UnsupportedOperationException("Service Containers have no Sessions");
+   }
+
+   public Object getMBean()
+   {
+      return mbean;
+   }
+   
+   public Object getSingleton()
+   {
+      return singleton;
+   }
+
+   public void create() throws Exception
+   {
+      super.create();
+      
+      // EJBTHREE-655: fire up an instance for use as MBean delegate
+      singleton = super.construct();
+
+      // won't work, before starting the management interface MBean injection must have been done.
+      //registerManagementInterface();
+      
+      invokeOptionalMethod("create");
+   }
+
+   @Override
+   public void instantiated()
+   {
+      super.instantiated();
+   }
+
+   @Override
+   protected List<Class<?>> resolveBusinessInterfaces()
+   {
+      List<Class<?>> interfaces = super.resolveBusinessInterfaces();
+      Management man = (Management) resolveAnnotation(Management.class);
+      if (man != null)
+      {
+         Class iface = man.value();
+         if (iface != null)
+         {
+            interfaces.add(iface);
+         }
+      }
+
+      Class[] implIfaces = getBeanClass().getInterfaces();
+      for (Class<?> iface : implIfaces)
+      {
+         if (iface.getAnnotation(Management.class) != null)
+         {
+            interfaces.add(iface);
+         }
+      }
+      return interfaces;
+   }
+   
+   protected void reinitialize()
+   {
+      super.reinitialize();
+      
+      singleton = super.construct();
+ 
+      invokeOptionalMethod("create");
+   }
+   
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      super.lockedStart();
+      proxyDeployer.start();
+
+      try
+      {
+         initBeanContext();
+
+         // make sure the timer service is there before injection takes place
+         timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
+
+         injectDependencies(beanContext);
+
+         // TODO: EJBTHREE-655: shouldn't happen here, but in create
+         registerManagementInterface();
+         
+         TimerServiceFactory.getInstance().restoreTimerService(timerService);
+         
+         invokeOptionalMethod("start");
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         this.lockedStop();
+      }
+   }
+
+   @Override
+   protected void lockedStop() throws Exception
+   {      
+      invokeOptionalMethod("stop");
+      
+      if (timerService != null)
+      {
+         TimerServiceFactory.getInstance().removeTimerService(timerService);
+         timerService = null;
+      }
+
+      // TODO: EJBTHREE-655: shouldn't happen here, but in destroy
+      unregisterManagementInterface();
+      
+      singleton = null;
+      beanContext = null;
+      
+      super.lockedStop();
+      
+      try
+      {
+         proxyDeployer.stop();
+      }
+      catch (Exception ignore)
+      {
+         log.debug("Proxy deployer stop failed", ignore);
+      }
+   }
+
+   public void destroy() throws Exception
+   {
+      invokeOptionalMethod("destroy");
+      
+      //unregisterManagementInterface();
+      
+      super.destroy();
+   }
+
+   public void initializePool() throws Exception
+   {
+      resolveInjectors();
+   }
+
+   public TimerService getTimerService()
+   {
+      return timerService;
+   }
+
+   public TimerService getTimerService(Object pKey)
+   {
+      assert timerService != null : "Timer Service not yet initialized";
+      return timerService;
+   }
+   
+   /**
+    * Invoke a method on the singleton without a specific security or transaction context.
+    * 
+    * @param methodName
+    */
+   private void invokeOptionalMethod(String methodName)
+   {
+      /* EJBTHREE-655 has been postponed
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); 
+      try
+      {
+         Thread.currentThread().setContextClassLoader(classloader);
+         Class parameterTypes[] = { };
+         Method method = clazz.getMethod(methodName, parameterTypes);
+         Object args[] = { };
+         method.invoke(singleton, args);
+      }
+      catch(NoSuchMethodException e)
+      {
+         // ignore
+      }
+      catch (IllegalArgumentException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (InvocationTargetException e)
+      {
+         throw new RuntimeException(e.getCause());
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+      */
+   }
+   
+   public void invokePostConstruct(BeanContext beanContext, Object[] params)
+   {
+      //Ignore
+   }
+
+   public void invokePreDestroy(BeanContext beanContext)
+   {
+      //Ignore
+   }
+   
+   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      return localInvoke(method, args, provider);
+   }
+   
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+   {
+      // no home interface for Service beans
+      return null;
+   }
+
+   /**
+    * Performs a synchronous local invocation
+    */
+   public Object localInvoke(Method method, Object[] args) throws Throwable
+   {
+      return localInvoke(method, args, null);
+   }
+
+   /**
+    * Performs a synchronous or asynchronous local invocation
+    *
+    * @param provider If null a synchronous invocation, otherwise an asynchronous
+    */
+   public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+      
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         invokeStats.callIn();
+         
+         Thread.currentThread().setContextClassLoader(classloader);
+         long hash = MethodHashing.calculateHash(method);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
+         }
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info,null);
+         nextInvocation.setAdvisor(getAdvisor());
+         nextInvocation.setArguments(args);
+
+         nextInvocation = populateInvocation(nextInvocation);
+
+         if (provider != null)
+         {
+            nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+            nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
+         }
+         return nextInvocation.invokeNext();
+      }
+      finally
+      {
+         if (method != null)
+         {
+            long end = System.currentTimeMillis();
+            long elapsed = end - start;
+            invokeStats.updateStats(method, elapsed);
+         }
+         
+         invokeStats.callOut();
+         
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+
+   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+      
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      StatefulContainerInvocation newSi = null;
+      
+      MethodInvocation si = (MethodInvocation) invocation;
+      MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+      Method method = info.getUnadvisedMethod();
+      try
+      {
+         invokeStats.callIn();
+         
+         Thread.currentThread().setContextClassLoader(classloader);
+         
+         if (info == null)
+         {
+            throw new RuntimeException("Could not resolve beanClass method from proxy call");
+         }
+         newSi = new StatefulContainerInvocation(info,null);
+         newSi.setArguments(si.getArguments());
+         newSi.setMetaData(si.getMetaData());
+         newSi.setAdvisor(getAdvisor());
+
+         newSi = populateInvocation(newSi);
+
+         Object rtn = null;
+         try
+         {
+            rtn = newSi.invokeNext();
+         }
+         catch (Throwable throwable)
+         {
+            return marshallException(invocation, throwable, newSi.getResponseContextInfo());
+         }
+         InvocationResponse response = SessionContainer.marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+
+         return response;
+      }
+      finally
+      {
+         if (method != null)
+         {
+            long end = System.currentTimeMillis();
+            long elapsed = end - start;
+            invokeStats.updateStats(method, elapsed);
+         }
+         
+         invokeStats.callOut();
+         
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+
+   protected void initBeanContext() throws RuntimeException
+   {
+      if (beanContext == null)
+      {
+         synchronized(singleton)
+         {
+            if (beanContext == null)
+            {
+               beanContext  = createBeanContext();
+               beanContext.initialiseInterceptorInstances();
+            }
+         }
+      }
+   }
+
+   public BeanContext<?> peekContext()
+   {
+      return beanContext;
+   }
+   
+   @Override
+   protected StatefulContainerInvocation populateInvocation(StatefulContainerInvocation invocation)
+   {
+      invocation.setTargetObject(singleton);
+      invocation.setBeanContext(beanContext);
+      return invocation;
+   }
+
+   protected synchronized void injectDependencies(BeanContext ctx)
+   {
+      if (injectors != null)
+      {
+         try
+         {
+            pushEnc();
+            for (Injector injector : injectors)
+            {
+               injector.inject(ctx);
+            }
+         }
+         finally
+         {
+            popEnc();
+         }
+      }
+   }
+
+   // Dynamic MBean implementation --------------------------------------------------
+
+   public Object getAttribute(String attribute) throws AttributeNotFoundException,
+                                                       MBeanException, ReflectionException
+   {
+      return delegate.getAttribute(attribute);
+   }
+
+   public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
+                                                        InvalidAttributeValueException, MBeanException, ReflectionException
+   {
+      delegate.setAttribute(attribute);
+   }
+
+   public AttributeList getAttributes(String[] attributes)
+   {
+      return delegate.getAttributes(attributes);
+   }
+
+   public AttributeList setAttributes(AttributeList attributes)
+   {
+      return delegate.setAttributes(attributes);
+   }
+
+   public Object invoke(String actionName, Object params[], String signature[])
+           throws MBeanException, ReflectionException
+   {
+      return delegate.invoke(actionName, params, signature);
+   }
+
+   public MBeanInfo getMBeanInfo()
+   {
+      return delegate.getMBeanInfo();
+   }
+
+   public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
+   {
+      ServiceLocalProxyFactory factory = new ServiceLocalProxyFactory(this, binding);
+
+      return factory.createProxyBusiness(id);
+   }
+   
+   public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
+   {
+      ServiceRemoteProxyFactory factory = new ServiceRemoteProxyFactory(this, binding);
+
+      return factory.createProxyBusiness(id);
+   }
+
+   private void registerManagementInterface()
+   {
+      try
+      {
+         Management annotation = (Management)resolveAnnotation(Management.class);
+
+         Class intf = null;
+         if (annotation != null)
+            intf = annotation.value();
+
+         if (intf ==null)
+         {
+            Class[] interfaces = this.getBeanClass().getInterfaces();
+            int interfaceIndex = 0;
+            while (intf == null && interfaceIndex < interfaces.length)
+            {
+               if (interfaces[interfaceIndex].getAnnotation(Management.class) != null)
+                  intf = interfaces[interfaceIndex];
+               else
+                  ++interfaceIndex;
+            }
+         }
+
+         if (intf != null)
+         {
+            if (mbeanServer == null)
+               mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
+
+            if (mbeanServer == null)
+               throw new RuntimeException("There is a @Management interface on " + ejbName + " but the MBeanServer has not been initialized for it");
+
+            Service service = (Service)resolveAnnotation(Service.class);
+
+            String objname = service.objectName();
+            delegateObjectName = (objname == null || objname.equals("")) ?
+                            new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
+
+            delegate = new ServiceMBeanDelegate(mbeanServer, this, intf, delegateObjectName);
+
+            getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
+         }
+         else
+         {
+            Service service = (Service)resolveAnnotation(Service.class);
+            if (service.xmbean().length() > 0)
+            {
+               if (mbeanServer == null)
+                  mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
+
+               if (mbeanServer == null)
+                  throw new RuntimeException(ejbName + "is defined as an XMBean, but the MBeanServer has not been initialized for it");
+
+               String objname = service.objectName();
+               delegateObjectName = (objname == null || objname.equals("")) ?
+                               new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
+
+               delegate = new ServiceMBeanDelegate(mbeanServer, this, service.xmbean(), delegateObjectName);
+
+               getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
+            }
+         }
+         
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Problem registering @Management interface for @Service " + getBeanClass(), e);
+      }
+   }
+
+   private void unregisterManagementInterface() throws InstanceNotFoundException, MBeanRegistrationException
+   {
+      if (delegate != null)
+      {
+         getDeployment().getKernelAbstraction().uninstallMBean(delegateObjectName);
+      }
+   }
+   
+   protected void removeHandle(Handle handle)
+   {
+      throw new RuntimeException("Don't do this");
+   }
+}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,46 @@
+/*
+ * 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.session;
+
+/**
+ * Ejb2xMethodNames
+ * 
+ * This interface contains immutable names of EJB2.x Methods for
+ * use in reflection
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface Ejb2xMethodNames
+{
+   // --------------------------------------------------------------------------------||
+   // Constants ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /*
+    * The following are used in EJB2.x Home Interfaces
+    */
+
+   String METHOD_NAME_HOME_CREATE = "create";
+
+   String METHOD_NAME_HOME_REMOVE = "remove";
+}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,74 @@
+/*
+ * 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.session;
+
+import java.lang.reflect.Method;
+
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.proxy.ClassProxy;
+import org.jboss.aop.proxy.ProxyMixin;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+
+/**
+ * Exposes InvokableContext.dynamicInvoke to Remoting
+ *
+ * org.jboss.aop.Dispatcher can handle only certain types.
+ * 
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class InvokableContextClassProxyHack implements ClassProxy
+{
+   private InvokableContext container;
+
+   InvokableContextClassProxyHack(InvokableContext container)
+   {
+      assert container != null : "container is null";
+
+      this.container = container;
+   }
+
+   public InvocationResponse _dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      return container.dynamicInvoke(invocation);
+   }
+
+   public void setMixins(ProxyMixin[] mixins)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public InstanceAdvisor _getInstanceAdvisor()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void _setInstanceAdvisor(InstanceAdvisor newAdvisor)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,233 +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.session;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-import org.jboss.ejb3.annotation.impl.LocalBindingImpl;
-import org.jboss.ejb3.annotation.impl.RemoteBindingImpl;
-import org.jboss.ejb3.annotation.impl.RemoteBindingsImpl;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.logging.Logger;
-
-/**
- * Delegatee of a SessionContainer for managing proxy factories.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ProxyDeployer
-{
-   private static final Logger log = Logger.getLogger(ProxyDeployer.class);
-   private SessionContainer container;
-   private Map<Object, ProxyFactory> proxyFactories = new HashMap<Object, ProxyFactory>();
-   private RemoteBindings remoteBindings;
-   private LocalBinding localBinding;
-
-   public ProxyDeployer(SessionContainer container)
-   {
-      assert container != null : "container is null";
-      
-      this.container = container;
-   }
-
-   private static <T> Constructor<T> getConstructor(Class<T> cls, Class<?> ... parameterTypes) throws SecurityException, NoSuchMethodException
-   {
-      try
-      {
-         return cls.getConstructor(parameterTypes);
-      }
-      catch(NoSuchMethodException e)
-      {
-         log.warn("Class " + cls + " does not have a proper constructor with parameters " + Arrays.toString(parameterTypes) + ", will try to find one");
-         
-         // I'm not going to modify the array, so I can cast it safely
-         // http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getConstructors()
-         Constructor<T> constructors[] = (Constructor<T>[]) cls.getConstructors();
-         for(Constructor<T> constructor : constructors)
-         {
-            if(parameterTypes.length != constructor.getParameterTypes().length)
-               continue;
-            
-            int i = 0;
-            for(; i < parameterTypes.length; i++)
-            {
-               if(!constructor.getParameterTypes()[i].isAssignableFrom(parameterTypes[i]))
-                  break;
-            }
-            if(i == parameterTypes.length)
-               return constructor;
-         }
-         throw e;
-      }
-   }
-   
-   public Map<Object, ProxyFactory> getProxyFactories()
-   {
-      return proxyFactories;
-   }
-   
-   public ProxyFactory getProxyFactory(Object key)
-   {
-      return this.getProxyFactories().get(key);
-   }
-
-   public void start() throws Exception
-   {
-      if (remoteBindings != null)
-      {
-         RemoteBinding[] list = remoteBindings.value();
-         for(RemoteBinding binding : list)
-         {
-            assert binding.jndiBinding().length() != 0 : "jndiBinding not set on binding " + binding;
-            
-            RemoteProxyFactory factory;
-            String factoryImplementationRegistryKey = binding.factory();
-            if (factoryImplementationRegistryKey.equals(RemoteBindingDefaults.PROXY_FACTORY_DEFAULT))
-            {
-               factory = container.getProxyFactory(binding);
-            }
-            else
-            {
-               Class<? extends RemoteProxyFactory> remoteFactoryClass = container.getDeployment().getRemoteProxyFactoryRegistry().getProxyFactoryClass(binding.factory());
-               Constructor<? extends RemoteProxyFactory> constructor = getConstructor(remoteFactoryClass, container.getClass(), RemoteBinding.class);
-               factory = constructor.newInstance(container, binding);
-            }
-            factory.start();
-            proxyFactories.put(binding,factory);
-         }
-      }
-
-      if (localBinding != null)
-      {
-         ProxyFactory factory = container.getProxyFactory(localBinding);
-         factory.start();
-         proxyFactories.put(localBinding,factory);
-      }
-   }
-
-   protected boolean hasJNDIBinding(String jndiName)
-   {
-      assert jndiName != null : "jndiName is null";
-      
-      if(localBinding != null)
-      {
-         if(localBinding.jndiBinding().equals(jndiName))
-            return true;
-      }
-      
-      if(remoteBindings != null)
-      {
-         for(RemoteBinding binding : remoteBindings.value())
-         {
-            if(binding.jndiBinding().equals(jndiName))
-               return true;
-         }
-      }
-      
-      return false;
-   }
-   
-   public void initializeLocalBindingMetadata()
-   {
-      localBinding = container.getAnnotation(LocalBinding.class);
-      if (localBinding == null)
-      {
-         if (ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container).length > 0)
-         {
-            localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container));
-            container.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding);
-         }
-      }
-   }
-   
-   private RemoteBinding initializeRemoteBinding(RemoteBinding binding)
-   {
-      if(binding.jndiBinding().length() == 0)
-      {
-         return new RemoteBindingImpl(ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container), binding
-               .interceptorStack(), binding.clientBindUrl(), binding.factory());
-      }
-      return binding;
-   }
-   
-   public void initializeRemoteBindingMetadata()
-   {
-      remoteBindings = container.getAnnotation(RemoteBindings.class);
-      if (remoteBindings == null)
-      {
-         RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
-         if (binding == null)
-         {
-            log.debug("no declared remote bindings for : " + container.getEjbName());
-            if (ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container).length > 0)
-            {
-               log.debug("there is remote interfaces for " + container.getEjbName());
-               String jndiName = ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
-               log.debug("default remote binding has jndiName of " + jndiName);
-               String uri = ""; // use the default
-               RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, RemoteBindingDefaults.PROXY_FACTORY_DEFAULT)};
-               remoteBindings = new RemoteBindingsImpl(list);
-               container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
-            }
-         }
-         else
-         {
-            RemoteBinding[] list = {initializeRemoteBinding(binding)};
-            remoteBindings = new RemoteBindingsImpl(list);
-            container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
-         }
-      }
-      else
-      {
-         List<RemoteBinding> list = new ArrayList<RemoteBinding>();
-         for(RemoteBinding binding : remoteBindings.value())
-         {
-            list.add(initializeRemoteBinding(binding));
-         }
-         remoteBindings = new RemoteBindingsImpl(list);
-         container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
-      }
-   }
-
-   public void stop() throws Exception
-   {
-      // Stop all proxy factories
-      Collection<ProxyFactory> proxyFactories = this.getProxyFactories().values();
-      for(ProxyFactory factory : proxyFactories)
-      {
-         factory.stop();
-      }
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,235 @@
+/*
+ * 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.session;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+import org.jboss.ejb3.annotation.impl.LocalBindingImpl;
+import org.jboss.ejb3.annotation.impl.RemoteBindingImpl;
+import org.jboss.ejb3.annotation.impl.RemoteBindingsImpl;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+
+/**
+ * Delegatee of a SessionContainer for managing proxy factories.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class ProxyDeployer
+{
+   private static final Logger log = Logger.getLogger(ProxyDeployer.class);
+   private SessionContainer container;
+   private Map<Object, ProxyFactory> proxyFactories = new HashMap<Object, ProxyFactory>();
+   private RemoteBindings remoteBindings;
+   private LocalBinding localBinding;
+
+   public ProxyDeployer(SessionContainer container)
+   {
+      assert container != null : "container is null";
+      
+      this.container = container;
+   }
+
+   private static <T> Constructor<T> getConstructor(Class<T> cls, Class<?> ... parameterTypes) throws SecurityException, NoSuchMethodException
+   {
+      try
+      {
+         return cls.getConstructor(parameterTypes);
+      }
+      catch(NoSuchMethodException e)
+      {
+         log.warn("Class " + cls + " does not have a proper constructor with parameters " + Arrays.toString(parameterTypes) + ", will try to find one");
+         
+         // I'm not going to modify the array, so I can cast it safely
+         // http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getConstructors()
+         Constructor<T> constructors[] = (Constructor<T>[]) cls.getConstructors();
+         for(Constructor<T> constructor : constructors)
+         {
+            if(parameterTypes.length != constructor.getParameterTypes().length)
+               continue;
+            
+            int i = 0;
+            for(; i < parameterTypes.length; i++)
+            {
+               if(!constructor.getParameterTypes()[i].isAssignableFrom(parameterTypes[i]))
+                  break;
+            }
+            if(i == parameterTypes.length)
+               return constructor;
+         }
+         throw e;
+      }
+   }
+   
+   public Map<Object, ProxyFactory> getProxyFactories()
+   {
+      return proxyFactories;
+   }
+   
+   public ProxyFactory getProxyFactory(Object key)
+   {
+      return this.getProxyFactories().get(key);
+   }
+
+   public void start() throws Exception
+   {
+      if (remoteBindings != null)
+      {
+         RemoteBinding[] list = remoteBindings.value();
+         for(RemoteBinding binding : list)
+         {
+            assert binding.jndiBinding().length() != 0 : "jndiBinding not set on binding " + binding;
+            
+            RemoteProxyFactory factory;
+            String factoryImplementationRegistryKey = binding.factory();
+            if (factoryImplementationRegistryKey.equals(RemoteBindingDefaults.PROXY_FACTORY_DEFAULT))
+            {
+               factory = container.getProxyFactory(binding);
+            }
+            else
+            {
+               Class<? extends RemoteProxyFactory> remoteFactoryClass = container.getDeployment().getRemoteProxyFactoryRegistry().getProxyFactoryClass(binding.factory());
+               Constructor<? extends RemoteProxyFactory> constructor = getConstructor(remoteFactoryClass, container.getClass(), RemoteBinding.class);
+               factory = constructor.newInstance(container, binding);
+            }
+            factory.start();
+            proxyFactories.put(binding,factory);
+         }
+      }
+
+      if (localBinding != null)
+      {
+         ProxyFactory factory = container.getProxyFactory(localBinding);
+         factory.start();
+         proxyFactories.put(localBinding,factory);
+      }
+   }
+
+   protected boolean hasJNDIBinding(String jndiName)
+   {
+      assert jndiName != null : "jndiName is null";
+      
+      if(localBinding != null)
+      {
+         if(localBinding.jndiBinding().equals(jndiName))
+            return true;
+      }
+      
+      if(remoteBindings != null)
+      {
+         for(RemoteBinding binding : remoteBindings.value())
+         {
+            if(binding.jndiBinding().equals(jndiName))
+               return true;
+         }
+      }
+      
+      return false;
+   }
+   
+   public void initializeLocalBindingMetadata()
+   {
+      localBinding = container.getAnnotation(LocalBinding.class);
+      if (localBinding == null)
+      {
+         if (ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container).length > 0)
+         {
+            localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container));
+            container.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding);
+         }
+      }
+   }
+   
+   private RemoteBinding initializeRemoteBinding(RemoteBinding binding)
+   {
+      if(binding.jndiBinding().length() == 0)
+      {
+         return new RemoteBindingImpl(ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container), binding
+               .interceptorStack(), binding.clientBindUrl(), binding.factory());
+      }
+      return binding;
+   }
+   
+   public void initializeRemoteBindingMetadata()
+   {
+      remoteBindings = container.getAnnotation(RemoteBindings.class);
+      if (remoteBindings == null)
+      {
+         RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
+         if (binding == null)
+         {
+            log.debug("no declared remote bindings for : " + container.getEjbName());
+            BusinessRemotesMetaData businessRemotes = container.getMetaData().getBusinessRemotes();
+            if (businessRemotes != null && businessRemotes.size() > 0)
+            {
+               log.debug("there is remote interfaces for " + container.getEjbName());
+               String jndiName = container.getMetaData().determineResolvedJndiName(null);
+               log.debug("default remote binding has jndiName of " + jndiName);
+               String uri = ""; // use the default
+               RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, RemoteBindingDefaults.PROXY_FACTORY_DEFAULT)};
+               remoteBindings = new RemoteBindingsImpl(list);
+               container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+            }
+         }
+         else
+         {
+            RemoteBinding[] list = {initializeRemoteBinding(binding)};
+            remoteBindings = new RemoteBindingsImpl(list);
+            container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+         }
+      }
+      else
+      {
+         List<RemoteBinding> list = new ArrayList<RemoteBinding>();
+         for(RemoteBinding binding : remoteBindings.value())
+         {
+            list.add(initializeRemoteBinding(binding));
+         }
+         remoteBindings = new RemoteBindingsImpl(list);
+         container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+      }
+   }
+
+   public void stop() throws Exception
+   {
+      // Stop all proxy factories
+      Collection<ProxyFactory> proxyFactories = this.getProxyFactories().values();
+      for(ProxyFactory factory : proxyFactories)
+      {
+         factory.stop();
+      }
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,563 +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.session;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.LocalHome;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.Ejb3Module;
-import org.jboss.ejb3.ThreadLocalStack;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.stateful.StatefulContainerInvocation;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.serial.io.MarshalledObjectForLocalCalls;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class SessionContainer extends EJBContainer
-{
-   @SuppressWarnings("unused")
-   private static final Logger log = Logger.getLogger(SessionContainer.class);
-
-   protected ProxyDeployer proxyDeployer;
-   private Map<String, HATarget> clusterFamilies;
-
-   public class InvokedMethod
-   {
-      public InvokedMethod(boolean localInterface, Method method)
-      {
-         isLocalInterface = localInterface;
-         this.method = method;
-      }
-
-      public boolean isLocalInterface;
-      public Method method;
-   }
-   
-   /**
-    * Returns a remote binding for this container
-    * 
-    * @deprecated Non-deterministic, more than one binding may be specified 
-    * for this container
-    * @return
-    */
-   @Deprecated
-   protected RemoteBinding getRemoteBinding()
-   {
-      RemoteBinding binding = null;
-      RemoteBindings bindings = getAnnotation(RemoteBindings.class);
-      if (bindings != null)
-         binding = bindings.value()[0];
-      else
-         binding = getAnnotation(RemoteBinding.class);
-      
-      return binding;
-   }
-
-   protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
-
-   public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
-                           Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
-   {
-      super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, deployment, beanMetaData);
-      proxyDeployer = new ProxyDeployer(this);
-   }
-
-   /**
-    * Create a local proxy factory.
-    * @return
-    */
-   protected abstract ProxyFactory getProxyFactory(LocalBinding binding);
-   
-   /**
-    * Create a remote proxy factory on the given binding.
-    * 
-    * @param binding
-    * @return
-    */
-   protected abstract RemoteProxyFactory getProxyFactory(RemoteBinding binding);
-   
-   public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
-   
-   public Class<?> getInvokedBusinessInterface()
-   {
-      InvokedMethod method = invokedMethod.get();
-      if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
-      if (method.method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
-      if (method.isLocalInterface) return method.method.getDeclaringClass();
-      Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
-      for (Class<?> intf : remoteInterfaces)
-      {
-         try
-         {
-            intf.getMethod(method.method.getName(), method.method.getParameterTypes());
-            return intf;
-         }
-         catch (NoSuchMethodException ignored)
-         {
-            // continue
-         }
-      }
-      throw new IllegalStateException("Unable to find geInvokedBusinessInterface()");
-   }
-
-   protected JBossSessionBeanMetaData getMetaData()
-   {
-      // TODO: resolve this cast using generics on EJBContainer
-      return (JBossSessionBeanMetaData) getXml();
-   }
-   
-   @Override
-   public void instantiated()
-   {
-      super.instantiated();
-      proxyDeployer.initializeRemoteBindingMetadata();
-      proxyDeployer.initializeLocalBindingMetadata();
-   }
-
-   @Override
-   protected List<Class<?>> resolveBusinessInterfaces()
-   {
-      // Obtain all business interfaces
-      List<Class<?>> list = new ArrayList<Class<?>>();
-      list.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(this)));
-      list.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(this)));
-      
-      return list;
-   }
-   
-   protected void lockedStart() throws Exception
-   {
-      super.lockedStart();
-      // So that Remoting layer can reference this container easily.
-      Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
-      proxyDeployer.start();
-   }
-
-   /**
-    * This gets called by replicants manager interceptor factory
-    * during the initialization of the bean container (during construction of EJBContainer).
-    * So we have detached construction here.
-    * 
-    * @return the cluster families, never null
-    */
-   public Map<String, HATarget> getClusterFamilies()
-   {
-      if(clusterFamilies != null)
-         return clusterFamilies;
-      
-      synchronized (this)
-      {
-         if(clusterFamilies == null)
-            clusterFamilies = new HashMap<String, HATarget>();
-      }
-      return clusterFamilies;
-   }
-
-   protected void lockedStop() throws Exception
-   {
-      try
-      {
-         proxyDeployer.stop();
-      }
-      catch (Exception ignore)
-      {
-         log.debug("Proxy deployer stop failed", ignore);
-      }
-      try
-      {
-         Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
-      }
-      catch (Exception ignore)
-      {
-         log.debug("Dispatcher unregister target failed", ignore);
-      }
-      super.lockedStop();
-   }
-
-   @Override
-   public List<Method> getVirtualMethods()
-   {
-      List<Method> virtualMethods = new ArrayList<Method>();
-      try
-      {
-         RemoteHome home = getAnnotation(RemoteHome.class);
-         if (home != null)
-         {
-            Method[] declaredMethods = home.value().getMethods();
-            for(Method declaredMethod : declaredMethods)
-               virtualMethods.add(declaredMethod);
-
-            declaredMethods = javax.ejb.EJBObject.class.getMethods();
-            for(Method declaredMethod : declaredMethods)
-               virtualMethods.add(declaredMethod);
-         }
-
-         LocalHome localHome = getAnnotation(LocalHome.class);
-         if (localHome != null)
-         {
-            Method[] declaredMethods = localHome.value().getMethods();
-            for(Method declaredMethod : declaredMethods)
-               virtualMethods.add(declaredMethod);
-
-            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
-            for(Method declaredMethod : declaredMethods)
-               virtualMethods.add(declaredMethod);
-         }
-      }
-      catch (SecurityException e)
-      {
-         // TODO: privileged?
-         throw new RuntimeException(e);
-      }
-      return virtualMethods;
-   }
-   
-   /*
-   protected void createMethodMap()
-   {
-      super.createMethodMap();
-      try
-      {
-         RemoteHome home = (RemoteHome) resolveAnnotation(RemoteHome.class);
-         if (home != null)
-         {
-            Method[] declaredMethods = home.value().getMethods();
-            for (int i = 0; i < declaredMethods.length; i++)
-            {
-               long hash = MethodHashing.methodHash(declaredMethods[i]);
-               advisedMethods.put(hash, declaredMethods[i]);
-            }
-
-            declaredMethods = javax.ejb.EJBObject.class.getMethods();
-            for (int i = 0; i < declaredMethods.length; i++)
-            {
-               long hash = MethodHashing.methodHash(declaredMethods[i]);
-               advisedMethods.put(hash, declaredMethods[i]);
-            }
-         }
-
-         LocalHome localHome = (LocalHome) resolveAnnotation(LocalHome.class);
-         if (localHome != null)
-         {
-            Method[] declaredMethods = localHome.value().getMethods();
-            for (int i = 0; i < declaredMethods.length; i++)
-            {
-               long hash = MethodHashing.methodHash(declaredMethods[i]);
-               advisedMethods.put(hash, declaredMethods[i]);
-            }
-
-            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
-            for (int i = 0; i < declaredMethods.length; i++)
-            {
-               long hash = MethodHashing.methodHash(declaredMethods[i]);
-               advisedMethods.put(hash, declaredMethods[i]);
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   */
-
-   protected boolean isHomeMethod(Method method)
-   {
-      if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
-      if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
-      return false;
-   }
-
-   protected boolean isEJBObjectMethod(Method method)
-   {
-      if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
-         return true;
-
-      if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
-         return true;
-
-      return false;
-   }
-
-   protected boolean isHandleMethod(Method method)
-   {
-      if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
-         return true;
-
-      return false;
-   }
-
-   public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
-   {
-      if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
-
-      InvocationResponse response = new InvocationResponse();
-      response.setContextInfo(responseContext);
-
-      response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
-
-      return response;
-   }
-
-   public static InvocationResponse marshallResponse(Invocation invocation, Object rtn, Map responseContext)
-           throws java.io.IOException
-   {
-      InvocationResponse response;
-      // marshall return value
-      if (rtn != null && invocation.getMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.IS_LOCAL) != null)
-      {
-         response = new InvocationResponse(new MarshalledObjectForLocalCalls(rtn));
-      }
-      else
-      {
-         response = new InvocationResponse(rtn);
-      }
-      response.setContextInfo(responseContext);
-      return response;
-   }
-   
-   /**
-    * Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one
-    * of the business interfaces (or home interface) of the bean.
-    * 
-    * TODO: work in progress
-    * 
-    * @param factory    the originating end point
-    * @param id         unique identifier (primary key), can be null for stateless
-    * @param method     the business or home method to invoke
-    * @param args       the arguments for the method
-    * @param provider   for asynchronous usage
-    */
-   public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
-   {
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      pushEnc();
-      try
-      {
-         long hash = MethodHashing.calculateHash(method);
-         MethodInfo info = getAdvisor().getMethodInfo(hash);
-         if (info == null)
-         {
-            throw new RuntimeException(
-                    "Could not resolve beanClass method from proxy call: "
-                            + method.toString());
-         }
-
-         Method unadvisedMethod = info.getUnadvisedMethod();
-
-         if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-         {
-            return invokeHomeMethod(factory, info, args);
-         }
-         else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-         {
-            return invokeEJBObjectMethod(factory, id, info, args);
-         }
-
-         // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
-         EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
-         nextInvocation.setAdvisor(getAdvisor());
-         nextInvocation.setArguments(args);
-         
-         // allow a container to supplement information into an invocation
-         nextInvocation = populateInvocation(nextInvocation);
-
-         ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
-         try
-         {
-            invokedMethod.push(new InvokedMethod(true, method));
-            return nextInvocation.invokeNext();
-         }
-         finally
-         {
-            invokedMethod.pop();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-         popEnc();
-      }
-   }
-   
-   /**
-    * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
-    * TODO: Move this to SessionSpecContainer
-    */
-   //TODO
-   private Object invokeHomeMethod(SessionProxyFactory factory, MethodInfo info, Object args[]) throws Exception
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("create"))
-      {
-         return this.invokeHomeCreate(factory, unadvisedMethod, args);
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         if(args[0] instanceof Handle)
-            removeHandle((Handle) args[0]);
-         else
-            destroySession(args[0]);
-
-         return null;
-      }
-      else
-      {
-         throw new IllegalArgumentException("illegal home method " + unadvisedMethod);
-      }
-   }
-   
-   /**
-    * Provides implementation for this bean's EJB 2.1 Home.create() method 
-    * 
-    * @param factory
-    * @param unadvisedMethod
-    * @param args
-    * @return
-    * @throws Exception
-    */
-   //TODO Move this to SessionSpecContainer
-   protected abstract Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception;
-   
-   /**
-    * Create session to an EJB bean.
-    * 
-    * @param initParameterTypes     the parameter types used by the home's create method
-    * @param initParameterValues    the arguments for the home's create method
-    * @return   the identifier of the session
-    */
-   abstract public Object createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
-   
-   abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
-   
-   abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
-   
-   public Object createSession()
-   {
-      return createSession(new Class<?>[]{}, new Object[]{});
-   }
-   
-   /**
-    * Destroy a created session.
-    * 
-    * @param id     the identifier of the session
-    */
-   protected void destroySession(Object id)
-   {
-      throw new RuntimeException("NYI");
-   }
-   
-   /**
-    * Checks if this session bean binds to the given JNDI name.
-    */
-   @Override
-   public boolean hasJNDIBinding(String jndiName)
-   {
-      return proxyDeployer.hasJNDIBinding(jndiName);
-   }
-   
-   protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if(unadvisedMethod.getName().equals("getEJBHome"))
-      {
-         return factory.createHomeProxy();
-      }
-      if(unadvisedMethod.getName().equals("getPrimaryKey"))
-      {
-         return id;
-      }
-      if(unadvisedMethod.getName().equals("isIdentical"))
-      {
-         // object has no identity
-         if(id == null)
-            return false;
-         
-         EJBObject bean = (EJBObject) args[0];
-
-         Object primaryKey = bean.getPrimaryKey();
-         if(primaryKey == null)
-            return false;
-
-         boolean isIdentical = id.equals(primaryKey);
-
-         return isIdentical;
-      }
-      if (unadvisedMethod.getName().equals("remove"))
-      {
-         destroySession(id);
-
-         return null;
-      }
-      throw new RuntimeException("NYI");
-   }
-   
-   /**
-    * Allow a container sub class to supplement an invocation. Per default nothing to supplement.
-    * 
-    * @param invocation
-    * @return
-    */
-   protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
-   {
-      return invocation;
-   }
-   
-   abstract protected void removeHandle(Handle handle) throws Exception;
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,619 @@
+/*
+ * 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.session;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.LocalHome;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3Module;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.ejb3.stateful.StatefulContainerInvocation;
+import org.jboss.ha.framework.server.HATarget;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.serial.io.MarshalledObjectForLocalCalls;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class SessionContainer extends EJBContainer
+{
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(SessionContainer.class);
+
+   protected ProxyDeployer proxyDeployer;
+   private Map<String, HATarget> clusterFamilies;
+   
+   /**
+    * Returns a remote binding for this container
+    * 
+    * @deprecated Non-deterministic, more than one binding may be specified 
+    * for this container
+    * @return
+    */
+   @Deprecated
+   protected RemoteBinding getRemoteBinding()
+   {
+      RemoteBinding binding = null;
+      RemoteBindings bindings = getAnnotation(RemoteBindings.class);
+      if (bindings != null)
+         binding = bindings.value()[0];
+      else
+         binding = getAnnotation(RemoteBinding.class);
+      
+      return binding;
+   }
+
+   public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+                           Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, deployment, beanMetaData);
+      proxyDeployer = new ProxyDeployer(this);
+   }
+
+   /**
+    * Create a local proxy factory.
+    * @return
+    */
+   protected abstract ProxyFactory getProxyFactory(LocalBinding binding);
+   
+   /**
+    * Create a remote proxy factory on the given binding.
+    * 
+    * @param binding
+    * @return
+    */
+   protected abstract RemoteProxyFactory getProxyFactory(RemoteBinding binding);
+   
+   public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
+
+   public JBossSessionBeanMetaData getMetaData()
+   {
+      // TODO: resolve this cast using generics on EJBContainer
+      return (JBossSessionBeanMetaData) getXml();
+   }
+   
+   @Override
+   public void instantiated()
+   {
+      super.instantiated();
+      proxyDeployer.initializeRemoteBindingMetadata();
+      proxyDeployer.initializeLocalBindingMetadata();
+   }
+
+   @Override
+   protected List<Class<?>> resolveBusinessInterfaces()
+   {
+      // Obtain all business interfaces
+      List<Class<?>> list = new ArrayList<Class<?>>();
+      list.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(this)));
+      list.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(this)));
+      
+      return list;
+   }
+   
+   protected void lockedStart() throws Exception
+   {
+      super.lockedStart();
+      this.registerWithAopDispatcher();
+      
+      //TODO Remove
+      //      proxyDeployer.start();
+   }
+   
+   /**
+    * Registers this Container with Remoting
+    */
+   protected void registerWithAopDispatcher()
+   {
+      // So that Remoting layer can reference this container easily.
+      Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
+   }
+
+   /**
+    * This gets called by replicants manager interceptor factory
+    * during the initialization of the bean container (during construction of EJBContainer).
+    * So we have detached construction here.
+    * 
+    * @return the cluster families, never null
+    */
+   public Map<String, HATarget> getClusterFamilies()
+   {
+      if(clusterFamilies != null)
+         return clusterFamilies;
+      
+      synchronized (this)
+      {
+         if(clusterFamilies == null)
+            clusterFamilies = new HashMap<String, HATarget>();
+      }
+      return clusterFamilies;
+   }
+
+   protected void lockedStop() throws Exception
+   {
+      //TODO Remove
+//      try
+//      {
+//         proxyDeployer.stop();
+//      }
+//      catch (Exception ignore)
+//      {
+//         log.debug("Proxy deployer stop failed", ignore);
+//      }
+      try
+      {
+         Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
+      }
+      catch (Exception ignore)
+      {
+         log.debug("Dispatcher unregister target failed", ignore);
+      }
+      super.lockedStop();
+   }
+
+   @Override
+   public List<Method> getVirtualMethods()
+   {
+      List<Method> virtualMethods = new ArrayList<Method>();
+      try
+      {
+         RemoteHome home = getAnnotation(RemoteHome.class);
+         if (home != null)
+         {
+            Method[] declaredMethods = home.value().getMethods();
+            for(Method declaredMethod : declaredMethods)
+               virtualMethods.add(declaredMethod);
+
+            declaredMethods = javax.ejb.EJBObject.class.getMethods();
+            for(Method declaredMethod : declaredMethods)
+               virtualMethods.add(declaredMethod);
+         }
+
+         LocalHome localHome = getAnnotation(LocalHome.class);
+         if (localHome != null)
+         {
+            Method[] declaredMethods = localHome.value().getMethods();
+            for(Method declaredMethod : declaredMethods)
+               virtualMethods.add(declaredMethod);
+
+            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+            for(Method declaredMethod : declaredMethods)
+               virtualMethods.add(declaredMethod);
+         }
+      }
+      catch (SecurityException e)
+      {
+         // TODO: privileged?
+         throw new RuntimeException(e);
+      }
+      return virtualMethods;
+   }
+   
+   
+//   /**
+//    * Obtains a List of all methods handled by the bean class
+//    * 
+//    * @return The methods handled by the bean class directly
+//    */
+//   @Override
+//   //FIXME: Should be adapted to use metadata view from metadata bridge
+//   // such that *-aop.xml annotations may be included
+//   public List<Method> getVirtualMethods()
+//   {
+//      // Initialize
+//      List<Method> virtualMethods = new ArrayList<Method>();
+//
+//      // Obtain Metadata
+//      JBossSessionBeanMetaData smd = this.getMetaData();
+//
+//      // Obtain CL
+//      ClassLoader cl = this.getClassloader();
+//
+//      /*
+//       * Business Remotes
+//       */
+//
+//      // Obtain all specified business remotes
+//      BusinessRemotesMetaData businessRemotes = smd.getBusinessRemotes();
+//      if (businessRemotes != null)
+//      {
+//         // For each business remote
+//         for (String businessRemote : businessRemotes)
+//         {
+//            // Load the Class
+//            Class<?> businessRemoteClass = null;
+//            try
+//            {
+//               businessRemoteClass = Class.forName(businessRemote, true, cl);
+//            }
+//            catch (ClassNotFoundException e)
+//            {
+//               throw new RuntimeException("Could not find specified business remote class: " + businessRemote, e);
+//            }
+//
+//            // Obtain all methods declared by the class
+//            Method[] declaredMethods = businessRemoteClass.getMethods();
+//
+//            // Add each method
+//            for (Method declaredMethod : declaredMethods)
+//            {
+//               virtualMethods.add(declaredMethod);
+//            }
+//         }
+//      }
+//
+//      /*
+//       * Business Locals
+//       */
+//
+//      // Obtain all specified business locals
+//      BusinessLocalsMetaData businessLocals = smd.getBusinessLocals();
+//      if (businessLocals != null)
+//      {
+//         // For each business local
+//         for (String businessLocal : businessLocals)
+//         {
+//            // Load the Class
+//            Class<?> businessLocalClass = null;
+//            try
+//            {
+//               businessLocalClass = Class.forName(businessLocal, true, cl);
+//            }
+//            catch (ClassNotFoundException e)
+//            {
+//               throw new RuntimeException("Could not find specified business local class: " + businessLocal, e);
+//            }
+//
+//            // Obtain all methods declared by the class
+//            Method[] declaredMethods = businessLocalClass.getMethods();
+//
+//            // Add each method
+//            for (Method declaredMethod : declaredMethods)
+//            {
+//               virtualMethods.add(declaredMethod);
+//            }
+//         }
+//      }
+//
+//      // Remote Home
+//      String remoteHomeClassName = smd.getHome();
+//      if (remoteHomeClassName != null)
+//      {
+//         Class<?> remoteHomeClass = null;
+//         try
+//         {
+//            remoteHomeClass = Class.forName(remoteHomeClassName, true, cl);
+//         }
+//         catch (ClassNotFoundException e)
+//         {
+//            throw new RuntimeException("Could not find specified Remote Home Class: " + remoteHomeClassName, e);
+//         }
+//         if (remoteHomeClass != null)
+//         {
+//            Method[] declaredMethods = remoteHomeClass.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//
+//            declaredMethods = javax.ejb.EJBObject.class.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//         }
+//      }
+//
+//      // Local Home
+//      String localHomeClassName = smd.getLocalHome();
+//      if (localHomeClassName != null)
+//      {
+//         Class<?> localHomeClass = null;
+//         try
+//         {
+//            localHomeClass = Class.forName(localHomeClassName, true, cl);
+//         }
+//         catch (ClassNotFoundException e)
+//         {
+//            throw new RuntimeException("Could not find specified Local Home Class: " + localHomeClass, e);
+//         }
+//         if (localHomeClass != null)
+//         {
+//            Method[] declaredMethods = localHomeClass.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//
+//            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//         }
+//      }
+//      
+//      log.debug("Found virtual methods: ");
+//      for(Method m : virtualMethods)
+//      {
+//         log.debug("\t" + m + " - " + MethodHashing.calculateHash(m));
+//      }
+//      
+//
+//      return virtualMethods;
+//   }
+   
+   /*
+   protected void createMethodMap()
+   {
+      super.createMethodMap();
+      try
+      {
+         RemoteHome home = (RemoteHome) resolveAnnotation(RemoteHome.class);
+         if (home != null)
+         {
+            Method[] declaredMethods = home.value().getMethods();
+            for (int i = 0; i < declaredMethods.length; i++)
+            {
+               long hash = MethodHashing.methodHash(declaredMethods[i]);
+               advisedMethods.put(hash, declaredMethods[i]);
+            }
+
+            declaredMethods = javax.ejb.EJBObject.class.getMethods();
+            for (int i = 0; i < declaredMethods.length; i++)
+            {
+               long hash = MethodHashing.methodHash(declaredMethods[i]);
+               advisedMethods.put(hash, declaredMethods[i]);
+            }
+         }
+
+         LocalHome localHome = (LocalHome) resolveAnnotation(LocalHome.class);
+         if (localHome != null)
+         {
+            Method[] declaredMethods = localHome.value().getMethods();
+            for (int i = 0; i < declaredMethods.length; i++)
+            {
+               long hash = MethodHashing.methodHash(declaredMethods[i]);
+               advisedMethods.put(hash, declaredMethods[i]);
+            }
+
+            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+            for (int i = 0; i < declaredMethods.length; i++)
+            {
+               long hash = MethodHashing.methodHash(declaredMethods[i]);
+               advisedMethods.put(hash, declaredMethods[i]);
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   */
+
+   public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
+   {
+      if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
+
+      InvocationResponse response = new InvocationResponse();
+      response.setContextInfo(responseContext);
+
+      response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
+
+      return response;
+   }
+
+   public static InvocationResponse marshallResponse(Invocation invocation, Object rtn, Map responseContext)
+           throws java.io.IOException
+   {
+      InvocationResponse response;
+      // marshall return value
+      if (rtn != null && invocation.getMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.IS_LOCAL) != null)
+      {
+         response = new InvocationResponse(new MarshalledObjectForLocalCalls(rtn));
+      }
+      else
+      {
+         response = new InvocationResponse(rtn);
+      }
+      response.setContextInfo(responseContext);
+      return response;
+   }
+   
+   /**
+    * Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one
+    * of the business interfaces (or home interface) of the bean.
+    * 
+    * TODO: work in progress
+    * 
+    * @param factory    the originating end point
+    * @param id         unique identifier (primary key), can be null for stateless
+    * @param method     the business or home method to invoke
+    * @param args       the arguments for the method
+    * @param provider   for asynchronous usage
+    * @deprecated Use "invoke" as defined by InvokableContext
+    */
+   @Deprecated
+   public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
+   {
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      pushEnc();
+      try
+      {
+         long hash = MethodHashing.calculateHash(method);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException(
+                    "Could not resolve beanClass method from proxy call: "
+                            + method.toString());
+         }
+
+         
+         // Handled now by SessionSpecContainer
+         //Method unadvisedMethod = info.getUnadvisedMethod();
+//         if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+//         {
+//            return invokeHomeMethod(factory, info, args);
+//         }
+//         else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+//         {
+//            return invokeEJBObjectMethod(factory, id, info, args);
+//         }
+
+         // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+         //StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info,null);
+         //EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+         nextInvocation.setAdvisor(getAdvisor());
+         nextInvocation.setArguments(args);
+         
+         // allow a container to supplement information into an invocation
+         nextInvocation = populateInvocation(nextInvocation);
+
+         ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+         return nextInvocation.invokeNext();
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+   
+   /**
+    * Create session to an EJB bean.
+    * 
+    * @param initParameterTypes     the parameter types used by the home's create method
+    * @param initParameterValues    the arguments for the home's create method
+    * @return   the identifier of the session
+    */
+   abstract public Serializable createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
+   
+   abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
+   
+   abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
+   
+   public Serializable createSession()
+   {
+      return createSession(new Class<?>[]{}, new Object[]{});
+   }
+   
+   /**
+    * Destroy a created session.
+    * 
+    * @param id     the identifier of the session
+    */
+   protected void destroySession(Object id)
+   {
+      throw new RuntimeException("NYI");
+   }
+   
+   /**
+    * Checks if this session bean binds to the given JNDI name.
+    */
+   @Override
+   public boolean hasJNDIBinding(String jndiName)
+   {
+      return proxyDeployer.hasJNDIBinding(jndiName);
+   }
+   
+   protected Object invokeEJBObjectMethod(Object id, MethodInfo info, Object args[]) throws Exception
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if(unadvisedMethod.getName().equals("getEJBHome"))
+      {
+         return this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
+      }
+      if(unadvisedMethod.getName().equals("getPrimaryKey"))
+      {
+         return id;
+      }
+      if(unadvisedMethod.getName().equals("isIdentical"))
+      {
+         // object has no identity
+         if(id == null)
+            return false;
+         
+         EJBObject bean = (EJBObject) args[0];
+
+         Object primaryKey = bean.getPrimaryKey();
+         if(primaryKey == null)
+            return false;
+
+         boolean isIdentical = id.equals(primaryKey);
+
+         return isIdentical;
+      }
+      if (unadvisedMethod.getName().equals("remove"))
+      {
+         destroySession(id);
+
+         return null;
+      }
+      throw new RuntimeException("NYI");
+   }
+   
+   /**
+    * Allow a container sub class to supplement an invocation. Per default nothing to supplement.
+    * 
+    * @param invocation
+    * @return
+    */
+   protected StatefulContainerInvocation populateInvocation(
+         StatefulContainerInvocation invocation)
+   {
+      return invocation;
+   }
+   
+   abstract protected void removeHandle(Handle handle) throws Exception;
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,86 +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.session;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.SessionContext;
-import javax.xml.rpc.handler.MessageContext;
-
-import org.jboss.ejb3.EJBContextImpl;
-import org.jboss.ejb3.stateless.StatelessBeanContext;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class SessionContextDelegateBase<J extends SessionContainer> extends EJBContextImpl<J, SessionBeanContext<J>>
-      implements
-         SessionContext
-{
-   // Class Members
-   @SuppressWarnings("unused")
-   private static final Logger log = Logger.getLogger(SessionContextDelegateBase.class);
-   
-   // Constructor
-   public SessionContextDelegateBase(SessionBeanContext<J> beanContext)
-   {
-      super(beanContext);
-   }
-   
-   // Specifications
-   
-   public abstract EJBLocalObject getEJBLocalObject() throws IllegalStateException;
-   
-   public abstract EJBObject getEJBObject() throws IllegalStateException;
-   
-   // Implementations
-   
-   public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException
-   {
-      if(businessInterface == null)
-         throw new IllegalStateException("businessInterface is null");
-      
-      return container.getBusinessObject(beanContext, businessInterface); 
-   }
-   
-   public Class<?> getInvokedBusinessInterface() throws IllegalStateException
-   {
-      return container.getInvokedBusinessInterface();
-   }
-   
-   public MessageContext getMessageContext() throws IllegalStateException
-   {
-      // disallowed for stateful session beans (EJB3 FR 4.4.1 p 81)
-      if(beanContext instanceof StatelessBeanContext)
-      {
-         MessageContext ctx = ((StatelessBeanContext) beanContext).getMessageContextJAXRPC();
-         if(ctx == null)
-            throw new IllegalStateException("No message context found");
-         return ctx;
-      }
-      throw new UnsupportedOperationException("Only stateless beans can have a message context");
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,88 @@
+/*
+ * 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.session;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.SessionContext;
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ejb3.EJBContextImpl;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class SessionContextDelegateBase<J extends SessionSpecContainer>
+      extends
+         EJBContextImpl<J, SessionBeanContext<J>>
+      implements
+         SessionContext
+{
+   // Class Members
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(SessionContextDelegateBase.class);
+   
+   // Constructor
+   public SessionContextDelegateBase(SessionBeanContext<J> beanContext)
+   {
+      super(beanContext);
+   }
+   
+   // Specifications
+   
+   public abstract EJBLocalObject getEJBLocalObject() throws IllegalStateException;
+   
+   public abstract EJBObject getEJBObject() throws IllegalStateException;
+   
+   // Implementations
+   
+   public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException
+   {
+      if(businessInterface == null)
+         throw new IllegalStateException("businessInterface is null");
+      
+      return container.getBusinessObject(beanContext, businessInterface); 
+   }
+   
+   public Class<?> getInvokedBusinessInterface() throws IllegalStateException
+   {
+      return container.getInvokedBusinessInterface();
+   }
+   
+   public MessageContext getMessageContext() throws IllegalStateException
+   {
+      // disallowed for stateful session beans (EJB3 FR 4.4.1 p 81)
+      if(beanContext instanceof StatelessBeanContext)
+      {
+         MessageContext ctx = ((StatelessBeanContext) beanContext).getMessageContextJAXRPC();
+         if(ctx == null)
+            throw new IllegalStateException("No message context found");
+         return ctx;
+      }
+      throw new UnsupportedOperationException("Only stateless beans can have a message context");
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,77 +0,0 @@
-package org.jboss.ejb3.session;
-
-import java.util.Hashtable;
-
-import org.jboss.aop.Domain;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * SessionSpecContainer
- * 
- * A SessionContainer with support for Session Beans defined 
- * specifically by the EJB3 Specification
- * 
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class SessionSpecContainer extends SessionContainer
-{
-   
-   // Constructor
-   
-   public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
-         Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData)
-         throws ClassNotFoundException
-   {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
-   }
-   
-   /**
-    * Create a remote proxy (EJBObject) for an enterprise bean identified by id
-    * 
-    * @param id
-    * @return
-    * @throws Exception
-    */
-   public Object createProxyRemoteEjb21(String businessInterfaceType) throws Exception
-   {
-      RemoteBinding binding = this.getRemoteBinding();
-      return this.createProxyRemoteEjb21(binding, businessInterfaceType);
-   }
-
-   /**
-    * Create a remote proxy (EJBObject) for an enterprise bean identified by id on a given binding
-    * 
-    * @param id
-    * @param binding
-    * @return
-    * @throws Exception
-    */
-   public abstract Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception;
-
-   /**
-    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id
-    * 
-    * @param id
-    * @return
-    * @throws Exception
-    */
-   public Object createProxyLocalEjb21(String businessInterfaceType) throws Exception
-   {
-      LocalBinding binding = this.getAnnotation(LocalBinding.class);
-      return this.createProxyLocalEjb21(binding, businessInterfaceType);
-   }
-
-   /**
-    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
-    * the specified LocalBinding
-    * 
-    * @param id
-    * @return
-    * @throws Exception
-    */
-   public abstract Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception;
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java (from rev 76878, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,653 @@
+package org.jboss.ejb3.session;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.proxy.ClassProxy;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.ThreadLocalStack;
+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.common.lang.SerializableMethod;
+import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandlerBase;
+import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
+import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.stateful.StatefulContainerInvocation;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.RemoteBindingMetaData;
+
+/**
+ * SessionSpecContainer
+ * 
+ * A SessionContainer with support for Session Beans defined 
+ * specifically by the EJB3 Specification
+ * 
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class SessionSpecContainer extends SessionContainer implements InvokableContext
+{
+
+   // ------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(SessionSpecContainer.class);
+   
+   /**
+    * The method invoked upon by the client
+    */
+   //TODO: Remove when CurrentInvocation is completely sorted out
+   @Deprecated 
+   protected static ThreadLocalStack<SerializableMethod> invokedMethod = new ThreadLocalStack<SerializableMethod>();
+
+   // ------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private JndiSessionRegistrarBase jndiRegistrar;
+
+   // ------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+         Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData)
+         throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+   }
+
+   /**
+    * Create a remote proxy (EJBObject) for an enterprise bean identified by id
+    * 
+    * @param id
+    * @return
+    * @throws Exception
+    */
+   public Object createProxyRemoteEjb21(String businessInterfaceType) throws Exception
+   {
+      RemoteBinding binding = this.getRemoteBinding();
+      return this.createProxyRemoteEjb21(binding, businessInterfaceType);
+   }
+
+   /**
+    * Create a remote proxy (EJBObject) for an enterprise bean identified by id on a given binding
+    * 
+    * @param id
+    * @param binding
+    * @return
+    * @throws Exception
+    */
+   public abstract Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception;
+
+   /**
+    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id
+    * 
+    * @param id
+    * @return
+    * @throws Exception
+    */
+   public Object createProxyLocalEjb21(String businessInterfaceType) throws Exception
+   {
+      LocalBinding binding = this.getAnnotation(LocalBinding.class);
+      return this.createProxyLocalEjb21(binding, businessInterfaceType);
+   }
+
+   /**
+    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
+    * the specified LocalBinding
+    * 
+    * @param id
+    * @return
+    * @throws Exception
+    */
+   public abstract Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception;
+
+   /**
+    * Invokes the method described by the specified serializable method
+    * as called from the specified proxy, using the specified arguments
+    * 
+    * @param proxy The proxy making the invocation
+    * @param method The method to be invoked
+    * @param args The arguments to the invocation
+    * @throws Throwable A possible exception thrown by the invocation
+    * @return
+    */
+   public Object invoke(Object proxy, SerializableMethod method, Object[] args) throws Throwable
+   {
+      /*
+       * Replace the TCL with the CL for this Container
+       */
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+      
+      // Push the ENC onto the Stack
+      pushEnc();
+      
+      try
+      {
+         
+         /*
+          * Obtain the target method (advised)
+          */
+         Method unadvisedMethod = method.toMethod(this.getClassloader());
+         long hash = MethodHashing.calculateHash(unadvisedMethod);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException("Method invocation via Proxy could not be found handled for EJB "
+                  + this.getEjbName() + " : " + method.toString()
+                  + ", probable error in virtual method registration w/ Advisor for the Container");
+         }
+
+         // Obtain Invocation Handler
+         //TODO Ugly, use polymorphism and get Session ID for SFSB only
+         assert Proxy.isProxyClass(proxy.getClass());
+         SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler)Proxy.getInvocationHandler(proxy);
+         Object sessionId = null;
+         if (handler instanceof StatefulProxyInvocationHandlerBase)
+         {
+            sessionId = ((StatefulProxyInvocationHandlerBase) handler).getSessionId();
+         }
+         
+         /*
+          * Invoke directly if this is an EJB2.x Method
+          */
+
+         if (unadvisedMethod != null && isHomeMethod(method))
+         {
+            return invokeHomeMethod(method, args);
+         }
+         else if (unadvisedMethod != null && this.isEjbObjectMethod(method))
+         {
+            return invokeEJBObjectMethod(sessionId, info, args);
+         }
+
+         // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
+         //TODO Use Polymorphism to have sessions only in StatefulContainer
+         
+//         Interceptor[] interceptors, long methodHash, Method advisedMethod,
+//         Method unadvisedMethod, SerializableMethod invokedMethod, Advisor advisor
+         
+//         StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info
+//               .getInterceptors(), hash, info.getAdvisedMethod(), info.getUnadvisedMethod(), method, getAdvisor());
+         
+         /*
+          * Build an invocation
+          */
+         
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info,sessionId);
+         nextInvocation.getMetaData().addMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
+               SessionSpecRemotingMetadata.KEY_INVOKED_METHOD, method);
+         nextInvocation.setArguments(args);
+         
+         
+         //nextInvocation.setAdvisor(getAdvisor());
+         //nextInvocation.setSessionId(sessionId);
+//         EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, sessionId);
+//         nextInvocation.setAdvisor(getAdvisor());
+//         nextInvocation.setArguments(args);
+
+         // allow a container to supplement information into an invocation
+         //nextInvocation = populateInvocation(nextInvocation);
+
+         //TODO Support Async Invocation
+         //         ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+        
+         
+         try
+         {
+            /*
+             * Invoke
+             */
+            
+            invokedMethod.push(method);
+            return nextInvocation.invokeNext();
+         }
+         finally
+         {
+            invokedMethod.pop();
+         }
+
+
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+
+   public Class<?> getInvokedBusinessInterface()
+   {
+      //TODO Should be getting from current invocation
+      SerializableMethod invokedMethod = SessionSpecContainer.invokedMethod.get();
+      assert invokedMethod!=null : "Invoked Method has not been set";
+      String interfaceName = invokedMethod.getActualClassName();
+      assert interfaceName !=null && interfaceName.trim().length()>0 : "Target Business Interface is not available on invoked method";
+      Class<?> invokedInterface = null;
+      
+      try
+      {
+         invokedInterface = Class.forName(interfaceName, false, this.getClassloader());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Invoked Business Interface on Proxy was set to " + interfaceName
+               + ", but this could not be loaded by the " + ClassLoader.class.getSimpleName() + " for " + this);
+      }
+//      if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+//      if (method.getName() == null || method.getName().equals("")) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+      
+//      String invokedBusinessInterfaceClassName = method.getActualClassName();
+//      Class<?> invokedBusinessInterface = null;
+//      try
+//      {
+//         invokedBusinessInterface = this.getClassloader().loadClass(invokedBusinessInterfaceClassName);
+//      }
+//      catch (ClassNotFoundException e)
+//      {
+//         throw new RuntimeException("Invoked Business Interface on Proxy was set to "
+//               + invokedBusinessInterfaceClassName + ", but this could not be loaded by the "
+//               + ClassLoader.class.getSimpleName() + " for " + this);
+//      }
+      
+      return invokedInterface;
+   }
+   
+   /**
+    * Provides implementation for this bean's EJB 2.1 Home.create() method 
+    * 
+    * @param method
+    * @param args
+    * @return
+    * @throws Exception
+    */
+   protected abstract Object invokeHomeCreate(SerializableMethod method, Object args[]) throws Exception;
+
+   /**
+    * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
+    */
+   //TODO
+   private Object invokeHomeMethod(SerializableMethod method, Object args[]) throws Exception
+   {
+      if (method.getName().equals(Ejb2xMethodNames.METHOD_NAME_HOME_CREATE))
+      {
+         return this.invokeHomeCreate(method, args);
+      }
+      else if (method.getName().equals(Ejb2xMethodNames.METHOD_NAME_HOME_REMOVE))
+      {
+         if (args[0] instanceof Handle)
+            removeHandle((Handle) args[0]);
+         else
+            destroySession(args[0]);
+
+         return null;
+      }
+      else
+      {
+         throw new IllegalArgumentException("illegal home method " + method);
+      }
+   }
+
+   /**
+    * @deprecated Use isHomeMethod(SerializableMethod method) in SessionSpecContainer
+    */
+   @Deprecated
+   protected boolean isHomeMethod(Method method)
+   {
+      if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass()))
+         return true;
+      if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass()))
+         return true;
+      return false;
+   }
+
+   /**
+    * Determines whether the specified method is an EJB2.x Home Method
+    * 
+    * @param method
+    * @return
+    */
+   protected boolean isHomeMethod(SerializableMethod method)
+   {
+      // Get the Method
+      Method invokingMethod = method.toMethod(this.getClassloader());
+
+      // Use legacy
+      return this.isHomeMethod(invokingMethod);
+   }
+
+   /**
+    * @param method
+    * @return
+    * @deprecated Use isEjbObjectMethod(SerializableMethod method)
+    */
+   @Deprecated
+   protected boolean isEJBObjectMethod(Method method)
+   {
+      /*
+       * Initialize
+       */
+      
+      // Get the declaring class
+      Class<?> declaringClass = method.getDeclaringClass();
+      
+      /*
+       * Test if declared by EJBObject/EJBLocalObject
+       */
+      
+      if (declaringClass.getName().equals(EJBObject.class.getName()))
+         return true;
+
+      if (declaringClass.getName().equals(EJBLocalObject.class.getName()))
+         return true;
+
+      return false;
+   }
+
+   /**
+    * Determines whether the specified method is an EJB2.x Local 
+    * or Remote Method
+    * 
+    * @param method
+    * @return
+    */
+   protected boolean isEjbObjectMethod(SerializableMethod method)
+   {
+      
+      /*
+       * Initialize
+       */
+      
+      // Get the declaring class
+      Class<?> declaringClass = null;
+      String declaringClassName = method.getDeclaringClassName();
+      try
+      {
+         declaringClass = Class.forName(declaringClassName, false, this.getClassloader());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Invoked Method specifies a declaring class that could not be loaded by the "
+               + ClassLoader.class.getSimpleName() + " for EJB " + this.getEjbName());
+      }
+      
+      /*
+       * Test if declared by EJBObject/EJBLocalObject
+       */
+      
+      if (declaringClass.getName().equals(EJBObject.class.getName()))
+         return true;
+
+      if (declaringClass.getName().equals(EJBLocalObject.class.getName()))
+         return true;
+
+      // If we've reached here, not EJBObject/EJBLocalObject
+      return false;
+   }
+
+   /**
+    * 
+    * @param method
+    * @return
+    * @deprecated Use isHandleMethod(SerializableMethod method)
+    */
+   @Deprecated
+   protected boolean isHandleMethod(Method method)
+   {
+      if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
+         return true;
+
+      return false;
+   }
+
+   /**
+    * Determines if the specified Method is a Handle Method
+    * @param method
+    * @return
+    */
+   protected boolean isHandleMethod(SerializableMethod method)
+   {
+      // Get the Method
+      Method invokingMethod = method.toMethod(this.getClassloader());
+
+      // Use legacy
+      return this.isHandleMethod(invokingMethod);
+   }
+   
+   /**
+    * Registers this Container with Remoting / AOP Dispatcher
+    */
+   @Override
+   protected void registerWithAopDispatcher()
+   {
+      String registrationName = this.getObjectName().getCanonicalName();
+      ClassProxy classProxy = new InvokableContextClassProxyHack(this);
+      
+      // So that Remoting layer can reference this container easily.
+      Dispatcher.singleton.registerTarget(registrationName, classProxy);
+      
+      // Log
+      log.debug("Registered " + this + " with " + Dispatcher.class.getName() + " via "
+            + InvokableContextClassProxyHack.class.getSimpleName() + " at key " + registrationName);
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Lifecycle Methods ------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public static ClassLoader TMP_CL = null;
+   
+   /**
+    * Lifecycle Start
+    */
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      log.info("Starting " + this);
+
+      super.lockedStart();
+
+      //TODO
+      /*
+       * Temporary Hack Alert
+       * 
+       * Populate JBoss-specific metadata until this is done by
+       * AnnotationMetaDataDeployer and MergedJBossMetaDataDeployer
+       * 
+       * http://jira.jboss.com/jira/browse/JBMETA-45
+       * http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157770
+       */
+      log.warn("Populating JBoss-specific annotation metadata manually until done by deployers: " + this);
+
+      // Obtain annotations 
+      RemoteBindings remoteBindings = this.getAnnotation(RemoteBindings.class);
+      RemoteBinding remoteBinding = this.getAnnotation(RemoteBinding.class);
+      RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+      LocalHomeBinding localHomeBinding = this.getAnnotation(LocalHomeBinding.class);
+      //      LocalBinding localBinding = this.getAnnotation(LocalBinding.class); // < No LocalBindingMetaData?
+
+      // Create a Set to hold RemoteBindings
+      Set<RemoteBinding> remoteBindingsSet = new HashSet<RemoteBinding>();
+
+      // Populate Set with Remote Bindings
+      if (remoteBindings != null)
+      {
+         for (RemoteBinding binding : remoteBindings.value())
+         {
+            remoteBindingsSet.add(binding);
+         }
+      }
+      if (remoteBinding != null)
+      {
+         remoteBindingsSet.add(remoteBinding);
+      }
+
+      // Ensure remote bindings metadata is not null
+      List<RemoteBindingMetaData> rbmd = this.getMetaData().getRemoteBindings();
+      if (rbmd == null || rbmd.size() == 0)
+      {
+         rbmd = new ArrayList<RemoteBindingMetaData>();
+         this.getMetaData().setRemoteBindings(rbmd);
+      }
+
+      // For each remote binding, populate metadata
+      for (RemoteBinding binding : remoteBindingsSet)
+      {
+         RemoteBindingMetaData md = new RemoteBindingMetaData();
+         md.setClientBindUrl(binding.clientBindUrl());
+         md.setInterceptorStack(binding.interceptorStack());
+         md.setJndiName(binding.jndiBinding());
+         md.setProxyFactory(binding.factory());
+         //TODO binding.invokerName?
+         rbmd.add(md);
+      }
+
+      // Populate metadata for @RemoteHomeBinding
+      if (remoteHomeBinding != null)
+      {
+         this.getMetaData().setHomeJndiName(remoteHomeBinding.jndiBinding());
+      }
+
+      // Populate metadata for @LocalHomeBinding
+      if (localHomeBinding != null)
+      {
+         this.getMetaData().setLocalHomeJndiName(localHomeBinding.jndiBinding());
+      }
+
+      /*
+       * End Temporary Hack
+       */
+
+      // Obtain registrar
+      JndiSessionRegistrarBase registrar = this.getJndiRegistrar();
+
+      // Bind all appropriate references/factories to Global JNDI for Client access, if a JNDI Registrar is present
+      if (registrar != null)
+      {
+         String guid = Ejb3Registry.guid(this);
+         registrar.bindEjb(this.getInitialContext(), this.getMetaData(), this.getClassloader(), this.getObjectName()
+               .getCanonicalName(), guid, this.getAdvisor());
+      }
+      else
+      {
+         log.warn("No " + JndiSessionRegistrarBase.class.getSimpleName()
+               + " was found; byassing binding of Proxies to " + this.getName() + " in Global JNDI.");
+      }
+      
+      //TODO Remove
+      TMP_CL = this.getClassloader();
+   }
+
+   /**
+    * Lifecycle Stop
+    */
+   @Override
+   protected void lockedStop() throws Exception
+   {
+      log.info("Stopping " + this);
+
+      super.lockedStop();
+
+      // Deregister with Remoting
+      Dispatcher.singleton.unregisterTarget(this.getName());
+
+      // Unbind applicable JNDI Entries
+      JndiSessionRegistrarBase jndiRegistrar = this.getJndiRegistrar();
+      if (jndiRegistrar != null)
+      {
+         jndiRegistrar.unbindEjb(this.getInitialContext(), this.getMetaData());
+      }
+
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Contracts ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected abstract String getJndiRegistrarBindName();
+
+   // --------------------------------------------------------------------------------||
+   // Accessors / Mutators -----------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the JndiSessionRegistrarBase from MC, null if not found
+    * 
+    * @return
+    */
+   protected JndiSessionRegistrarBase getJndiRegistrar()
+   {
+      // If defined already, use it
+      if (this.jndiRegistrar != null)
+      {
+         return this.jndiRegistrar;
+      }
+
+      // Initialize
+      String jndiRegistrarBindName = this.getJndiRegistrarBindName();
+
+      // Obtain Registrar
+      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
+
+      // Lookup
+      Object obj = null;
+      try
+      {
+         obj = registrar.lookup(jndiRegistrarBindName);
+         this.setJndiRegistrar(jndiRegistrar);
+      }
+      // If not installed, warn and return null
+      catch (NotBoundException e)
+      {
+         log.warn("No " + JndiSessionRegistrarBase.class.getName()
+               + " was found installed in the ObjectStore (Registry) at " + jndiRegistrarBindName);
+         return null;
+
+      }
+
+      // Cast
+      JndiSessionRegistrarBase jndiRegistrar = (JndiSessionRegistrarBase) obj;
+
+      // Return
+      return jndiRegistrar;
+   }
+
+   public void setJndiRegistrar(JndiSessionRegistrarBase jndiRegistrar)
+   {
+      this.jndiRegistrar = jndiRegistrar;
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,1201 +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.stateful;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.rmi.NoSuchObjectException;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.Init;
-import javax.ejb.NoSuchEJBException;
-import javax.ejb.NoSuchObjectLocalException;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.RemoteHome;
-import javax.ejb.RemoveException;
-import javax.ejb.TimerService;
-
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.annotation.Cache;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.cache.CacheFactoryRegistry;
-import org.jboss.ejb3.cache.Ejb3CacheFactory;
-import org.jboss.ejb3.cache.StatefulCache;
-import org.jboss.ejb3.cache.StatefulObjectFactory;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulRemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.StatefulLocalProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.StatefulProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory;
-import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.injection.Injector;
-import org.jboss.injection.JndiPropertyInjector;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulContainer extends SessionSpecContainer implements StatefulObjectFactory<StatefulBeanContext>
-{
-   private static final Logger log = Logger.getLogger(StatefulContainer.class);
-
-   protected StatefulCache cache;
-   private StatefulDelegateWrapper mbean = new StatefulDelegateWrapper(this);
-
-   public StatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
-                            Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
-   {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
-   }
-
-   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
-   {
-      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
-      // Tell context how to handle replication
-      CacheConfig config = getAnnotation(CacheConfig.class);
-      if (config != null)
-      {
-         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
-      }
-
-      // this is for propagated extended PC's
-      sfctx = sfctx.pushContainedIn();
-      
-      pushContext(sfctx);
-      try
-      {
-         if (injectors != null)
-         {
-            for (Injector injector : injectors)
-            {
-               injector.inject(sfctx);
-            }
-         }
-
-         sfctx.initialiseInterceptorInstances();
-
-      }
-      finally
-      {
-         popContext();
-         // this is for propagated extended PC's
-         sfctx.popContainedIn();
-      }
-      
-      invokePostConstruct(sfctx, initValues);
-      
-      //TODO This needs to be reimplemented as replacement for create() on home interface
-      invokeInit(sfctx.getInstance(), initTypes, initValues);
-      
-      return sfctx;
-   }
-   
-   @Override
-   public BeanContext<?> createBeanContext()
-   {
-      return new StatefulBeanContext(this, construct());
-   }
-   
-   @Override
-   protected StatefulLocalProxyFactory getProxyFactory(LocalBinding binding)
-   {
-      StatefulLocalProxyFactory factory = (StatefulLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
-
-      if (factory == null)
-      {
-         factory = new StatefulLocalProxyFactory(this, binding);
-
-         try
-         {
-            factory.init();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-      
-      return factory;
-   }
-   
-   public Object createProxyLocalEjb21(Object id, LocalBinding binding, String businessInterfaceType) throws Exception
-   {
-      StatefulLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
-      return proxyFactory.createProxyEjb21(id,businessInterfaceType);
-   }
-   
-   public Object createProxyRemoteEjb21(Object id, String businessInterfaceType) throws Exception
-   {
-      RemoteBinding binding = this.getRemoteBinding();
-      return this.createProxyRemoteEjb21(id,binding, businessInterfaceType);
-   }
-
-   public Object createProxyRemoteEjb21(Object id, RemoteBinding binding, String businessInterfaceType) throws Exception
-   { 
-      BaseStatefulRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
-      return proxyFactory.createProxyEjb21(id, businessInterfaceType);
-   }
-   
-   public Object createProxyLocalEjb21(Object id, String businessInterfaceType) throws Exception
-   {
-      LocalBinding binding = this.getAnnotation(LocalBinding.class);
-      return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
-   }
-   
-   @Override
-   public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
-   {
-      Object id = this.createSession();
-      return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
-   }
-
-   @Override
-   public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
-   {
-      Object id = this.createSession();
-      return this.createProxyRemoteEjb21(id, binding, businessInterfaceType);
-   }
-   
-   @Override
-   protected BaseStatefulRemoteProxyFactory getProxyFactory(RemoteBinding binding)
-   {
-      BaseStatefulRemoteProxyFactory factory = (BaseStatefulRemoteProxyFactory) this.proxyDeployer
-            .getProxyFactory(binding);
-
-      if (factory == null)
-      {
-
-         Clustered clustered = getAnnotation(Clustered.class);
-         if (clustered != null)
-         {
-            factory = new StatefulClusterProxyFactory(this, binding, clustered);
-         }
-         else
-         {
-            factory = new StatefulRemoteProxyFactory(this, binding);
-         }
-         
-         try
-         {
-            factory.init();
-         }
-         catch(Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-
-      return factory;
-   }
-   
-   public void destroy(StatefulBeanContext ctx)
-   {
-      try
-      {
-         invokePreDestroy(ctx);
-      }
-      finally
-      {
-         ctx.remove();
-      }
-   }
-   
-   public Object getMBean()
-   {
-      return mbean;
-   }
-   
-   /**
-    * Creates and starts the configured cache, if not
-    * started already
-    * 
-    * @throws Exception
-    */
-   protected void createAndStartCache() throws Exception {
-      
-      // If Cache is initialized, exit
-      if(this.cache!=null && this.cache.isStarted())
-      {
-         return;
-      }
-      
-      Cache cacheConfig = getAnnotation(Cache.class);
-      CacheFactoryRegistry registry = getCacheFactoryRegistry();
-      Ejb3CacheFactory factory = registry.getCacheFactory(cacheConfig.value());
-      this.cache = factory.createCache();
-      this.cache.initialize(this);
-      this.cache.start();
-   }
-   
-   @Override
-   protected void lockedStart() throws Exception
-   {
-      try
-      {
-         super.lockedStart();
-         this.createAndStartCache();
-      }
-      catch (Exception e)
-      {
-         try
-         {
-            this.lockedStop();
-         }
-         catch (Exception ignore)
-         {
-            log.debug("Failed to cleanup after start() failure", ignore);
-         }
-         throw e;
-      }
-
-   }
-
-   @Override
-   protected void lockedStop() throws Exception
-   {
-      if (cache != null) cache.stop();
-      
-      super.lockedStop();
-   }
-
-   public StatefulCache getCache()
-   {
-      // Ensure initialized
-      try{
-         this.createAndStartCache();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-      
-      // Return
-      return cache;
-   }
-   
-   public CacheFactoryRegistry getCacheFactoryRegistry()
-   {
-      return this.getDeployment().getCacheFactoryRegistry();
-   }
-
-   /**
-    * Performs a synchronous local invocation
-    */
-   public Object localInvoke(Object id, Method method, Object[] args)
-           throws Throwable
-   {
-      return localInvoke(id, method, args, null);
-   }
-
-   /**
-    * Performs a synchronous or asynchronous local invocation
-    *
-    */
-   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
-   {
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      pushEnc();
-      try
-      {
-         long hash = MethodHashing.calculateHash(method);
-         MethodInfo info = getAdvisor().getMethodInfo(hash);
-         if (info == null)
-         {
-            throw new RuntimeException(
-                    "Could not resolve beanClass method from proxy call: "
-                            + method.toString());
-         }
-         return invokeLocalHomeMethod(info, args);
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-         popEnc();
-      }
-   }
-
-   /**
-    * Performs a synchronous or asynchronous local invocation
-    *
-    * @param provider If null a synchronous invocation, otherwise an asynchronous
-    */
-   public Object localInvoke(Object id, Method method, Object[] args,
-         FutureHolder provider) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      pushEnc();
-      try
-      {
-         long hash = MethodHashing.calculateHash(method);
-         MethodInfo info = getAdvisor().getMethodInfo(hash);
-         if (info == null)
-         {
-            throw new RuntimeException(
-                  "Could not resolve beanClass method from proxy call: "
-                  + method.toString());
-         }
-      
-         Method unadvisedMethod = info.getUnadvisedMethod();
-      
-         try
-         {
-            invokeStats.callIn();
-      
-            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-            {
-               return invokeLocalHomeMethod(info, args);
-            }
-            else if (unadvisedMethod != null
-                  && isEJBObjectMethod(unadvisedMethod))
-            {
-               return invokeEJBLocalObjectMethod(id, info, args);
-            }
-            
-            StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
-            nextInvocation.setAdvisor(getAdvisor());
-            nextInvocation.setArguments(args);
-            
-            ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
-            
-            invokedMethod.push(new InvokedMethod(true, method));
-            return nextInvocation.invokeNext();
-         }
-         finally
-         {
-            if (unadvisedMethod != null)
-            {
-               long end = System.currentTimeMillis();
-               long elapsed = end - start;
-               invokeStats.updateStats(unadvisedMethod, elapsed);
-            }
-         
-            invokeStats.callOut();
-            
-            invokedMethod.pop();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-         popEnc();
-      }
-   }
-   
-   /**
-    * Create a stateful bean and return its oid.
-    *
-    * @return
-    */
-   public Object createSession(Class<?>[] initTypes, Object[] initValues)
-   {
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      pushEnc();
-      try
-      {
-         Thread.currentThread().setContextClassLoader(classloader);
-         StatefulCache cache = this.getCache();
-         StatefulBeanContext ctx = cache.create(initTypes, initValues);
-         // Since we return the key here, the context is not in use.
-         cache.release(ctx);
-         return ctx.getId();
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-         popEnc();
-      }
-   }
-
-   protected void destroySession(Object id)
-   {
-      getCache().remove(id);
-   }
-
-   /**
-    * This should be a remote invocation call
-    *
-    * @param invocation
-    * @return
-    * @throws Throwable
-    */
-   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      EJBContainerInvocation newSi = null;
-      pushEnc();
-      try
-      {
-         Thread.currentThread().setContextClassLoader(classloader);
-         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
-         MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
-         if (info == null)
-         {
-            throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
-         }
-
-         InvocationResponse response = null;
-         Method unadvisedMethod = info.getUnadvisedMethod();
-         Object newId = null;
-         
-         try
-         {
-            invokeStats.callIn();
-            
-            if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-            {
-               response = invokeHomeMethod(info, si);
-            }
-            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-            {
-               response = invokeEJBObjectMethod(info, si);
-            }
-            else
-            {
-               if (unadvisedMethod.isBridge())
-               {
-                  unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
-                  info = super.getMethodInfo(unadvisedMethod);
-               }
-               
-               if (si.getId() == null)
-               {
-                  StatefulBeanContext ctx = getCache().create(null, null);
-                  newId = ctx.getId();
-               }
-               else
-               {
-                  newId = si.getId();
-               }
-               newSi = new StatefulContainerInvocation(info, newId);
-               newSi.setArguments(si.getArguments());
-               newSi.setMetaData(si.getMetaData());
-               newSi.setAdvisor(getAdvisor());
-   
-               Object rtn = null;
-                 
-               invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
-               rtn = newSi.invokeNext();
-
-               response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
-               if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
-            }
-         }
-         catch (Throwable throwable)
-         {
-            Throwable exception = throwable;
-            if (newId != null)
-            {
-               exception = new ForwardId(throwable, newId);
-            }
-            Map responseContext = null;
-            if (newSi != null) newSi.getResponseContextInfo();
-            response = marshallException(invocation, exception, responseContext);
-            return response;
-         }
-         finally
-         {
-            if (unadvisedMethod != null)
-            {
-               long end = System.currentTimeMillis();
-               long elapsed = end - start;
-               invokeStats.updateStats(unadvisedMethod, elapsed);
-            }
-            
-            invokeStats.callOut();
-            
-            invokedMethod.pop();
-         }
-
-         return response;
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-         popEnc();
-      }
-   }
-
-
-   public TimerService getTimerService()
-   {
-      throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)");
-   }
-
-   public TimerService getTimerService(Object pKey)
-   {
-      return getTimerService();
-   }
-   
-   @Override
-   public void invokePostActivate(BeanContext beanContext)
-   {
-      for (Injector injector : injectors)
-      {
-         if (injector instanceof JndiPropertyInjector)
-         {
-            AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();
-            
-            if (field.isAnnotationPresent(javax.ejb.EJB.class))
-            {
-               continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
-            }
-            
-            if (field instanceof Field)
-            {
-               // reinject transient fields
-               if ((((Field)field).getModifiers() & Modifier.TRANSIENT) > 0)
-                  injector.inject(beanContext);
-            }
-         }
-      }
-      
-      this.invokeCallback(beanContext, PostActivate.class);
-   }
-
-   @Override
-   public void invokePrePassivate(BeanContext beanContext)
-   {
-      this.invokeCallback(beanContext, PrePassivate.class);
-   }
-
-   /*
-   @Override
-   protected Class[] getHandledCallbacks()
-   {
-      return new Class[]
-              {PostConstruct.class, PreDestroy.class, PostActivate.class,
-                      PrePassivate.class};
-   }
-   */
-
-   public void invokeInit(Object bean, Class[] initParameterTypes,
-                          Object[] initParameterValues)
-   {
-      int numParameters = 0;
-      if(initParameterTypes != null)
-         numParameters = initParameterTypes.length;
-      try
-      {
-         for(Method method : bean.getClass().getDeclaredMethods())
-         {
-            if(numParameters != method.getParameterTypes().length)
-               continue;
-            
-            if ((method.getAnnotation(Init.class) != null)
-                    || (resolveAnnotation(method, Init.class) != null))
-            {
-               if(initParameterTypes != null)
-               {
-                  Object[] parameters = getInitParameters(method,
-                          initParameterTypes, initParameterValues);
-   
-                  if (parameters != null)
-                     method.invoke(bean, parameters);
-               }
-               else
-               {
-                  method.invoke(bean);
-               }
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   protected Object[] getInitParameters(Method method,
-                                        Class[] initParameterTypes, Object[] initParameterValues)
-   {
-      if (method.getParameterTypes().length == initParameterTypes.length)
-      {
-         for (int i = 0; i < initParameterTypes.length; ++i)
-         {
-            Class formal = method.getParameterTypes()[i];
-            Class actual = initParameterTypes[i];
-            if (!isMethodInvocationConvertible(formal, actual == null ? null
-                    : actual))
-               return null;
-         }
-         return initParameterValues;
-      }
-      return null;
-   }
-
-   /**
-    * Determines whether a type represented by a class object is convertible to
-    * another type represented by a class object using a method invocation
-    * conversion, treating object types of primitive types as if they were
-    * primitive types (that is, a Boolean actual parameter type matches boolean
-    * primitive formal type). This behavior is because this method is used to
-    * determine applicable methods for an actual parameter list, and primitive
-    * types are represented by their object duals in reflective method calls.
-    *
-    * @param formal the formal parameter type to which the actual parameter type
-    *               should be convertible
-    * @param actual the actual parameter type.
-    * @return true if either formal type is assignable from actual type, or
-    *         formal is a primitive type and actual is its corresponding object
-    *         type or an object type of a primitive type that can be converted
-    *         to the formal type.
-    */
-   private static boolean isMethodInvocationConvertible(Class formal,
-                                                        Class actual)
-   {
-      /*
-       * if it's a null, it means the arg was null
-       */
-      if (actual == null && !formal.isPrimitive())
-      {
-         return true;
-      }
-      /*
-       * Check for identity or widening reference conversion
-       */
-      if (actual != null && formal.isAssignableFrom(actual))
-      {
-         return true;
-      }
-      /*
-       * Check for boxing with widening primitive conversion. Note that actual
-       * parameters are never primitives.
-       */
-      if (formal.isPrimitive())
-      {
-         if (formal == Boolean.TYPE && actual == Boolean.class)
-            return true;
-         if (formal == Character.TYPE && actual == Character.class)
-            return true;
-         if (formal == Byte.TYPE && actual == Byte.class)
-            return true;
-         if (formal == Short.TYPE
-                 && (actual == Short.class || actual == Byte.class))
-            return true;
-         if (formal == Integer.TYPE
-                 && (actual == Integer.class || actual == Short.class || actual == Byte.class))
-            return true;
-         if (formal == Long.TYPE
-                 && (actual == Long.class || actual == Integer.class
-                 || actual == Short.class || actual == Byte.class))
-            return true;
-         if (formal == Float.TYPE
-                 && (actual == Float.class || actual == Long.class
-                 || actual == Integer.class || actual == Short.class || actual == Byte.class))
-            return true;
-         if (formal == Double.TYPE
-                 && (actual == Double.class || actual == Float.class
-                 || actual == Long.class || actual == Integer.class
-                 || actual == Short.class || actual == Byte.class))
-            return true;
-      }
-      return false;
-   }
-
-   private Object invokeEJBLocalObjectMethod(Object id, MethodInfo info,
-                                             Object[] args) throws Exception
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("remove"))
-      {
-         try
-         {
-            destroySession(id);
-         }
-         catch(NoSuchEJBException e)
-         {
-            throw new NoSuchObjectLocalException(e.getMessage(), e);
-         }
-
-         return null;
-      }
-      else if (unadvisedMethod.getName().equals("getEJBLocalHome"))
-      {
-         Object bean = getCache().get(id).getInstance();
-
-         return bean;
-      }
-      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
-      {
-         return id;
-      }
-      else if (unadvisedMethod.getName().equals("isIdentical"))
-      {
-         EJBObject bean = (EJBObject) args[0];
-
-         Object primaryKey = bean.getPrimaryKey();
-
-         boolean isIdentical = id.equals(primaryKey);
-
-         return isIdentical;
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   private Object invokeLocalHomeMethod(MethodInfo info, Object[] args)
-           throws Exception
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().startsWith("create"))
-      {
-         Class<?>[] initParameterTypes =
-                 {};
-         Object[] initParameterValues =
-                 {};
-         if (unadvisedMethod.getParameterTypes().length > 0)
-         {
-            initParameterTypes = unadvisedMethod.getParameterTypes();
-            initParameterValues = args;
-         }
-
-         LocalBinding binding = this.getAnnotation(LocalBinding.class);
-
-         StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
-         factory.init();
-
-         Object proxy = factory.createProxyEjb21(initParameterTypes,
-                 initParameterValues, unadvisedMethod.getReturnType().getName());
-
-         return proxy;
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         remove(args[0]);
-
-         return null;
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-   public Object createLocalProxy(Object id) throws Exception
-   {
-      return this.createLocalProxy(id, this.getAnnotation(LocalBinding.class));
-   }
-   
-   public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
-   {
-      StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
-      factory.init();
-
-      return factory.createProxyBusiness(id);
-   }
-   
-   public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
-   {
-      StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
-      factory.init();
-
-      if (id != null)
-         return factory.createProxyBusiness(id,null);
-      else
-         return factory.createProxyBusiness();
-   }
-   
-   public boolean isClustered()
-   {
-      return isAnnotationPresent(Clustered.class);
-   }
-
-   protected InvocationResponse invokeHomeMethod(MethodInfo info,
-                                                 StatefulRemoteInvocation statefulInvocation) throws Throwable
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().startsWith("create"))
-      {
-         Class<?>[] initParameterTypes =
-                 {};
-         Object[] initParameterValues =
-                 {};
-         if (unadvisedMethod.getParameterTypes().length > 0)
-         {
-            initParameterTypes = unadvisedMethod.getParameterTypes();
-            initParameterValues = statefulInvocation.getArguments();
-         }
-
-         RemoteBinding binding = null;
-         RemoteBindings bindings = this.getAnnotation(RemoteBindings.class);
-         if (bindings != null)
-            binding = bindings.value()[0];
-         else
-            binding = this.getAnnotation(RemoteBinding.class);
-
-         StatefulContainerInvocation newStatefulInvocation = buildNewInvocation(
-                 info, statefulInvocation, initParameterTypes,
-                 initParameterValues);
-
-         StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
-         factory.init();
-
-         Object proxy = null;
-         String businessInterfaceType = unadvisedMethod.getReturnType().getName();
-         if (newStatefulInvocation.getId() != null)
-            proxy = factory.createProxyEjb21(newStatefulInvocation.getId(), businessInterfaceType);
-         else
-            proxy = factory.createProxyEjb21(businessInterfaceType);
-
-         InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
-         if (newStatefulInvocation.getId() != null)
-            response.addAttachment(StatefulConstants.NEW_ID,
-                    newStatefulInvocation.getId());
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         remove(statefulInvocation.getArguments()[0]);
-
-         InvocationResponse response = new InvocationResponse(null);
-         response.setContextInfo(statefulInvocation.getResponseContextInfo());
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("getEJBMetaData"))
-      {
-         Class<?> remote = null;
-         Class<?> home = null;
-         Class<?> pkClass = Object.class;
-         HomeHandleImpl homeHandle = null;
-
-         Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this);
-         if (remotes != null && remotes.length > 0)
-         {
-            remote = remotes[0];
-         }
-         RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
-         if (homeAnnotation != null)
-            home = homeAnnotation.value();
-         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
-         if (remoteBindingAnnotation != null)
-            homeHandle = new HomeHandleImpl(remoteBindingAnnotation
-                    .jndiBinding());
-
-         EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
-                 true, false, homeHandle);
-
-         InvocationResponse response = marshallResponse(statefulInvocation, metadata, null);
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("getHomeHandle"))
-      {
-         HomeHandleImpl homeHandle = null;
-
-         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
-         if (remoteBindingAnnotation != null)
-            homeHandle = new HomeHandleImpl(remoteBindingAnnotation
-                    .jndiBinding());
-
-
-         InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
-         return response;
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-   /**
-    * Provides implementation for this bean's EJB 2.1 Home.create() method 
-    * 
-    * @param factory
-    * @param unadvisedMethod
-    * @param args
-    * @return
-    * @throws Exception
-    */
-   @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception
-   {
-      
-      // Cast
-      String errorMessage = "Specified factory " + factory.getClass().getName() + " is not of type "
-            + StatefulProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName();
-      assert factory instanceof StatefulProxyFactory : errorMessage;
-      StatefulProxyFactory statefulFactory = null;
-      try
-      {
-         statefulFactory = (StatefulProxyFactory) factory;
-      }
-      catch (ClassCastException cce)
-      {
-         throw new ClassCastException(errorMessage);
-      }
-      
-      Class<?>[] initParameterTypes =
-      {};
-      Object[] initParameterValues =
-      {};
-      if (unadvisedMethod.getParameterTypes().length > 0)
-      {
-         initParameterTypes = unadvisedMethod.getParameterTypes();
-         initParameterValues = args;
-      }
-
-      Object id = createSession(initParameterTypes, initParameterValues);
-
-      Object proxy = statefulFactory.createProxyBusiness(id, unadvisedMethod.getReturnType().getName());
-
-      return proxy;
-   }
-
-   protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
-                                                      StatefulRemoteInvocation statefulInvocation) throws Throwable
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("getHandle"))
-      {
-         StatefulContainerInvocation newStatefulInvocation = buildInvocation(
-                 info, statefulInvocation);
-
-         ProxyFactory proxyFactory = this.getProxyFactory(this.getAnnotation(RemoteBinding.class));
-         BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
-         EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId(), null);
-         StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
-         InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         try
-         {
-            destroySession(statefulInvocation.getId());
-         }
-         catch(NoSuchEJBException e)
-         {
-            if(log.isTraceEnabled())
-               log.trace("Throwing " + e.getClass().getName(), e);
-            throw new NoSuchObjectException(e.getMessage());
-         }
-
-         InvocationResponse response = new InvocationResponse(null);
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("getEJBHome"))
-      {
-         HomeHandleImpl homeHandle = null;
-
-         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
-         if (remoteBindingAnnotation != null)
-            homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
-
-         EJBHome ejbHome = homeHandle.getEJBHome();
-
-         InvocationResponse response = marshallResponse(statefulInvocation, ejbHome, null);
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
-      {
-         Object id = statefulInvocation.getId();
-
-         InvocationResponse response = marshallResponse(statefulInvocation, id, null);
-         return response;
-      }
-      else if (unadvisedMethod.getName().equals("isIdentical"))
-      {
-         Object id = statefulInvocation.getId();
-         EJBObject bean = (EJBObject) statefulInvocation.getArguments()[0];
-
-         Object primaryKey = bean.getPrimaryKey();
-
-         boolean isIdentical = id.equals(primaryKey);
-
-         InvocationResponse response = marshallResponse(statefulInvocation, isIdentical, null);
-         return response;
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   private StatefulContainerInvocation buildNewInvocation(MethodInfo info,
-                                                          StatefulRemoteInvocation statefulInvocation,
-                                                          Class[] initParameterTypes, Object[] initParameterValues)
-   {
-      StatefulContainerInvocation newStatefulInvocation = null;
-
-      StatefulBeanContext ctx = null;
-      if (initParameterTypes.length > 0)
-         ctx = getCache().create(initParameterTypes, initParameterValues);
-      else
-         ctx = getCache().create(null, null);
-
-      Object newId = ctx.getId();
-      newStatefulInvocation = new StatefulContainerInvocation(info, newId);
-
-      newStatefulInvocation.setArguments(statefulInvocation.getArguments());
-      newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
-      newStatefulInvocation.setAdvisor(getAdvisor());
-
-      return newStatefulInvocation;
-   }
-
-   private StatefulContainerInvocation buildInvocation(MethodInfo info,
-                                                       StatefulRemoteInvocation statefulInvocation)
-   {
-      StatefulContainerInvocation newStatefulInvocation = null;
-      Object newId = null;
-      if (statefulInvocation.getId() == null)
-      {
-         StatefulBeanContext ctx = getCache().create(null, null);
-         newId = ctx.getId();
-         newStatefulInvocation = new StatefulContainerInvocation(info, newId);
-      }
-      else
-      {
-         newStatefulInvocation = new StatefulContainerInvocation(info, statefulInvocation.getId());
-      }
-
-      newStatefulInvocation.setArguments(statefulInvocation.getArguments());
-      newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
-      newStatefulInvocation.setAdvisor(getAdvisor());
-
-      return newStatefulInvocation;
-   }
-
-   @Override
-   public Object getBusinessObject(BeanContext beanContext, Class businessInterface) throws IllegalStateException
-   {
-      assert beanContext != null : "beanContext is null";
-      assert businessInterface != null : "businessInterface is null";
-      
-      StatefulBeanContext ctx = (StatefulBeanContext) beanContext;
-      
-      SessionContainer container = ctx.getContainer();
-      assert container == this : "beanContext not of this container (" + container + " != " + this + ")";
-      
-      boolean isRemote = false;
-      boolean found = false;
-      Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
-      for (Class intf : remoteInterfaces)
-      {
-         if (intf.getName().equals(businessInterface.getName()))
-         {
-            isRemote = true;
-            found = true;
-            break;
-         }
-      }
-      if (found == false)
-      {
-         Class[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
-         for (Class intf : localInterfaces)
-         {
-            if (intf.getName().equals(businessInterface.getName()))
-            {
-               found = true;
-               break;
-            }
-         }
-      }
-      if (found == false) throw new IllegalStateException(businessInterface.getName() + " is not a business interface for container " + this);
-
-      Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
-      for (ProxyFactory factory : proxyFactories)
-      {
-         if (isRemote && factory instanceof StatefulRemoteProxyFactory)
-         {
-            return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
-         }
-         else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
-         {
-            return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
-         }
-      }
-      throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
-   }
-
-   /**
-    * Remove the given object. Called when remove on Home is invoked.
-    * 
-    * @param target             either a Handle or a primaryKey
-    * @throws RemoveException   if it's not allowed to be removed
-    */
-   private void remove(Object target) throws RemoveException
-   {
-      // EJBTHREE-1217: EJBHome.remove(Object primaryKey) must throw RemoveException
-      if(!(target instanceof Handle))
-         throw new RemoveException("EJB 3 3.6.2.2: Session beans do not have a primary key");
-      
-      StatefulHandleRemoteImpl handle = (StatefulHandleRemoteImpl) target;
-
-      try
-      {
-         handle.getEJBObject().remove();
-      }
-      catch(RemoteException re)
-      {
-         throw new RemoveException(re.getMessage());
-      }
-   }
-   
-   protected void removeHandle(Handle arg) throws Exception
-   {
-      /*
-      StatefulHandleImpl handle = (StatefulHandleImpl) arg;
-
-      destroySession(handle.id);
-      */
-      arg.getEJBObject().remove();
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,1445 @@
+/*
+ * 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.stateful;
+
+import java.io.Serializable;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.Init;
+import javax.ejb.NoSuchEJBException;
+import javax.ejb.NoSuchObjectLocalException;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.RemoteHome;
+import javax.ejb.RemoveException;
+import javax.ejb.TimerService;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.annotation.Cache;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.cache.CacheFactoryRegistry;
+import org.jboss.ejb3.cache.Ejb3CacheFactory;
+import org.jboss.ejb3.cache.StatefulCache;
+import org.jboss.ejb3.cache.StatefulObjectFactory;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulRemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory;
+import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
+import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
+import org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
+import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.proxy.remoting.StatefulSessionRemotingMetadata;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.injection.Injector;
+import org.jboss.injection.JndiPropertyInjector;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatefulContainer extends SessionSpecContainer
+      implements
+         StatefulObjectFactory<StatefulBeanContext>,
+         StatefulSessionInvokableContext
+{
+   private static final Logger log = Logger.getLogger(StatefulContainer.class);
+
+   protected StatefulCache cache;
+   private StatefulDelegateWrapper mbean = new StatefulDelegateWrapper(this);
+
+   public StatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+                            Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+   }
+
+   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
+   {
+      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
+      // Tell context how to handle replication
+      CacheConfig config = getAnnotation(CacheConfig.class);
+      if (config != null)
+      {
+         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
+      }
+
+      // this is for propagated extended PC's
+      sfctx = sfctx.pushContainedIn();
+      
+      pushContext(sfctx);
+      try
+      {
+         if (injectors != null)
+         {
+            for (Injector injector : injectors)
+            {
+               injector.inject(sfctx);
+            }
+         }
+
+         sfctx.initialiseInterceptorInstances();
+
+      }
+      finally
+      {
+         popContext();
+         // this is for propagated extended PC's
+         sfctx.popContainedIn();
+      }
+      
+      invokePostConstruct(sfctx, initValues);
+      
+      //TODO This needs to be reimplemented as replacement for create() on home interface
+      invokeInit(sfctx.getInstance(), initTypes, initValues);
+      
+      return sfctx;
+   }
+   
+   @Override
+   public BeanContext<?> createBeanContext()
+   {
+      return new StatefulBeanContext(this, construct());
+   }
+   
+   @Override
+   protected StatefulLocalProxyFactory getProxyFactory(LocalBinding binding)
+   {
+      StatefulLocalProxyFactory factory = (StatefulLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
+
+      if (factory == null)
+      {
+         factory = new StatefulLocalProxyFactory(this, binding);
+
+         try
+         {
+            factory.init();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      
+      return factory;
+   }
+   
+   public Object createProxyLocalEjb21(Object id, LocalBinding binding, String businessInterfaceType) throws Exception
+   {
+      StatefulLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
+      return proxyFactory.createProxyEjb21(id,businessInterfaceType);
+   }
+   
+   public Object createProxyRemoteEjb21(Object id, String businessInterfaceType) throws Exception
+   {
+      RemoteBinding binding = this.getRemoteBinding();
+      return this.createProxyRemoteEjb21(id,binding, businessInterfaceType);
+   }
+
+   public Object createProxyRemoteEjb21(Object id, RemoteBinding binding, String businessInterfaceType) throws Exception
+   { 
+      BaseStatefulRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
+      return proxyFactory.createProxyEjb21(id, businessInterfaceType);
+   }
+   
+   public Object createProxyLocalEjb21(Object id, String businessInterfaceType) throws Exception
+   {
+      LocalBinding binding = this.getAnnotation(LocalBinding.class);
+      return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
+   }
+   
+   @Override
+   public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
+   {
+      Object id = this.createSession();
+      return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
+   }
+
+   @Override
+   public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
+   {
+      Object id = this.createSession();
+      return this.createProxyRemoteEjb21(id, binding, businessInterfaceType);
+   }
+   
+   @Override
+   protected BaseStatefulRemoteProxyFactory getProxyFactory(RemoteBinding binding)
+   {
+      BaseStatefulRemoteProxyFactory factory = (BaseStatefulRemoteProxyFactory) this.proxyDeployer
+            .getProxyFactory(binding);
+
+      if (factory == null)
+      {
+
+         Clustered clustered = getAnnotation(Clustered.class);
+         if (clustered != null)
+         {
+            factory = new StatefulClusterProxyFactory(this, binding, clustered);
+         }
+         else
+         {
+            factory = new StatefulRemoteProxyFactory(this, binding);
+         }
+         
+         try
+         {
+            factory.init();
+         }
+         catch(Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+
+      return factory;
+   }
+   
+   public void destroy(StatefulBeanContext ctx)
+   {
+      try
+      {
+         invokePreDestroy(ctx);
+      }
+      finally
+      {
+         ctx.remove();
+      }
+   }
+   
+   public Object getMBean()
+   {
+      return mbean;
+   }
+   
+   /**
+    * Creates and starts the configured cache, if not
+    * started already
+    * 
+    * @throws Exception
+    */
+   protected void createAndStartCache() throws Exception {
+      
+      // If Cache is initialized, exit
+      if(this.cache!=null && this.cache.isStarted())
+      {
+         return;
+      }
+      
+      Cache cacheConfig = getAnnotation(Cache.class);
+      CacheFactoryRegistry registry = getCacheFactoryRegistry();
+      Ejb3CacheFactory factory = registry.getCacheFactory(cacheConfig.value());
+      this.cache = factory.createCache();
+      this.cache.initialize(this);
+      this.cache.start();
+   }
+   
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      try
+      {
+         super.lockedStart();
+         this.createAndStartCache();
+      }
+      catch (Exception e)
+      {
+         try
+         {
+            this.lockedStop();
+         }
+         catch (Exception ignore)
+         {
+            log.debug("Failed to cleanup after start() failure", ignore);
+         }
+         throw e;
+      }
+
+   }
+
+   @Override
+   protected void lockedStop() throws Exception
+   {
+      if (cache != null) cache.stop();
+      
+      super.lockedStop();
+   }
+
+   public StatefulCache getCache()
+   {
+      // Ensure initialized
+      try{
+         this.createAndStartCache();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+      
+      // Return
+      return cache;
+   }
+   
+   public CacheFactoryRegistry getCacheFactoryRegistry()
+   {
+      return this.getDeployment().getCacheFactoryRegistry();
+   }
+   
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected String getJndiRegistrarBindName()
+   {
+      return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SFSB;
+   }
+
+   /**
+    * Performs a synchronous local invocation
+    */
+   public Object localInvoke(Object id, Method method, Object[] args)
+           throws Throwable
+   {
+      return localInvoke(id, method, args, null);
+   }
+
+   /**
+    * Performs a synchronous or asynchronous local invocation
+    *
+    */
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+   {
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      pushEnc();
+      try
+      {
+         long hash = MethodHashing.calculateHash(method);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException(
+                    "Could not resolve beanClass method from proxy call: "
+                            + method.toString());
+         }
+         return invokeLocalHomeMethod(info, args);
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+
+   /**
+    * Performs a synchronous or asynchronous local invocation
+    *
+    * @param provider If null a synchronous invocation, otherwise an asynchronous
+    */
+   public Object localInvoke(Object id, Method method, Object[] args,
+         FutureHolder provider) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      pushEnc();
+      try
+      {
+         long hash = MethodHashing.calculateHash(method);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException(
+                  "Could not resolve beanClass method from proxy call: "
+                  + method.toString());
+         }
+      
+         Method unadvisedMethod = info.getUnadvisedMethod();
+      
+         try
+         {
+            invokeStats.callIn();
+      
+            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               return invokeLocalHomeMethod(info, args);
+            }
+            else if (unadvisedMethod != null
+                  && isEJBObjectMethod(unadvisedMethod))
+            {
+               return invokeEJBLocalObjectMethod(id, info, args);
+            }
+            
+            SerializableMethod invoked = new SerializableMethod(method, method.getClass());
+            
+            //StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+            StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info);
+            nextInvocation.setSessionId(id);
+            nextInvocation.setAdvisor(getAdvisor());
+            nextInvocation.setArguments(args);
+            
+            ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+            
+            //invokedMethod.push(invoked);
+            return nextInvocation.invokeNext();
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+         
+            invokeStats.callOut();
+            
+            //invokedMethod.pop();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+   
+   /**
+    * Create a stateful bean and return its oid.
+    *
+    * @return
+    */
+   public Serializable createSession(Class<?>[] initTypes, Object[] initValues)
+   {
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      pushEnc();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(classloader);
+         StatefulCache cache = this.getCache();
+         StatefulBeanContext ctx = cache.create(initTypes, initValues);
+         // Since we return the key here, the context is not in use.
+         cache.release(ctx);
+         Object id = ctx.getId();
+         assert id instanceof Serializable : "SFSB Session IDs must be " + Serializable.class.getSimpleName();
+         return (Serializable) id;
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+
+   protected void destroySession(Object id)
+   {
+      getCache().remove(id);
+   }
+   
+   /**
+    * Remote Invocation entry point, as delegated from
+    * ClassProxyHack (Remoting Dispatcher)
+    */
+   //TODO
+   public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      /*
+       * Initialize
+       */
+
+      // Mark the start time
+      long start = System.currentTimeMillis();
+
+      // Create a pointer to a new Invocation
+      EJBContainerInvocation newSi = null;
+
+      // Create a pointer to the response we'll return
+      InvocationResponse response = null;
+
+      // Create a pointer to the Session ID
+      Serializable sessionId = null;
+
+      /*
+       * Setup Environment (Stack/Thread)
+       */
+
+      // Hold a reference to the existing TCL
+      ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
+
+      // Set the Container's CL as TCL, required to unmarshall methods from the bean impl class
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+
+      // Push the ENC onto the stack
+      pushEnc();
+
+      try
+      {
+
+         /*
+          * Obtain the target method (unmarshall from invocation)
+          */
+
+         // Cast
+         assert invocation instanceof StatefulRemoteInvocation : SessionContainer.class.getName()
+               + ".dynamicInoke supports only " + StatefulRemoteInvocation.class.getSimpleName()
+               + ", but has been passed: " + invocation;
+         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
+
+         // Get the method hash
+         long methodHash = si.getMethodHash();
+         log.debug("Received dynamic invocation for method with hash: " + methodHash);
+
+         // Get the Method via MethodInfo from the Advisor
+         Advisor advisor = this.getAdvisor();
+         MethodInfo info = advisor.getMethodInfo(methodHash);
+         Method unadvisedMethod = info.getMethod();
+         
+         // Get the invoked method from invocation metadata
+         Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
+         assert objInvokedMethod !=null : "Invoked Method must be set on invocation metadata";
+         assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type " + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
+         SerializableMethod invokedMethod = (SerializableMethod)objInvokedMethod;
+
+         try
+         {
+
+            // Increment invocation statistics
+            invokeStats.callIn();
+
+            /*
+             * Obtain Session ID
+             */
+
+            // Obtain the Session ID
+            Object objSessionId = si.getMetaData(StatefulSessionRemotingMetadata.TAG_SFSB_INVOCATION,
+                  StatefulSessionRemotingMetadata.KEY_SESSION_ID);
+            if (objSessionId != null)
+            {
+               assert objSessionId instanceof Serializable : "Session IDs must be "
+                     + Serializable.class.getSimpleName();
+               sessionId = (Serializable) objSessionId;
+            }
+
+            if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               response = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               response = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+               if (unadvisedMethod.isBridge())
+               {
+                  unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
+                  info = super.getMethodInfo(unadvisedMethod);
+               }
+
+               if (sessionId == null)
+               {
+                  StatefulBeanContext ctx = getCache().create(null, null);
+                  Object objNewId = ctx.getId();
+                  assert objNewId instanceof Serializable : "Obtained new Session ID from cache, " + objNewId
+                        + ", which is not " + Serializable.class.getSimpleName();
+                  sessionId = (Serializable) objNewId;
+               }
+               
+               /*
+                * Set the invoked method
+                */
+               //TODO Remove when CurrentInvocation is ironed out
+               
+               // Set onto stack
+               SessionSpecContainer.invokedMethod.push(invokedMethod);
+               
+               /*
+                * Build a new Invocation
+                */
+
+               // Construct the invocation
+               newSi = new StatefulContainerInvocation(info, sessionId);
+               //newSi = new StatefulContainerInvocation(info.getInterceptors(), long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor, Object id);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+
+               // Create an object to hold the return value
+               Object returnValue = null;
+
+               /*
+                * Perform Invocation
+                */
+
+               // Invoke
+               returnValue = newSi.invokeNext();
+
+               // Marshall the response
+               response = marshallResponse(invocation, returnValue, newSi.getResponseContextInfo());
+               if (sessionId != null)
+               {
+                  response.addAttachment(StatefulConstants.NEW_ID, sessionId);
+               }
+               
+//               response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+//               if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
+               
+               // Create a Response
+//             response = new InvocationResponse(returnValue);
+//             Map<Object, Object> responseContext = newSi.getResponseContextInfo();
+//             response.setContextInfo(responseContext);
+            }
+         }
+         catch (Throwable t)
+         {
+            Throwable exception = t;
+//            if (sessionId != null)
+//            {
+//               exception = new ForwardId(t, sessionId);
+//            }
+            Map<Object, Object> responseContext = null;
+            if (newSi != null)
+            {
+               responseContext = newSi.getResponseContextInfo();
+            }
+            response = marshallException(invocation, exception, responseContext);
+            return response;
+         }
+         finally
+         {
+            /*
+             * Update Invocation Statistics
+             */
+            if (unadvisedMethod != null)
+            {
+               // Mark end time
+               long end = System.currentTimeMillis();
+
+               // Calculate elapsed time
+               long elapsed = end - start;
+
+               // Update statistics with elapsed time
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+
+            // Complete call to increment statistics
+            invokeStats.callOut();
+            
+            // Pop invoked method off the stack
+            //TODO Remove when CurrentInvocation handles this
+            SessionSpecContainer.invokedMethod.pop();
+         }
+
+         // Return
+         return response;
+      }
+      finally
+      {
+         // Reset the TCL to original
+         Thread.currentThread().setContextClassLoader(originalLoader);
+
+         // Pop the ENC off the stack
+         this.popEnc();
+      }
+   }
+   
+   /**
+    * This should be a remote invocation call
+    *
+    * @param invocation
+    * @return
+    * @throws Throwable
+    * @deprecated Use dynamicInvoke(Invocation invocation)
+    */
+   @Deprecated
+   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+      
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      EJBContainerInvocation newSi = null;
+      pushEnc();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(classloader);
+         MethodInvocation mi = (MethodInvocation)invocation;
+         
+         MethodInfo info = getAdvisor().getMethodInfo(mi.getMethodHash());
+         if (info == null)
+         {
+            throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
+         }
+         Method unadvisedMethod = info.getUnadvisedMethod();
+         
+         
+         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
+         
+
+         InvocationResponse response = null;
+         
+         Object newId = null;
+         
+         try
+         {
+            invokeStats.callIn();
+            
+            if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               response = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               response = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+               if (unadvisedMethod.isBridge())
+               {
+                  unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
+                  info = super.getMethodInfo(unadvisedMethod);
+               }
+               
+               if (si.getId() == null)
+               {
+                  StatefulBeanContext ctx = getCache().create(null, null);
+                  newId = ctx.getId();
+               }
+               else
+               {
+                  newId = si.getId();
+               }
+               newSi = new StatefulContainerInvocation(info, newId);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+   
+               Object rtn = null;
+                 
+
+               rtn = newSi.invokeNext();
+
+               response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+               if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
+            }
+         }
+         catch (Throwable throwable)
+         {
+            Throwable exception = throwable;
+            if (newId != null)
+            {
+               exception = new ForwardId(throwable, newId);
+            }
+            Map responseContext = null;
+            if (newSi != null) newSi.getResponseContextInfo();
+            response = marshallException(invocation, exception, responseContext);
+            return response;
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+            
+            invokeStats.callOut();
+         }
+
+         return response;
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+
+
+   public TimerService getTimerService()
+   {
+      throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)");
+   }
+
+   public TimerService getTimerService(Object pKey)
+   {
+      return getTimerService();
+   }
+   
+   @Override
+   public void invokePostActivate(BeanContext beanContext)
+   {
+      for (Injector injector : injectors)
+      {
+         if (injector instanceof JndiPropertyInjector)
+         {
+            AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();
+            
+            if (field.isAnnotationPresent(javax.ejb.EJB.class))
+            {
+               continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
+            }
+            
+            if (field instanceof Field)
+            {
+               // reinject transient fields
+               if ((((Field)field).getModifiers() & Modifier.TRANSIENT) > 0)
+                  injector.inject(beanContext);
+            }
+         }
+      }
+      
+      this.invokeCallback(beanContext, PostActivate.class);
+   }
+
+   @Override
+   public void invokePrePassivate(BeanContext beanContext)
+   {
+      this.invokeCallback(beanContext, PrePassivate.class);
+   }
+
+   /*
+   @Override
+   protected Class[] getHandledCallbacks()
+   {
+      return new Class[]
+              {PostConstruct.class, PreDestroy.class, PostActivate.class,
+                      PrePassivate.class};
+   }
+   */
+
+   public void invokeInit(Object bean, Class[] initParameterTypes,
+                          Object[] initParameterValues)
+   {
+      int numParameters = 0;
+      if(initParameterTypes != null)
+         numParameters = initParameterTypes.length;
+      try
+      {
+         for(Method method : bean.getClass().getDeclaredMethods())
+         {
+            if(numParameters != method.getParameterTypes().length)
+               continue;
+            
+            if ((method.getAnnotation(Init.class) != null)
+                    || (resolveAnnotation(method, Init.class) != null))
+            {
+               if(initParameterTypes != null)
+               {
+                  Object[] parameters = getInitParameters(method,
+                          initParameterTypes, initParameterValues);
+   
+                  if (parameters != null)
+                     method.invoke(bean, parameters);
+               }
+               else
+               {
+                  method.invoke(bean);
+               }
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   protected Object[] getInitParameters(Method method,
+                                        Class[] initParameterTypes, Object[] initParameterValues)
+   {
+      if (method.getParameterTypes().length == initParameterTypes.length)
+      {
+         for (int i = 0; i < initParameterTypes.length; ++i)
+         {
+            Class formal = method.getParameterTypes()[i];
+            Class actual = initParameterTypes[i];
+            if (!isMethodInvocationConvertible(formal, actual == null ? null
+                    : actual))
+               return null;
+         }
+         return initParameterValues;
+      }
+      return null;
+   }
+
+   /**
+    * Determines whether a type represented by a class object is convertible to
+    * another type represented by a class object using a method invocation
+    * conversion, treating object types of primitive types as if they were
+    * primitive types (that is, a Boolean actual parameter type matches boolean
+    * primitive formal type). This behavior is because this method is used to
+    * determine applicable methods for an actual parameter list, and primitive
+    * types are represented by their object duals in reflective method calls.
+    *
+    * @param formal the formal parameter type to which the actual parameter type
+    *               should be convertible
+    * @param actual the actual parameter type.
+    * @return true if either formal type is assignable from actual type, or
+    *         formal is a primitive type and actual is its corresponding object
+    *         type or an object type of a primitive type that can be converted
+    *         to the formal type.
+    */
+   private static boolean isMethodInvocationConvertible(Class formal,
+                                                        Class actual)
+   {
+      /*
+       * if it's a null, it means the arg was null
+       */
+      if (actual == null && !formal.isPrimitive())
+      {
+         return true;
+      }
+      /*
+       * Check for identity or widening reference conversion
+       */
+      if (actual != null && formal.isAssignableFrom(actual))
+      {
+         return true;
+      }
+      /*
+       * Check for boxing with widening primitive conversion. Note that actual
+       * parameters are never primitives.
+       */
+      if (formal.isPrimitive())
+      {
+         if (formal == Boolean.TYPE && actual == Boolean.class)
+            return true;
+         if (formal == Character.TYPE && actual == Character.class)
+            return true;
+         if (formal == Byte.TYPE && actual == Byte.class)
+            return true;
+         if (formal == Short.TYPE
+                 && (actual == Short.class || actual == Byte.class))
+            return true;
+         if (formal == Integer.TYPE
+                 && (actual == Integer.class || actual == Short.class || actual == Byte.class))
+            return true;
+         if (formal == Long.TYPE
+                 && (actual == Long.class || actual == Integer.class
+                 || actual == Short.class || actual == Byte.class))
+            return true;
+         if (formal == Float.TYPE
+                 && (actual == Float.class || actual == Long.class
+                 || actual == Integer.class || actual == Short.class || actual == Byte.class))
+            return true;
+         if (formal == Double.TYPE
+                 && (actual == Double.class || actual == Float.class
+                 || actual == Long.class || actual == Integer.class
+                 || actual == Short.class || actual == Byte.class))
+            return true;
+      }
+      return false;
+   }
+
+   private Object invokeEJBLocalObjectMethod(Object id, MethodInfo info,
+                                             Object[] args) throws Exception
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().equals("remove"))
+      {
+         try
+         {
+            destroySession(id);
+         }
+         catch(NoSuchEJBException e)
+         {
+            throw new NoSuchObjectLocalException(e.getMessage(), e);
+         }
+
+         return null;
+      }
+      else if (unadvisedMethod.getName().equals("getEJBLocalHome"))
+      {
+         Object bean = getCache().get(id).getInstance();
+
+         return bean;
+      }
+      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+      {
+         return id;
+      }
+      else if (unadvisedMethod.getName().equals("isIdentical"))
+      {
+         EJBObject bean = (EJBObject) args[0];
+
+         Object primaryKey = bean.getPrimaryKey();
+
+         boolean isIdentical = id.equals(primaryKey);
+
+         return isIdentical;
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   private Object invokeLocalHomeMethod(MethodInfo info, Object[] args)
+           throws Exception
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().startsWith("create"))
+      {
+         Class<?>[] initParameterTypes =
+                 {};
+         Object[] initParameterValues =
+                 {};
+         if (unadvisedMethod.getParameterTypes().length > 0)
+         {
+            initParameterTypes = unadvisedMethod.getParameterTypes();
+            initParameterValues = args;
+         }
+
+         LocalBinding binding = this.getAnnotation(LocalBinding.class);
+
+         StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
+         factory.init();
+
+         Object proxy = factory.createProxyEjb21(initParameterTypes,
+                 initParameterValues, unadvisedMethod.getReturnType().getName());
+
+         return proxy;
+      }
+      else if (unadvisedMethod.getName().equals("remove"))
+      {
+         remove(args[0]);
+
+         return null;
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   public Object createLocalProxy(Object id) throws Exception
+   {
+      return this.createLocalProxy(id, this.getAnnotation(LocalBinding.class));
+   }
+   
+   public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
+   {
+      StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
+      factory.init();
+
+      return factory.createProxyBusiness(id);
+   }
+   
+   public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
+   {
+      StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
+      factory.init();
+
+      if (id != null)
+         return factory.createProxyBusiness(id,null);
+      else
+         return factory.createProxyBusiness();
+   }
+   
+   public boolean isClustered()
+   {
+      return isAnnotationPresent(Clustered.class);
+   }
+
+   protected InvocationResponse invokeHomeMethod(MethodInfo info,
+         StatefulRemoteInvocation statefulInvocation) throws Throwable
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().startsWith("create"))
+      {
+         Class<?>[] initParameterTypes =
+                 {};
+         Object[] initParameterValues =
+                 {};
+         if (unadvisedMethod.getParameterTypes().length > 0)
+         {
+            initParameterTypes = unadvisedMethod.getParameterTypes();
+            initParameterValues = statefulInvocation.getArguments();
+         }
+
+         RemoteBinding binding = null;
+         RemoteBindings bindings = this.getAnnotation(RemoteBindings.class);
+         if (bindings != null)
+            binding = bindings.value()[0];
+         else
+            binding = this.getAnnotation(RemoteBinding.class);
+
+         StatefulSessionContainerMethodInvocation newStatefulInvocation = buildNewInvocation(
+                 info, statefulInvocation, initParameterTypes,
+                 initParameterValues);
+
+         StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
+         factory.init();
+
+         Object proxy = null;
+         String businessInterfaceType = unadvisedMethod.getReturnType().getName();
+         if (newStatefulInvocation.getSessionId() != null)
+            proxy = factory.createProxyEjb21(newStatefulInvocation.getSessionId(), businessInterfaceType);
+         else
+            proxy = factory.createProxyEjb21(businessInterfaceType);
+
+         InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
+         if (newStatefulInvocation.getSessionId() != null)
+            response.addAttachment(StatefulConstants.NEW_ID,
+                    newStatefulInvocation.getSessionId());
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("remove"))
+      {
+         remove(statefulInvocation.getArguments()[0]);
+
+         InvocationResponse response = new InvocationResponse(null);
+         response.setContextInfo(statefulInvocation.getResponseContextInfo());
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("getEJBMetaData"))
+      {
+         Class<?> remote = null;
+         Class<?> home = null;
+         Class<?> pkClass = Object.class;
+         HomeHandleImpl homeHandle = null;
+
+         Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this);
+         if (remotes != null && remotes.length > 0)
+         {
+            remote = remotes[0];
+         }
+         RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
+         if (homeAnnotation != null)
+            home = homeAnnotation.value();
+         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+         if (remoteBindingAnnotation != null)
+            homeHandle = new HomeHandleImpl(remoteBindingAnnotation
+                    .jndiBinding());
+
+         EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
+                 true, false, homeHandle);
+
+         InvocationResponse response = marshallResponse(statefulInvocation, metadata, null);
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("getHomeHandle"))
+      {
+         HomeHandleImpl homeHandle = null;
+
+         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+         if (remoteBindingAnnotation != null)
+            homeHandle = new HomeHandleImpl(remoteBindingAnnotation
+                    .jndiBinding());
+
+
+         InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
+         return response;
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   /**
+    * Provides implementation for this bean's EJB 2.1 Home.create() method 
+    * 
+    * @param factory
+    * @param unadvisedMethod
+    * @param args
+    * @return
+    * @throws Exception
+    */
+   @Override
+   protected Object invokeHomeCreate(SerializableMethod method, Object args[])
+         throws Exception
+   {  
+      // Lookup
+      String proxyFactoryKey = this.getJndiRegistrar().getProxyFactoryRegistryKey(this.getMetaData(), false);
+      Object factory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey);
+      
+      // Cast
+      assert factory instanceof StatefulSessionProxyFactory : "Specified factory " + factory.getClass().getName() + " is not of type "
+      + StatefulSessionProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName() + ", but was instead " + factory;
+      StatefulSessionProxyFactory statefulFactory = null;
+      statefulFactory = StatefulSessionProxyFactory.class.cast(factory);
+
+      Object proxy = statefulFactory.createProxyEjb2x();
+
+      return proxy;
+   }
+
+   protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
+         StatefulRemoteInvocation statefulInvocation) throws Throwable
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().equals("getHandle"))
+      {
+         StatefulContainerInvocation newStatefulInvocation = buildInvocation(
+                 info, statefulInvocation);
+
+         ProxyFactory proxyFactory = this.getProxyFactory(this.getAnnotation(RemoteBinding.class));
+         BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
+         EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId(), null);
+         StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
+         InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("remove"))
+      {
+         try
+         {
+            destroySession(statefulInvocation.getId());
+         }
+         catch(NoSuchEJBException e)
+         {
+            if(log.isTraceEnabled())
+               log.trace("Throwing " + e.getClass().getName(), e);
+            throw new NoSuchObjectException(e.getMessage());
+         }
+
+         InvocationResponse response = new InvocationResponse(null);
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("getEJBHome"))
+      {
+         HomeHandleImpl homeHandle = null;
+
+         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+         if (remoteBindingAnnotation != null)
+            homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
+
+         EJBHome ejbHome = homeHandle.getEJBHome();
+
+         InvocationResponse response = marshallResponse(statefulInvocation, ejbHome, null);
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+      {
+         Object id = statefulInvocation.getId();
+
+         InvocationResponse response = marshallResponse(statefulInvocation, id, null);
+         return response;
+      }
+      else if (unadvisedMethod.getName().equals("isIdentical"))
+      {
+         Object id = statefulInvocation.getId();
+         EJBObject bean = (EJBObject) statefulInvocation.getArguments()[0];
+
+         Object primaryKey = bean.getPrimaryKey();
+
+         boolean isIdentical = id.equals(primaryKey);
+
+         InvocationResponse response = marshallResponse(statefulInvocation, isIdentical, null);
+         return response;
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   private StatefulSessionContainerMethodInvocation buildNewInvocation(MethodInfo info,
+         StatefulRemoteInvocation statefulInvocation, Class<?>[] initParameterTypes,
+         Object[] initParameterValues)
+   {
+      StatefulSessionContainerMethodInvocation newStatefulInvocation = null;
+
+      StatefulBeanContext ctx = null;
+      if (initParameterTypes.length > 0)
+         ctx = getCache().create(initParameterTypes, initParameterValues);
+      else
+         ctx = getCache().create(null, null);
+
+      Object newId = ctx.getId();
+      newStatefulInvocation = new StatefulSessionContainerMethodInvocation(info);
+      newStatefulInvocation.setSessionId(newId);
+
+      newStatefulInvocation.setArguments(statefulInvocation.getArguments());
+      newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
+      newStatefulInvocation.setAdvisor(getAdvisor());
+
+      return newStatefulInvocation;
+   }
+
+   private StatefulContainerInvocation buildInvocation(MethodInfo info,
+                                                       StatefulRemoteInvocation statefulInvocation)
+   {
+      StatefulContainerInvocation newStatefulInvocation = null;
+      Object newId = null;
+      if (statefulInvocation.getId() == null)
+      {
+         StatefulBeanContext ctx = getCache().create(null, null);
+         newId = ctx.getId();
+         newStatefulInvocation = new StatefulContainerInvocation(info, newId);
+      }
+      else
+      {
+         newStatefulInvocation = new StatefulContainerInvocation(info, statefulInvocation.getId());
+      }
+
+      newStatefulInvocation.setArguments(statefulInvocation.getArguments());
+      newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
+      newStatefulInvocation.setAdvisor(getAdvisor());
+
+      return newStatefulInvocation;
+   }
+
+   @Override
+   public Object getBusinessObject(BeanContext beanContext, Class businessInterface) throws IllegalStateException
+   {
+      assert beanContext != null : "beanContext is null";
+      assert businessInterface != null : "businessInterface is null";
+      
+      StatefulBeanContext ctx = (StatefulBeanContext) beanContext;
+      
+      SessionContainer container = ctx.getContainer();
+      assert container == this : "beanContext not of this container (" + container + " != " + this + ")";
+      
+      boolean isRemote = false;
+      boolean found = false;
+      Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
+      for (Class<?> intf : remoteInterfaces)
+      {
+         if (intf.getName().equals(businessInterface.getName()))
+         {
+            isRemote = true;
+            found = true;
+            break;
+         }
+      }
+      if (found == false)
+      {
+         Class<?>[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
+         for (Class<?> intf : localInterfaces)
+         {
+            if (intf.getName().equals(businessInterface.getName()))
+            {
+               found = true;
+               break;
+            }
+         }
+      }
+      if (found == false) throw new IllegalStateException(businessInterface.getName() + " is not a business interface for container " + this);
+      
+      // Obtain SFSB JNDI Registrar
+      String sfsbJndiRegistrarObjectStoreBindName = this.getJndiRegistrarBindName();
+      JndiStatefulSessionRegistrar sfsbJndiRegistrar = Ejb3RegistrarLocator
+            .locateRegistrar().lookup(sfsbJndiRegistrarObjectStoreBindName,JndiStatefulSessionRegistrar.class);
+      
+      // Find the Proxy Factory Key for this SFSB
+      String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(this.getMetaData(), !isRemote);
+      
+      // Lookup the Proxy Factory in the Object Store
+      StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
+            StatefulSessionProxyFactory.class);
+      
+      // Create a new business proxy
+      Object proxy = proxyFactory.createProxyBusiness((Serializable) ctx.getId(), businessInterface.getName());
+      
+      // Return the Proxy
+      return proxy;
+
+//      Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
+//      for (ProxyFactory factory : proxyFactories)
+//      {
+//         if (isRemote && factory instanceof StatefulRemoteProxyFactory)
+//         {
+//            return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
+//         }
+//         else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
+//         {
+//            return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
+//         }
+//      }
+//      throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
+   }
+
+   /**
+    * Remove the given object. Called when remove on Home is invoked.
+    * 
+    * @param target             either a Handle or a primaryKey
+    * @throws RemoveException   if it's not allowed to be removed
+    */
+   private void remove(Object target) throws RemoveException
+   {
+      // EJBTHREE-1217: EJBHome.remove(Object primaryKey) must throw RemoveException
+      if(!(target instanceof Handle))
+         throw new RemoveException("EJB 3 3.6.2.2: Session beans do not have a primary key");
+      
+      StatefulHandleRemoteImpl handle = (StatefulHandleRemoteImpl) target;
+
+      try
+      {
+         handle.getEJBObject().remove();
+      }
+      catch(RemoteException re)
+      {
+         throw new RemoveException(re.getMessage());
+      }
+   }
+   
+   protected void removeHandle(Handle arg) throws Exception
+   {
+      /*
+      StatefulHandleImpl handle = (StatefulHandleImpl) arg;
+
+      destroySession(handle.id);
+      */
+      arg.getEJBObject().remove();
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,630 +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.stateless;
-
-
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb.AllowedOperationsAssociation;
-import org.jboss.ejb.AllowedOperationsFlags;
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.BeanContextLifecycleCallback;
-import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateless.BaseStatelessRemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.timerservice.TimedObjectInvoker;
-import org.jboss.ejb3.timerservice.TimerServiceFactory;
-import org.jboss.injection.WebServiceContextProxy;
-import org.jboss.injection.lang.reflect.BeanProperty;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
-import org.jboss.proxy.ejb.handle.HomeHandleImpl;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
-import org.jboss.wsf.spi.invocation.InvocationType;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
-import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
-import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
-
-import javax.ejb.*;
-import javax.naming.NamingException;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Map;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessContainer extends SessionSpecContainer
-  implements TimedObjectInvoker, ServiceEndpointContainer
-{
-   private static final Logger log = Logger.getLogger(StatelessContainer.class);
-
-   protected TimerService timerService;
-   private Method timeout;
-   private StatelessDelegateWrapper mbean = new StatelessDelegateWrapper(this);
-
-   public StatelessContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
-                             Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
-   {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
-      
-      initializeTimeout();
-   }
-
-   @Override
-   public BeanContext<?> createBeanContext()
-   {
-      return new StatelessBeanContext(this, construct());
-   }
-   
-   @Override
-   protected StatelessLocalProxyFactory getProxyFactory(LocalBinding binding)
-   {
-      StatelessLocalProxyFactory factory = (StatelessLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
-
-      if (factory == null)
-      {
-         factory = new StatelessLocalProxyFactory(this, binding);
-         try
-         {
-            factory.init();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-
-      return factory;
-   }
-   
-   @Override
-   protected BaseStatelessRemoteProxyFactory getProxyFactory(RemoteBinding binding)
-   {
-      BaseStatelessRemoteProxyFactory factory = (BaseStatelessRemoteProxyFactory) this.proxyDeployer
-            .getProxyFactory(binding);
-
-      if (factory == null)
-      {
-         Clustered clustered = getAnnotation(Clustered.class);
-         if (clustered != null)
-            factory = new StatelessClusterProxyFactory(this, binding, clustered);
-         else
-            factory = new StatelessRemoteProxyFactory(this, binding);
-         
-         try
-         {
-            factory.init();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-
-      return factory;
-   }
-   
-   /**
-    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
-    * the specified LocalBinding
-    * 
-    * @param id
-    * @return
-    * @throws Exception
-    */
-   @Override
-   public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
-   {
-      StatelessLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
-      return proxyFactory.createProxyEjb21(businessInterfaceType);
-   }
-   
-   @Override
-   public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
-   {
-      BaseStatelessRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
-      return proxyFactory.createProxyEjb21(businessInterfaceType);
-   }
-   
-   public Object createSession(Class<?> initTypes[], Object initArgs[])
-   {
-      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
-         throw new IllegalArgumentException("stateless bean create method must take no arguments (EJB3 4.5)");
-      // a stateless bean has no sessions
-      // TODO: pool stuff
-      return null;
-   }
-   
-   public boolean isClustered()
-   {
-      return isAnnotationPresent(Clustered.class);
-   }
-   
-   public Object getMBean()
-   {
-      return mbean;
-   }
-   
-   private void initializeTimeout()
-   {
-      JBossSessionBeanMetaData metaData = getMetaData();
-      NamedMethodMetaData timeoutMethodMetaData = null;
-      if(metaData != null)
-         timeoutMethodMetaData = metaData.getTimeoutMethod();
-      this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
-   }
-   
-   @Override
-   protected void lockedStart() throws Exception
-   {
-      try
-      {
-         super.lockedStart();
-         
-         timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
-         
-         TimerServiceFactory.getInstance().restoreTimerService(timerService);
-      }
-      catch (Exception e)
-      {
-         try
-         {
-            this.lockedStop();
-         }
-         catch (Exception ignore)
-         {
-            log.debug("Failed to cleanup after start() failure", ignore);
-         }
-         throw e;
-      }
-   }
-
-   @Override
-   protected void lockedStop() throws Exception
-   {
-      if (timerService != null)
-      {
-         TimerServiceFactory.getInstance().removeTimerService(timerService);
-         timerService = null;
-      }
-      
-      super.lockedStop();
-   }
-
-   public TimerService getTimerService()
-   {
-      return timerService;
-   }
-
-   public TimerService getTimerService(Object pKey)
-   {
-      assert timerService != null : "Timer Service not yet initialized";
-      return timerService;
-   }
-   
-   public void callTimeout(Timer timer) throws Exception
-   {
-      if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
-      Object[] args = {timer};
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
-         try
-         {
-            MethodInfo info = super.getMethodInfo(timeout);
-            EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
-            nextInvocation.setAdvisor(getAdvisor());
-            nextInvocation.setArguments(args);
-            nextInvocation.invokeNext();
-         }
-         catch (Throwable throwable)
-         {
-            if (throwable instanceof Exception) throw (Exception) throwable;
-            throw new RuntimeException(throwable);
-         }
-         finally
-         {
-            AllowedOperationsAssociation.popInMethodFlag();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-   }
-
-   /**
-    * Performs a synchronous local invocation
-    */
-   public Object localInvoke(Method method, Object[] args) throws Throwable
-   {
-      return localInvoke(method, args, null);
-   }
-
-   /**
-    * Performs a synchronous or asynchronous local invocation
-    *
-    * @param provider If null a synchronous invocation, otherwise an asynchronous
-    */
-   public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
-   {
-      return localInvoke(method, args, provider, null);
-   }
-   
-   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
-   {
-      return localInvoke(method, args, provider);
-   }
-   
-   public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback<StatelessBeanContext> callback) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         MethodInfo info = getMethodInfo(method);
-         Method unadvisedMethod = info.getUnadvisedMethod();
-
-         try
-         {
-            invokeStats.callIn();
-            
-            invokedMethod.push(new InvokedMethod(true, unadvisedMethod));
-
-            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-            {
-               return localHomeInvoke(unadvisedMethod, args);
-            }
-
-            EJBContainerInvocation<StatelessContainer, StatelessBeanContext> nextInvocation = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
-            nextInvocation.setAdvisor(getAdvisor());
-            nextInvocation.setArguments(args);
-            nextInvocation.setContextCallback(callback);
-
-            ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
-            return nextInvocation.invokeNext();
-         }
-         finally
-         {
-            if (unadvisedMethod != null)
-            {
-               long end = System.currentTimeMillis();
-               long elapsed = end - start;
-               invokeStats.updateStats(unadvisedMethod, elapsed);
-            }
-            
-            invokeStats.callOut();
-            
-            invokedMethod.pop();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-   }
-
-   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
-   {
-      long start = System.currentTimeMillis();
-      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         Thread.currentThread().setContextClassLoader(classloader);
-         MethodInvocation si = (MethodInvocation) invocation;
-         MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
-         if (info == null)
-         {
-            throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
-         }
-
-         Method unadvisedMethod = info.getUnadvisedMethod();
-         try
-         {
-            invokeStats.callIn();
-            
-            invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
-            Map responseContext = null;
-            Object rtn = null;
-            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-            {
-               rtn = invokeHomeMethod(info, si);
-            }
-            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-            {
-               rtn = invokeEJBObjectMethod(info, si);
-            }
-            else
-            {
-
-               EJBContainerInvocation newSi = null;
-
-               newSi = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
-               newSi.setArguments(si.getArguments());
-               newSi.setMetaData(si.getMetaData());
-               newSi.setAdvisor(getAdvisor());
-               try
-               {
-                  rtn = newSi.invokeNext();
-                  responseContext = newSi.getResponseContextInfo();
-               }
-               catch (Throwable throwable)
-               {
-                  responseContext = newSi.getResponseContextInfo();
-                  return marshallException(invocation, throwable, responseContext);
-               }
-            }
-
-            InvocationResponse response = marshallResponse(invocation, rtn, responseContext);
-            return response;
-         }
-         finally
-         {
-            if (unadvisedMethod != null)
-            {
-               long end = System.currentTimeMillis();
-               long elapsed = end - start;
-               invokeStats.updateStats(unadvisedMethod, elapsed);
-            }
-            
-            invokeStats.callOut();
-            
-            invokedMethod.pop();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
-   }
-
-
-   protected Object invokeEJBObjectMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("getHandle"))
-      {
-         
-         StatelessHandleRemoteImpl handle = null;
-         RemoteBinding binding = this.getAnnotation(RemoteBinding.class);
-         BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
-         handle = factory.createHandle();
-
-         return handle;
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         return null;
-      }
-      else if (unadvisedMethod.getName().equals("getEJBHome"))
-      {
-         HomeHandleImpl homeHandle = null;
-
-         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
-         if (remoteBindingAnnotation != null)
-            homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
-
-         return homeHandle.getEJBHome();
-      }
-      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
-      {
-         return null;
-      }
-      else if (unadvisedMethod.getName().equals("isIdentical"))
-      {
-         return false;
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-   /**
-    * Provides implementation for this bean's EJB 2.1 Home.create() method 
-    * 
-    * @param factory
-    * @param unadvisedMethod
-    * @param args
-    * @return
-    * @throws Exception
-    */
-   @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception
-   {   
-
-      Object proxy = factory.createProxyBusiness(unadvisedMethod.getReturnType().getName());
-
-      return proxy;
-   }
-
-   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
-   {
-      if (method.getName().equals("create"))
-      {
-         LocalBinding binding = this.getAnnotation(LocalBinding.class);
-
-         // FIXME: why this binding? Could be another one. (there is only one local binding, but that's another bug)
-
-         StatelessLocalProxyFactory factory = this.getProxyFactory(binding);
-
-         Object proxy = factory.createProxyEjb21(method.getReturnType().getName());
-
-         return proxy;
-      }
-      else
-      // remove
-      {
-         return null;
-      }
-   }
-
-   protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("create"))
-      {
-         RemoteBinding binding = this.getRemoteBinding();
-
-         BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
-
-         return factory.createProxyEjb21(unadvisedMethod.getReturnType().getName());
-      }
-      else
-      // remove
-      {
-         return null;
-      }
-   }
-
-   @Override
-   public Object getBusinessObject(BeanContext ctx, Class intf)
-   {
-      assert intf != null : "intf is null";
-      
-      try
-      {
-         String jndiName = ProxyFactoryHelper.getJndiName(this, intf);
-         if (jndiName == null) throw new IllegalStateException("Cannot find BusinessObject for interface: " + intf.getName());
-         return getInitialContext().lookup(ProxyFactoryHelper.getJndiName(this, intf));
-      }
-      catch (NamingException e)
-      {
-         throw new RuntimeException("failed to invoke getBusinessObject", e);
-      }
-   }
-
-   protected void removeHandle(Handle handle)
-   {
-      throw new RuntimeException("NYI");
-   }
-
-   /**
-    * WS integration
-    * @return
-    */
-   public Class getServiceImplementationClass()
-   {
-      return this.getBeanClass();
-   }
-
-   /**
-    * WS Integration
-    * @param method
-    * @param args
-    * @param invCtxCallback
-    * @return
-    * @throws Throwable
-    */
-   public Object invokeEndpoint(Method method, Object[] args, InvocationContextCallback invCtxCallback) throws Throwable
-   {
-      // JAX-RPC message context
-      javax.xml.rpc.handler.MessageContext jaxrpcContext = invCtxCallback.get(javax.xml.rpc.handler.MessageContext.class);
-
-      // JAX-WS webservice context
-      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-      WebServiceContextFactory contextFactory = spiProvider.getSPI(WebServiceContextFactory.class);
-      ExtensibleWebServiceContext jaxwsContext = contextFactory.newWebServiceContext(
-        InvocationType.JAXWS_EJB3,
-        invCtxCallback.get(javax.xml.ws.handler.MessageContext.class)
-      );
-
-      // ThreadLocal association
-      WebServiceContextProxy.associateMessageContext(jaxwsContext);
-
-      // EJB3 Injection Callbacks
-      WSCallbackImpl ejb3Callback = new WSCallbackImpl( jaxrpcContext, jaxwsContext );
-
-      // Actual invocation
-      return this.localInvoke(method, args, null, ejb3Callback);
-   }
-
-   public String getContainerName()
-   {
-      String name = this.getObjectName() != null ? this.getObjectName().getCanonicalName() : null;
-      return name;
-   }
-   
-   static class WSCallbackImpl implements BeanContextLifecycleCallback
-   {
-      private ExtensibleWebServiceContext jaxwsContext;
-      private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
-
-      public WSCallbackImpl(javax.xml.rpc.handler.MessageContext jaxrpc, ExtensibleWebServiceContext jaxws)
-      {
-         jaxrpcMessageContext = jaxrpc;
-         jaxwsContext = jaxws;
-      }
-
-      public void attached(BeanContext beanCtx)
-      {
-         // JAX-RPC MessageContext
-         StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
-         sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
-
-         // JAX-WS MessageContext
-         BeanProperty beanProp = sbc.getWebServiceContextProperty();
-         if (beanProp != null)
-         {
-            EJBContext ejbCtx = beanCtx.getEJBContext();            
-            jaxwsContext.addAttachment(EJBContext.class, ejbCtx);
-            beanProp.set(beanCtx.getInstance(), jaxwsContext);
-         }
-      }
-
-      public void released(BeanContext beanCtx)
-      {
-         StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
-         sbc.setMessageContextJAXRPC(null);
-
-         BeanProperty beanProp = sbc.getWebServiceContextProperty();
-         if (beanProp != null)
-            beanProp.set(beanCtx.getInstance(), null);
-      }      
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,790 @@
+/*
+ * 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.stateless;
+
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.Handle;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.naming.NamingException;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb.AllowedOperationsAssociation;
+import org.jboss.ejb.AllowedOperationsFlags;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.BeanContextLifecycleCallback;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.BaseStatelessRemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
+import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
+import org.jboss.ejb3.timerservice.TimedObjectInvoker;
+import org.jboss.ejb3.timerservice.TimerServiceFactory;
+import org.jboss.injection.WebServiceContextProxy;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+import org.jboss.proxy.ejb.handle.HomeHandleImpl;
+import org.jboss.util.NotImplementedException;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
+import org.jboss.wsf.spi.invocation.InvocationType;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
+import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
+import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessContainer extends SessionSpecContainer
+  implements TimedObjectInvoker, ServiceEndpointContainer, InvokableContext
+{
+   private static final Logger log = Logger.getLogger(StatelessContainer.class);
+
+   protected TimerService timerService;
+   private Method timeout;
+   private StatelessDelegateWrapper mbean = new StatelessDelegateWrapper(this);
+
+   public StatelessContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+                             Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+      
+      initializeTimeout();
+   }
+
+   @Override
+   public BeanContext<?> createBeanContext()
+   {
+      return new StatelessBeanContext(this, construct());
+   }
+   
+   @Override
+   protected StatelessLocalProxyFactory getProxyFactory(LocalBinding binding)
+   {
+      StatelessLocalProxyFactory factory = (StatelessLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
+
+      if (factory == null)
+      {
+         factory = new StatelessLocalProxyFactory(this, binding);
+         try
+         {
+            factory.init();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+
+      return factory;
+   }
+   
+   @Override
+   protected BaseStatelessRemoteProxyFactory getProxyFactory(RemoteBinding binding)
+   {
+      BaseStatelessRemoteProxyFactory factory = (BaseStatelessRemoteProxyFactory) this.proxyDeployer
+            .getProxyFactory(binding);
+
+      if (factory == null)
+      {
+         Clustered clustered = getAnnotation(Clustered.class);
+         if (clustered != null)
+            factory = new StatelessClusterProxyFactory(this, binding, clustered);
+         else
+            factory = new StatelessRemoteProxyFactory(this, binding);
+         
+         try
+         {
+            factory.init();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+
+      return factory;
+   }
+   
+   /**
+    * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
+    * the specified LocalBinding
+    * 
+    * @param id
+    * @return
+    * @throws Exception
+    */
+   @Override
+   public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
+   {
+      StatelessLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
+      return proxyFactory.createProxyEjb21(businessInterfaceType);
+   }
+   
+   @Override
+   public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
+   {
+      BaseStatelessRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
+      return proxyFactory.createProxyEjb21(businessInterfaceType);
+   }
+   
+   public Serializable createSession(Class<?> initTypes[], Object initArgs[])
+   {
+      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
+         throw new IllegalArgumentException("stateless bean create method must take no arguments (EJB3 4.5)");
+      // a stateless bean has no sessions
+      // TODO: pool stuff
+      return null;
+   }
+   
+   public boolean isClustered()
+   {
+      return isAnnotationPresent(Clustered.class);
+   }
+   
+   public Object getMBean()
+   {
+      return mbean;
+   }
+   
+   private void initializeTimeout()
+   {
+      JBossSessionBeanMetaData metaData = getMetaData();
+      NamedMethodMetaData timeoutMethodMetaData = null;
+      if(metaData != null)
+         timeoutMethodMetaData = metaData.getTimeoutMethod();
+      this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
+   }
+   
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      try
+      {
+         super.lockedStart();
+         
+         timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
+         
+         TimerServiceFactory.getInstance().restoreTimerService(timerService);
+      }
+      catch (Exception e)
+      {
+         try
+         {
+            this.lockedStop();
+         }
+         catch (Exception ignore)
+         {
+            log.debug("Failed to cleanup after start() failure", ignore);
+         }
+         throw e;
+      }
+   }
+
+   @Override
+   protected void lockedStop() throws Exception
+   {
+      if (timerService != null)
+      {
+         TimerServiceFactory.getInstance().removeTimerService(timerService);
+         timerService = null;
+      }
+      
+      super.lockedStop();
+   }
+
+   public TimerService getTimerService()
+   {
+      return timerService;
+   }
+
+   public TimerService getTimerService(Object pKey)
+   {
+      assert timerService != null : "Timer Service not yet initialized";
+      return timerService;
+   }
+   
+   public void callTimeout(Timer timer) throws Exception
+   {
+      if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
+      Object[] args = {timer};
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
+         try
+         {
+            MethodInfo info = super.getMethodInfo(timeout);
+            EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
+            nextInvocation.setAdvisor(getAdvisor());
+            nextInvocation.setArguments(args);
+            nextInvocation.invokeNext();
+         }
+         catch (Throwable throwable)
+         {
+            if (throwable instanceof Exception) throw (Exception) throwable;
+            throw new RuntimeException(throwable);
+         }
+         finally
+         {
+            AllowedOperationsAssociation.popInMethodFlag();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+
+   /**
+    * Performs a synchronous local invocation
+    */
+   public Object localInvoke(Method method, Object[] args) throws Throwable
+   {
+      return localInvoke(method, args, null);
+   }
+
+   /**
+    * Performs a synchronous or asynchronous local invocation
+    *
+    * @param provider If null a synchronous invocation, otherwise an asynchronous
+    */
+   public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      return localInvoke(method, args, provider, null);
+   }
+   
+   public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+   {
+      return localInvoke(method, args, provider);
+   }
+   
+   public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback<StatelessBeanContext> callback) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+      
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         MethodInfo info = getMethodInfo(method);
+         Method unadvisedMethod = info.getUnadvisedMethod();
+
+         try
+         {
+            invokeStats.callIn();
+            
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
+
+            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               return localHomeInvoke(unadvisedMethod, args);
+            }
+
+            EJBContainerInvocation<StatelessContainer, StatelessBeanContext> nextInvocation = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+            nextInvocation.setAdvisor(getAdvisor());
+            nextInvocation.setArguments(args);
+            nextInvocation.setContextCallback(callback);
+
+            ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+            return nextInvocation.invokeNext();
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+            
+            invokeStats.callOut();
+            
+            //invokedMethod.pop();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+   
+   /**
+    * Remote Invocation entry point, as delegated from
+    * ClassProxyHack (Remoting Dispatcher)
+    */
+   public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      /*
+       * Initialize
+       */
+
+      // Mark the start time
+      long start = System.currentTimeMillis();
+
+      // Create a pointer to a new Invocation
+      EJBContainerInvocation newSi = null;
+
+      // Create a pointer to the response we'll return
+      InvocationResponse response = null;
+      
+
+      /*
+       * Setup Environment (Stack/Thread)
+       */
+
+      // Hold a reference to the existing TCL
+      ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
+
+      // Set the Container's CL as TCL, required to unmarshall methods from the bean impl class
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+
+      // Push the ENC onto the stack
+      pushEnc();
+      
+      try
+      {
+         
+         /*
+          * Obtain the target method (unmarshall from invocation)
+          */
+
+         // Cast
+         assert invocation instanceof StatefulRemoteInvocation : SessionContainer.class.getName()
+               + ".dynamicInoke supports only " + StatefulRemoteInvocation.class.getSimpleName()
+               + ", but has been passed: " + invocation;
+         MethodInvocation si = (MethodInvocation) invocation;
+
+         // Get the method hash
+         long methodHash = si.getMethodHash();
+         log.debug("Received dynamic invocation for method with hash: " + methodHash);
+
+         // Get the Method via MethodInfo from the Advisor
+         Advisor advisor = this.getAdvisor();
+         MethodInfo info = advisor.getMethodInfo(methodHash);
+         Method unadvisedMethod = info.getMethod();
+         
+         try
+         {
+            invokeStats.callIn();
+
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
+            Map responseContext = null;
+            Object rtn = null;
+            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               rtn = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               rtn = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+
+               newSi = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+               
+               /*
+                * Set the invoked method
+                */
+               //TODO Remove when CurrentInvocation is ironed out
+               
+               // Get the invoked method from invocation metadata
+               Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
+               assert objInvokedMethod !=null : "Invoked Method must be set on invocation metadata";
+               assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type " + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
+               SerializableMethod invokedMethod = (SerializableMethod)objInvokedMethod;
+               
+               // Set onto stack
+               SessionSpecContainer.invokedMethod.push(invokedMethod);
+               
+               
+               try
+               {
+                  rtn = newSi.invokeNext();
+                  responseContext = newSi.getResponseContextInfo();
+               }
+               catch (Throwable throwable)
+               {
+                  responseContext = newSi.getResponseContextInfo();
+                  return marshallException(invocation, throwable, responseContext);
+               }
+               finally
+               {
+                  SessionSpecContainer.invokedMethod.pop();
+               }
+            }
+
+            response = marshallResponse(invocation, rtn, responseContext);
+            return response;
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+
+            invokeStats.callOut();
+
+            //invokedMethod.pop();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(originalLoader);
+      }
+   }
+
+   @Deprecated
+   public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+   {
+      long start = System.currentTimeMillis();
+      
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(classloader);
+         MethodInvocation si = (MethodInvocation) invocation;
+         MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+         if (info == null)
+         {
+            throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
+         }
+
+         Method unadvisedMethod = info.getUnadvisedMethod();
+         try
+         {
+            invokeStats.callIn();
+            
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
+            Map responseContext = null;
+            Object rtn = null;
+            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               rtn = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               rtn = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+
+               EJBContainerInvocation newSi = null;
+
+               newSi = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+               try
+               {
+                  rtn = newSi.invokeNext();
+                  responseContext = newSi.getResponseContextInfo();
+               }
+               catch (Throwable throwable)
+               {
+                  responseContext = newSi.getResponseContextInfo();
+                  return marshallException(invocation, throwable, responseContext);
+               }
+            }
+
+            InvocationResponse response = marshallResponse(invocation, rtn, responseContext);
+            return response;
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+            
+            invokeStats.callOut();
+            
+            //invokedMethod.pop();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+
+
+   protected Object invokeEJBObjectMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().equals("getHandle"))
+      {
+         
+         StatelessHandleRemoteImpl handle = null;
+         RemoteBinding binding = this.getAnnotation(RemoteBinding.class);
+         BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
+         handle = factory.createHandle();
+
+         return handle;
+      }
+      else if (unadvisedMethod.getName().equals("remove"))
+      {
+         return null;
+      }
+      else if (unadvisedMethod.getName().equals("getEJBHome"))
+      {
+         HomeHandleImpl homeHandle = null;
+
+         RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+         if (remoteBindingAnnotation != null)
+            homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
+
+         return homeHandle.getEJBHome();
+      }
+      else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+      {
+         return null;
+      }
+      else if (unadvisedMethod.getName().equals("isIdentical"))
+      {
+         return false;
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   /**
+    * Provides implementation for this bean's EJB 2.1 Home.create() method 
+    * 
+    * @param factory
+    * @param unadvisedMethod
+    * @param args
+    * @return
+    * @throws Exception
+    */
+   @Override
+   protected Object invokeHomeCreate(SerializableMethod unadvisedMethod, Object args[])
+         throws Exception
+   {   
+      // Lookup factory
+      Object factory = this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
+      SessionProxyFactory proxyFactory = SessionProxyFactory.class.cast(factory);
+
+      Object proxy = proxyFactory.createProxyBusiness(unadvisedMethod.getReturnType());
+
+      return proxy;
+   }
+
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+   {
+      if (method.getName().equals("create"))
+      {
+         LocalBinding binding = this.getAnnotation(LocalBinding.class);
+
+         // FIXME: why this binding? Could be another one. (there is only one local binding, but that's another bug)
+
+         StatelessLocalProxyFactory factory = this.getProxyFactory(binding);
+
+         Object proxy = factory.createProxyEjb21(method.getReturnType().getName());
+
+         return proxy;
+      }
+      else
+      // remove
+      {
+         return null;
+      }
+   }
+
+   protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
+   {
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      if (unadvisedMethod.getName().equals("create"))
+      {
+         RemoteBinding binding = this.getRemoteBinding();
+
+         BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
+
+         return factory.createProxyEjb21(unadvisedMethod.getReturnType().getName());
+      }
+      else
+      // remove
+      {
+         return null;
+      }
+   }
+
+   @Override
+   public Object getBusinessObject(BeanContext ctx, Class intf)
+   {
+      assert intf != null : "intf is null";
+      
+      try
+      {
+         String jndiName = ProxyFactoryHelper.getJndiName(this, intf);
+         if (jndiName == null) throw new IllegalStateException("Cannot find BusinessObject for interface: " + intf.getName());
+         return getInitialContext().lookup(ProxyFactoryHelper.getJndiName(this, intf));
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException("failed to invoke getBusinessObject", e);
+      }
+   }
+
+   protected void removeHandle(Handle handle)
+   {
+      throw new RuntimeException("NYI");
+   }
+
+   /**
+    * WS integration
+    * @return
+    */
+   public Class getServiceImplementationClass()
+   {
+      return this.getBeanClass();
+   }
+
+   /**
+    * WS Integration
+    * @param method
+    * @param args
+    * @param invCtxCallback
+    * @return
+    * @throws Throwable
+    */
+   public Object invokeEndpoint(Method method, Object[] args, InvocationContextCallback invCtxCallback) throws Throwable
+   {
+      // JAX-RPC message context
+      javax.xml.rpc.handler.MessageContext jaxrpcContext = invCtxCallback.get(javax.xml.rpc.handler.MessageContext.class);
+
+      // JAX-WS webservice context
+      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+      WebServiceContextFactory contextFactory = spiProvider.getSPI(WebServiceContextFactory.class);
+      ExtensibleWebServiceContext jaxwsContext = contextFactory.newWebServiceContext(
+        InvocationType.JAXWS_EJB3,
+        invCtxCallback.get(javax.xml.ws.handler.MessageContext.class)
+      );
+
+      // ThreadLocal association
+      WebServiceContextProxy.associateMessageContext(jaxwsContext);
+
+      // EJB3 Injection Callbacks
+      WSCallbackImpl ejb3Callback = new WSCallbackImpl( jaxrpcContext, jaxwsContext );
+
+      // Actual invocation
+      return this.localInvoke(method, args, null, ejb3Callback);
+   }
+
+   public String getContainerName()
+   {
+      String name = this.getObjectName() != null ? this.getObjectName().getCanonicalName() : null;
+      return name;
+   }
+   
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected String getJndiRegistrarBindName()
+   {
+      return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SLSB;
+   }
+   
+   static class WSCallbackImpl implements BeanContextLifecycleCallback
+   {
+      private ExtensibleWebServiceContext jaxwsContext;
+      private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
+
+      public WSCallbackImpl(javax.xml.rpc.handler.MessageContext jaxrpc, ExtensibleWebServiceContext jaxws)
+      {
+         jaxrpcMessageContext = jaxrpc;
+         jaxwsContext = jaxws;
+      }
+
+      public void attached(BeanContext beanCtx)
+      {
+         // JAX-RPC MessageContext
+         StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+         sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+
+         // JAX-WS MessageContext
+         BeanProperty beanProp = sbc.getWebServiceContextProperty();
+         if (beanProp != null)
+         {
+            EJBContext ejbCtx = beanCtx.getEJBContext();            
+            jaxwsContext.addAttachment(EJBContext.class, ejbCtx);
+            beanProp.set(beanCtx.getInstance(), jaxwsContext);
+         }
+      }
+
+      public void released(BeanContext beanCtx)
+      {
+         StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+         sbc.setMessageContextJAXRPC(null);
+
+         BeanProperty beanProp = sbc.getWebServiceContextProperty();
+         if (beanProp != null)
+            beanProp.set(beanCtx.getInstance(), null);
+      }      
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,330 +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.injection;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.injection.lang.reflect.BeanProperty;
-import org.jboss.injection.lang.reflect.BeanPropertyFactory;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.javaee.spec.RemoteEnvironment;
-import org.jboss.metadata.javaee.spec.ResourceInjectionMetaData;
-import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
-import org.jboss.metamodel.descriptor.InjectionTarget;
-import org.jboss.metamodel.descriptor.Ref;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class InjectionUtil
-{
-   private static final Logger log = Logger
-           .getLogger(InjectionUtil.class);
-
-
-   /**
-    * This method will take a set of XML loaded injectors and collapse them based on spec inheritance rules
-    * It will remove injectors that should not be used in the injection of the base component class.
-    *
-    * @param visitedMethods
-    * @param clazz
-    * @param xmlDefinedInjectors
-    * @param classInjectors
-    */
-   public static void collapseXmlMethodInjectors(Set<String> visitedMethods, Class clazz, Map<String, Map<AccessibleObject, Injector>> xmlDefinedInjectors, Map<AccessibleObject, Injector> classInjectors)
-   {
-      if (clazz == null || clazz.equals(Object.class))
-      {
-         return;
-      }
-      Map<AccessibleObject, Injector> xmlInjectors = xmlDefinedInjectors.get(clazz.getName());
-      if (xmlInjectors != null)
-      {
-         Method[] methods = clazz.getDeclaredMethods();
-         for (Method method : methods)
-         {
-            if (method.getParameterTypes().length != 1) continue;
-
-            if (!Modifier.isPrivate(method.getModifiers()))
-            {
-               if (visitedMethods.contains(method.getName()))
-               {
-                  xmlInjectors.remove(method); // if not private then it has been overriden
-                  continue;
-               }
-               visitedMethods.add(method.getName());
-            }
-         }
-         classInjectors.putAll(xmlInjectors);
-      }
-      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
-      collapseXmlMethodInjectors(visitedMethods, clazz.getSuperclass(), xmlDefinedInjectors, classInjectors);
-   }
-
-   /**
-    * Create and add multiple injectors for injection targets.
-    * 
-    * @param injectors          the list on which to add injectors
-    * @param classLoader        the class loader to resolve an injection target
-    * @param factory            the injector factory
-    * @param injectionTargets   the injection targets
-    */
-   public static void createInjectors(List<Injector> injectors, ClassLoader classLoader, InjectorFactory<?> factory, Collection<ResourceInjectionTargetMetaData> injectionTargets)
-   {
-      for(ResourceInjectionTargetMetaData injectionTarget : injectionTargets)
-      {
-         AccessibleObject ao = findInjectionTarget(classLoader, injectionTarget);
-         BeanProperty property = BeanPropertyFactory.create(ao);
-         injectors.add(factory.create(property));
-      }
-   }
-   
-   public static <X extends RemoteEnvironment> void processMethodAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Set<String> visitedMethods, Class<?> clazz, Map<AccessibleObject, Injector> classInjectors)
-   {
-      if (clazz == null || clazz.equals(Object.class))
-      {
-         return;
-      }
-      Method[] methods = clazz.getDeclaredMethods();
-      for (Method method : methods)
-      {
-         if (method.getParameterTypes().length != 1) continue;
-
-         if (!Modifier.isPrivate(method.getModifiers()))
-         {
-            if (visitedMethods.contains(method.getName()))
-            {
-               continue;
-            }
-            visitedMethods.add(method.getName());
-         }
-        
-         if (handlers != null)
-         {
-            for (InjectionHandler<?> handler : handlers)
-            {
-               handler.handleMethodAnnotations(method, container, classInjectors);
-            }
-         }
-      }
-      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
-      processMethodAnnotations(container, handlers, visitedMethods, clazz.getSuperclass(), classInjectors);
-   }
-
-   public static <X extends RemoteEnvironment> void processFieldAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz, Map<AccessibleObject, Injector> classInjectors)
-   {
-      if (clazz == null || clazz.equals(Object.class))
-      {
-         return;
-      }
- 
-      if (handlers != null)
-      {
-         Field[] fields = clazz.getDeclaredFields();
-         for (Field field : fields)
-         {
-            log.trace("process field annotation for " + field.toGenericString());
-            for (InjectionHandler<?> handler : handlers)
-            {
-               handler.handleFieldAnnotations(field, container, classInjectors);
-            }
-         }
-      }
-      
-      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
-      processFieldAnnotations(container, handlers, clazz.getSuperclass(), classInjectors);
-   }
-
-   public static <X extends RemoteEnvironment> void processClassAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz)
-   {
-      if (clazz == null || clazz.equals(Object.class))
-      {
-         return;
-      }
-    
-      if (handlers != null)
-      {
-         for (InjectionHandler<?> handler : handlers)
-         {
-            handler.handleClassAnnotations(clazz, container);
-         }
-      }
-      
-      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
-      processClassAnnotations(container, handlers, clazz.getSuperclass());
-   }
-
-   public static <X extends RemoteEnvironment> Map<AccessibleObject, Injector> processAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz)
-   {
-      Map<AccessibleObject, Injector> classInjectors = new HashMap<AccessibleObject, Injector>();
-      HashSet<String> visitedMethods = new HashSet<String>();
-      collapseXmlMethodInjectors(visitedMethods, clazz, container.getEncInjections(), classInjectors);
-
-      processClassAnnotations(container, handlers, clazz);
-      visitedMethods = new HashSet<String>();
-      processMethodAnnotations(container, handlers, visitedMethods, clazz, classInjectors);
-      processFieldAnnotations(container, handlers, clazz, classInjectors);
-      return classInjectors;
-   }
-
-   public static AccessibleObject findInjectionTarget(ClassLoader loader, ResourceInjectionTargetMetaData target)
-   {
-      Class<?> clazz = null;
-      try
-      {
-         clazz = loader.loadClass(target.getInjectionTargetClass());
-      }
-      catch (ClassNotFoundException e)
-      {
-         throw new RuntimeException("<injection-target> class: " + target.getInjectionTargetClass() + " was not found in deployment");
-      }
-
-      for (Field field : clazz.getDeclaredFields())
-      {
-         if (target.getInjectionTargetName().equals(field.getName())) return field;
-      }
-
-      for (java.lang.reflect.Method method : clazz.getDeclaredMethods())
-      {
-         if (method.getName().equals(target.getInjectionTargetName())) return method;
-      }
-
-      throw new RuntimeException("<injection-target> could not be found: " + target.getInjectionTargetClass() + "." + target.getInjectionTargetName());
-
-   }
-
-   public static String getEncName(Class type)
-   {
-      return "env/" + type.getName();
-   }
-
-   public static String getEncName(Method method)
-   {
-      String encName = method.getName().substring(3);
-      if (encName.length() > 1)
-      {
-         encName = encName.substring(0, 1).toLowerCase() + encName.substring(1);
-      }
-      else
-      {
-         encName = encName.toLowerCase();
-      }
-
-      encName = getEncName(method.getDeclaringClass()) + "/" + encName;
-      return encName;
-   }
-
-   public static String getEncName(Field field)
-   {
-      return getEncName(field.getDeclaringClass()) + "/" + field.getName();
-   }
-
-   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Class<?> annotatedClass, boolean isContainer)
-   {
-      if (isContainer)
-      {
-         return container.resolveAnnotation(annotation);
-      }
-      else
-      {
-         return annotatedClass.getAnnotation(annotation);
-      }
-   }
-
-   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Method method, boolean isContainer)
-   {
-      if (isContainer)
-      {
-         return container.resolveAnnotation(method, annotation);
-      }
-      else
-      {
-         return method.getAnnotation(annotation);
-      }
-   }
-
-   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Field field, boolean isContainer)
-   {
-      if (isContainer)
-      {
-         return container.resolveAnnotation(field, annotation);
-      }
-      else
-      {
-         return field.getAnnotation(annotation);
-      }
-   }
-
-   public static Class<?> injectionTarget(String encName, ResourceInjectionMetaData ref, InjectionContainer container, Map<String, Map<AccessibleObject, Injector>> classInjectors)
-   {
-      Class<?> injectionType = null;
-      
-      if(ref.getInjectionTargets() == null)
-         return injectionType;
-      
-      for(ResourceInjectionTargetMetaData injectionTarget : ref.getInjectionTargets())
-      {
-         // todo, get injection target class
-         AccessibleObject ao = findInjectionTarget(container.getClassloader(), injectionTarget);
-         Map<AccessibleObject, Injector> injectors = classInjectors.get(injectionTarget.getInjectionTargetClass());
-         if (injectors == null)
-         {
-            injectors = new HashMap<AccessibleObject, Injector>();
-            classInjectors.put(injectionTarget.getInjectionTargetClass(), injectors);
-         }
-         Class<?> type;
-         if (ao instanceof Field)
-         {
-            type = ((Field) ao).getType();
-            injectors.put(ao, new JndiFieldInjector((Field) ao, encName, container.getEnc()));
-         }
-         else
-         {
-            type = ((Method) ao).getParameterTypes()[0];
-            injectors.put(ao, new JndiMethodInjector((Method) ao, encName, container.getEnc()));
-         }
-         if(injectionType == null)
-            injectionType = type;
-         else
-         {
-            if(!injectionType.equals(type))
-               throw new IllegalStateException("Found multiple injection targets with different types");
-         }
-      }
-      
-      return injectionType;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/InjectionUtil.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,328 @@
+/*
+ * 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.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.injection.lang.reflect.BeanPropertyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.RemoteEnvironment;
+import org.jboss.metadata.javaee.spec.ResourceInjectionMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class InjectionUtil
+{
+   private static final Logger log = Logger
+           .getLogger(InjectionUtil.class);
+
+
+   /**
+    * This method will take a set of XML loaded injectors and collapse them based on spec inheritance rules
+    * It will remove injectors that should not be used in the injection of the base component class.
+    *
+    * @param visitedMethods
+    * @param clazz
+    * @param xmlDefinedInjectors
+    * @param classInjectors
+    */
+   public static void collapseXmlMethodInjectors(Set<String> visitedMethods, Class clazz, Map<String, Map<AccessibleObject, Injector>> xmlDefinedInjectors, Map<AccessibleObject, Injector> classInjectors)
+   {
+      if (clazz == null || clazz.equals(Object.class))
+      {
+         return;
+      }
+      Map<AccessibleObject, Injector> xmlInjectors = xmlDefinedInjectors.get(clazz.getName());
+      if (xmlInjectors != null)
+      {
+         Method[] methods = clazz.getDeclaredMethods();
+         for (Method method : methods)
+         {
+            if (method.getParameterTypes().length != 1) continue;
+
+            if (!Modifier.isPrivate(method.getModifiers()))
+            {
+               if (visitedMethods.contains(method.getName()))
+               {
+                  xmlInjectors.remove(method); // if not private then it has been overriden
+                  continue;
+               }
+               visitedMethods.add(method.getName());
+            }
+         }
+         classInjectors.putAll(xmlInjectors);
+      }
+      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
+      collapseXmlMethodInjectors(visitedMethods, clazz.getSuperclass(), xmlDefinedInjectors, classInjectors);
+   }
+
+   /**
+    * Create and add multiple injectors for injection targets.
+    * 
+    * @param injectors          the list on which to add injectors
+    * @param classLoader        the class loader to resolve an injection target
+    * @param factory            the injector factory
+    * @param injectionTargets   the injection targets
+    */
+   public static void createInjectors(List<Injector> injectors, ClassLoader classLoader, InjectorFactory<?> factory, Collection<ResourceInjectionTargetMetaData> injectionTargets)
+   {
+      for(ResourceInjectionTargetMetaData injectionTarget : injectionTargets)
+      {
+         AccessibleObject ao = findInjectionTarget(classLoader, injectionTarget);
+         BeanProperty property = BeanPropertyFactory.create(ao);
+         injectors.add(factory.create(property));
+      }
+   }
+   
+   public static <X extends RemoteEnvironment> void processMethodAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Set<String> visitedMethods, Class<?> clazz, Map<AccessibleObject, Injector> classInjectors)
+   {
+      if (clazz == null || clazz.equals(Object.class))
+      {
+         return;
+      }
+      Method[] methods = clazz.getDeclaredMethods();
+      for (Method method : methods)
+      {
+         if (method.getParameterTypes().length != 1) continue;
+
+         if (!Modifier.isPrivate(method.getModifiers()))
+         {
+            if (visitedMethods.contains(method.getName()))
+            {
+               continue;
+            }
+            visitedMethods.add(method.getName());
+         }
+        
+         if (handlers != null)
+         {
+            for (InjectionHandler<?> handler : handlers)
+            {
+               handler.handleMethodAnnotations(method, container, classInjectors);
+            }
+         }
+      }
+      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
+      processMethodAnnotations(container, handlers, visitedMethods, clazz.getSuperclass(), classInjectors);
+   }
+
+   public static <X extends RemoteEnvironment> void processFieldAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz, Map<AccessibleObject, Injector> classInjectors)
+   {
+      if (clazz == null || clazz.equals(Object.class))
+      {
+         return;
+      }
+ 
+      if (handlers != null)
+      {
+         Field[] fields = clazz.getDeclaredFields();
+         for (Field field : fields)
+         {
+            log.trace("process field annotation for " + field.toGenericString());
+            for (InjectionHandler<?> handler : handlers)
+            {
+               handler.handleFieldAnnotations(field, container, classInjectors);
+            }
+         }
+      }
+      
+      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
+      processFieldAnnotations(container, handlers, clazz.getSuperclass(), classInjectors);
+   }
+
+   public static <X extends RemoteEnvironment> void processClassAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz)
+   {
+      if (clazz == null || clazz.equals(Object.class))
+      {
+         return;
+      }
+    
+      if (handlers != null)
+      {
+         for (InjectionHandler<?> handler : handlers)
+         {
+            handler.handleClassAnnotations(clazz, container);
+         }
+      }
+      
+      // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored
+      processClassAnnotations(container, handlers, clazz.getSuperclass());
+   }
+
+   public static <X extends RemoteEnvironment> Map<AccessibleObject, Injector> processAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz)
+   {
+      Map<AccessibleObject, Injector> classInjectors = new HashMap<AccessibleObject, Injector>();
+      HashSet<String> visitedMethods = new HashSet<String>();
+      collapseXmlMethodInjectors(visitedMethods, clazz, container.getEncInjections(), classInjectors);
+
+      processClassAnnotations(container, handlers, clazz);
+      visitedMethods = new HashSet<String>();
+      processMethodAnnotations(container, handlers, visitedMethods, clazz, classInjectors);
+      processFieldAnnotations(container, handlers, clazz, classInjectors);
+      return classInjectors;
+   }
+
+   public static AccessibleObject findInjectionTarget(ClassLoader loader, ResourceInjectionTargetMetaData target)
+   {
+      Class<?> clazz = null;
+      try
+      {
+         clazz = loader.loadClass(target.getInjectionTargetClass());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("<injection-target> class: " + target.getInjectionTargetClass() + " was not found in deployment");
+      }
+
+      for (Field field : clazz.getDeclaredFields())
+      {
+         if (target.getInjectionTargetName().equals(field.getName())) return field;
+      }
+
+      for (java.lang.reflect.Method method : clazz.getDeclaredMethods())
+      {
+         if (method.getName().equals(target.getInjectionTargetName())) return method;
+      }
+
+      throw new RuntimeException("<injection-target> could not be found: " + target.getInjectionTargetClass() + "." + target.getInjectionTargetName());
+
+   }
+
+   public static String getEncName(Class type)
+   {
+      return "env/" + type.getName();
+   }
+
+   public static String getEncName(Method method)
+   {
+      String encName = method.getName().substring(3);
+      if (encName.length() > 1)
+      {
+         encName = encName.substring(0, 1).toLowerCase() + encName.substring(1);
+      }
+      else
+      {
+         encName = encName.toLowerCase();
+      }
+
+      encName = getEncName(method.getDeclaringClass()) + "/" + encName;
+      return encName;
+   }
+
+   public static String getEncName(Field field)
+   {
+      return getEncName(field.getDeclaringClass()) + "/" + field.getName();
+   }
+
+   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Class<?> annotatedClass, boolean isContainer)
+   {
+      if (isContainer)
+      {
+         return container.resolveAnnotation(annotation);
+      }
+      else
+      {
+         return annotatedClass.getAnnotation(annotation);
+      }
+   }
+
+   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Method method, boolean isContainer)
+   {
+      if (isContainer)
+      {
+         return container.resolveAnnotation(method, annotation);
+      }
+      else
+      {
+         return method.getAnnotation(annotation);
+      }
+   }
+
+   public static Object getAnnotation(Class<? extends Annotation> annotation, EJBContainer container, Field field, boolean isContainer)
+   {
+      if (isContainer)
+      {
+         return container.resolveAnnotation(field, annotation);
+      }
+      else
+      {
+         return field.getAnnotation(annotation);
+      }
+   }
+
+   public static Class<?> injectionTarget(String encName, ResourceInjectionMetaData ref, InjectionContainer container, Map<String, Map<AccessibleObject, Injector>> classInjectors)
+   {
+      Class<?> injectionType = null;
+      
+      if(ref.getInjectionTargets() == null)
+         return injectionType;
+      
+      for(ResourceInjectionTargetMetaData injectionTarget : ref.getInjectionTargets())
+      {
+         // todo, get injection target class
+         AccessibleObject ao = findInjectionTarget(container.getClassloader(), injectionTarget);
+         Map<AccessibleObject, Injector> injectors = classInjectors.get(injectionTarget.getInjectionTargetClass());
+         if (injectors == null)
+         {
+            injectors = new HashMap<AccessibleObject, Injector>();
+            classInjectors.put(injectionTarget.getInjectionTargetClass(), injectors);
+         }
+         Class<?> type;
+         if (ao instanceof Field)
+         {
+            type = ((Field) ao).getType();
+            injectors.put(ao, new JndiFieldInjector((Field) ao, encName, container.getEnc()));
+         }
+         else
+         {
+            type = ((Method) ao).getParameterTypes()[0];
+            injectors.put(ao, new JndiMethodInjector((Method) ao, encName, container.getEnc()));
+         }
+         if(injectionType == null)
+            injectionType = type;
+         else
+         {
+            if(!injectionType.equals(type))
+               throw new IllegalStateException("Found multiple injection targets with different types");
+         }
+      }
+      
+      return injectionType;
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.injection;
-
-import java.util.Arrays;
-
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.JndiUtil;
-import org.jboss.injection.lang.reflect.BeanProperty;
-import org.jboss.logging.Logger;
-
-/**
- * Injects a jndi dependency into a bean property.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class JndiPropertyInjector extends AbstractPropertyInjector implements PojoInjector
-{
-   @SuppressWarnings("unused")
-   private static final Logger log = Logger.getLogger(JndiPropertyInjector.class);
-   
-   private String jndiName;
-   private Context ctx;
-
-   public JndiPropertyInjector(BeanProperty property, String jndiName, Context ctx)
-   {
-      super(property);
-      this.jndiName = jndiName;
-      this.ctx = ctx;
-   }
-
-   public void inject(BeanContext bctx)
-   {
-      inject(bctx, bctx.getInstance());
-   }
-   
-   public Class<?> getInjectionClass()
-   {
-      return property.getType();
-   }
-   
-   protected Object lookup(String jndiName)
-   {
-      Object dependency = null;
-      
-      try
-      {
-         dependency = JndiUtil.lookup(ctx, jndiName);
-      }
-      catch (NamingException e)
-      {
-         Throwable cause = e;
-         while(cause.getCause() != null)
-            cause = cause.getCause();
-         throw new RuntimeException("Unable to inject jndi dependency: " + jndiName + " into property " + property + ": " + cause.getMessage(), e);
-      }
-      return dependency;
-   }
-   
-   public void inject(BeanContext bctx, Object instance)
-   {
-      inject(instance);
-   }
-
-   public void inject(Object instance)
-   {
-      Object value = lookup(jndiName);
-      log.trace("injecting " + value + " from " + jndiName + " into " + property + " of " + instance);
-      try
-      {
-         property.set(instance, value);
-      }
-      catch(IllegalArgumentException e)
-      {
-         // We found something to inject, but it happened to be the wrong thing
-         String realJndiName;
-         try
-         {
-            // TODO: check whether it's a real link beforehand
-            Object link = JndiUtil.lookupLink(ctx, jndiName);
-            realJndiName = jndiName + (link instanceof LinkRef ? " (link -> " + ((LinkRef) link).getLinkName() + ")" : "");
-         }
-         catch(NamingException ne)
-         {
-            log.trace("Failed to obtain the real JNDI name", ne);
-            realJndiName = jndiName;
-         }
-         Class<?> interfaces[] = value.getClass().getInterfaces();
-         String interfacesStr = (interfaces.length > 0 ? " (implements " + Arrays.toString(interfaces) + ")" : "");
-         String msg = "failed to inject " + value + interfacesStr + " from " + realJndiName + " into " + property + " of " + instance;
-         throw new IllegalArgumentException(msg, e);
-      }
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java (from rev 76876, projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/main/java/org/jboss/injection/JndiPropertyInjector.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.injection;
+
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
+
+import javax.naming.Context;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.JndiUtil;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.logging.Logger;
+
+/**
+ * Injects a jndi dependency into a bean property.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JndiPropertyInjector extends AbstractPropertyInjector implements PojoInjector
+{
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(JndiPropertyInjector.class);
+   
+   private String jndiName;
+   private Context ctx;
+
+   public JndiPropertyInjector(BeanProperty property, String jndiName, Context ctx)
+   {
+      super(property);
+      this.jndiName = jndiName;
+      this.ctx = ctx;
+   }
+
+   public void inject(BeanContext bctx)
+   {
+      inject(bctx, bctx.getInstance());
+   }
+   
+   public Class<?> getInjectionClass()
+   {
+      return property.getType();
+   }
+   
+   protected Object lookup(String jndiName)
+   {
+      Object dependency = null;
+      
+      try
+      {
+         dependency = JndiUtil.lookup(ctx, jndiName);
+      }
+      catch (NamingException e)
+      {
+         Throwable cause = e;
+         while(cause.getCause() != null)
+            cause = cause.getCause();
+         throw new RuntimeException("Unable to inject jndi dependency: " + jndiName + " into property " + property + ": " + cause.getMessage(), e);
+      }
+      return dependency;
+   }
+   
+   public void inject(BeanContext bctx, Object instance)
+   {
+      inject(instance);
+   }
+
+   public void inject(Object instance)
+   {
+      
+      
+      
+      
+      
+      Object value = lookup(jndiName);
+      
+//      Class<?> valueClass = value.getClass();
+//      
+//      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+//      ClassLoader classcl = property.getType().getClassLoader();
+//      ClassLoader valueCl = valueClass.getClassLoader();
+//      ClassLoader proxyHandlerCl = null;
+//      if(Proxy.isProxyClass(value.getClass()))
+//      {
+//         Object proxyHandler = Proxy.getInvocationHandler(value);
+//         proxyHandlerCl = proxyHandler.getClass().getClassLoader();
+//         
+//      }
+//      ClassLoader containerCl = SessionSpecContainer.TMP_CL;
+//      boolean equalsCl = classcl.equals(valueCl);
+      
+      log.trace("injecting " + value + " from " + jndiName + " into " + property + " of " + instance);
+      try
+      {
+         property.set(instance, value);
+      }
+      catch(IllegalArgumentException e)
+      {
+         // We found something to inject, but it happened to be the wrong thing
+         String realJndiName;
+         try
+         {
+            // TODO: check whether it's a real link beforehand
+            Object link = JndiUtil.lookupLink(ctx, jndiName);
+            realJndiName = jndiName + (link instanceof LinkRef ? " (link -> " + ((LinkRef) link).getLinkName() + ")" : "");
+         }
+         catch(NamingException ne)
+         {
+            log.trace("Failed to obtain the real JNDI name", ne);
+            realJndiName = jndiName;
+         }
+         Class<?> interfaces[] = value.getClass().getInterfaces();
+         String interfacesStr = (interfaces.length > 0 ? " (implements " + Arrays.toString(interfaces) + ")" : "");
+         String msg = "failed to inject " + value + interfacesStr + " from " + realJndiName + " into " + property + " of " + instance;
+         throw new IllegalArgumentException(msg, e);
+      }
+   }
+}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1060 (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060)

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,140 +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.ejbthree1150.unit;
-
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import javax.naming.InitialContext;
-import javax.xml.ws.WebServiceContext;
-
-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.ejbthree1150.AnnotatedWebServiceContextInjectedBean;
-import org.jboss.ejb3.core.test.ejbthree1150.OverrideWebServiceContextInjectedBean;
-import org.jboss.ejb3.core.test.ejbthree1150.WebServiceContextInjected;
-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.JBossEnvironmentRefsGroupMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
-import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class WebServiceContextInjectionTestCase extends AbstractEJB3TestCase
-{
-   @Test
-   public void testCheckWebServiceContext() throws Exception
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      Class<?> beanClass = AnnotatedWebServiceContextInjectedBean.class;
-      String beanClassname = beanClass.getName();
-      String ejbName = beanClass.getSimpleName();
-      Domain domain = getDomain("Stateless Bean");
-      Hashtable<?,?> ctxProperties = null;
-      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
-      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(beanClass);
-      StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
-      
-      // TODO: wickedness
-      container.instantiated();
-      
-      container.processMetadata();
-      
-      // Register the Container in ObjectStore (MC)
-      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());
-      WebServiceContextInjected bean = (WebServiceContextInjected) ctx.lookup("AnnotatedWebServiceContextInjectedBean/local");
-      
-      bean.checkWebServiceContext();
-      
-      getBootstrap().getKernel().getController().uninstall(containerName);
-   }
-
-   @Test
-   public void testCheckWebServiceContextWithOverride() throws Exception
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      Class<?> beanClass = OverrideWebServiceContextInjectedBean.class;
-      String beanClassname = beanClass.getName();
-      String ejbName = beanClass.getSimpleName();
-      Domain domain = getDomain("Stateless Bean");
-      Hashtable<?,?> ctxProperties = null;
-      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
-      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(beanClass);
-      
-      // add an override
-      
-      ResourceInjectionTargetMetaData injectionTarget = new ResourceInjectionTargetMetaData();
-      injectionTarget.setInjectionTargetClass(OverrideWebServiceContextInjectedBean.class.getName());
-      injectionTarget.setInjectionTargetName("wsContext");
-      
-      Set<ResourceInjectionTargetMetaData> injectionTargets = new HashSet<ResourceInjectionTargetMetaData>();
-      injectionTargets.add(injectionTarget);
-      
-      ResourceEnvironmentReferenceMetaData resEnvRef = new ResourceEnvironmentReferenceMetaData();
-      resEnvRef.setName("wsContext");
-      resEnvRef.setType(WebServiceContext.class.getName());
-      resEnvRef.setInjectionTargets(injectionTargets);
-      
-      if(beanMetaData.getJndiEnvironmentRefsGroup() == null)
-         beanMetaData.setJndiEnvironmentRefsGroup(new JBossEnvironmentRefsGroupMetaData());
-      if(beanMetaData.getResourceEnvironmentReferences() == null)
-         ((JBossEnvironmentRefsGroupMetaData) beanMetaData.getJndiEnvironmentRefsGroup()).setResourceEnvironmentReferences(new ResourceEnvironmentReferencesMetaData());
-      beanMetaData.getResourceEnvironmentReferences().add(resEnvRef);
-      //
-      
-      StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
-      
-      // TODO: wickedness
-      container.instantiated();
-      
-      container.processMetadata();
-      
-      // Register the Container in ObjectStore (MC)
-      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());
-      WebServiceContextInjected bean = (WebServiceContextInjected) ctx.lookup("OverrideWebServiceContextInjectedBean/local");
-      
-      bean.checkWebServiceContext();
-      
-      getBootstrap().getKernel().getController().uninstall(containerName);
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,140 @@
+/*
+ * 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.ejbthree1150.unit;
+
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.xml.ws.WebServiceContext;
+
+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.ejbthree1150.AnnotatedWebServiceContextInjectedBean;
+import org.jboss.ejb3.core.test.ejbthree1150.OverrideWebServiceContextInjectedBean;
+import org.jboss.ejb3.core.test.ejbthree1150.WebServiceContextInjected;
+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.JBossEnvironmentRefsGroupMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class WebServiceContextInjectionTestCase extends AbstractEJB3TestCase
+{
+   @Test
+   public void testCheckWebServiceContext() throws Exception
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      Class<?> beanClass = AnnotatedWebServiceContextInjectedBean.class;
+      String beanClassname = beanClass.getName();
+      String ejbName = beanClass.getSimpleName();
+      Domain domain = getDomain("Stateless Bean");
+      Hashtable<?,?> ctxProperties = null;
+      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
+      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(beanClass);
+      StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
+      
+      // TODO: wickedness
+      container.instantiated();
+      
+      container.processMetadata();
+      
+      // Register the Container in ObjectStore (MC)
+      String containerName = container.getObjectName().getCanonicalName();
+      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
+
+      InitialContext ctx = new InitialContext();
+      System.out.println("ctx = " + ctx);
+      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
+      WebServiceContextInjected bean = (WebServiceContextInjected) ctx.lookup("AnnotatedWebServiceContextInjectedBean/local");
+      
+      bean.checkWebServiceContext();
+      
+      Ejb3RegistrarLocator.locateRegistrar().unbind(containerName);
+   }
+
+   @Test
+   public void testCheckWebServiceContextWithOverride() throws Exception
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      Class<?> beanClass = OverrideWebServiceContextInjectedBean.class;
+      String beanClassname = beanClass.getName();
+      String ejbName = beanClass.getSimpleName();
+      Domain domain = getDomain("Stateless Bean");
+      Hashtable<?,?> ctxProperties = null;
+      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
+      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(beanClass);
+      
+      // add an override
+      
+      ResourceInjectionTargetMetaData injectionTarget = new ResourceInjectionTargetMetaData();
+      injectionTarget.setInjectionTargetClass(OverrideWebServiceContextInjectedBean.class.getName());
+      injectionTarget.setInjectionTargetName("wsContext");
+      
+      Set<ResourceInjectionTargetMetaData> injectionTargets = new HashSet<ResourceInjectionTargetMetaData>();
+      injectionTargets.add(injectionTarget);
+      
+      ResourceEnvironmentReferenceMetaData resEnvRef = new ResourceEnvironmentReferenceMetaData();
+      resEnvRef.setName("wsContext");
+      resEnvRef.setType(WebServiceContext.class.getName());
+      resEnvRef.setInjectionTargets(injectionTargets);
+      
+      if(beanMetaData.getJndiEnvironmentRefsGroup() == null)
+         beanMetaData.setJndiEnvironmentRefsGroup(new JBossEnvironmentRefsGroupMetaData());
+      if(beanMetaData.getResourceEnvironmentReferences() == null)
+         ((JBossEnvironmentRefsGroupMetaData) beanMetaData.getJndiEnvironmentRefsGroup()).setResourceEnvironmentReferences(new ResourceEnvironmentReferencesMetaData());
+      beanMetaData.getResourceEnvironmentReferences().add(resEnvRef);
+      //
+      
+      StatelessContainer container = new StatelessContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
+      
+      // TODO: wickedness
+      container.instantiated();
+      
+      container.processMetadata();
+      
+      // Register the Container in ObjectStore (MC)
+      String containerName = container.getObjectName().getCanonicalName();
+      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
+
+      InitialContext ctx = new InitialContext();
+      System.out.println("ctx = " + ctx);
+      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
+      WebServiceContextInjected bean = (WebServiceContextInjected) ctx.lookup("OverrideWebServiceContextInjectedBean/local");
+      
+      bean.checkWebServiceContext();
+      
+      getBootstrap().getKernel().getController().uninstall(containerName);
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,95 +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.regression.ejbthree1253.unit;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-
-import org.jboss.aop.Domain;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
-import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
-import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful;
-import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStatefulBean;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
-import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
-import org.jboss.ejb3.test.common.MetaDataHelper;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class OverriddenProxyFactoryTestCase extends AbstractEJB3TestCase
-{
-   @Test
-   public void test1() throws Throwable
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      System.out.println(cl.getResource("jndi.properties"));
-      String beanClassname = MyStatefulBean.class.getName();
-      String ejbName = MyStatefulBean.class.getSimpleName();
-      Domain domain = getDomain("Stateful Bean");
-      Hashtable<?,?> ctxProperties = null;
-      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
-      deployment.setPersistenceManagerFactoryRegistry(getBootstrap().lookup("EJB3PersistenceManagerFactoryRegistry", PersistenceManagerFactoryRegistry.class));
-      deployment.setRemoteProxyFactoryRegistry(getBootstrap().lookup("EJB3RemoteProxyFactoryRegistry", RemoteProxyFactoryRegistry.class));
-      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatefulBean.class);
-      StatefulContainer container = new StatefulContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
-      
-      // TODO: wickedness
-      container.instantiated();
-      
-      // A container does not register itself
-      Ejb3Registry.register(container);
-      
-      // Register the Container in ObjectStore (MC)
-      String containerName = container.getName();
-      AbstractBeanMetaData bmd = new AbstractBeanMetaData(containerName, StatefulContainer.class.getName());
-      KernelControllerContext context = getBootstrap().getKernel().getController().install(bmd, container);
-      if(context.getError() != null)
-         throw context.getError();
-//      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
-
-      
-      InitialContext ctx = new InitialContext();
-      System.out.println("ctx = " + ctx);
-      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
-      MyStateful bean = (MyStateful) ctx.lookup("MyStatefulBean/remote");
-      
-      bean.setName("Me");
-      String actual = bean.sayHi();
-      assertEquals("Hi Me", actual);
-      
-      getBootstrap().getKernel().getController().uninstall(containerName);
-      Ejb3Registry.unregister(container);
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,108 @@
+/*
+ * 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.regression.ejbthree1253.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.Ejb3Registry;
+import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful;
+import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStatefulBean;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.stateful.StatefulContainer;
+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.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class OverriddenProxyFactoryTestCase extends AbstractEJB3TestCase
+{
+   @Test
+   public void test1() throws Throwable
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      System.out.println(cl.getResource("jndi.properties"));
+      String beanClassname = MyStatefulBean.class.getName();
+      String ejbName = MyStatefulBean.class.getSimpleName();
+      Domain domain = getDomain("Stateful Bean");
+      Hashtable<?,?> ctxProperties = null;
+      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
+      deployment.setPersistenceManagerFactoryRegistry(getBootstrap().lookup("EJB3PersistenceManagerFactoryRegistry", PersistenceManagerFactoryRegistry.class));
+      deployment.setRemoteProxyFactoryRegistry(getBootstrap().lookup("EJB3RemoteProxyFactoryRegistry", RemoteProxyFactoryRegistry.class));
+      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatefulBean.class);
+      StatefulContainer container = new StatefulContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
+      
+      // TODO: wickedness
+      container.instantiated();
+      
+      // A container does not register itself
+      Ejb3Registry.register(container);
+      
+      // Register the Container in ObjectStore (MC)
+      String containerName = container.getObjectName().getCanonicalName();
+//      AbstractBeanMetaData bmd = new AbstractBeanMetaData(containerName, StatefulContainer.class.getName());
+//      KernelControllerContext context = getBootstrap().getKernel().getController().install(bmd, container);
+//      if(context.getError() != null)
+//         throw context.getError();
+      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
+
+      
+      InitialContext ctx = new InitialContext();
+      System.out.println("ctx = " + ctx);
+      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
+      MyStateful bean = (MyStateful) ctx.lookup("MyStatefulBean/remote");
+      
+      bean.setName("Me");
+      String actual = bean.sayHi();
+      assertEquals("Hi Me", actual);
+      
+      getBootstrap().getKernel().getController().uninstall(containerName);
+      Ejb3Registry.unregister(container);
+   }
+   
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractEJB3TestCase.beforeClass();
+   }
+
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      AbstractEJB3TestCase.afterClass();
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,75 +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;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.SessionContext;
-
-import org.jboss.ejb3.annotation.Cache;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.PersistenceManager;
-import org.jboss.ejb3.annotation.Pool;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
- at Cache("SimpleStatefulCache")
- at PersistenceManager("MyStatefulSessionFilePersistenceManager")
- at CacheConfig(idleTimeoutSeconds=1)
- at Pool("ThreadlocalPool")
-public class MockBean implements Mock
-{
-   public static Object notification = new Object();
-   public static boolean passivated = false;
-   
-   @Resource
-   public SessionContext ctx;
-   
-   @PostActivate
-   public void postActivate()
-   {
-      System.out.println("postActivate");
-   }
-   
-   @PostConstruct
-   public void postConstruct()
-   {
-      System.out.println("postConstruct");
-   }
-   
-   @PrePassivate
-   public void prePassivate()
-   {
-      System.out.println("prePassivate");
-      synchronized (notification)
-      {
-         passivated = true;
-         notification.notify();
-      }
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,77 @@
+/*
+ * 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;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.Cache;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.PersistenceManager;
+import org.jboss.ejb3.annotation.Pool;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Cache("SimpleStatefulCache")
+ at PersistenceManager("MyStatefulSessionFilePersistenceManager")
+ at CacheConfig(idleTimeoutSeconds=1)
+ at Pool("ThreadlocalPool")
+ at Stateful
+public class MockBean implements Mock
+{
+   public static Object notification = new Object();
+   public static boolean passivated = false;
+   
+   @Resource
+   public SessionContext ctx;
+   
+   @PostActivate
+   public void postActivate()
+   {
+      System.out.println("postActivate");
+   }
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      System.out.println("postConstruct");
+   }
+   
+   @PrePassivate
+   public void prePassivate()
+   {
+      System.out.println("prePassivate");
+      synchronized (notification)
+      {
+         passivated = true;
+         notification.notify();
+      }
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,193 +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;
-
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.ejb3.DeploymentUnit;
-import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class MockDeploymentUnit implements DeploymentUnit
-{
-
-   public Object addAttachment(String name, Object attachment)
-   {
-      return null;
-   }
-   public Object getAttachment(String name)
-   {
-      return null;
-   }
-   public Object removeAttachment(String name)
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getClassLoader()
-    */
-   public ClassLoader getClassLoader()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getClasses()
-    */
-   @SuppressWarnings("unchecked")
-   public List<Class> getClasses()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getDefaultEntityManagerName()
-    */
-   public String getDefaultEntityManagerName()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getDefaultPersistenceProperties()
-    */
-   @SuppressWarnings("unchecked")
-   public Map getDefaultPersistenceProperties()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getEjbJarXml()
-    */
-   public URL getEjbJarXml()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getInterceptorInfoRepository()
-    */
-   public InterceptorInfoRepository getInterceptorInfoRepository()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getJbossXml()
-    */
-   public URL getJbossXml()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getJndiProperties()
-    */
-   @SuppressWarnings("unchecked")
-   public Hashtable getJndiProperties()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getMetaDataFile(java.lang.String)
-    */
-   public VirtualFile getMetaDataFile(String string)
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getPersistenceXml()
-    */
-   public URL getPersistenceXml()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getRelativeURL(java.lang.String)
-    */
-   public URL getRelativeURL(String path)
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getResourceLoader()
-    */
-   public ClassLoader getResourceLoader()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getResources(org.jboss.virtual.VirtualFileFilter)
-    */
-   public List<VirtualFile> getResources(VirtualFileFilter filter)
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getRootFile()
-    */
-   public VirtualFile getRootFile()
-   {
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getShortName()
-    */
-   public String getShortName()
-   {
-      return null;
-   }
-
-   public String getRelativePath()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.DeploymentUnit#getUrl()
-    */
-   public URL getUrl()
-   {
-      return null;
-   }
-
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,193 @@
+/*
+ * 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;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MockDeploymentUnit implements DeploymentUnit
+{
+
+   public Object addAttachment(String name, Object attachment)
+   {
+      return null;
+   }
+   public Object getAttachment(String name)
+   {
+      return null;
+   }
+   public Object removeAttachment(String name)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getClassLoader()
+    */
+   public ClassLoader getClassLoader()
+   {
+      return Thread.currentThread().getContextClassLoader();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getClasses()
+    */
+   @SuppressWarnings("unchecked")
+   public List<Class> getClasses()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getDefaultEntityManagerName()
+    */
+   public String getDefaultEntityManagerName()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getDefaultPersistenceProperties()
+    */
+   @SuppressWarnings("unchecked")
+   public Map getDefaultPersistenceProperties()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getEjbJarXml()
+    */
+   public URL getEjbJarXml()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getInterceptorInfoRepository()
+    */
+   public InterceptorInfoRepository getInterceptorInfoRepository()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getJbossXml()
+    */
+   public URL getJbossXml()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getJndiProperties()
+    */
+   @SuppressWarnings("unchecked")
+   public Hashtable getJndiProperties()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getMetaDataFile(java.lang.String)
+    */
+   public VirtualFile getMetaDataFile(String string)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getPersistenceXml()
+    */
+   public URL getPersistenceXml()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getRelativeURL(java.lang.String)
+    */
+   public URL getRelativeURL(String path)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getResourceLoader()
+    */
+   public ClassLoader getResourceLoader()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getResources(org.jboss.virtual.VirtualFileFilter)
+    */
+   public List<VirtualFile> getResources(VirtualFileFilter filter)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getRootFile()
+    */
+   public VirtualFile getRootFile()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getShortName()
+    */
+   public String getShortName()
+   {
+      return null;
+   }
+
+   public String getRelativePath()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getUrl()
+    */
+   public URL getUrl()
+   {
+      return null;
+   }
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,70 +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;
-
-import java.util.Hashtable;
-
-import org.jboss.aop.Domain;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.JBossSessionPolicyDecorator;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class MockStatefulContainer extends StatefulContainer
-{
-
-   @SuppressWarnings("unchecked")
-   public MockStatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
-         Hashtable ctxProperties, Ejb3Deployment deployment) throws ClassNotFoundException
-   {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, createMockBeanMetaData());
-   }
-   
-   @Override
-   public Object createSession()
-   {
-      // TODO Auto-generated method stub
-      return super.createSession();
-   }
-   
-   private static JBossSessionBeanMetaData createMockBeanMetaData()
-   {
-      JBossMetaData metaData = new JBossMetaData();
-      JBossEnterpriseBeansMetaData enterpriseBeans = new JBossEnterpriseBeansMetaData();
-      metaData.setEnterpriseBeans(enterpriseBeans);
-      metaData.setAssemblyDescriptor(new JBossAssemblyDescriptorMetaData());
-      JBossSessionBeanMetaData sessionBeanMetaData = new JBossSessionBeanMetaData();
-      sessionBeanMetaData.setEnterpriseBeansMetaData(enterpriseBeans);
-      sessionBeanMetaData = new JBossSessionPolicyDecorator(sessionBeanMetaData, new BasicJndiBindingPolicy());
-      return sessionBeanMetaData;
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+import java.util.Hashtable;
+
+import org.jboss.aop.Domain;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.stateful.StatefulContainer;
+import org.jboss.ejb3.test.common.MetaDataHelper;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MockStatefulContainer extends StatefulContainer
+{
+
+   @SuppressWarnings("unchecked")
+   public MockStatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+         Hashtable ctxProperties, Ejb3Deployment deployment) throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, createMockBeanMetaData(beanClassName));
+   }
+
+   @Override
+   public Serializable createSession()
+   {
+      // TODO Auto-generated method stub
+      return super.createSession();
+   }
+
+   private static JBossSessionBeanMetaData createMockBeanMetaData(String beanClassName)
+   {
+      try
+      {
+         return MetaDataHelper.getMetadataFromBeanImplClass(Thread.currentThread().getContextClassLoader().loadClass(
+               beanClassName));
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Could not load Bean Implementation class when creating new "
+               + MockStatefulContainer.class, e);
+      }
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/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-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,133 +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();
-      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);
-      }
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,134 @@
+/*
+ * 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);
+      }
+   }
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,286 +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.threadlocal;
-
-import java.util.Hashtable;
-
-import javax.ejb.TimerService;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.DependencyPolicy;
-import org.jboss.ejb3.pool.Pool;
-import org.jboss.ejb3.statistics.InvocationStatistics;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision$
- */
-public class MockContainer implements Container
-{
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#construct()
-    */
-   public Object construct()
-   {
-      return new MockBean();
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#create()
-    */
-   public void create() throws Exception
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   public BeanContext<?> createBeanContext()
-   {
-      return new MockBeanContext(construct());
-   }
-   
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#destroy()
-    */
-   public void destroy() throws Exception
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getBeanClass()
-    */
-   public Class getBeanClass()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getDependencyPolicy()
-    */
-   public DependencyPolicy getDependencyPolicy()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getEjbName()
-    */
-   public String getEjbName()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getEnc()
-    */
-   public Context getEnc()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getInitialContext()
-    */
-   public InitialContext getInitialContext()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getInitialContextProperties()
-    */
-   public Hashtable getInitialContextProperties()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getInvokeStats()
-    */
-   public InvocationStatistics getInvokeStats()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   public Object getMBean()
-   {
-      throw new RuntimeException("mock");
-   }
-   
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getObjectName()
-    */
-   public ObjectName getObjectName()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getPool()
-    */
-   public Pool getPool()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   public <T> T getSecurityManager(Class<T> type)
-   {
-      throw new RuntimeException("mock");
-   }
-   
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getTimerService()
-    */
-   public TimerService getTimerService()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#getTimerService(java.lang.Object)
-    */
-   public TimerService getTimerService(Object pKey)
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokeInit(java.lang.Object)
-    */
-   public void invokeInit(Object bean)
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokeInit(java.lang.Object, java.lang.Class[], java.lang.Object[])
-    */
-   public void invokeInit(Object bean, Class[] initTypes, Object[] initValues)
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokePostActivate(org.jboss.ejb3.BeanContext)
-    */
-   public void invokePostActivate(BeanContext beanContext)
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokePostConstruct(org.jboss.ejb3.BeanContext)
-    */
-   public void invokePostConstruct(BeanContext beanContext, Object[] params)
-   {
-      ((MockBean) beanContext.getInstance()).postConstruct();
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokePreDestroy(org.jboss.ejb3.BeanContext)
-    */
-   public void invokePreDestroy(BeanContext beanContext)
-   {
-      ((MockBean) beanContext.getInstance()).preDestroy();
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#invokePrePassivate(org.jboss.ejb3.BeanContext)
-    */
-   public void invokePrePassivate(BeanContext beanContext)
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#isClustered()
-    */
-   public boolean isClustered()
-   {
-      // TODO Auto-generated method stub
-      return false;
-   }
-
-   public BeanContext<?> peekContext()
-   {
-      throw new RuntimeException("mock");
-   }
-   
-   public BeanContext<?> popContext()
-   {
-      // do nothing
-      return null;
-   }
-   
-   public void processMetadata()
-   {
-      throw new RuntimeException("mock");
-   }
-
-   public void pushContext(BeanContext<?> ctx)
-   {
-      // do nothing
-   }
-   
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#start()
-    */
-   public void start() throws Exception
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.ejb3.Container#stop()
-    */
-   public void stop() throws Exception
-   {
-      // TODO Auto-generated method stub
-
-   }
-
-}

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java (from rev 76876, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,296 @@
+/*
+ * 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.threadlocal;
+
+import java.util.Hashtable;
+
+import javax.ejb.TimerService;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.pool.Pool;
+import org.jboss.ejb3.statistics.InvocationStatistics;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public class MockContainer implements Container
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#construct()
+    */
+   public Object construct()
+   {
+      return new MockBean();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#create()
+    */
+   public void create() throws Exception
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   public BeanContext<?> createBeanContext()
+   {
+      return new MockBeanContext(construct());
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#destroy()
+    */
+   public void destroy() throws Exception
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getBeanClass()
+    */
+   public Class getBeanClass()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getDependencyPolicy()
+    */
+   public DependencyPolicy getDependencyPolicy()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getEjbName()
+    */
+   public String getEjbName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getEnc()
+    */
+   public Context getEnc()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getInitialContext()
+    */
+   public InitialContext getInitialContext()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getInitialContextProperties()
+    */
+   public Hashtable getInitialContextProperties()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getInvokeStats()
+    */
+   public InvocationStatistics getInvokeStats()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public Object getMBean()
+   {
+      throw new RuntimeException("mock");
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getObjectName()
+    */
+   public ObjectName getObjectName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getPool()
+    */
+   public Pool getPool()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public <T> T getSecurityManager(Class<T> type)
+   {
+      throw new RuntimeException("mock");
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getTimerService()
+    */
+   public TimerService getTimerService()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getTimerService(java.lang.Object)
+    */
+   public TimerService getTimerService(Object pKey)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokeInit(java.lang.Object)
+    */
+   public void invokeInit(Object bean)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokeInit(java.lang.Object, java.lang.Class[], java.lang.Object[])
+    */
+   public void invokeInit(Object bean, Class[] initTypes, Object[] initValues)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokePostActivate(org.jboss.ejb3.BeanContext)
+    */
+   public void invokePostActivate(BeanContext beanContext)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokePostConstruct(org.jboss.ejb3.BeanContext)
+    */
+   public void invokePostConstruct(BeanContext beanContext, Object[] params)
+   {
+      ((MockBean) beanContext.getInstance()).postConstruct();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokePreDestroy(org.jboss.ejb3.BeanContext)
+    */
+   public void invokePreDestroy(BeanContext beanContext)
+   {
+      ((MockBean) beanContext.getInstance()).preDestroy();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#invokePrePassivate(org.jboss.ejb3.BeanContext)
+    */
+   public void invokePrePassivate(BeanContext beanContext)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#isClustered()
+    */
+   public boolean isClustered()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+   public BeanContext<?> peekContext()
+   {
+      throw new RuntimeException("mock");
+   }
+   
+   public BeanContext<?> popContext()
+   {
+      // do nothing
+      return null;
+   }
+   
+   public void processMetadata()
+   {
+      throw new RuntimeException("mock");
+   }
+
+   public void pushContext(BeanContext<?> ctx)
+   {
+      // do nothing
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#start()
+    */
+   public void start() throws Exception
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.Container#stop()
+    */
+   public void stop() throws Exception
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getName()
+    */
+   public String getName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+}

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-   <bean name="SimpleClassLoaderDeployer" class="org.jboss.ejb3.core.test.common.SimpleClassLoaderDeployer"/>
-   
-   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
-      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
-   </bean>
-   
-   <bean name="AspectAppParsingDeployer" class="org.jboss.aop.deployers.AspectAppParsingDeployer"/>
-   <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
-      <property name="type">aop</property>
-      <property name="aspectManager"><inject bean="AspectManager"/></property>
-   </bean>
-    
-   <!-- The MainDeployer -->
-   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
-      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
-      <property name="deployers"><inject bean="Deployers"/></property>
-      <!--property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property-->
-   </bean>
-      
-   <!-- The holder for deployers that determine structure -->
-   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
-      <property name="structureBuilder">
-         <!-- The consolidator of the structure information -->
-         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
-      </property>
-      <!-- Accept any implementor of structure deployer -->
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-   
-   <!-- The holder for deployers that do real deployment -->
-   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
-      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
-      <!-- Accept any implementor of deployer -->
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-   
-   <!-- File Structure -->
-   <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure"/>
-   
-   <!-- JNDI -->
-   <bean name="NameServer" class="org.jnp.server.SingletonNamingServer"/>
-   
-   <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer"/>
-   
-   <bean name="TransactionManager" class="org.jboss.ejb3.core.test.common.SimpleTransactionService">
-      <depends>NameServer</depends>
-   </bean>
-   
-   <!-- 
-   <bean name="AspectDeployment" class="org.jboss.ejb3.test.tx.common.AspectDeployment">
-      <property name="mainDeployer"><inject bean="MainDeployer"/></property>
-      <property name="resource">instance/jboss-aop.xml</property>
-      <depends>TransactionManager</depends>
-   </bean>
-   
-   <bean name="TestContainer" class="org.jboss.ejb3.test.tx.common.SimpleContainer">
-      <constructor>
-         <parameter>TestContainer</parameter>
-         <parameter>Stateful Container</parameter>
-         <parameter>org.jboss.ejb3.test.tx.instance.InstanceTestBean</parameter>
-      </constructor>
-      <depends>AspectDeployment</depends>
-      <depends>TransactionManager</depends>
-   </bean>
-   -->
-   
-   <!-- 
-    
-    JNDI Registrars
-    
-    
-    The JNDI Registrar is responsible for all JNDI Bindings for
-    an EJB.  Its constructor takes the following arguments, in order:
-    
-    javax.naming.Context (JNDI Context into which to bind objects)
-    org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry (Implementation of ProxyFactoryRegistry)
-    String statelessSessionProxyObjectFactoryType The JNDI ObjectFactory implementation to use for SLSB
-    ...more later when SFSB, @Service, MDB Implemented
-    
-  -->
-
-  <!-- SLSB JNDI Registrar 
-  <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
-    class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
-    <constructor>
-      <parameter>
-        <inject bean="org.jboss.ejb3.JndiContext" />
-      </parameter>
-      <parameter>
-        org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
-      </parameter>
-    </constructor>
-    <depends>NameServer</depends>
-  </bean> -->
-
-  <!-- SFSB JNDI Registrar 
-  <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
-    class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
-    <constructor>
-      <parameter>
-        <inject bean="org.jboss.ejb3.JndiContext" />
-      </parameter>
-      <parameter>
-        org.jboss.ejb3.proxy.objectfactory.session.stateful.StatefulSessionProxyObjectFactory
-      </parameter>
-    </constructor>
-    <depends>NameServer</depends>
-  </bean> -->
-
-  <!-- JNDI Registrar Configuration -->
-  <bean name="org.jboss.ejb3.JndiContext"
-    class="javax.naming.InitialContext" />
-    
-   <!-- Remoting Proxy Factory Registry -->
-   <bean name="EJB3RemoteProxyFactoryRegistry" class="org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry">
-      <property name="factories">
-         <!-- Define each of the registered factories -->
-         <map class="java.util.HashMap" keyClass="java.lang.String"
-            valueClass="java.lang.Class">
-            <!-- RemoteProxyFactory -->
-            <entry>
-               <key>RemoteProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.RemoteProxyFactory</value>
-            </entry>
-            <!-- IORFactory -->
-            <!-- Only available in AS 
-            <entry>
-               <key>IORFactory</key>
-               <value>org.jboss.ejb3.iiop.IORFactory</value>
-            </entry>
-            -->
-            <!-- ServiceRemoteProxyFactory -->
-            <entry>
-               <key>ServiceRemoteProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory</value>
-            </entry>
-            <!-- StatefulClusterProxyFactory -->
-            <entry>
-               <key>StatefulClusterProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory</value>
-            </entry>
-            <!-- StatefulRemoteProxyFactory -->
-            <entry>
-               <key>StatefulRemoteProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory</value>
-            </entry>
-            <!-- StatelessClusterProxyFactory -->
-            <entry>
-               <key>StatelessClusterProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory</value>
-            </entry>
-            <!-- StatelessRemoteProxyFactory -->
-            <entry>
-               <key>StatelessRemoteProxyFactory</key>
-               <value>org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory</value>
-            </entry>            
-         </map>
-      </property>
-   </bean>
-   
-   <!-- EJB3 Persistence Manager Factory Registry -->
-   <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
-      <property name="factories">
-         <!-- Define each of the registered factories -->
-         <map class="java.util.HashMap" keyClass="java.lang.String"
-            valueClass="java.lang.Class">
-            <!-- StatefulSessionFilePersistenceManager -->
-            <entry>
-               <key>StatefulSessionFilePersistenceManager</key>
-               <!-- A dummy persistence manager which doesn't rely on the jboss mbean -->
-               <value>org.jboss.ejb3.test.cachepassivation.MyStatefulSessionFilePersistenceManagerFactory</value>
-            </entry>
-         </map>
-      </property>
-   </bean>
-   
-   <!-- REMOTING -->
-      
-   <bean name="ServerConfiguration" class="org.jboss.remoting.ServerConfiguration">
-      <property name="invocationHandlers">
-         <map keyClass="java.lang.String" valueClass="java.lang.String">
-            <entry>
-               <key>AOP</key>
-               <value>org.jboss.aspects.remoting.AOPRemotingInvocationHandler</value>
-            </entry>
-         </map>
-      </property>
-   </bean>
-   
-   <bean name="Connector" class="org.jboss.remoting.transport.Connector">
-      <property name="invokerLocator">socket://0.0.0.0:3875</property>
-      <property name="serverConfiguration"><inject bean="ServerConfiguration"/></property>
-   </bean>
-</deployment>
\ No newline at end of file

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml (from rev 76876, projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/basicbootstrap-beans.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="SimpleClassLoaderDeployer" class="org.jboss.ejb3.core.test.common.SimpleClassLoaderDeployer"/>
+   
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+   
+   <bean name="AspectAppParsingDeployer" class="org.jboss.aop.deployers.AspectAppParsingDeployer"/>
+   <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
+      <property name="type">aop</property>
+      <property name="aspectManager"><inject bean="AspectManager"/></property>
+   </bean>
+    
+   <!-- The MainDeployer -->
+   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+      <property name="deployers"><inject bean="Deployers"/></property>
+      <!--property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property-->
+   </bean>
+      
+   <!-- The holder for deployers that determine structure -->
+   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+      <property name="structureBuilder">
+         <!-- The consolidator of the structure information -->
+         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+      </property>
+      <!-- Accept any implementor of structure deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+   
+   <!-- The holder for deployers that do real deployment -->
+   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+      <!-- Accept any implementor of deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+   
+   <!-- File Structure -->
+   <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure"/>
+   
+   <!-- JNDI -->
+   <bean name="NameServer" class="org.jnp.server.SingletonNamingServer"/>
+   
+   <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer"/>
+   
+   <bean name="TransactionManager" class="org.jboss.ejb3.core.test.common.SimpleTransactionService">
+      <depends>NameServer</depends>
+   </bean>
+   
+   <!-- 
+   <bean name="AspectDeployment" class="org.jboss.ejb3.test.tx.common.AspectDeployment">
+      <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+      <property name="resource">instance/jboss-aop.xml</property>
+      <depends>TransactionManager</depends>
+   </bean>
+   
+   <bean name="TestContainer" class="org.jboss.ejb3.test.tx.common.SimpleContainer">
+      <constructor>
+         <parameter>TestContainer</parameter>
+         <parameter>Stateful Container</parameter>
+         <parameter>org.jboss.ejb3.test.tx.instance.InstanceTestBean</parameter>
+      </constructor>
+      <depends>AspectDeployment</depends>
+      <depends>TransactionManager</depends>
+   </bean>
+   -->
+   
+   <!-- 
+    
+    JNDI Registrars
+    
+    
+    The JNDI Registrar is responsible for all JNDI Bindings for
+    an EJB.  Its constructor takes the following arguments, in order:
+    
+    javax.naming.Context (JNDI Context into which to bind objects)
+    org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry (Implementation of ProxyFactoryRegistry)
+    String statelessSessionProxyObjectFactoryType The JNDI ObjectFactory implementation to use for SLSB
+    ...more later when SFSB, @Service, MDB Implemented
+    
+  -->
+
+  <!-- SLSB JNDI Registrar -->
+  <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
+    class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
+    <constructor>
+      <parameter>
+        org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
+      </parameter>
+    </constructor>
+    <depends>NameServer</depends>
+  </bean>
+
+  <!-- SFSB JNDI Registrar -->
+  <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
+    class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
+    <constructor>
+      <parameter>
+        org.jboss.ejb3.proxy.objectfactory.session.stateful.StatefulSessionProxyObjectFactory
+      </parameter>
+    </constructor>
+    <depends>NameServer</depends>
+  </bean>
+    
+   <!-- Remoting Proxy Factory Registry -->
+   <bean name="EJB3RemoteProxyFactoryRegistry" class="org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry">
+      <property name="factories">
+         <!-- Define each of the registered factories -->
+         <map class="java.util.HashMap" keyClass="java.lang.String"
+            valueClass="java.lang.Class">
+            <!-- RemoteProxyFactory -->
+            <entry>
+               <key>RemoteProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.RemoteProxyFactory</value>
+            </entry>
+            <!-- IORFactory -->
+            <!-- Only available in AS 
+            <entry>
+               <key>IORFactory</key>
+               <value>org.jboss.ejb3.iiop.IORFactory</value>
+            </entry>
+            -->
+            <!-- ServiceRemoteProxyFactory -->
+            <entry>
+               <key>ServiceRemoteProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory</value>
+            </entry>
+            <!-- StatefulClusterProxyFactory -->
+            <entry>
+               <key>StatefulClusterProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory</value>
+            </entry>
+            <!-- StatefulRemoteProxyFactory -->
+            <entry>
+               <key>StatefulRemoteProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory</value>
+            </entry>
+            <!-- StatelessClusterProxyFactory -->
+            <entry>
+               <key>StatelessClusterProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory</value>
+            </entry>
+            <!-- StatelessRemoteProxyFactory -->
+            <entry>
+               <key>StatelessRemoteProxyFactory</key>
+               <value>org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory</value>
+            </entry>            
+         </map>
+      </property>
+   </bean>
+   
+   <!-- EJB3 Persistence Manager Factory Registry -->
+   <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
+      <property name="factories">
+         <!-- Define each of the registered factories -->
+         <map class="java.util.HashMap" keyClass="java.lang.String"
+            valueClass="java.lang.Class">
+            <!-- StatefulSessionFilePersistenceManager -->
+            <entry>
+               <key>StatefulSessionFilePersistenceManager</key>
+               <!-- A dummy persistence manager which doesn't rely on the jboss mbean -->
+               <value>org.jboss.ejb3.test.cachepassivation.MyStatefulSessionFilePersistenceManagerFactory</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <!-- REMOTING -->
+      
+   <bean name="ServerConfiguration" class="org.jboss.remoting.ServerConfiguration">
+      <property name="invocationHandlers">
+         <map keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>AOP</key>
+               <value>org.jboss.aspects.remoting.AOPRemotingInvocationHandler</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <bean name="Connector" class="org.jboss.remoting.transport.Connector">
+      <property name="invokerLocator">socket://0.0.0.0:3875</property>
+      <property name="serverConfiguration"><inject bean="ServerConfiguration"/></property>
+   </bean>
+</deployment>
\ No newline at end of file

Deleted: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/log4j.xml	2008-08-09 18:59:52 UTC (rev 76857)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!--                                                                       -->
-<!--  Log4j Configuration                                                  -->
-<!--                                                                       -->
-<!-- ===================================================================== -->
-
-<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
-
-<!--
-   | For more configuration infromation and examples see the Jakarta Log4j
-   | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
-  <!-- ================================= -->
-  <!-- Preserve messages in a local file -->
-  <!-- ================================= -->
-
-  <!-- A time/date based rolling appender -->
-  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
-    <param name="File" value="target/test.log"/>
-    <param name="Append" value="false"/>
-
-    <!-- Rollover at midnight each day -->
-    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-
-    <!-- Rollover at the top of each hour
-    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
-    -->
-
-    <layout class="org.apache.log4j.PatternLayout">
-      <!-- The default pattern: Date Priority [Category] Message\n -->
-      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
-
-      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
-      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-       -->
-    </layout>	    
-  </appender>
-
-  <!-- A size based file rolling appender
-  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
-    <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
-    <param name="Append" value="false"/>
-    <param name="MaxFileSize" value="500KB"/>
-    <param name="MaxBackupIndex" value="1"/>
-
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
-    </layout>	    
-  </appender>
-  -->
-
-  <!-- ============================== -->
-  <!-- Append messages to the console -->
-  <!-- ============================== -->
-
-  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-    <param name="Target" value="System.out"/>
-    <param name="Threshold" value="WARN"/>
-
-    <layout class="org.apache.log4j.PatternLayout">
-      <!-- The default pattern: Date Priority [Category] Message\n -->
-      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-    </layout>
-  </appender>
-
-
-  <!-- ================ -->
-  <!-- Limit categories -->
-  <!-- ================ -->
-
-  <!-- Limit JBoss categories to INFO
-  <category name="org.jboss">
-    <priority value="INFO" class="org.jboss.logging.XLevel"/>
-  </category>
-  -->
-
-  <!-- Increase the priority threshold for the DefaultDS category
-  <category name="DefaultDS">
-    <priority value="FATAL"/>
-  </category>
-  -->
-
-  <!-- Decrease the priority threshold for the org.jboss.varia category
-  <category name="org.jboss.varia">
-    <priority value="DEBUG"/>
-  </category>
-  -->
-
-  <!--
-     | An example of enabling the custom TRACE level priority that is used
-     | by the JBoss internals to diagnose low level details. This example
-     | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
-     | subpackages. This will produce A LOT of logging output.
-  <category name="org.jboss.system">
-    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
-  </category>
-  -->
-
-  <category name="org.jboss.aop">
-    <priority value="WARN"/>
-  </category>
-  
-  <category name="org.jboss">
-    <priority value="INFO"/>
-  </category>
-  
-  <category name="org.jboss.ejb3.interceptors.aop.DomainClassLoader">
-    <priority value="DEBUG"/>
-  </category>
-  
-  <category name="org.jboss.ejb3">
-    <priority value="DEBUG"/>
-  </category>
-  
-  <category name="org.jboss.ejb3.test">
-    <priority value="DEBUG"/>
-  </category>
-  
-  <!-- ======================= -->
-  <!-- Setup the Root category -->
-  <!-- ======================= -->
-
-  <root>
-    <appender-ref ref="CONSOLE"/>
-    <appender-ref ref="FILE"/>
-  </root>
-  
-</log4j:configuration>

Copied: projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml (from rev 76876, projects/ejb3/trunk/core/src/test/resources/log4j.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-core-0.1.11/src/test/resources/log4j.xml	2008-08-11 04:04:05 UTC (rev 76905)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <!-- A time/date based rolling appender -->
+  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Append" value="false"/>
+
+    <!-- Rollover at midnight each day -->
+    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+    <!-- Rollover at the top of each hour
+    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+    -->
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+       -->
+    </layout>	    
+  </appender>
+
+  <!-- A size based file rolling appender
+  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+    <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+    <param name="Append" value="false"/>
+    <param name="MaxFileSize" value="500KB"/>
+    <param name="MaxBackupIndex" value="1"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>	    
+  </appender>
+  -->
+
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+    <param name="Threshold" value="DEBUG"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+    </layout>
+  </appender>
+
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Limit JBoss categories to INFO
+  <category name="org.jboss">
+    <priority value="INFO" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <!-- Increase the priority threshold for the DefaultDS category
+  <category name="DefaultDS">
+    <priority value="FATAL"/>
+  </category>
+  -->
+
+  <!-- Decrease the priority threshold for the org.jboss.varia category
+  <category name="org.jboss.varia">
+    <priority value="DEBUG"/>
+  </category>
+  -->
+
+  <!--
+     | An example of enabling the custom TRACE level priority that is used
+     | by the JBoss internals to diagnose low level details. This example
+     | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+     | subpackages. This will produce A LOT of logging output.
+  <category name="org.jboss.system">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <category name="org.jboss.aop">
+    <priority value="WARN"/>
+  </category>
+  
+  <category name="org.jboss">
+    <priority value="INFO"/>
+  </category>
+  
+  <!-- 
+  Unnecessary, EJB3 is exposed as DEBUG
+  <category name="org.jboss.ejb3.interceptors.aop.DomainClassLoader">
+    <priority value="DEBUG"/>
+  </category>   -->
+  
+  <category name="org.jboss.ejb3">
+    <priority value="DEBUG"/>
+  </category>
+  
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <priority value="WARN" />
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>




More information about the jboss-cvs-commits mailing list