[jboss-cvs] JBossAS SVN: r100248 - in projects/ejb3/components: singleton and 44 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 2 07:47:56 EST 2010


Author: jaikiran
Date: 2010-02-02 07:47:53 -0500 (Tue, 02 Feb 2010)
New Revision: 100248

Added:
   projects/ejb3/components/singleton/
   projects/ejb3/components/singleton/trunk/
   projects/ejb3/components/singleton/trunk/build/
   projects/ejb3/components/singleton/trunk/build/pom.xml
   projects/ejb3/components/singleton/trunk/impl/
   projects/ejb3/components/singleton/trunk/impl/pom.xml
   projects/ejb3/components/singleton/trunk/impl/src/
   projects/ejb3/components/singleton/trunk/impl/src/main/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/ContainerInvocationContextImpl.java
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonBeanContext.java
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonContainer.java
   projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonEJBInstanceManagerImpl.java
   projects/ejb3/components/singleton/trunk/impl/src/test/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/SimpleSingletonBean.java
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/
   projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java
   projects/ejb3/components/singleton/trunk/legacy-container-integration/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/pom.xml
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedContainerInvocationContext.java
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedInterceptorRegistry.java
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedSingletonContainer.java
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/LegacySingletonBeanContext.java
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/test/
   projects/ejb3/components/singleton/trunk/legacy-container-integration/src/test/java/
   projects/ejb3/components/singleton/trunk/pom.xml
   projects/ejb3/components/singleton/trunk/spi/
   projects/ejb3/components/singleton/trunk/spi/pom.xml
   projects/ejb3/components/singleton/trunk/spi/src/
   projects/ejb3/components/singleton/trunk/spi/src/main/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/
   projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/SingletonEJBInstanceManager.java
   projects/ejb3/components/singleton/trunk/spi/src/main/resources/
   projects/ejb3/components/singleton/trunk/spi/src/test/
   projects/ejb3/components/singleton/trunk/spi/src/test/java/
   projects/ejb3/components/singleton/trunk/spi/src/test/resources/
Log:
Initial commit for a singleton container based on the new container spi. Still a PoC

Added: projects/ejb3/components/singleton/trunk/build/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/build/pom.xml	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/build/pom.xml	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <!--
+  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</groupId>
+        <artifactId>jboss-parent</artifactId>
+        <version>4</version>
+    </parent>
+
+    <!-- Model Version -->
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- Artifact Configuration -->
+    <groupId>org.jboss.ejb3.singleton</groupId>
+    <artifactId>jboss-ejb3-singleton-build</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>JBoss EJB3.1 @Singleton build module</name>
+    <description>Centralized Build Configuration for EJB 3.1+ @Singleton support</description>
+    <packaging>pom</packaging>
+
+    <!-- Properties -->
+    <properties>
+
+        <!-- Versioning -->
+        <version.junit_junit>4.6</version.junit_junit>
+        <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
+        <version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
+    </properties>
+
+    <!-- SCM -->
+    <scm>
+        <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/components/singleton</connection>
+        <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/components/singleton</developerConnection>
+        <url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/components/singleton</url>
+    </scm>
+
+    <!-- Issues -->
+    <issueManagement>
+        <system>jira</system>
+        <url>http://jira.jboss.com/jira/browse/EJBTHREE</url>
+    </issueManagement>
+
+    <!-- Build -->
+    <build>
+
+        <plugins>
+
+            <!-- Compiler / JDK6 required for EJB 3.1 -->
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <inherited>true</inherited>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <showDeprecation>false</showDeprecation>
+                    <showWarnings>true</showWarnings>
+                    <optimize>true</optimize>
+                    <compilerVersion>1.6</compilerVersion>
+                    <fork>true</fork>
+                    <argLine>-Xmx512M</argLine>
+                    <executable>${JAVA_HOME}/bin/javac</executable>
+                </configuration>
+            </plugin>
+
+            <!-- Surefire -->
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <printSummary>true</printSummary>
+                    <forkMode>always</forkMode>
+                </configuration>
+            </plugin>
+
+            <!-- Maven Release Plugin Configuration -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+                <configuration>
+                    <tagBase>https://svn.jboss.org/repos/jbossas/projects/ejb3/tags</tagBase>
+                </configuration>
+            </plugin>
+
+            <!-- Enforce Maven Environment -->
+            <plugin>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>enforce-maven-environment</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <rules>
+                        <requireJavaVersion>
+                            <version>1.6</version> <!-- Must be JDK6 -->
+                        </requireJavaVersion>
+                        <requireProperty>
+                            <property>env.JAVA_HOME</property>
+                            <message>"JAVA_HOME needs to be
+                                set to compile"</message>
+                        </requireProperty>
+                    </rules>
+                </configuration>
+            </plugin>
+        </plugins>
+
+    </build>
+
+    <!-- Dependency Management -->
+    <dependencyManagement>
+        <dependencies>
+
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>${version.junit_junit}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.logging</groupId>
+                <artifactId>jboss-logging-log4j</artifactId>
+                <version>${version.jboss.logging.log4j}</version>
+                <scope>runtime</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.logging</groupId>
+                <artifactId>jboss-logging-spi</artifactId>
+                <version>${version.jboss.logging.spi}</version>
+            </dependency>
+
+
+        </dependencies>
+    </dependencyManagement>
+
+    <!-- Reporting -->
+    <reporting>
+        <plugins>
+
+            <!-- Cobertura (Code Coverage) -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <configuration>
+                    <formats>
+                        <format>html</format>
+                        <format>xml</format>
+                    </formats>
+                </configuration>
+            </plugin>
+
+            <!-- FindBugs -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <xmlOutput>true</xmlOutput>
+                    <findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
+                </configuration>
+            </plugin>
+
+            <!-- JavaDoc / APIViz -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.5</version>
+                <configuration>
+                    <doclet>org.jboss.apiviz.APIviz</doclet>
+                    <docletArtifact>
+                        <groupId>org.jboss.apiviz</groupId>
+                        <artifactId>apiviz</artifactId>
+                        <version>1.3.0.GA</version>
+                    </docletArtifact>
+                    <useStandardDocletOptions>true</useStandardDocletOptions>
+                    <charset>UTF-8</charset>
+                    <encoding>UTF-8</encoding>
+                    <docencoding>UTF-8</docencoding>
+                    <breakiterator>true</breakiterator>
+                    <version>true</version>
+                    <author>true</author>
+                    <keywords>true</keywords>
+                    <additionalparam>
+                        -sourceclasspath ${project.build.outputDirectory}
+          </additionalparam>
+                </configuration>
+            </plugin>
+
+
+        </plugins>
+    </reporting>
+
+</project>
+

Added: projects/ejb3/components/singleton/trunk/impl/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/pom.xml	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/pom.xml	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <!--
+    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>
+        <groupId>org.jboss.ejb3.singleton</groupId>
+        <artifactId>jboss-ejb3-singleton-build</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../build/pom.xml</relativePath>
+    </parent>
+    
+    <!-- Model Information -->
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- Artifact Information  -->
+    <groupId>org.jboss.ejb3.singleton</groupId>
+    <artifactId>jboss-ejb3-singleton-impl</artifactId>
+    <packaging>jar</packaging>
+    <name>JBoss EJB 3.1+ @Singleton implementation</name>
+    <url>http://www.jboss.org</url>
+    <description>Implementation of @Singleton as detailed by EJB 3.1 Specification</description>
+    
+    <properties>
+        <version.ejb3.singleton.container.spi>${project.version}</version.ejb3.singleton.container.spi>
+    </properties>
+    
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.jboss.ejb3.singleton</groupId>
+            <artifactId>jboss-ejb3-singleton-spi</artifactId>
+            <version>${version.ejb3.singleton.container.spi}</version>
+        </dependency>
+        
+        <!-- ***************************** -->
+        <!--  Test dependencies -->
+        <!-- ***************************** -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    
+    </dependencies>
+
+</project>	
\ No newline at end of file

Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/ContainerInvocationContextImpl.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/ContainerInvocationContextImpl.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/ContainerInvocationContextImpl.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.container;
+
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+
+/**
+ * ContainerInvocationContextImpl
+ *
+ * TODO: This needs to be in a better place like a common container impl
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ContainerInvocationContextImpl implements ContainerInvocationContext
+{
+
+   private Method method;
+   
+   private Object[] args;
+   
+   public ContainerInvocationContextImpl(Method method, Object[] args)
+   {
+      this.method = method;
+      this.args = args;
+   }
+   
+   /**
+    * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getArgs()
+    */
+   @Override
+   public Object[] getArgs()
+   {
+      return this.args;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getMethod()
+    */
+   @Override
+   public Method getMethod()
+   {
+      return this.method;
+   }
+
+   
+}

Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonBeanContext.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonBeanContext.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonBeanContext.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.container;
+
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.container.spi.EJBContainer;
+
+/**
+ * SingletonBeanContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonBeanContext implements BeanContext
+{
+
+   /**
+    * Instance of the bean
+    */
+   private Object beanInstance;
+   
+   /**
+    * The container for the bean
+    */
+   private EJBContainer beanContainer;
+   
+   /**
+    * Creates a {@link SingletonBeanContext} for a <code>beanInstance</code> and the
+    * associated <code>container</code>
+    * 
+    * @param beanInstance The instance of a bean
+    * @param container The container which manages the bean
+    */
+   public SingletonBeanContext(Object beanInstance, EJBContainer container)
+   {
+      this.beanContainer = container;
+      this.beanInstance = beanInstance;
+   }
+   
+   /**
+    * @see org.jboss.ejb3.container.spi.BeanContext#getBeanInstance()
+    */
+   @Override
+   public Object getBeanInstance()
+   {
+      return this.beanInstance;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.BeanContext#getEJBContainer()
+    */
+   @Override
+   public EJBContainer getEJBContainer()
+   {
+      return this.beanContainer;
+   }
+
+}

Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonContainer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonContainer.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonContainer.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,279 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.container;
+
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.EJBDeploymentInfo;
+import org.jboss.ejb3.container.spi.EJBInstanceManager;
+import org.jboss.ejb3.container.spi.InterceptorRegistry;
+import org.jboss.ejb3.container.spi.lifecycle.EJBLifecycleHandler;
+import org.jboss.ejb3.singleton.spi.SingletonEJBInstanceManager;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+
+/**
+ * SingletonContainer
+ * <p>
+ * Implementation of {@link EJBContainer} for a @Singleton bean.
+ * </p>
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonContainer implements EJBContainer, EJBLifecycleHandler
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(SingletonContainer.class);
+   
+   /**
+    * Bean implementation class 
+    */
+   private Class<?> beanClass;
+
+   /**
+    * Session bean metadata
+    */
+   private JBossSessionBean31MetaData sessionBeanMetaData;
+
+   /**
+    * EJB instance manager
+    */
+   private SingletonEJBInstanceManager instanceManager;
+
+   /**
+    * The interceptor registry for this container
+    */
+   private InterceptorRegistry interceptorRegistry;
+
+   /**
+    * Creates a {@link SingletonContainer} for the EJB class <code>beanClass</code>
+    * and the associated session bean metadata <code>sessionBeanMetaData</code>
+    *  
+    * @param beanClass The EJB implementation class
+    * @param sessionBeanMetaData The session bean metadata
+    * @throws IllegalArgumentException If either <code>beanClass</code> or <code>sessionBeanMetaData</code> 
+    *                               is null.
+    * @throws IllegalStateException If the <code>sesssionBeanMetadata</code> does not represent a singleton
+    *               bean - which is checked by a call to {@link JBossSessionBean31MetaData#isSingleton()}
+    */
+   public SingletonContainer(Class<?> beanClass, JBossSessionBean31MetaData sessionBeanMetaData)
+   {
+      if (beanClass == null || sessionBeanMetaData == null)
+      {
+         throw new IllegalArgumentException(SingletonContainer.class.getSimpleName()
+               + " cannot be constructed out of a null bean class or null bean metadata");
+      }
+      // we handle only singleton beans. If this is not a singleton bean
+      // then throw an exception
+      if (!sessionBeanMetaData.isSingleton())
+      {
+         throw new IllegalStateException("Bean named " + sessionBeanMetaData.getEjbName() + " with class "
+               + sessionBeanMetaData.getEjbClass() + " is NOT a singleton bean");
+      }
+
+      this.beanClass = beanClass;
+      this.sessionBeanMetaData = sessionBeanMetaData;
+
+      // create instance manager
+      this.instanceManager = new SingletonEJBInstanceManagerImpl(beanClass, this);
+      // create an empty interceptor registry
+      this.interceptorRegistry = new EmptyInterceptorRegistry();
+   }
+
+   /**
+    * Creates a {@link SingletonContainer} for the EJB class <code>beanClass</code>
+    * and the associated session bean metadata <code>sessionBeanMetaData</code>. The
+    * <code>interceptorRegistry</code> will be used for intercepting the calls on the 
+    * target bean instance
+    * 
+    * @param beanClass The EJB implementation class 
+    * @param sessionBeanMetaData The session bean metadata
+    * @param interceptorRegistry The interceptor registry which will be used to intercept
+    *               the calls to the target bean instance during the invocation on the container 
+    *               ({@link #invoke(ContainerInvocationContext)})
+    * @throws IllegalArgumentException If any of the passed parameters is null.
+    * @throws IllegalStateException If the <code>sesssionBeanMetadata</code> does not represent a singleton
+    *               bean - which is checked by a call to {@link JBossSessionBean31MetaData#isSingleton()}                
+    */
+   public SingletonContainer(Class<?> beanClass, JBossSessionBean31MetaData sessionBeanMetaData,
+         InterceptorRegistry interceptorRegistry)
+   {
+      this(beanClass, sessionBeanMetaData);
+      if (interceptorRegistry == null)
+      {
+         throw new IllegalArgumentException(SingletonContainer.class.getSimpleName()
+               + " cannot be constructed out of a null interceptor registry");
+      }
+      this.interceptorRegistry = interceptorRegistry;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getBeanInstanceManager()
+    */
+   @Override
+   public EJBInstanceManager getBeanInstanceManager()
+   {
+      return this.instanceManager;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getDeploymentInfo()
+    */
+   @Override
+   public EJBDeploymentInfo getDeploymentInfo()
+   {
+      // TODO: Implement this (and rethink whether we need this method at all)
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getEJBClass()
+    */
+   @Override
+   public String getEJBClass()
+   {
+      return this.beanClass.getName();
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getEJBName()
+    */
+   @Override
+   public String getEJBName()
+   {
+      return this.sessionBeanMetaData.getEjbName();
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getMetaData()
+    */
+   @Override
+   public JBossEnterpriseBeanMetaData getMetaData()
+   {
+      return this.sessionBeanMetaData;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#invoke(org.jboss.ejb3.container.spi.ContainerInvocationContext)
+    */
+   @Override
+   public Object invoke(ContainerInvocationContext containerInvocation) throws Exception
+   {
+      BeanContext beanContext = this.instanceManager.get();
+
+      // TODO: Should container managed concurrency be implemented here in this container,
+      // or in some interceptor within the interceptor chain maintained by the interceptor
+      // registry?
+      return this.interceptorRegistry.intercept(containerInvocation, beanContext);
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getInterceptorRegistry()
+    */
+   @Override
+   public InterceptorRegistry getInterceptorRegistry()
+   {
+      return this.interceptorRegistry;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBContainer#getEJBLifecycleHandler()
+    */
+   @Override
+   public EJBLifecycleHandler getEJBLifecycleHandler()
+   {
+      return this;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.lifecycle.EJBLifecycleHandler#postConstruct(org.jboss.ejb3.container.spi.BeanContext)
+    */
+   @Override
+   public void postConstruct(BeanContext beanContext)
+   {
+      // TODO: Implement this
+      logger.warn("postConstruct() not yet implemented in " + this.getClass());
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.lifecycle.EJBLifecycleHandler#preDestroy(org.jboss.ejb3.container.spi.BeanContext)
+    */
+   @Override
+   public void preDestroy(BeanContext beanContext)
+   {
+      // TODO: Implement this
+      logger.warn("preDestroy() not yet implemented in " + this.getClass());
+   }
+
+   /**
+    * 
+    * EmptyInterceptorRegistry
+    * 
+    * <p>
+    * An implementation of the {@link InterceptorRegistry}. This does NOT apply any interceptors
+    * to the invocation on the target object during the {@link #intercept(ContainerInvocationContext, Object)}
+    * call. Instead, it directly invokes the method on the target object 
+    * </p>
+    * TODO: This {@link EmptyInterceptorRegistry} probably needs to be in a more better place to be used
+    * commonly by other containers. Probably this class needs to be an API.
+    * 
+    * @author Jaikiran Pai
+    * @version $Revision: $
+    */
+   private class EmptyInterceptorRegistry implements InterceptorRegistry
+   {
+
+      /**
+       * @see org.jboss.ejb3.container.spi.InterceptorRegistry#getEJBContainer()
+       */
+      @Override
+      public EJBContainer getEJBContainer()
+      {
+         return SingletonContainer.this;
+      }
+
+      /**
+       * @see org.jboss.ejb3.container.spi.InterceptorRegistry#intercept(ContainerInvocationContext, BeanContext)
+       */
+      @Override
+      public Object intercept(ContainerInvocationContext containerInvocation, BeanContext targetBeanContext) throws Exception
+      {
+         // just directly invoke on the target object
+         Method methodToBeInvoked = containerInvocation.getMethod();
+         Object args[] = containerInvocation.getArgs();
+
+         // invoke
+         return methodToBeInvoked.invoke(targetBeanContext.getBeanInstance(), args);
+      }
+
+   }
+
+}

Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonEJBInstanceManagerImpl.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonEJBInstanceManagerImpl.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/container/SingletonEJBInstanceManagerImpl.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,149 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.container;
+
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.lifecycle.EJBLifecycleHandler;
+import org.jboss.ejb3.singleton.spi.SingletonEJBInstanceManager;
+
+/**
+ * SingletonInstanceManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonEJBInstanceManagerImpl implements SingletonEJBInstanceManager
+{
+
+   /**
+    * Bean implementation class
+    */
+   private Class<?> beanClass;
+
+   /**
+    * The EJB container
+    */
+   private EJBContainer container;
+
+   /**
+    * The singleton bean context
+    */
+   private BeanContext singletonBeanContext;
+
+   /**
+    * Constructs a {@link SingletonEJBInstanceManagerImpl} for the <code>beanClass</code> and
+    * its associated {@link EJBContainer}
+    * 
+    * @param beanClass The bean implementation class
+    * @param container The container managing the bean
+    */
+   public SingletonEJBInstanceManagerImpl(Class<?> beanClass, EJBContainer container)
+   {
+      this.beanClass = beanClass;
+      this.container = container;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBInstanceManager#create()
+    */
+   @Override
+   public BeanContext create()
+   {
+      if (this.singletonBeanContext == null)
+      {
+         boolean newInstanceCreated = false;
+         synchronized (this)
+         {
+            if (this.singletonBeanContext == null)
+            {
+               Object beanInstance = this.createBeanInstance();
+               this.singletonBeanContext = new SingletonBeanContext(beanInstance, this.container);
+               newInstanceCreated = true;
+            }
+         }
+         if (newInstanceCreated)
+         {
+            // do post-construct
+            EJBLifecycleHandler beanLifecycleHandler = this.getEJBContainer().getEJBLifecycleHandler();
+            beanLifecycleHandler.postConstruct(this.singletonBeanContext);
+         }
+      }
+
+      return this.singletonBeanContext;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBInstanceManager#get()
+    */
+   @Override
+   public BeanContext get()
+   {
+      if (this.singletonBeanContext == null)
+      {
+         this.create();
+      }
+      return this.singletonBeanContext;
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.StatefulEJBInstanceManager#getEJBContainer()
+    */
+   @Override
+   public EJBContainer getEJBContainer()
+   {
+      return this.container;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.EJBInstanceManager#destroy(org.jboss.ejb3.container.spi.BeanContext)
+    */
+   @Override
+   public void destroy(BeanContext beanContext) throws IllegalArgumentException
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /**
+    * Creates an instance of the bean class
+    * 
+    * @return Returns the bean instance
+    */
+   private Object createBeanInstance()
+   {
+      try
+      {
+         return this.beanClass.newInstance();
+      }
+      catch (InstantiationException ie)
+      {
+         throw new RuntimeException("Could not create an instance of the bean classs: " + this.beanClass, ie);
+      }
+      catch (IllegalAccessException iae)
+      {
+         throw new RuntimeException("Could not create an instance of the bean class: " + this.beanClass, iae);
+      }
+   }
+
+}

Added: projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/SimpleSingletonBean.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/SimpleSingletonBean.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/SimpleSingletonBean.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.test.simple;
+
+import javax.ejb.Singleton;
+
+/**
+ * SimpleSingletonBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+public class SimpleSingletonBean
+{
+
+   private int count;
+   
+   public String echo(String msg)
+   {
+      return msg;
+   }
+   
+   public int getCount()
+   {
+      return this.count; 
+   }
+   
+   public void incrementCount()
+   {
+      this.count ++;
+   }
+   
+   public SimpleSingletonBean getMe()
+   {
+      return this;
+   }
+}

Added: projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,225 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.impl.test.simple.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+import org.jboss.ejb3.singleton.impl.container.SingletonContainer;
+import org.jboss.ejb3.singleton.impl.test.simple.SimpleSingletonBean;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.SessionType;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * SimpleSingletonContainerTest
+ * 
+ * Simple tests for the {@link SingletonContainer}
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SimpleSingletonContainerTest
+{
+   /**
+    * Singleton container
+    */
+   private SingletonContainer singletonContainer;
+
+   /**
+    * Setup
+    */
+   @Before
+   public void beforeTest()
+   {
+      JBossSessionBean31MetaData singletonBeanMetadata = new JBossSessionBean31MetaData();
+      singletonBeanMetadata.setEjbClass(SimpleSingletonBean.class.getName());
+      singletonBeanMetadata.setEjbName(SimpleSingletonBean.class.getSimpleName());
+      singletonBeanMetadata.setSessionType(SessionType.Singleton);
+
+      // create a singleton container
+      this.singletonContainer = new SingletonContainer(SimpleSingletonBean.class, singletonBeanMetadata);
+   }
+
+   /**
+    * Tests a simple method invocation on a singleton bean
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testSimpleInvocation() throws Exception
+   {
+      // invoke the "echo" method
+      final Method echoMethod = SimpleSingletonBean.class.getMethod("echo", new Class<?>[]
+      {String.class});
+      String message = "Good morning!";
+      final Object params[] = new Object[]
+      {message};
+
+      ContainerInvocationContext containerInvocation = new DummyContainerInvocation(echoMethod, params);
+
+      Object result = this.singletonContainer.invoke(containerInvocation);
+
+      assertNotNull("Result returned by singleton container was null", result);
+      assertEquals("Unexpected return type from singleton container", String.class, result.getClass());
+
+      String returnedMessage = (String) result;
+      assertEquals("Unexpected message returned from singleton container", message, returnedMessage);
+   }
+
+   /**
+    * Tests that a singleton container always uses the same single bean instance across multiple calls
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testInstanceIdentity() throws Exception
+   {
+      // multiple calls through the container, should be directed to the 
+      // same bean instance
+      final Method getMeMethod = SimpleSingletonBean.class.getMethod("getMe", new Class<?>[]
+      {});
+      final Object params[] = new Object[]
+      {};
+
+      ContainerInvocationContext containerInvocation = new DummyContainerInvocation(getMeMethod, params);
+      Object result = this.singletonContainer.invoke(containerInvocation);
+
+      assertNotNull("Result returned by singleton container was null", result);
+      assertEquals("Unexpected return type from singleton container", SimpleSingletonBean.class, result.getClass());
+
+      SimpleSingletonBean firstInstance = (SimpleSingletonBean) result;
+
+      // more invocations on the bean and check that the same instance is returned
+      for (int i = 0; i < 5; i++)
+      {
+         containerInvocation = new DummyContainerInvocation(getMeMethod, params);
+         result = this.singletonContainer.invoke(containerInvocation);
+
+         assertNotNull("Result returned by singleton container was null", result);
+         assertEquals("Unexpected return type from singleton container", SimpleSingletonBean.class, result.getClass());
+
+         SimpleSingletonBean instance = (SimpleSingletonBean) result;
+
+         assertSame("Unexpected bean instance used by singleton container - singleton semantics broken?",
+               firstInstance, instance);
+      }
+
+   }
+
+   /**
+    * Tests that the bean instance maintains the right state after each call
+    * @throws Exception
+    */
+   @Test
+   public void testState() throws Exception
+   {
+      final Method getCountMethod = SimpleSingletonBean.class.getMethod("getCount", new Class<?>[]
+      {});
+      final Object params[] = new Object[]
+      {};
+      final Method incrementCountMethod = SimpleSingletonBean.class.getMethod("incrementCount", new Class<?>[]
+      {});
+
+      ContainerInvocationContext containerInvocation = new DummyContainerInvocation(getCountMethod, params);
+      Object result = this.singletonContainer.invoke(containerInvocation);
+
+      assertNotNull("Result returned by singleton container was null", result);
+      assertEquals("Unexpected return type from singleton container", Integer.class, result.getClass());
+
+      Integer count = (Integer) result;
+      assertEquals("Unexpected initial count returned by singleton container", (Integer) 0, count);
+
+      for (int i = 1; i < 10; i++)
+      {
+         // first increment
+         containerInvocation = new DummyContainerInvocation(incrementCountMethod, params);
+         this.singletonContainer.invoke(containerInvocation);
+         // get the count
+         containerInvocation = new DummyContainerInvocation(getCountMethod, params);
+         result = this.singletonContainer.invoke(containerInvocation);
+
+         assertNotNull("Result returned by singleton container was null", result);
+         assertEquals("Unexpected return type from singleton container", Integer.class, result.getClass());
+
+         count = (Integer) result;
+         assertEquals("Unexpected count returned by singleton container", (Integer) i, count);
+
+      }
+   }
+
+   /**
+    * 
+    * DummyContainerInvocation
+    *
+    * A dummy {@link ContainerInvocationContext} used in tests
+    * @author Jaikiran Pai
+    * @version $Revision: $
+    */
+   private class DummyContainerInvocation implements ContainerInvocationContext
+   {
+
+      private Method method;
+
+      private Object[] args;
+
+      private boolean stateful;
+
+      public DummyContainerInvocation(Method method, Object[] args)
+      {
+         this.method = method;
+         this.args = args;
+      }
+
+      public DummyContainerInvocation(Method method, Object[] args, boolean isStateful)
+      {
+         this(method, args);
+         this.stateful = isStateful;
+      }
+
+      /**
+       * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getArgs()
+       */
+      @Override
+      public Object[] getArgs()
+      {
+
+         return this.args;
+      }
+
+      /**
+       * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getMethod()
+       */
+      @Override
+      public Method getMethod()
+      {
+         return this.method;
+      }
+
+      
+   }
+}

Added: projects/ejb3/components/singleton/trunk/legacy-container-integration/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/legacy-container-integration/pom.xml	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/legacy-container-integration/pom.xml	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <!--
+    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>
+        <groupId>org.jboss.ejb3.singleton</groupId>
+        <artifactId>jboss-ejb3-singleton-build</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../build/pom.xml</relativePath>
+    </parent>
+    
+    <!-- Model Information -->
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- Artifact Information  -->
+    <groupId>org.jboss.ejb3.singleton</groupId>
+    <artifactId>jboss-ejb3-singleton-legacy-container-int</artifactId>
+    <packaging>jar</packaging>
+    <name>JBoss EJB3.1 @Singleton container integration with the AOP based containers</name>
+    <url>http://www.jboss.org</url>
+    <description>An integration of the new jboss-ejb3-singleton-spi based singleton container with the
+    older AOP based containers</description>
+    
+    <properties>
+        <version.ejb3.singleton.impl>${project.version}</version.ejb3.singleton.impl>
+	<version.ejb3.core>1.2.0</version.ejb3.core>
+    </properties>
+    
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.jboss.ejb3.singleton</groupId>
+            <artifactId>jboss-ejb3-singleton-impl</artifactId>
+            <version>${version.ejb3.singleton.impl}</version>
+        </dependency>
+	
+	<dependency>
+		<groupId>org.jboss.ejb3</groupId>
+		<artifactId>jboss-ejb3-core</artifactId>
+		<version>${version.ejb3.core}</version>
+	</dependency>
+
+        
+        <!-- ***************************** -->
+        <!--  Test dependencies -->
+        <!-- ***************************** -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    
+    </dependencies>
+
+</project>	
\ No newline at end of file

Added: projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedContainerInvocationContext.java
===================================================================
--- projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedContainerInvocationContext.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedContainerInvocationContext.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.legacy.container.integration;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.aop.MethodInfo;
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+
+/**
+ * AOPBasedContainerInvocationContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AOPBasedContainerInvocationContext implements ContainerInvocationContext
+{
+
+   private Method unadvisedMethod;
+
+   private Object[] args;
+
+   private MethodInfo aopMethodInfo;
+
+   private Map<Object, Object> responseContextInfo = new HashMap<Object, Object>();
+
+   /**
+    * @param method
+    * @param args
+    */
+   public AOPBasedContainerInvocationContext(MethodInfo aopMethodInfo, Object[] args)
+   {
+      this.aopMethodInfo = aopMethodInfo;
+      this.args = args;
+
+      // set the unadvised method
+      this.unadvisedMethod = this.aopMethodInfo.getUnadvisedMethod();
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getArgs()
+    */
+   @Override
+   public Object[] getArgs()
+   {
+      return this.args;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.ContainerInvocationContext#getMethod()
+    */
+   @Override
+   public Method getMethod()
+   {
+      return this.unadvisedMethod;
+   }
+
+   
+   public MethodInfo getMethodInfo()
+   {
+      return this.aopMethodInfo;
+   }
+
+   public Map<Object, Object> getResponseContextInfo()
+   {
+      return this.responseContextInfo;
+   }
+   
+   public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
+   {
+      this.responseContextInfo = responseContextInfo;
+   }
+}

Added: projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedInterceptorRegistry.java
===================================================================
--- projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedInterceptorRegistry.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedInterceptorRegistry.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.legacy.container.integration;
+
+import org.jboss.aop.MethodInfo;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.InterceptorRegistry;
+
+/**
+ * AOPBasedInterceptorRegistry
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AOPBasedInterceptorRegistry implements InterceptorRegistry
+{
+
+   private AOPBasedSingletonContainer aopBasedSingletonContainer;
+
+   public AOPBasedInterceptorRegistry(AOPBasedSingletonContainer aopBasedContainer)
+   {
+      this.aopBasedSingletonContainer = aopBasedContainer;
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.InterceptorRegistry#getEJBContainer()
+    */
+   @Override
+   public EJBContainer getEJBContainer()
+   {
+      return this.aopBasedSingletonContainer.getSingletonContainer();
+   }
+
+   /**
+    * @see org.jboss.ejb3.container.spi.InterceptorRegistry#intercept(ContainerInvocationContext, BeanContext)
+    */
+   @Override
+   public Object intercept(ContainerInvocationContext containerInvocation, BeanContext targetBeanContext) throws Exception
+   {
+      // we handle only AOP based invocation
+      if (!(containerInvocation instanceof AOPBasedContainerInvocationContext))
+      {
+         throw new IllegalArgumentException(AOPBasedInterceptorRegistry.class + " can only handle "
+               + AOPBasedContainerInvocationContext.class + " , was passed " + containerInvocation.getClass());
+      }
+      AOPBasedContainerInvocationContext aopInvocationContext = (AOPBasedContainerInvocationContext) containerInvocation;
+
+      MethodInfo methodInfo = aopInvocationContext.getMethodInfo();
+      EJBContainerInvocation<AOPBasedSingletonContainer, LegacySingletonBeanContext> invocation = new EJBContainerInvocation<AOPBasedSingletonContainer, LegacySingletonBeanContext>(
+            aopInvocationContext.getMethodInfo());
+      invocation.setAdvisor(methodInfo.getAdvisor());
+      invocation.setArguments(containerInvocation.getArgs());
+      // get bean context (we could have used the passed one, but we need org.jboss.ejb3.BeanContext for the 
+      // AOP based invocation. Hence get it from the AOP based container)
+      org.jboss.ejb3.BeanContext<?> singletonBeanContext = this.aopBasedSingletonContainer.getSingletonBeanContext();
+      invocation.setBeanContext(singletonBeanContext);
+      
+      try
+      {
+         return invocation.invokeNext();
+      }
+      catch (Throwable t)
+      {
+         throw new RuntimeException(t);
+      }
+   }
+
+}

Added: projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedSingletonContainer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedSingletonContainer.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/AOPBasedSingletonContainer.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,376 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.legacy.container.integration;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.ejb.Handle;
+import javax.ejb.TimerService;
+
+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.aop.util.MethodHashing;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.container.spi.ContainerInvocationContext;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.EJBInstanceManager;
+import org.jboss.ejb3.container.spi.InterceptorRegistry;
+import org.jboss.ejb3.proxy.impl.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.singleton.impl.container.SingletonContainer;
+import org.jboss.injection.InjectionContainer;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+
+/**
+ * AOPBasedSingletonContainer
+ * <p>
+ * A singleton container based on AOP. This container is used to integrate the {@link EJBContainer} with the
+ * existing AOP based container framework (mainly the AOP interceptors). Most of the work in this container
+ * is delegated to the {@link SingletonContainer}. 
+ * </p>
+ * <p>
+ * The main purpose of this container is to act as an entry point to invocations and plug-in a 
+ * AOP based interceptor registry {@link AOPBasedInterceptorRegistry} into the {@link SingletonContainer}
+ * </p>
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AOPBasedSingletonContainer extends SessionSpecContainer implements InjectionContainer
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(AOPBasedSingletonContainer.class);
+
+   /**
+    * This is the container to which the {@link AOPBasedSingletonContainer} will
+    * delegate the calls to
+    */
+   private SingletonContainer simpleSingletonContainer;
+
+   /**
+    * (Legacy) Bean context
+    */
+   private BeanContext<?> beanContext;
+
+   /**
+    * @param cl
+    * @param beanClassName
+    * @param ejbName
+    * @param domain
+    * @param ctxProperties
+    * @param deployment
+    * @param beanMetaData
+    * @throws ClassNotFoundException
+    */
+   public AOPBasedSingletonContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+         Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBean31MetaData beanMetaData)
+         throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+
+      // create a AOP based interceptor registry which will be used by the container
+      InterceptorRegistry interceptorRegistry = new AOPBasedInterceptorRegistry(this);
+      // create the new jboss-ejb3-container-spi based singleton container
+      this.simpleSingletonContainer = new SingletonContainer(this.getBeanClass(), beanMetaData, interceptorRegistry);
+   }
+
+   public SingletonContainer getSingletonContainer()
+   {
+      return this.simpleSingletonContainer;
+   }
+
+   /**
+    * @see org.jboss.ejb3.session.SessionSpecContainer#lockedStart()
+    */
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      super.lockedStart();
+
+      // create singleton bean context
+   }
+
+   /**
+    * @see org.jboss.ejb3.session.SessionContainer#createSession(java.lang.Class<?>[], java.lang.Object[])
+    */
+   @Override
+   public Serializable createSession(Class<?>[] initParameterTypes, Object[] initParameterValues)
+   {
+      // no sessions for @Singleton
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.session.SessionContainer#dynamicInvoke(org.jboss.aop.joinpoint.Invocation)
+    */
+   @Override
+   public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      /*
+       * Obtain the target method (unmarshall from invocation)
+       */
+
+      // Cast
+      assert invocation instanceof MethodInvocation : AOPBasedSingletonContainer.class.getName()
+            + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName() + ", but has been passed: "
+            + invocation.getClass();
+
+      MethodInvocation methodInvocation = (MethodInvocation) invocation;
+
+      // Get the method hash
+      long methodHash = methodInvocation.getMethodHash();
+      if (logger.isTraceEnabled())
+      {
+         logger.trace("Received dynamic invocation for method with hash: " + methodHash);
+      }
+
+      // Get the Method via MethodInfo from the Advisor
+      Advisor advisor = this.getAdvisor();
+      MethodInfo methodInfo = advisor.getMethodInfo(methodHash);
+
+      // create a container invocation
+      AOPBasedContainerInvocationContext containerInvocation = new AOPBasedContainerInvocationContext(methodInfo,
+            methodInvocation.getArguments());
+      try
+      {
+         // TODO: This is legacy code copied from StatelessContainer/SessionSpecContainer of ejb3-core
+         // Get the invoked method from invocation metadata
+         Object objInvokedMethod = invocation.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;
+
+         // push onto stack
+         SessionSpecContainer.invokedMethod.push(invokedMethod);
+
+         // pass the control to the simple singleton container
+         Object result = this.simpleSingletonContainer.invoke(containerInvocation);
+
+         // create an InvocationResponse out of the result 
+         Map<Object, Object> responseContextInfo = containerInvocation.getResponseContextInfo();
+         InvocationResponse invocationResponse = marshallResponse(invocation, result, responseContextInfo);
+         return invocationResponse;
+
+      }
+      catch (Throwable throwable)
+      {
+         Map<Object, Object> responseContextInfo = containerInvocation.getResponseContextInfo();
+         return marshallException(invocation, throwable, responseContextInfo);
+      }
+      finally
+      {
+         SessionSpecContainer.invokedMethod.pop();
+      }
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.session.SessionSpecContainer#invoke(java.io.Serializable, java.lang.Class, java.lang.reflect.Method, java.lang.Object[])
+    */
+   @Override
+   public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
+         throws Throwable
+   {
+      // create a (AOP) MethodInfo first so that a AOP based container invocation can be created out of it
+      long hash = MethodHashing.calculateHash(method);
+      MethodInfo methodInfo = getAdvisor().getMethodInfo(hash);
+      if (methodInfo == 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");
+      }
+      SerializableMethod serializableMethod = new SerializableMethod(method, invokedBusinessInterface);
+      // create a container invocation
+      ContainerInvocationContext containerInvocation = new AOPBasedContainerInvocationContext(methodInfo, args);
+
+      try
+      {
+         // TODO: Legacy push/pop copied from StatelessContainer/SessionSpecContainer
+         SessionSpecContainer.invokedMethod.push(serializableMethod);
+         // pass the control to the simple singleton container
+         return this.simpleSingletonContainer.invoke(containerInvocation);
+
+      }
+      finally
+      {
+         SessionSpecContainer.invokedMethod.pop();
+      }
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.session.SessionContainer#getJndiRegistrarBindName()
+    */
+   @Override
+   protected String getJndiRegistrarBindName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.session.SessionContainer#localHomeInvoke(java.lang.reflect.Method, java.lang.Object[])
+    */
+   @Override
+   public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.session.SessionContainer#localInvoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
+    */
+   @Override
+   public Object localInvoke(Object id, Method method, Object[] args) throws Throwable
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.session.SessionContainer#removeHandle(javax.ejb.Handle)
+    */
+   @Override
+   protected void removeHandle(Handle handle) throws Exception
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /**
+    * @see org.jboss.ejb3.EJBContainer#createBeanContext()
+    */
+   @Override
+   public BeanContext<?> createBeanContext()
+   {
+      EJBInstanceManager instanceManager = this.simpleSingletonContainer.getBeanInstanceManager();
+      org.jboss.ejb3.container.spi.BeanContext context = instanceManager.create();
+      return new LegacySingletonBeanContext(this, context);
+   }
+
+   /**
+    * @see org.jboss.ejb3.Container#getMBean()
+    */
+   @Override
+   public Object getMBean()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.Container#getTimerService()
+    */
+   @Override
+   public TimerService getTimerService()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
+    * @see org.jboss.ejb3.Container#getTimerService(java.lang.Object)
+    */
+   @Override
+   public TimerService getTimerService(Object key)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.injection.InjectionContainer#getAnnotation(java.lang.Class, java.lang.Class)
+    */
+   @Override
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.injection.InjectionContainer#getAnnotation(java.lang.Class, java.lang.Class, java.lang.reflect.Method)
+    */
+   @Override
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Method method)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.injection.InjectionContainer#getAnnotation(java.lang.Class, java.lang.Class, java.lang.reflect.Field)
+    */
+   @Override
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz, Field field)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public BeanContext<?> getSingletonBeanContext()
+   {
+      return this.beanContext;
+   }
+
+   protected void initBeanContext() throws RuntimeException
+   {
+      if (beanContext == null)
+      {
+         synchronized (this)
+         {
+            if (beanContext == null)
+            {
+               beanContext = createBeanContext();
+               pushEnc();
+               try
+               {
+                  beanContext.initialiseInterceptorInstances();
+               }
+               finally
+               {
+                  popEnc();
+               }
+            }
+         }
+      }
+   }
+
+}

Added: projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/LegacySingletonBeanContext.java
===================================================================
--- projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/LegacySingletonBeanContext.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/legacy-container-integration/src/main/java/org/jboss/ejb3/singleton/legacy/container/integration/LegacySingletonBeanContext.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.legacy.container.integration;
+
+import javax.ejb.EJBContext;
+
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.session.SessionSpecBeanContext;
+
+/**
+ * LegacySingletonBeanContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LegacySingletonBeanContext extends SessionSpecBeanContext<AOPBasedSingletonContainer>
+{
+   private AOPBasedSingletonContainer aopBasedSingletonContainer;
+   
+   public LegacySingletonBeanContext(AOPBasedSingletonContainer aopBasedSingletonContainer, BeanContext context)
+   {
+      super(aopBasedSingletonContainer, context.getBeanInstance());
+      this.aopBasedSingletonContainer = aopBasedSingletonContainer;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.session.SessionBeanContext#getEJBContext()
+    */
+   @Override
+   public EJBContext getEJBContext()
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.BeanContext#remove()
+    */
+   @Override
+   public void remove()
+   {
+      throw new RuntimeException("Not yet implemented");
+      
+   }
+}

Added: projects/ejb3/components/singleton/trunk/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/pom.xml	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/pom.xml	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!-- Parent -->
+    <parent>
+        <groupId>org.jboss</groupId>
+        <artifactId>jboss-parent</artifactId>
+        <version>4</version>
+    </parent>
+
+    <!-- Model Information -->
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- Artifact Information  -->
+    <groupId>org.jboss.ejb3.singleton</groupId>
+    <artifactId>jboss-ejb3-singleton-aggregator</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>JBoss EJB 3.1+ @Singleton component Aggregator</name>
+    <url>http://www.jboss.org</url>
+    <description>Aggregator for @Singleton component</description>
+
+    <!-- Plugin Configuration -->
+    <build>
+        <plugins>
+
+            <!-- Deploy -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <!-- Don't include this aggregator in the deployment -->
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <!-- Aggregate Modules -->
+    <modules>
+        <!--  Order matters -->
+        <module>build</module>
+	<module>spi</module>
+        <module>impl</module>
+	<module>legacy-container-integration</module>
+    </modules>
+
+</project>

Added: projects/ejb3/components/singleton/trunk/spi/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/spi/pom.xml	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/spi/pom.xml	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <!--
+    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>
+        <groupId>org.jboss.ejb3.singleton</groupId>
+        <artifactId>jboss-ejb3-singleton-build</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../build/pom.xml</relativePath>
+    </parent>
+    
+    <!-- Model Information -->
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- Artifact Information  -->
+    <groupId>org.jboss.ejb3.singleton</groupId>
+    <artifactId>jboss-ejb3-singleton-spi</artifactId>
+    <packaging>jar</packaging>
+    <name>JBoss EJB 3.1+ @Singleton SPI</name>
+    <url>http://www.jboss.org</url>
+    <description>SPI for @Singleton</description>
+    
+    <properties>
+        <version.ejb3.container.spi>1.0.0-SNAPSHOT</version.ejb3.container.spi>
+    </properties>
+    
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.jboss.ejb3.container</groupId>
+            <artifactId>jboss-ejb3-container-spi</artifactId>
+            <version>${version.ejb3.container.spi}</version>
+        </dependency>
+        
+        <!-- ***************************** -->
+        <!--  Test dependencies -->
+        <!-- ***************************** -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    
+    </dependencies>
+
+</project>	
\ No newline at end of file

Added: projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/SingletonEJBInstanceManager.java
===================================================================
--- projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/SingletonEJBInstanceManager.java	                        (rev 0)
+++ projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/SingletonEJBInstanceManager.java	2010-02-02 12:47:53 UTC (rev 100248)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.singleton.spi;
+
+import org.jboss.ejb3.container.spi.BeanContext;
+import org.jboss.ejb3.container.spi.EJBInstanceManager;
+
+
+/**
+ * SingletonEJBInstanceManager
+ * <p>
+ *  A {@link SingletonEJBInstanceManager} is responsible for creating/destroying 
+ *  the singleton bean instance.
+ * </p>
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface SingletonEJBInstanceManager extends EJBInstanceManager
+{
+
+   /**
+    * @return Returns the {@link BeanContext} for the singleton bean.
+    *  
+    */
+   BeanContext get();
+}




More information about the jboss-cvs-commits mailing list