[jboss-cvs] JBossAS SVN: r101658 - in projects/ejb3/components/singleton/trunk: aop-impl and 75 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 1 09:11:28 EST 2010
Author: jaikiran
Date: 2010-03-01 09:11:24 -0500 (Mon, 01 Mar 2010)
New Revision: 101658
Added:
projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/
projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package-assembler.xml
projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package.xml
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/LegacyEJB3DeploymentAdapter.java
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/MCBasedEJB3DeploymentUnit.java
projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/
projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/META-INF/
projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/META-INF/singleton-container-aop.xml
projects/ejb3/components/singleton/trunk/deployer/
projects/ejb3/components/singleton/trunk/deployer/pom.xml
projects/ejb3/components/singleton/trunk/deployer/src/
projects/ejb3/components/singleton/trunk/deployer/src/assembly/
projects/ejb3/components/singleton/trunk/deployer/src/assembly/package-assembler.xml
projects/ejb3/components/singleton/trunk/deployer/src/assembly/package.xml
projects/ejb3/components/singleton/trunk/deployer/src/main/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJB3DeploymentDeployer.java
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJBContainerDeployer.java
projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/SingletonContainerDeployer.java
projects/ejb3/components/singleton/trunk/deployer/src/main/resources/
projects/ejb3/components/singleton/trunk/deployer/src/main/resources/META-INF/
projects/ejb3/components/singleton/trunk/deployer/src/main/resources/META-INF/jboss-ejb3-singleton-deployer-jboss-beans.xml
projects/ejb3/components/singleton/trunk/deployer/src/test/
projects/ejb3/components/singleton/trunk/deployer/src/test/java/
projects/ejb3/components/singleton/trunk/deployer/src/test/resources/
projects/ejb3/components/singleton/trunk/docs/
projects/ejb3/components/singleton/trunk/docs/reference/
projects/ejb3/components/singleton/trunk/docs/reference/en/
projects/ejb3/components/singleton/trunk/docs/reference/en/container.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/deployer.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/ejb3deployment.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/interceptor.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/intro.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/jbremoting.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/master.xml
projects/ejb3/components/singleton/trunk/docs/reference/en/proxy.xml
projects/ejb3/components/singleton/trunk/docs/reference/jboss-ejb3-singleton-reference-doc-en-US.iml
projects/ejb3/components/singleton/trunk/docs/reference/pom.xml
projects/ejb3/components/singleton/trunk/impl/src/assembly/
projects/ejb3/components/singleton/trunk/impl/src/assembly/package-assembler.xml
projects/ejb3/components/singleton/trunk/impl/src/assembly/package.xml
projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/
projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/JBossRemotingContainer.java
projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotableContainerInvocation.java
projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotingInvocationHandler.java
projects/ejb3/components/singleton/trunk/impl/src/main/resources/
projects/ejb3/components/singleton/trunk/impl/src/main/resources/META-INF/
projects/ejb3/components/singleton/trunk/impl/src/main/resources/META-INF/ejb3-connectors-jboss-beans.xml
projects/ejb3/components/singleton/trunk/proxy/
projects/ejb3/components/singleton/trunk/proxy/pom.xml
projects/ejb3/components/singleton/trunk/proxy/src/
projects/ejb3/components/singleton/trunk/proxy/src/assembly/
projects/ejb3/components/singleton/trunk/proxy/src/assembly/package-assembler.xml
projects/ejb3/components/singleton/trunk/proxy/src/assembly/package.xml
projects/ejb3/components/singleton/trunk/proxy/src/main/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/ProxyFactory.java
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteInvocationHandler.java
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteJNDIBinder.java
projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonProxyFactory.java
projects/ejb3/components/singleton/trunk/proxy/src/main/resources/
projects/ejb3/components/singleton/trunk/proxy/src/test/
projects/ejb3/components/singleton/trunk/proxy/src/test/java/
projects/ejb3/components/singleton/trunk/proxy/src/test/resources/
projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/ContainerRegistry.java
projects/ejb3/components/singleton/trunk/testsuite/
projects/ejb3/components/singleton/trunk/testsuite/pom.xml
projects/ejb3/components/singleton/trunk/testsuite/src/
projects/ejb3/components/singleton/trunk/testsuite/src/test/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/common/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/common/AbstractSingletonTestCase.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/Counter.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/SimpleSingletonBean.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/unit/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/unit/SingletonDeploymentUnitTestCase.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SimpleInterceptor.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SingletonBeanWithInterceptor.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/unit/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/unit/SingletonBeanInterceptorTestCase.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/TxAwareSingletonBean.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/User.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/UserManager.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/unit/
projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/unit/SingletonBeanTxSemanticsTestCase.java
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/build-test.xml
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/jndi.properties
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/META-INF/
projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/META-INF/persistence.xml
Removed:
projects/ejb3/components/singleton/trunk/legacy-container-integration/
Modified:
projects/ejb3/components/singleton/trunk/aop-impl/pom.xml
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedContainerInvocationContext.java
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedInterceptorRegistry.java
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedSingletonContainer.java
projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/LegacySingletonBeanContext.java
projects/ejb3/components/singleton/trunk/aop-impl/src/test/java/org/jboss/ejb3/singleton/aop/impl/test/common/MockDeploymentUnit.java
projects/ejb3/components/singleton/trunk/impl/pom.xml
projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java
projects/ejb3/components/singleton/trunk/pom.xml
projects/ejb3/components/singleton/trunk/spi/pom.xml
Log:
EJBTHREE-2010 Singleton container impl (work in progress)
Modified: projects/ejb3/components/singleton/trunk/aop-impl/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/pom.xml 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -26,9 +26,36 @@
<properties>
<version.ejb3.singleton.impl>${project.version}</version.ejb3.singleton.impl>
- <version.ejb3.core>1.2.0</version.ejb3.core>
+ <version.ejb3.core>1.2.3</version.ejb3.core>
+ <version.ejb3.vfs.impl>1.0.0-alpha-1</version.ejb3.vfs.impl>
</properties>
+ <build>
+ <plugins>
+ <!-- Assembly Plugin -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <!-- Build singleton aop "package" -->
+ <execution>
+ <id>build-singleton-aop-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/package-assembler.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
<dependencies>
<dependency>
@@ -42,23 +69,13 @@
<artifactId>jboss-ejb3-core</artifactId>
<version>${version.ejb3.core}</version>
</dependency>
-
-
- <!-- ***************************** -->
- <!-- Test dependencies -->
- <!-- ***************************** -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <!-- Get rid of this! it's required for ServiceMBeanSupport class
+
+ <!-- Get rid of this! it's required for ServiceMBeanSupport class
which is being extended by EJB3Deployment -->
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>5.1.0.GA</version>
- <scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.microcontainer</groupId>
@@ -78,7 +95,23 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.vfs</groupId>
+ <artifactId>jboss-ejb3-vfs-impl-vfs2</artifactId>
+ <version>${version.ejb3.vfs.impl}</version>
+ </dependency>
+ <!-- ***************************** -->
+ <!-- Test dependencies -->
+ <!-- ***************************** -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+
+
<!-- this needs to be removed - EJBTHREE-1343 -->
<dependency>
<groupId>org.jboss.jbossas</groupId>
@@ -114,7 +147,17 @@
</exclusions>
<scope>test</scope>
</dependency>
+
+ <!-- ***************************** -->
+ <!-- Runtime dependencies -->
+ <!-- ***************************** -->
+ <dependency>
+ <groupId>org.jboss.ejb3.timeout</groupId>
+ <artifactId>jboss-ejb3-timeout-3.0</artifactId>
+ <version>0.1.1</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package-assembler.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package-assembler.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package-assembler.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly 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/xsd/assembly-1.1.1.xsd"
+>
+ <id>package</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/assembly</directory>
+ <filtered>true</filtered>
+ <includes>
+ <include>package.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/resources/META-INF</directory>
+ <includes>
+ <include>singleton-container-aop.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useProjectArtifact>true</useProjectArtifact>
+ <includes>
+ <include>org.jboss.ejb3.singleton:jboss-ejb3-singleton-aop-impl:jar</include>
+ <include>org.jboss.ejb3:jboss-ejb3-core:jar</include>
+ <include>org.jboss.ejb3.vfs:jboss-ejb3-vfs-spi:jar</include>
+ <include>org.jboss.ejb3.vfs:jboss-ejb3-vfs-impl-vfs2:jar</include>
+ </includes>
+
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Added: projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/assembly/package.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,40 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ 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.
+ -->
+<!--
+ jboss-ejb3-singleton-aop-impl
+-->
+<package name="${project.groupId}:${project.artifactId}" version="${project.version}" xmlns="org/jboss/packagemanager/package">
+
+ <!-- Place in common/lib of AS -->
+ <file name="jboss-ejb3-singleton-aop-impl.jar" dest-path="common/lib" type="library"/>
+ <!-- Hack -->
+ <file name="jboss-ejb3-core.jar" dest-path="common/lib" type="library"/>
+ <file name="jboss-ejb3-vfs-spi.jar" dest-path="common/lib" type="library"/>
+ <file name="jboss-ejb3-vfs-impl-vfs2.jar" dest-path="common/lib" type="library"/>
+
+ <!-- The xml file containing the AOP interceptors -->
+ <file name="singleton-container-aop.xml" dest-path="server/default/deploy" type="config"/>
+ <file name="singleton-container-aop.xml" dest-path="server/all/deploy" type="config"/>
+
+
+</package>
\ No newline at end of file
Modified: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedContainerInvocationContext.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedContainerInvocationContext.java 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedContainerInvocationContext.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -30,7 +30,7 @@
import org.jboss.ejb3.container.spi.ContainerInvocation;
/**
- * AOPBasedContainerInvocationContext
+ * A AOP based implementation of {@link ContainerInvocation}
*
* @author Jaikiran Pai
* @version $Revision: $
@@ -38,19 +38,37 @@
public class AOPBasedContainerInvocationContext implements ContainerInvocation
{
+ /**
+ * Unadvised method
+ */
private Method unadvisedMethod;
+ /**
+ * The method arguments
+ */
private Object[] args;
+ /**
+ * AOP method info
+ */
private MethodInfo aopMethodInfo;
+ /**
+ * The business interface on which the method was invoked
+ */
private Class<?> businessInterface;
+ /**
+ * Response context (legacy AOP stuff), used to pass around
+ * the response
+ */
private Map<Object, Object> responseContextInfo = new HashMap<Object, Object>();
/**
- * @param method
- * @param args
+ * Creates a {@link AOPBasedContainerInvocationContext}
+ *
+ * @param method The AOP method
+ * @param args The arguments to the method
*/
public AOPBasedContainerInvocationContext(MethodInfo aopMethodInfo, Object[] args)
{
@@ -63,8 +81,11 @@
}
/**
- * @param method
- * @param args
+ * Constructs a {@link AOPBasedContainerInvocationContext}
+ *
+ * @param method The AOP method
+ * @param args Arguments to the method
+ * @param businessInterface The business interface on which the method was invoked
*/
public AOPBasedContainerInvocationContext(MethodInfo aopMethodInfo, Object[] args, Class<?> businessInterface)
{
@@ -90,23 +111,37 @@
return this.unadvisedMethod;
}
-
+ /**
+ * Returns the AOP {@link MethodInfo}
+ * @return
+ */
public MethodInfo getMethodInfo()
{
return this.aopMethodInfo;
}
+ /**
+ * Returns the response context information
+ * @return
+ */
public Map<Object, Object> getResponseContextInfo()
{
return this.responseContextInfo;
}
+ /**
+ * Sets the response context information
+ *
+ * @param responseContextInfo Response context
+ */
public void setResponseContextInfo(Map<Object, Object> responseContextInfo)
{
this.responseContextInfo = responseContextInfo;
}
/**
+ * Returns null, since invocations on singleton containers don't have sessions.
+ *
* @see org.jboss.ejb3.container.spi.ContainerInvocation#getSessionId()
*/
@Override
Modified: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedInterceptorRegistry.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedInterceptorRegistry.java 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedInterceptorRegistry.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -21,6 +21,8 @@
*/
package org.jboss.ejb3.singleton.aop.impl;
+import java.util.List;
+
import org.jboss.aop.MethodInfo;
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.container.spi.BeanContext;
@@ -29,8 +31,9 @@
import org.jboss.ejb3.container.spi.InterceptorRegistry;
/**
- * AOPBasedInterceptorRegistry
- *
+ * A AOP based implementation of the {@link InterceptorRegistry} for a
+ * {@link AOPBasedSingletonContainer}
+ *
* @author Jaikiran Pai
* @version $Revision: $
*/
@@ -63,6 +66,9 @@
}
/**
+ * Processes the <code>targetBeanContext</code> through a chain of AOP based
+ * interceptors
+ *
* @see org.jboss.ejb3.container.spi.InterceptorRegistry#intercept(ContainerInvocation, BeanContext)
*/
@Override
@@ -75,7 +81,7 @@
+ AOPBasedContainerInvocationContext.class + " , was passed " + containerInvocation.getClass());
}
AOPBasedContainerInvocationContext aopInvocationContext = (AOPBasedContainerInvocationContext) containerInvocation;
-
+ // form a AOP invocation
MethodInfo methodInfo = aopInvocationContext.getMethodInfo();
EJBContainerInvocation<AOPBasedSingletonContainer, LegacySingletonBeanContext> invocation = new EJBContainerInvocation<AOPBasedSingletonContainer, LegacySingletonBeanContext>(
aopInvocationContext.getMethodInfo());
@@ -85,10 +91,13 @@
// AOP based invocation. Hence get it from the AOP based container)
org.jboss.ejb3.BeanContext<?> singletonBeanContext = new LegacySingletonBeanContext(
this.aopBasedSingletonContainer, targetBeanContext);
+
+ // set the target bean context of the AOP invocation
invocation.setBeanContext(singletonBeanContext);
try
{
+ // fire the AOP invocation
return invocation.invokeNext();
}
catch (Throwable t)
@@ -98,6 +107,8 @@
}
/**
+ * This is a no-op since singleton beans do not have a post-activate lifecycle
+ *
* @see org.jboss.ejb3.container.spi.InterceptorRegistry#invokePostActivate(org.jboss.ejb3.container.spi.BeanContext)
*/
@Override
@@ -108,6 +119,9 @@
}
/**
+ * Invokes the post-construct lifecycle on the <code>targetBeanContext</code>
+ * by processing it through a chain of AOP interceptors (and user defined javax.interceptor.Interceptor)
+ *
* @see org.jboss.ejb3.container.spi.InterceptorRegistry#invokePostConstruct(org.jboss.ejb3.container.spi.BeanContext)
*/
@Override
@@ -116,11 +130,30 @@
// fallback on legacy AOP based lifecycle impl
org.jboss.ejb3.BeanContext<?> legacyBeanContext = new LegacySingletonBeanContext(this.aopBasedSingletonContainer,
targetBeanContext);
+ // TODO: This passes the bean context through a series of injectors
+ // which are responsible for carrying out the injection on the bean context (ex: field based
+ // injection like for @PersistenceContext).
+ // THIS HAS TO BE IN THE EJBLifecycleHandler SO THAT THE INJECTIONS
+ // CAN HAPPEN ON LIFECYCLE EVENTS (LIKE BEAN INSTANTIATION)
+ this.aopBasedSingletonContainer.injectBeanContext(legacyBeanContext);
+
+ // Note: The method name initialiseInterceptorInstances() gives a
+ // wrong impression. This method not just instantiates a interceptor instance,
+ // but it also injects (through the help of InjectionHanlder(s)) the interceptor
+ // instance for any injectable fields
+ // TODO: Ideally, this should be split up into separate instantiation and injection
+ // calls.
+ legacyBeanContext.initialiseInterceptorInstances();
+
+ // invoke post construct lifecycle on the bean/interceptor instances
this.aopBasedSingletonContainer.invokePostConstruct(legacyBeanContext);
}
/**
+ * Invokes the pre-destroy lifecycle on the <code>targetBeanContext</code>
+ * by processing it through a chain of AOP interceptors (and user defined javax.interceptor.Interceptor)
+ *
* @see org.jboss.ejb3.container.spi.InterceptorRegistry#invokePreDestroy(org.jboss.ejb3.container.spi.BeanContext)
*/
@Override
@@ -134,6 +167,8 @@
}
/**
+ * This is a no-op since singleton beans do not have a pre-passivate lifecycle
+ *
* @see org.jboss.ejb3.container.spi.InterceptorRegistry#invokePrePassivate(org.jboss.ejb3.container.spi.BeanContext)
*/
@Override
@@ -143,4 +178,13 @@
}
+ /**
+ * @see org.jboss.ejb3.container.spi.InterceptorRegistry#getInterceptorClasses()
+ */
+ @Override
+ public List<Class<?>> getInterceptorClasses()
+ {
+ return this.aopBasedSingletonContainer.getBeanContainer().getInterceptorRegistry().getInterceptorClasses();
+ }
+
}
Modified: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedSingletonContainer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedSingletonContainer.java 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/AOPBasedSingletonContainer.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -36,14 +36,17 @@
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.util.MethodHashing;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.aop.BeanContainer;
import org.jboss.ejb3.common.lang.SerializableMethod;
import org.jboss.ejb3.container.spi.ContainerInvocation;
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.proxy.impl.jndiregistrar.JndiSessionRegistrarBase;
import org.jboss.ejb3.proxy.impl.remoting.SessionSpecRemotingMetadata;
import org.jboss.ejb3.session.SessionSpecContainer;
import org.jboss.ejb3.singleton.impl.container.SingletonContainer;
@@ -52,7 +55,6 @@
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
@@ -109,6 +111,7 @@
InterceptorRegistry interceptorRegistry = new AOPBasedInterceptorRegistry(this);
// create the new jboss-ejb3-container-spi based singleton container
this.simpleSingletonContainer = new SingletonContainer(this.getBeanClass(), beanMetaData, interceptorRegistry);
+
}
/**
@@ -134,6 +137,15 @@
}
/**
+ * @see org.jboss.ejb3.EJBContainer#initializePool()
+ */
+ @Override
+ protected void initializePool() throws Exception
+ {
+ // do nothing (we don't have a pool)
+ }
+
+ /**
* @see org.jboss.ejb3.session.SessionSpecContainer#lockedStop()
*/
@Override
@@ -278,6 +290,19 @@
}
/**
+ *
+ * This method returns null, because binding of proxies into JNDI is done
+ * by a separate module, outside of the singleton container implementation
+ *
+ * @see org.jboss.ejb3.session.SessionContainer#getJndiRegistrar()
+ */
+ @Override
+ protected JndiSessionRegistrarBase getJndiRegistrar()
+ {
+ return null;
+ }
+
+ /**
* @see org.jboss.ejb3.session.SessionContainer#localHomeInvoke(java.lang.reflect.Method, java.lang.Object[])
*/
@Override
@@ -403,4 +428,13 @@
return this.simpleSingletonContainer.getInterceptorRegistry();
}
+ /**
+ * Expose this as public so that the {@link AOPBasedInterceptorRegistry}
+ * can get hold of the legacy AOP based {@link org.jboss.ejb3.interceptors.registry.InterceptorRegistry}
+ */
+ public BeanContainer getBeanContainer()
+ {
+ return super.getBeanContainer();
+ }
+
}
Modified: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/LegacySingletonBeanContext.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/LegacySingletonBeanContext.java 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/LegacySingletonBeanContext.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -40,6 +40,7 @@
{
super(aopBasedSingletonContainer, context.getBeanInstance());
this.aopBasedSingletonContainer = aopBasedSingletonContainer;
+
}
/* (non-Javadoc)
Added: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/LegacyEJB3DeploymentAdapter.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/LegacyEJB3DeploymentAdapter.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/LegacyEJB3DeploymentAdapter.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,168 @@
+/*
+* 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.aop.impl.deployment;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.jacc.PolicyConfiguration;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.deployment.EJB3Deployment;
+import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
+import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * LegacyEJB3DeploymentAdapter
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LegacyEJB3DeploymentAdapter extends Ejb3Deployment implements EJB3Deployment
+{
+
+
+ private PersistenceUnitDependencyResolver persistenceUnitResolver;
+
+ private org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit;
+
+ /**
+ * @param deploymentUnit
+ * @param unit
+ * @param deploymentScope
+ * @param metaData
+ */
+ public LegacyEJB3DeploymentAdapter(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit,
+ DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData)
+ {
+ super(deploymentUnit, unit, deploymentScope, metaData);
+ this.deploymentUnit = deploymentUnit;
+ }
+
+ /**
+ * EJB name --> EJB container map
+ */
+ private Map<String, EJBContainer> containers = new HashMap<String, EJBContainer>();
+
+ /**
+ * @see org.jboss.ejb3.Ejb3Deployment#createDependencyPolicy(org.jboss.ejb3.javaee.JavaEEComponent)
+ */
+ @Override
+ public DependencyPolicy createDependencyPolicy(JavaEEComponent component)
+ {
+ return new JBoss5DependencyPolicy(component);
+ }
+
+ /**
+ * @see org.jboss.ejb3.Ejb3Deployment#createPolicyConfiguration()
+ */
+ @Override
+ protected PolicyConfiguration createPolicyConfiguration() throws Exception
+ {
+ throw new UnsupportedOperationException("NYI - createPolicyConfiguration");
+ }
+
+ /**
+ * @see org.jboss.ejb3.Ejb3Deployment#putJaccInService(javax.security.jacc.PolicyConfiguration, org.jboss.ejb3.DeploymentUnit)
+ */
+ @Override
+ protected void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit)
+ {
+ throw new UnsupportedOperationException("NYI - putJaccInService");
+
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.deployment.EJB3Deployment#addContainer(org.jboss.ejb3.container.spi.EJBContainer)
+ */
+ @Override
+ public void addContainer(EJBContainer ejbContainer) throws IllegalArgumentException
+ {
+ String ejbName = ejbContainer.getEJBName();
+ if (this.containers.containsKey(ejbName))
+ {
+ throw new IllegalArgumentException("Container for ejb named " + ejbName + " is already registered");
+ }
+ this.containers.put(ejbName, ejbContainer);
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.deployment.EJB3Deployment#getEJBContainer(java.lang.String)
+ */
+ @Override
+ public EJBContainer getEJBContainer(String ejbName)
+ {
+ return this.containers.get(ejbName);
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.deployment.EJB3Deployment#getEJBContainers()
+ */
+ @Override
+ public Collection<EJBContainer> getEJBContainers()
+ {
+ return Collections.unmodifiableCollection(this.containers.values());
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.deployment.EJB3Deployment#removeEJBContainer(org.jboss.ejb3.container.spi.EJBContainer)
+ */
+ @Override
+ public void removeEJBContainer(EJBContainer ejbContainer) throws IllegalArgumentException
+ {
+ String ejbName = ejbContainer.getEJBName();
+ if (!this.containers.containsKey(ejbName))
+ {
+ throw new IllegalArgumentException("EJB container for ejb name " + ejbName + " is not registered");
+ }
+ this.containers.remove(ejbName);
+ }
+
+ @Inject
+ public void setPersistenceUnitResolver(PersistenceUnitDependencyResolver puResolver)
+ {
+ this.persistenceUnitResolver = puResolver;
+ }
+
+ /**
+ * @see org.jboss.ejb3.Ejb3Deployment#resolvePersistenceUnitSupplier(java.lang.String)
+ */
+ @Override
+ protected String resolvePersistenceUnitSupplier(String persistenceUnitName)
+ {
+ if (this.persistenceUnitResolver == null)
+ {
+ return null;
+ }
+ return this.persistenceUnitResolver.resolvePersistenceUnitSupplier(this.deploymentUnit, persistenceUnitName);
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/MCBasedEJB3DeploymentUnit.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/MCBasedEJB3DeploymentUnit.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/java/org/jboss/ejb3/singleton/aop/impl/deployment/MCBasedEJB3DeploymentUnit.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,275 @@
+/*
+* 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.aop.impl.deployment;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.ejb3.vfs.impl.vfs2.VirtualFileWrapper;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
+import org.jboss.ejb3.vfs.spi.VirtualFileFilter;
+
+/**
+ * MCBasedEJB3DeploymentUnit
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class MCBasedEJB3DeploymentUnit implements DeploymentUnit
+{
+
+ private VFSDeploymentUnit vfsDeploymentUnit;
+
+ public MCBasedEJB3DeploymentUnit(VFSDeploymentUnit vfsDeploymentUnit)
+ {
+ this.vfsDeploymentUnit = vfsDeploymentUnit;
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#addAttachment(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public Object addAttachment(String name, Object attachment)
+ {
+ return this.vfsDeploymentUnit.addAttachment(name, attachment);
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getAttachment(java.lang.String)
+ */
+ @Override
+ public Object getAttachment(String name)
+ {
+ return this.vfsDeploymentUnit.getAttachment(name);
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getClassLoader()
+ */
+ @Override
+ public ClassLoader getClassLoader()
+ {
+ return this.vfsDeploymentUnit.getClassLoader();
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getClasses()
+ */
+ @Override
+ public List<Class> getClasses()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getDefaultEntityManagerName()
+ */
+ @Override
+ public String getDefaultEntityManagerName()
+ {
+ throw new UnsupportedOperationException("NYI - getDefaultEntityManagerName");
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getDefaultPersistenceProperties()
+ */
+ @Override
+ public Map getDefaultPersistenceProperties()
+ {
+ throw new UnsupportedOperationException("NYI - getDefaultPersistenceProperties");
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getEjbJarXml()
+ */
+ @Override
+ public URL getEjbJarXml()
+ {
+ return this.extractDescriptorUrl("ejb-jar.xml");
+ }
+
+ /**
+ * @see org.jboss.ejb3.DeploymentUnit#getInterceptorInfoRepository()
+ */
+ @Override
+ public InterceptorInfoRepository getInterceptorInfoRepository()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getJbossXml()
+ */
+ @Override
+ public URL getJbossXml()
+ {
+ return this.extractDescriptorUrl("jboss.xml");
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getJndiProperties()
+ */
+ @Override
+ public Hashtable getJndiProperties()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getMetaDataFile(java.lang.String)
+ */
+ @Override
+ public VirtualFile getMetaDataFile(String filename)
+ {
+ // TODO: revisit this
+ org.jboss.virtual.VirtualFile virtualFile = this.vfsDeploymentUnit.getMetaDataFile(filename);
+ VirtualFileWrapper virtualFileWrapper = new VirtualFileWrapper(virtualFile);
+ return virtualFileWrapper;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getPersistenceXml()
+ */
+ @Override
+ public URL getPersistenceXml()
+ {
+ return this.extractDescriptorUrl("persistence.xml");
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getRelativePath()
+ */
+ @Override
+ public String getRelativePath()
+ {
+ return this.vfsDeploymentUnit.getRelativePath();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getRelativeURL(java.lang.String)
+ */
+ @Override
+ public URL getRelativeURL(String path)
+ {
+ try
+ {
+ return new URL(path);
+ }
+ catch (MalformedURLException e)
+ {
+ try
+ {
+ if (getUrl() == null)
+ throw new RuntimeException("relative <jar-file> not allowed when standalone deployment unit is used");
+ return new URL(getUrl(), path);
+ }
+ catch (Exception e1)
+ {
+ throw new RuntimeException("could not find relative path: " + path, e1);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getResourceLoader()
+ */
+ @Override
+ public ClassLoader getResourceLoader()
+ {
+ return this.getClassLoader();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getResources(org.jboss.virtual.VirtualFileFilter)
+ */
+ @Override
+ public List<VirtualFile> getResources(VirtualFileFilter filter)
+ {
+ throw new UnsupportedOperationException("NYI");
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getRootFile()
+ */
+ @Override
+ public VirtualFile getRootFile()
+ {
+ org.jboss.virtual.VirtualFile virtualFile = this.vfsDeploymentUnit.getFile("");
+ return new VirtualFileWrapper(virtualFile);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getShortName()
+ */
+ @Override
+ public String getShortName()
+ {
+ return this.vfsDeploymentUnit.getFile("").getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#getUrl()
+ */
+ @Override
+ public URL getUrl()
+ {
+ try
+ {
+ return this.vfsDeploymentUnit.getFile("").toURL();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.DeploymentUnit#removeAttachment(java.lang.String)
+ */
+ @Override
+ public Object removeAttachment(String name)
+ {
+ return this.vfsDeploymentUnit.removeAttachment(name);
+ }
+
+ private URL extractDescriptorUrl(String resource)
+ {
+ try
+ {
+ org.jboss.virtual.VirtualFile vf = this.vfsDeploymentUnit.getMetaDataFile(resource);
+ if (vf == null) return null;
+ return vf.toURL();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/META-INF/singleton-container-aop.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/META-INF/singleton-container-aop.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/main/resources/META-INF/singleton-container-aop.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+ <domain name="Singleton Bean" extends="Intercepted Bean" inheritBindings="true">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <stack-ref name="EJBInterceptors"/>
+ </bind>
+ </domain>
+
+
+
+</aop>
\ No newline at end of file
Modified: projects/ejb3/components/singleton/trunk/aop-impl/src/test/java/org/jboss/ejb3/singleton/aop/impl/test/common/MockDeploymentUnit.java
===================================================================
--- projects/ejb3/components/singleton/trunk/aop-impl/src/test/java/org/jboss/ejb3/singleton/aop/impl/test/common/MockDeploymentUnit.java 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/aop-impl/src/test/java/org/jboss/ejb3/singleton/aop/impl/test/common/MockDeploymentUnit.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -30,8 +30,8 @@
import org.jboss.ejb3.DeploymentUnit;
import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
+import org.jboss.ejb3.vfs.spi.VirtualFileFilter;
/**
* MockDeploymentUnit
Added: projects/ejb3/components/singleton/trunk/deployer/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/pom.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,128 @@
+<?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-deployer</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss EJB 3.1+ Singleton Container Deployer</name>
+ <url>http://www.jboss.org</url>
+ <description>A MC based deployer for deploying a Singleton container for @Singleton beans</description>
+
+ <properties>
+ <version.org.jboss.deployers>2.0.8.GA</version.org.jboss.deployers>
+ <version.jboss.metadata.ejb>2.0.0-alpha-6</version.jboss.metadata.ejb>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Assembly Plugin -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <!-- Build singleton deployer "package" -->
+ <execution>
+ <id>build-singleton-deployer-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/package-assembler.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-aop-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-proxy-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <!-- JBoss deployers -->
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+
+ <!-- EJB metadata -->
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata-ejb</artifactId>
+ <version>${version.jboss.metadata.ejb}</version>
+ </dependency>
+
+ <!-- Get rid of this! it's required for ServiceMBeanSupport class
+ which is being extended by EJB3Deployment -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <version>5.1.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
+ </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/deployer/src/assembly/package-assembler.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/assembly/package-assembler.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/assembly/package-assembler.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly 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/xsd/assembly-1.1.1.xsd"
+>
+ <id>package</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/assembly</directory>
+ <filtered>true</filtered>
+ <includes>
+ <include>package.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/resources/META-INF</directory>
+ <includes>
+ <include>jboss-ejb3-singleton-deployer-jboss-beans.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useProjectArtifact>true</useProjectArtifact>
+ <includes>
+ <include>org.jboss.ejb3.singleton:jboss-ejb3-singleton-deployer:jar</include>
+ </includes>
+
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Added: projects/ejb3/components/singleton/trunk/deployer/src/assembly/package.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/assembly/package.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/assembly/package.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,36 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ 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.
+ -->
+<!--
+ jboss-ejb3-singleton-deployer
+-->
+<package name="${project.groupId}:${project.artifactId}" version="${project.version}" xmlns="org/jboss/packagemanager/package">
+
+ <!-- Place in common/lib of AS -->
+ <file name="jboss-ejb3-singleton-deployer.jar" dest-path="common/lib" type="library"/>
+
+ <!-- The xml file containing the deployers -->
+ <file name="jboss-ejb3-singleton-deployer-jboss-beans.xml" dest-path="server/default/deployers" type="config"/>
+ <file name="jboss-ejb3-singleton-deployer-jboss-beans.xml" dest-path="server/all/deployers" type="config"/>
+
+
+</package>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJB3DeploymentDeployer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJB3DeploymentDeployer.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJB3DeploymentDeployer.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,130 @@
+/*
+* 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.deployer;
+
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.ejb3.container.spi.deployment.EJB3Deployment;
+import org.jboss.ejb3.singleton.aop.impl.deployment.LegacyEJB3DeploymentAdapter;
+import org.jboss.ejb3.singleton.aop.impl.deployment.MCBasedEJB3DeploymentUnit;
+import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * A deployer responsible for creating a {@link EJB3Deployment} and deploying
+ * it as a MC bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJB3DeploymentDeployer extends AbstractDeployer
+{
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(EJB3DeploymentDeployer.class);
+
+ private Controller kernelController;
+
+ /**
+ * Constructs a {@link SingletonContainerDeployer} for
+ * processing singleton beans
+ */
+ public EJB3DeploymentDeployer()
+ {
+ // Set the Stage to post-CL
+ this.setStage(DeploymentStages.POST_CLASSLOADER);
+
+ this.setInput(JBossMetaData.class);
+ // ordering
+ this.addInput(AttachmentNames.PROCESSED_METADATA);
+
+ this.addOutput(Ejb3Deployment.class);
+ // also add the new SPI based EJB3Deployment as output
+ this.addOutput(EJB3Deployment.class);
+
+
+
+ }
+
+ /**
+ * Processes EJB3.x {@link JBossMetaData} and creates a {@link EJB3Deployment} corresponding to this unit
+ *
+ * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ if ((unit instanceof VFSDeploymentUnit) == false)
+ {
+ return;
+ }
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+ // get metadata
+ JBossMetaData metadata = unit.getAttachment(AttachmentNames.PROCESSED_METADATA,JBossMetaData.class);
+ // we only process EJB3.x
+ if (!metadata.isEJB3x())
+ {
+ return;
+ }
+
+ Ejb3Deployment ejb3Deployment = new LegacyEJB3DeploymentAdapter(unit,new MCBasedEJB3DeploymentUnit(vfsDeploymentUnit),null,metadata);
+ String deploymentMCBeanName = ejb3Deployment + "-" + "EJB3Deployment";
+
+ // add as a attachment
+ unit.addAttachment(Ejb3Deployment.class, ejb3Deployment);
+ unit.addAttachment(EJB3Deployment.class, (EJB3Deployment) ejb3Deployment);
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(deploymentMCBeanName, ejb3Deployment.getClass().getName());
+ builder.setConstructorValue(ejb3Deployment);
+
+ KernelControllerContext context = new AbstractKernelControllerContext(null, builder.getBeanMetaData(), null);
+
+ try
+ {
+ // install the EJB3Deployment as a MC bean
+ // don't rely on BeanMetaDataDeployer since we need EJB3Deployment to
+ // go through the MC deployment cycle immidiately before other deployers
+ // come into picture
+ kernelController.install(context);
+ }
+ catch (Throwable t)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error deploying EJB3Deployment for : " + unit.getName(), t);
+ }
+
+ }
+
+ public void setKernelController(Controller kernelController)
+ {
+ this.kernelController = kernelController;
+ }
+}
Added: projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJBContainerDeployer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJBContainerDeployer.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/EJBContainerDeployer.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,145 @@
+/*
+* 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.deployer;
+
+import java.util.Collection;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.MCDependencyPolicy;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.deployment.EJB3Deployment;
+import org.jboss.logging.Logger;
+
+/**
+ * EJBContainerDeployer
+ *
+ * TODO: Remove this - not used currently
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJBContainerDeployer extends AbstractSimpleRealDeployer<EJB3Deployment>
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(EJBContainerDeployer.class);
+
+ /**
+ * @param input
+ */
+ public EJBContainerDeployer()
+ {
+ super(EJB3Deployment.class);
+
+
+ addOutput(BeanMetaData.class);
+ }
+
+ /**
+ * @see org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit, java.lang.Object)
+ */
+ @Override
+ public void deploy(DeploymentUnit unit, EJB3Deployment ejb3Deployment) throws DeploymentException
+ {
+ Collection<EJBContainer> ejbContainers = ejb3Deployment.getEJBContainers();
+ for (EJBContainer ejbContainer : ejbContainers)
+ {
+ // create dependencies for the container
+ if (ejbContainer instanceof org.jboss.ejb3.EJBContainer)
+ {
+ org.jboss.ejb3.EJBContainer legacyContainer = (org.jboss.ejb3.EJBContainer) ejbContainer;
+ legacyContainer.instantiated();
+ legacyContainer.processMetadata();
+
+ DependencyPolicy dependencyPolicy = legacyContainer.getDependencyPolicy();
+ if (dependencyPolicy instanceof MCDependencyPolicy)
+ {
+ // deploy the container as MC bean (by attaching to DU)
+ this.createContainerWithDependencies(unit, ejbContainer, (MCDependencyPolicy) dependencyPolicy);
+ }
+
+ }
+
+ }
+
+ }
+
+ private void createContainerWithDependencies(DeploymentUnit unit, EJBContainer container,
+ MCDependencyPolicy mcDependencyPolicy) throws DeploymentException
+ {
+ String containerMCBeanName = container.getMetaData().getContainerName();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(containerMCBeanName, container.getClass()
+ .getName());
+ builder.setConstructorValue(container);
+
+ logger.info("installing bean: " + containerMCBeanName);
+ logger.info(" with dependencies:");
+ if (mcDependencyPolicy.getDependencies() != null)
+ {
+ for (DependencyMetaData dependency : mcDependencyPolicy.getDependencies())
+ {
+ builder.addDependency(dependency.getDependency());
+ logger.info("\t" + dependency.getDependency());
+ }
+ }
+ logger.info(" and demands:");
+ if (mcDependencyPolicy.getDemands() != null)
+ {
+ for (DemandMetaData demand : mcDependencyPolicy.getDemands())
+ {
+ builder.addDemand(demand.getDemand());
+ logger.info("\t" + demand.getDemand());
+ }
+ }
+
+ logger.info(" and supplies:");
+ if (mcDependencyPolicy.getSupplies() != null)
+ {
+ for (SupplyMetaData supply : mcDependencyPolicy.getSupplies())
+ {
+ builder.addSupply(supply.getSupply());
+ logger.info("\t" + supply.getSupply());
+ }
+ }
+
+ // Add the singleton container MC bean as an attachment
+ // TODO: This does not work for component only deployers. For some reason, the BeanMetadata attachment
+ // has to be attached to the "parent"
+ //unit.addAttachment(BeanMetaData.class + ":" + singletonContainerMCBeanName, builder.getBeanMetaData());
+ // if (unit.getParent() == null)
+ // {
+ // throw new DeploymentException("DeploymentUnit " + unit + " does not have a parent");
+ // }
+ unit.addAttachment(BeanMetaData.class + ":" + containerMCBeanName, builder.getBeanMetaData());
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/SingletonContainerDeployer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/SingletonContainerDeployer.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/main/java/org/jboss/ejb3/singleton/deployer/SingletonContainerDeployer.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,381 @@
+/*
+* 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.deployer;
+
+import java.util.Hashtable;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.DomainDefinition;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.MCDependencyPolicy;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.deployment.EJB3Deployment;
+import org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer;
+import org.jboss.ejb3.singleton.proxy.impl.SingletonBeanRemoteJNDIBinder;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * A MC based deployer for deploying a {@link EJBContainer} as a MC bean
+ * for each singleton bean.
+ * <p>
+ * Expects {@link JBossEnterpriseBeanMetaData} as an input and processes the metadata
+ * for any potential singleton beans. If any singleton bean is found, then this deployer
+ * creates a {@link BeanMetaData} for a {@link EJBContainer} corresponding to the singleton
+ * bean. The {@link BeanMetaData} is then attached to the {@link DeploymentUnit} so that MC
+ * can deploy it as MC bean.
+ * </p>
+ * <p>
+ * Before deploying the container as a MC bean, this deployer sets up appropriate dependencies for
+ * the container.
+ * </p>
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonContainerDeployer extends AbstractDeployer
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(SingletonContainerDeployer.class);
+
+ /**
+ * Constructs a {@link SingletonContainerDeployer} for
+ * processing singleton beans
+ */
+ public SingletonContainerDeployer()
+ {
+ setInput(JBossMetaData.class);
+ setStage(DeploymentStages.REAL);
+
+ // we output the container as a MC bean
+ addOutput(BeanMetaData.class);
+
+ // ordering
+ addInput(Ejb3Deployment.class);
+ addInput(AttachmentNames.PROCESSED_METADATA);
+ }
+
+ /**
+ * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ JBossMetaData metadata = unit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class);
+ if (metadata == null || metadata.getEnterpriseBeans() == null)
+ {
+ return;
+ }
+ JBossEnterpriseBeansMetaData enterpriseBeans = metadata.getEnterpriseBeans();
+ for (JBossEnterpriseBeanMetaData enterpriseBean : enterpriseBeans)
+ {
+ this.deploy(unit, enterpriseBean);
+ }
+
+ }
+
+ /**
+ * Processes a {@link DeploymentUnit} with {@link JBossEnterpriseBeanMetaData} to
+ * check if it's a singleton bean.
+ * <p>
+ * If it's a singleton bean then this method creates a {@link EJBContainer}, for that singleton bean and
+ * deploys it as a MC bean
+ * </p>
+ *
+ */
+ private void deploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData beanMetaData) throws DeploymentException
+ {
+ // we are only interested in EJB3.1
+ if (!beanMetaData.getJBossMetaData().isEJB31())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Ignoring non-EJB3.1 bean " + beanMetaData.getName());
+ }
+ return;
+ }
+ // we are not interested in non-session beans
+ if (!beanMetaData.isSession())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Ignoring non-session bean " + beanMetaData.getName());
+ }
+ return;
+ }
+ // one last check to make sure we have got the right type!
+ if (!(beanMetaData instanceof JBossSessionBean31MetaData))
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Ignoring bean " + beanMetaData.getName() + " because its metadata is not of type "
+ + JBossSessionBean31MetaData.class);
+ }
+ return;
+ }
+
+ // now start with actual processing
+ JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) beanMetaData;
+ // we are only concerned with Singleton beans
+ if (!sessionBean.isSingleton())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Ignoring non-singleton bean " + sessionBean.getName());
+ }
+ return;
+ }
+
+ // Create a singleton container
+ ClassLoader classLoader = unit.getClassLoader();
+ String domainName = AOPBasedSingletonContainer.getAOPDomainName();
+ DomainDefinition singletonContainerAOPDomain = AspectManager.instance().getContainer(domainName);
+ if (singletonContainerAOPDomain == null)
+ {
+ throw new DeploymentException(domainName + " AOP domain not configured - cannot deploy EJB named "
+ + beanMetaData.getEjbName() + " in unit " + unit);
+ }
+ Hashtable<String, String> ctxProperties = new Hashtable<String, String>();
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ {
+ throw new DeploymentException("Could not find " + Ejb3Deployment.class
+ + " for creating singleton container for bean " + sessionBean.getEjbName() + " in unit " + unit);
+ }
+ AOPBasedSingletonContainer singletonContainer = null;
+ try
+ {
+ singletonContainer = new AOPBasedSingletonContainer(classLoader, sessionBean.getEjbClass(), sessionBean
+ .getEjbName(), (Domain) singletonContainerAOPDomain.getManager(), ctxProperties, ejb3Deployment,
+ sessionBean);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new DeploymentException("Could not find class during deployment of bean named "
+ + sessionBean.getEjbName() + " in unit " + unit, cnfe);
+ }
+
+ // Register the newly created container with the new SPI based Ejb3Deployment
+ if (ejb3Deployment instanceof EJB3Deployment)
+ {
+ ((EJB3Deployment) ejb3Deployment).addContainer(singletonContainer);
+ }
+
+ String singletonContainerMCBeanName;
+ try
+ {
+ // get the name for the MC bean
+ singletonContainerMCBeanName = this.getContainerName(unit, sessionBean);
+
+ //TODO: One more ugly hack (to allow backward compatibility)
+ // Webservices expects the metadata to provide container name
+ sessionBean.setContainerName(singletonContainerMCBeanName);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new DeploymentException("Could not obtain a container name for bean " + sessionBean.getName()
+ + " in unit " + unit);
+ }
+
+ // Here we let the injection handlers to setup appropriate dependencies
+ // on the container and also create injectors for the container
+ singletonContainer.instantiated();
+ singletonContainer.processMetadata();
+
+ DependencyPolicy dependencyPolicy = singletonContainer.getDependencyPolicy();
+ if (dependencyPolicy instanceof MCDependencyPolicy)
+ {
+ // deploy the container as MC bean (by attaching to DU)
+ BeanMetaData containerBMD = this.createContainerWithDependencies(unit, singletonContainerMCBeanName,
+ singletonContainer, (MCDependencyPolicy) dependencyPolicy);
+ unit.addAttachment(BeanMetaData.class + ":" + containerBMD.getName(), containerBMD);
+ }
+
+ // TODO: This shouldn't be here
+ SingletonBeanRemoteJNDIBinder jndiBinder = new SingletonBeanRemoteJNDIBinder(singletonContainer);
+ try
+ {
+ jndiBinder.bind(new InitialContext());
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException(e);
+ }
+
+ }
+
+ /**
+ * @see org.jboss.deployers.spi.deployer.helpers.AbstractDeployer#undeploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ @Override
+ public void undeploy(DeploymentUnit unit)
+ {
+
+ super.undeploy(unit);
+ // TODO: need to do proper implementation here - to unregister the container from the EJB3Deployment
+ // and other stuff
+ }
+
+ /**
+ * Ultimately, the container name should come from the <code>sessionBeanMetadata</code>.
+ * However because of the current behaviour where the container on its start sets the containername
+ * in the metadata, its not possible to get this information even before the container is started.
+ *
+ * Hence let's for the time being create the container name from all the information that we have
+ * in the <code>unit</code>
+ *
+ * @param unit The deployment unit
+ * @param sessionBeanMetadata Session bean metadata
+ * @return Returns the container name for the bean corresponding to the <code>sessionBeanMetadata</code> in the <code>unit</code>
+ *
+ * @throws MalformedObjectNameException
+ */
+ private String getContainerName(DeploymentUnit unit, JBossSessionBeanMetaData sessionBeanMetadata)
+ throws MalformedObjectNameException
+ {
+ // TODO the base ejb3 jmx object name comes from Ejb3Module.BASE_EJB3_JMX_NAME, but
+ // we don't need any reference to ejb3-core. Right now just hard code here, we need
+ // a better way/place for this later
+ StringBuilder containerName = new StringBuilder("jboss.j2ee:service=EJB3" + ",");
+
+ // Get the top level unit for this unit (ex: the top level might be an ear and this unit might be the jar
+ // in that ear
+ DeploymentUnit toplevelUnit = unit.getTopLevel();
+ if (toplevelUnit != null)
+ {
+ // if top level is an ear, then create the name with the ear reference
+ if (isEar(toplevelUnit))
+ {
+ containerName.append("ear=");
+ containerName.append(toplevelUnit.getSimpleName());
+ containerName.append(",");
+
+ }
+ }
+ // now work on the passed unit, to get the jar name
+ if (unit.getSimpleName() == null)
+ {
+ containerName.append("*");
+ }
+ else
+ {
+ containerName.append("jar=");
+ containerName.append(unit.getSimpleName());
+ }
+ // now the ejbname
+ containerName.append(",name=");
+ containerName.append(sessionBeanMetadata.getEjbName());
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Container name generated for ejb = " + sessionBeanMetadata.getEjbName() + " in unit " + unit
+ + " is " + containerName);
+ }
+ ObjectName containerJMXName = new ObjectName(containerName.toString());
+ return containerJMXName.getCanonicalName();
+ }
+
+ /**
+ * Returns true if this <code>unit</code> represents an .ear deployment
+ *
+ * @param unit
+ * @return
+ */
+ private boolean isEar(DeploymentUnit unit)
+ {
+ return unit.getSimpleName().endsWith(".ear") || unit.getAttachment(JBossAppMetaData.class) != null;
+ }
+
+ /**
+ * Creates a {@link BeanMetaData} for the passed <code>container</code> and sets appropriate dependencies,
+ * specified through <code>mcDependencyPolicy</code> on the {@link BeanMetaData}
+ *
+ * @param unit Deployment unit
+ * @param mcBeanName The name to be assigned to the MC bean for the <code>container</code>
+ * @param container The container for which the {@link BeanMetaData} has to be created
+ * @param mcDependencyPolicy The dependencies that are to be assigned on the {@link BeanMetaData} of the <code>container</code>
+ * @return Returns the {@link BeanMetaData} for the <code>container</code> with appropriate dependencies set
+ */
+ private BeanMetaData createContainerWithDependencies(DeploymentUnit unit, String mcBeanName, EJBContainer container,
+ MCDependencyPolicy mcDependencyPolicy)
+ {
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(mcBeanName, container.getClass().getName());
+ builder.setConstructorValue(container);
+
+ logger.info("creating bean: " + mcBeanName);
+ logger.info(" with dependencies:");
+ if (mcDependencyPolicy.getDependencies() != null)
+ {
+ for (DependencyMetaData dependency : mcDependencyPolicy.getDependencies())
+ {
+ builder.addDependency(dependency.getDependency());
+ logger.info("\t" + dependency.getDependency());
+ }
+ }
+ logger.info(" and demands:");
+ if (mcDependencyPolicy.getDemands() != null)
+ {
+ for (DemandMetaData demand : mcDependencyPolicy.getDemands())
+ {
+ builder.addDemand(demand.getDemand());
+ logger.info("\t" + demand.getDemand());
+ }
+ }
+
+ logger.info(" and supplies:");
+ if (mcDependencyPolicy.getSupplies() != null)
+ {
+ for (SupplyMetaData supply : mcDependencyPolicy.getSupplies())
+ {
+ builder.addSupply(supply.getSupply());
+ logger.info("\t" + supply.getSupply());
+ }
+ }
+
+ return builder.getBeanMetaData();
+ }
+}
Added: projects/ejb3/components/singleton/trunk/deployer/src/main/resources/META-INF/jboss-ejb3-singleton-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/deployer/src/main/resources/META-INF/jboss-ejb3-singleton-deployer-jboss-beans.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/deployer/src/main/resources/META-INF/jboss-ejb3-singleton-deployer-jboss-beans.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+
+ <!-- EJB3.1 Singleton bean container deployer -->
+ <bean name="SingletonContainerDeployer" class="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer"/>
+
+ <!-- deploys a EJB3Deployment (TODO: needs to move out to a different component, since this isn't specific to singleton) -->
+ <bean name="EJB3DeploymentDeployer" class="org.jboss.ejb3.singleton.deployer.EJB3DeploymentDeployer">
+ <property name="kernelController"><inject bean="jboss.kernel:service=KernelController"/></property>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/container.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/container.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/container.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,76 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<!--suppress XmlWrongRootElement -->
+<chapter id="container">
+ <title>Container</title>
+ <para>
+ Before we look into the implementation of the container, let's just see what modules are present in the singleton component.
+ The singleton component consists of:
+ <itemizedlist>
+ <listitem>spi : Module exposing any singleton specific SPI</listitem>
+ <listitem>impl : This module provides a singleton implementation purely based on the new container SPI</listitem>
+ <listitem>aop-impl : This module provides integration between the AOP based existing container/interceptors, which are
+ present in jboss-ejb3-core, with the new singleton container implementation available in the "impl" module</listitem>
+ <listitem>proxy : Module responsible for generating proxies for singleton beans</listitem>
+ <listitem>deployer : Module containing MC based deployers for carrying out various deployment time activities</listitem>
+ <listitem>testsuite : Module responsible for running the singleton bean integration tests against the AS</listitem>
+ </itemizedlist>
+ </para>
+ <sect1>
+ <title>impl module</title>
+ <para>
+ In this section we will look into the implementation available in the "impl" module of the singleton component.
+ </para>
+ <para>
+ This module provides a simple <link linkend="TODO-link">SingletonContainer</link> which is an implementation of the
+ new container SPI. This container uses a <link linkend="TODO-link">SingletonEJBInstanceManagerImpl</link> for managing
+ the bean instances. The SingletonContainer itself acts an <link linkend="TODO-link">EJBLifecycleHandler</link>
+ </para>
+ </sect1>
+ <sect1>
+ <title>aop-impl module</title>
+ <para>
+ In it's current form, this acts as an integration between the "impl" module and the old containers and interceptors which
+ are based on AOP and reside in the jboss-ejb3-core module. The <link linkend="TODO-link">AOPBasedSingletonContainer</link>
+ *is a* org.jboss.ejb3.EJBContainer (the old jboss-ejb3-core) *as well as* a org.jboss.ejb3.container.spi.EJBContainer (new SPI based):
+ <programlisting>
+ <![CDATA[
+public class AOPBasedSingletonContainer extends SessionSpecContainer implements InjectionContainer, EJBContainer
+{
+
+ /**
+ * This is the container to which the {@link AOPBasedSingletonContainer} will
+ * delegate the calls to
+ */
+ private SingletonContainer simpleSingletonContainer;]]>
+ </programlisting>
+ The only reason why the AOPBasedSingletonContainer *is a* org.jboss.ejb3.EJBContainer (old jboss-ejb3-core) is because
+ the existing AOP based interceptor framework expects the container to be of type org.jboss.ejb3.EJBContainer. Once we
+ have moved away from AOP based interceptors to completely use the new container spi, we can get rid of relying on the old
+ containers.
+ </para>
+ <para>
+ The AOPBasedSingletonContainer is responsible for the following:
+ <itemizedlist>
+ <listitem>
+ <para>Create a instance of the new SPI based <link linkend="TODO-link">SingletonContainer</link></para>
+ </listitem>
+ <listitem>
+ <para>The SingletonContainer thus created will be passed an <link linkend="TODO-link">AOPBasedInterceptorRegistry</link>
+ The AOPBasedInterceptorRegistry uses a AOP backed interceptor stack for intercepting the calls to the bean instance.</para>
+ </listitem>
+ <listitem>
+ <para>Delegate all runtime calls to the new SPI based SingletonContainer (ex: invocation on the bean instance, bean instance
+ creation etc...)
+ </para>
+ </listitem>
+ <listitem>
+ <para>Act as an entry point to any remoting/AOP based calls into the container (the dynamicInvoke method).
+ <note><para>This may no longer be true because of the way the invocation handler on the proxy and the RemotingContiner
+ is implemented (i.e. AOP is no longer used for a remote invocation on the container).</para></note>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect1>
+</chapter>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/deployer.xml
===================================================================
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/ejb3deployment.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/ejb3deployment.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/ejb3deployment.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<chapter id="ejb3deployment">
+ <title>EJB3Deployment</title>
+ <para>
+ <ulink url="TODO-link">EJB3Deployment</ulink> is a collection of <code>EJBContainer</code>s. Dependency resolution between
+ <code>EJBContainer</code> and other components (like a PersistenceUnit) should happen at the <code>EJB3Deployment</code> level.
+ As such methods like org.jboss.ejb3.EJBContainer.processMetaData() (in the jboss-ejb3-core containers) which setup a dependency policy
+ will no longer be applicable for new containers.
+ </para>
+ <para>
+ Currently the old containers through the processMetadata method setup a DependencyPolicy. Internally the processMetadata processes
+ the metadata through a set of <code>InjectionHandler</code>s which setup appropriate dependencies and injectors for the container.
+ For the new containers, this will be (slowly) moved out of the containers and instead be done in a deployer which installs the container
+ as a MC bean. The deployer will be responsible for setting up (with the help of appropriate handlers and EJB3Deployment) dependencies
+ for the container. *After* setting up the dependencies on the container, the deployer will deploy the container as a MC bean. See
+ <ulink url="TODO-link">SingletonContainerDeployer</ulink> on how this is done.
+ </para>
+</chapter>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/interceptor.xml
===================================================================
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/intro.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/intro.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/intro.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<chapter id="Introduction">
+ <title>Introduction</title>
+ <para> The singleton container implementation follows the new SPI for EJB3
+ containers. The SPI is currently work-in-progress and is
+ located <ulink
+ url="http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/components/container/trunk/"
+ >here</ulink>. The goal of the singleton container
+ implementation is to: <itemizedlist>
+ <listitem>Implement the singleton container
+ following the new SPI</listitem>
+ <listitem>Use the existing AOP based interceptors
+ and other container infrastructure that exists in
+ the jboss-ejb3-core module </listitem>
+ </itemizedlist>
+ </para>
+</chapter>
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/jbremoting.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/jbremoting.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/jbremoting.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,68 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<!--suppress XmlWrongRootElement -->
+<chapter id="remotingcontainer">
+
+ <title>Proxy/InvocationHandler interaction with the RemotingContainer</title>
+ <sect1>
+ <title>Overview</title>
+ <para>The proxies created for a singleton session bean interact with client side invocation handlers.
+ The responsibility of these client side invocation handlers is to (somehow) pass on the control to the container which might reside on a remote server.
+ The invocation handler uses the new SPI <link linkend="TODO-link">RemotingContainer</link> and just invokes the invoke() method on the RemotingContainer.
+ Implementations of the RemotingContainer will have the necessary knowledge to (somehow) pass on the control to the container on the remote server. In this
+ chapter, we will look at one such implementation of RemotingContainer.
+ </para>
+ </sect1>
+ <sect1 id="jbremotingcontainer">
+ <title>JBoss Remoting 2.x based implementation of RemotingContainer</title>
+ <para>
+ A JBoss Remoting 2.x based implementation of the RemotingContainer is available <link linkend="TODO-link">here</link>. Internally it uses
+ the default InvokerLocator URL (or the one overridden in metadata) to connect to the JBRemoting server. The important thing to notice here
+ is that it expects a "SIMPLE" subsystem to be available on this Remoting connector (unlike the older client side interceptors which expect
+ an "AOP" subsystem). The <code>JBossRemotingContainer</code> creates a <code>InvocationRequest</code> which contains the container id as well
+ as a <link linkend="TODO-link">RemotableContainerInvocation</link>.
+ <note><para>Client side interceptors need to be invoked in the JBossRemotingContainer before passing on the control to the
+ JBRemoting server side invocation handler. This is currently a TODO</para></note>
+ </para>
+ <para>
+ The "SIMPLE" subsystem is backed by a <link linkend="TODO-link">RemotingInvocationHandler</link> which is a server side
+ JBRemoting invocation handler (and hence implements <code>org.jboss.remoting.ServerInvocationHandler</code>). The goal of this RemotingInvocationHandler
+ is to remote any AOP aspects from the client to remote container interaction. Internally, when a call reaches the <code>RemotingInvocationHandler</code>,
+ it obtains a container id (TODO: we need to discuss this) from the <code>InvocationRequest</code>.
+ The container id is populated in the <code>InvocationRequest</code> by the client side <code>JBossRemotingContainer</code>.
+ An container registry exists on the server side with all registered container ids. The <code>RemotingInvocationHandler</code> then looks up this
+ registry to get hold of the (new SPI based) <code>EJBContainer</code> and invokes <code>EJBContainer.invoke(ContainerInvocation)</code> method.
+ <note>
+ <para>With this new "SIMPLE" subsystem, the dynamicInvoke method (of the old jboss-ejb3-core container) is not used. And all AOP semantics
+ are skipped</para>
+ </note>
+ Here's the server configuration (notice the "SIMPLE" subsystem) from the ejb3-connectors-jboss-beans.xml:
+ <programlisting>
+<![CDATA[
+<!-- Remoting Server Configuration -->
+ <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>
+ <entry>
+ <key>SIMPLE</key>
+ <value>
+ org.jboss.ejb3.singleton.impl.remoting.RemotingInvocationHandler
+ </value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ ]]>
+
+ </programlisting>
+ </para>
+ </sect1>
+</chapter>
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/master.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/master.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/master.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding="iso-8859-1"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+
+<book lang="en">
+ <title>JBoss EJB3.x Singleton</title>
+ <bookinfo>
+ <title>JBoss EJB 3.x Singleton Reference Documentation</title>
+ <subtitle>JBoss EJB 3.x Singleton Reference Documentation</subtitle>
+ <releaseinfo>1.0.0</releaseinfo>
+ <!--<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Author_Group.xml"/> -->
+ </bookinfo>
+
+ <toc/>
+
+ <preface id="preface" revision="1">
+ <title>Preface</title>
+
+ <para>
+ This is a reference documentation for the JBoss EJB3.x Singleton container implementation
+ </para>
+
+
+ </preface>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="intro.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="proxy.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="jbremoting.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="container.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ejb3deployment.xml"/>
+</book>
Added: projects/ejb3/components/singleton/trunk/docs/reference/en/proxy.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/en/proxy.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/en/proxy.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,32 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<chapter id="proxy">
+ <title>Proxy for singleton beans</title>
+ <para>
+ The proxies for singleton beans are generated using the proxy-factory SPI. These proxies are then bound to the JNDI through the
+ <xref linkend="jndi-binder">jndi binders</xref>.
+ </para>
+ <sect1>
+ <title>Invocation Handlers</title>
+ <para>
+ These proxies use invocation handlers which interact with a <link linkend="TODO-link">RemotingContainer</link>. The implementations
+ of RemotingContainer are responsible for invoking the real remote container (EJBContainer.invoke(ContainerInvocation)). An example
+ implementation of the RemotingContainer is the <link linkend="TODO-link">JBossRemotingContainer</link> which uses JBoss Remoting2 to
+ invoke on the remote container. Before doing so, it may even run the invocation past some client side interceptors.
+ </para>
+ <note>
+ <para>
+ One of the reasons why the RemotingContainer is named so, instead of naming it a RemotingInvocationHandler is because, it is also
+ responsible for doing tasks like running the invocation past a client side interceptor stack (if any).
+ </para>
+ </note>
+ <note>
+ <para>
+ More on the JBossRemotingContainer implementation can be found here <xref linkend="jbremotingcontainer"/>
+ </para>
+ </note>
+
+ </sect1>
+</chapter>
+
+
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/docs/reference/jboss-ejb3-singleton-reference-doc-en-US.iml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/jboss-ejb3-singleton-reference-doc-en-US.iml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/jboss-ejb3-singleton-reference-doc-en-US.iml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
Added: projects/ejb3/components/singleton/trunk/docs/reference/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/docs/reference/pom.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/docs/reference/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,21 @@
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>documentation</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-reference-doc-${translation}</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>JBoss EJB3.x Singleton Reference Documentation</name>
+
+
+
+</project>
Property changes on: projects/ejb3/components/singleton/trunk/docs/reference/pom.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: projects/ejb3/components/singleton/trunk/impl/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/pom.xml 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/impl/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -28,6 +28,32 @@
<version.ejb3.singleton.container.spi>${project.version}</version.ejb3.singleton.container.spi>
</properties>
+ <build>
+ <plugins>
+ <!-- Assembly Plugin -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <!-- Build singleton impl "package" -->
+ <execution>
+ <id>build-singleton-impl-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/package-assembler.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
<dependencies>
<dependency>
@@ -36,6 +62,18 @@
<version>${version.ejb3.singleton.container.spi}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>2.5.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-common</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
<!-- ***************************** -->
<!-- Test dependencies -->
<!-- ***************************** -->
Added: projects/ejb3/components/singleton/trunk/impl/src/assembly/package-assembler.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/assembly/package-assembler.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/assembly/package-assembler.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly 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/xsd/assembly-1.1.1.xsd"
+>
+ <id>package</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/assembly</directory>
+ <filtered>true</filtered>
+ <includes>
+ <include>package.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/resources/META-INF</directory>
+ <includes>
+ <include>ejb3-connectors-jboss-beans.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useProjectArtifact>true</useProjectArtifact>
+ <includes>
+ <include>org.jboss.ejb3.singleton:jboss-ejb3-singleton-spi:jar</include>
+ <include>org.jboss.ejb3.singleton:jboss-ejb3-singleton-impl:jar</include>
+ <include>org.jboss.ejb3.container:jboss-ejb3-container-spi:jar</include>
+ </includes>
+
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Added: projects/ejb3/components/singleton/trunk/impl/src/assembly/package.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/assembly/package.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/assembly/package.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ 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.
+ -->
+<!--
+ jboss-ejb3-singleton-impl
+-->
+<package name="${project.groupId}:${project.artifactId}" version="${project.version}" xmlns="org/jboss/packagemanager/package">
+
+ <!-- Place in common/lib of AS -->
+ <file name="jboss-ejb3-singleton-impl.jar" dest-path="common/lib" type="library"/>
+ <file name="jboss-ejb3-singleton-spi.jar" dest-path="common/lib" type="library"/>
+ <file name="jboss-ejb3-container-spi.jar" dest-path="common/lib" type="library"/>
+
+ <!-- The xml file containing the deployers -->
+ <file name="ejb3-connectors-jboss-beans.xml" dest-path="server/default/deploy" type="config"/>
+ <file name="ejb3-connectors-jboss-beans.xml" dest-path="server/all/deploy" type="config"/>
+
+
+</package>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/JBossRemotingContainer.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/JBossRemotingContainer.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/JBossRemotingContainer.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,131 @@
+/*
+* 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.remoting;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.ejb3.container.spi.ContainerInvocation;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.remote.RemotingContainer;
+import org.jboss.ejb3.singleton.spi.ContainerRegistry;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * Implementation of {@link RemotingContainer} which is responsible for
+ * handling container invocations on the client side and passing on the
+ * control to the remote container.
+ *
+ * <p>
+ * {@link JBossRemotingContainer} uses JBoss Remoting 2.x to interact with the
+ * remote container. It expects a "SIMPLE" subsystem to be present on the
+ * JBoss Remoting connector through which it will interact with the remote container
+ * </p>
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class JBossRemotingContainer implements RemotingContainer, Serializable
+{
+
+ /**
+ * JBoss Remoting InvokerLocator URL
+ */
+ private String remotingURL;
+
+ /**
+ * The key of the remote {@link EJBContainer} with which this {@link RemotingContainer} will be interacting.
+ * The {@link EJBContainer} is expected to be registered with this key, in the {@link ContainerRegistry}
+ * on the remote server side.
+ */
+ private String containerRegistryKey;
+
+ /**
+ * Creates a {@link JBossRemotingContainer} for a {@link EJBContainer} represented by the
+ * <code>remoteContainerKey</code>
+ *
+ * @param remoteContainerKey Key of the remote {@link EJBContainer} with which the container is registered
+ * in {@link ContainerRegistry}
+ * @param remotingURL The InvokerLocator url of the JBoss Remoting connector configuration
+ */
+ public JBossRemotingContainer(String remoteContainerKey, String remotingURL)
+ {
+ this.remotingURL = remotingURL;
+ this.containerRegistryKey = remoteContainerKey;
+ }
+
+ /**
+ * Creates a {@link ContainerInvocation} for the passed parameters and then
+ * invokes the {@link EJBContainer#invoke(ContainerInvocation)}.
+ * <p>
+ * The {@link EJBContainer} is identified by the <code>remoteContainerKey</code> which was passed
+ * to the constructor of this {@link JBossRemotingContainer}
+ * </p>
+ * @see org.jboss.ejb3.container.spi.remote.RemotingContainer#invoke(java.io.Serializable, java.lang.reflect.Method, java.lang.Object[], java.lang.Class)
+ */
+ @Override
+ public Object invoke(Serializable sessionId, Method method, Object[] args, Class<?> businessIntf)
+ {
+ InvokerLocator locator = null;
+ try
+ {
+ locator = new InvokerLocator(this.remotingURL);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException("Could not create " + InvokerLocator.class.getSimpleName() + " to url \""
+ + this.remotingURL + "\"", e);
+ }
+ Client client = null;
+ try
+ {
+ // we connect to "SIMPLE" subsystem
+ client = new Client(locator, "SIMPLE");
+ // create a container invocation
+ String businessIntfClassName = businessIntf == null ? null : businessIntf.getName();
+ ContainerInvocation containerInvocation = new RemotableContainerInvocation(sessionId, method, args, businessIntfClassName);
+ Map payload = new HashMap();
+ payload.put("ContainerInvocation", containerInvocation);
+
+ client.connect();
+ Object response = client.invoke(this.containerRegistryKey, payload);
+ return response;
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ finally
+ {
+ if (client != null)
+ {
+ client.disconnect();
+ }
+ }
+
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotableContainerInvocation.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotableContainerInvocation.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotableContainerInvocation.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,143 @@
+/*
+* 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.remoting;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.container.spi.ContainerInvocation;
+import org.jboss.ejb3.container.spi.EJBContainer;
+
+/**
+ * A serializable implementation of {@link ContainerInvocation}
+ * <p>
+ * {@link RemotableContainerInvocation} can be used for passing the
+ * container invocation from a remote client to the server side {@link EJBContainer}.
+ * </p>
+ *
+ * TODO: Might have to be in some common location instead of singleton component
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class RemotableContainerInvocation implements ContainerInvocation, Serializable
+{
+
+ /**
+ * Session id
+ */
+ private Serializable sessionId;
+
+ /**
+ * Arguments to be passed to the method
+ */
+ private Object[] args;
+
+ /**
+ * Fully qualified class name of business interface
+ */
+ private String businessInterfaceClassName;
+
+ /**
+ * The method being invoked
+ */
+ private SerializableMethod serializableMethod;
+
+ /**
+ * The business interface on which the method is being invoked
+ */
+ private transient Class<?> businessInterface;
+
+ /**
+ * Creates a {@link RemotableContainerInvocation} for the passed arguments.
+ *
+ * @param sessionId Session id (can be null)
+ * @param method The method being invoked.
+ * @param args The arguments to be passed to the method being invoked
+ * @param businessInterface The fully qualified classname of the business interface on which
+ * the method is being invoked
+ */
+ public RemotableContainerInvocation(Serializable sessionId, Method method, Object[] args,
+ String businessIntfClassName)
+ {
+ this.sessionId = sessionId;
+ this.serializableMethod = new SerializableMethod(method);
+ this.args = args;
+ this.businessInterfaceClassName = businessIntfClassName;
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.ContainerInvocation#getArgs()
+ */
+ @Override
+ public Object[] getArgs()
+ {
+ return this.args;
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.ContainerInvocation#getInvokedBusinessInterface()
+ */
+ @Override
+ public Class<?> getInvokedBusinessInterface()
+ {
+ if (this.businessInterfaceClassName == null)
+ {
+ return null;
+ }
+
+ if (this.businessInterface == null)
+ {
+ try
+ {
+ this.businessInterface = Thread.currentThread().getContextClassLoader().loadClass(
+ this.businessInterfaceClassName);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new RuntimeException("Could not load business interface class " + this.businessInterfaceClassName,
+ cnfe);
+ }
+ }
+ return this.businessInterface;
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.ContainerInvocation#getMethod()
+ */
+ @Override
+ public Method getMethod()
+ {
+ return this.serializableMethod.toMethod();
+ }
+
+ /**
+ * @see org.jboss.ejb3.container.spi.ContainerInvocation#getSessionId()
+ */
+ @Override
+ public Serializable getSessionId()
+ {
+ return this.sessionId;
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotingInvocationHandler.java
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotingInvocationHandler.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/java/org/jboss/ejb3/singleton/impl/remoting/RemotingInvocationHandler.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,121 @@
+/*
+* 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.remoting;
+
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import org.jboss.ejb3.container.spi.ContainerInvocation;
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.singleton.spi.ContainerRegistry;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+/**
+ * Implementation of {@link ServerInvocationHandler} which is responsible
+ * for handling invocations on the EJB3 remoting connector for the "SIMPLE"
+ * subsystem.
+ *
+ * <p>
+ * This {@link RemotingInvocationHandler} passes on the invocation to the
+ * {@link EJBContainer}
+ * </p>
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class RemotingInvocationHandler implements ServerInvocationHandler
+{
+
+ /**
+ * @see org.jboss.remoting.ServerInvocationHandler#addListener(org.jboss.remoting.callback.InvokerCallbackHandler)
+ */
+ @Override
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ // we don't have anything specific to do
+
+ }
+
+ /**
+ * Processes the incoming {@link InvocationRequest} and passes on the control to
+ * {@link EJBContainer#invoke(ContainerInvocation)} method.
+ * <p>
+ * This method expects the <code>invocation</code> to contain the container registry key
+ * as the param of the invocation request (obtained through {@link InvocationRequest#getParameter()}.
+ * It also expects the <code>invocation</code> to contain the {@link ContainerInvocation} as the
+ * payload with the key "ContainerInvocation".
+ * </p>
+ *
+ * @see org.jboss.remoting.ServerInvocationHandler#invoke(org.jboss.remoting.InvocationRequest)
+ */
+ @Override
+ public Object invoke(InvocationRequest invocation) throws Throwable
+ {
+ Object param = invocation.getParameter();
+
+ if (!(param instanceof String))
+ {
+ throw new IllegalArgumentException("Unexpected invocation param " + param + " from invocation " + invocation);
+ }
+ String containerRegistryKey = (String) param;
+ EJBContainer container = ContainerRegistry.INSTANCE.getContainer(containerRegistryKey);
+ Map payload = invocation.getRequestPayload();
+ // TODO: Don't hard code the "ContainerInvocation" payload key
+ ContainerInvocation containerInvocation = (ContainerInvocation) payload.get("ContainerInvocation");
+ return container.invoke(containerInvocation);
+ }
+
+ /**
+ * @see org.jboss.remoting.ServerInvocationHandler#removeListener(org.jboss.remoting.callback.InvokerCallbackHandler)
+ */
+ @Override
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ // we don't have anything specific to do
+
+ }
+
+ /**
+ * @see org.jboss.remoting.ServerInvocationHandler#setInvoker(org.jboss.remoting.ServerInvoker)
+ */
+ @Override
+ public void setInvoker(ServerInvoker invoker)
+ {
+ // we don't have anything specific to do
+
+ }
+
+ /**
+ * @see org.jboss.remoting.ServerInvocationHandler#setMBeanServer(javax.management.MBeanServer)
+ */
+ @Override
+ public void setMBeanServer(MBeanServer server)
+ {
+ // we don't have anything specific to do
+
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/impl/src/main/resources/META-INF/ejb3-connectors-jboss-beans.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/impl/src/main/resources/META-INF/ejb3-connectors-jboss-beans.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/impl/src/main/resources/META-INF/ejb3-connectors-jboss-beans.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ EJB3 Connectors
+
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!-- We don't want the AOPDependencyBuilder -->
+ <annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP</annotation>
+
+ <!--
+
+ JBoss Remoting Connector
+
+ Note: Bean Name "org.jboss.ejb3.RemotingConnector" is used
+ as a lookup value; alter only after checking java references
+ to this key.
+
+ -->
+ <bean name="org.jboss.ejb3.RemotingConnector"
+ class="org.jboss.remoting.transport.Connector">
+
+ <property name="invokerLocator">
+
+ <value-factory bean="ServiceBindingManager"
+ method="getStringBinding">
+ <parameter>
+ jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3
+ </parameter>
+ <parameter>
+ <null />
+ </parameter>
+ <parameter>socket://${jboss.bind.address}:${port}</parameter>
+ <parameter>
+ <null />
+ </parameter>
+ <parameter>3873</parameter>
+ </value-factory>
+
+ </property>
+ <property name="serverConfiguration">
+ <inject bean="ServerConfiguration" />
+ </property>
+ </bean>
+
+ <!-- Remoting Server Configuration -->
+ <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>
+ <entry>
+ <key>SIMPLE</key>
+ <value>
+ org.jboss.ejb3.singleton.impl.remoting.RemotingInvocationHandler
+ </value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Modified: 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 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/impl/src/test/java/org/jboss/ejb3/singleton/impl/test/simple/unit/SimpleSingletonContainerTest.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -26,6 +26,8 @@
import static org.junit.Assert.assertSame;
import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
import org.jboss.ejb3.container.spi.BeanContext;
import org.jboss.ejb3.container.spi.ContainerInvocation;
@@ -242,5 +244,14 @@
}
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.container.spi.InterceptorRegistry#getInterceptorClasses()
+ */
+ @Override
+ public List<Class<?>> getInterceptorClasses()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
}
}
Modified: projects/ejb3/components/singleton/trunk/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/pom.xml 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -42,9 +42,22 @@
<modules>
<!-- Order matters -->
<module>build</module>
- <module>spi</module>
- <module>impl</module>
- <module>aop-impl</module>
+ <module>spi</module>
+ <module>impl</module>
+ <module>aop-impl</module>
+ <module>deployer</module>
+ <module>proxy</module>
</modules>
+
+ <profiles>
+ <!-- An integration profile for running the integration testsuite -->
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>testsuite</module>
+ </modules>
+ </profile>
+ </profiles>
+
</project>
Added: projects/ejb3/components/singleton/trunk/proxy/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/pom.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,82 @@
+<?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-proxy-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss EJB 3.1 Singleton Proxy implementation</name>
+ <url>http://www.jboss.org</url>
+ <description>A jboss-ejb3-proxy-impl based implementation for JBoss EJB3.1 Singleton bean proxies</description>
+
+ <properties>
+
+ <version.jboss.ejb3.proxy.impl>1.0.6</version.jboss.ejb3.proxy.impl>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Assembly Plugin -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <!-- Build singleton proxy "package" -->
+ <execution>
+ <id>build-singleton-proxy-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/package-assembler.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-impl</artifactId>
+ <version>${project.version}</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/proxy/src/assembly/package-assembler.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/assembly/package-assembler.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/assembly/package-assembler.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly 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/xsd/assembly-1.1.1.xsd"
+>
+ <id>package</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/assembly</directory>
+ <filtered>true</filtered>
+ <includes>
+ <include>package.xml</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useProjectArtifact>true</useProjectArtifact>
+ <includes>
+ <include>org.jboss.ejb3.singleton:jboss-ejb3-singleton-proxy-impl:jar</include>
+ </includes>
+
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Added: projects/ejb3/components/singleton/trunk/proxy/src/assembly/package.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/assembly/package.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/assembly/package.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,32 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ 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.
+ -->
+<!--
+ jboss-ejb3-singleton-proxy-impl
+-->
+<package name="${project.groupId}:${project.artifactId}" version="${project.version}" xmlns="org/jboss/packagemanager/package">
+
+ <!-- Place in common/lib of AS -->
+ <file name="jboss-ejb3-singleton-proxy-impl.jar" dest-path="common/lib" type="library"/>
+
+
+</package>
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/ProxyFactory.java
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/ProxyFactory.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/ProxyFactory.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,50 @@
+/*
+* 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.proxy.spi;
+
+import java.lang.reflect.InvocationHandler;
+
+/**
+ * A {@link ProxyFactory} is responsible for creating proxies which are castable to
+ * the {@link Class}(es) specified in the {@link ProxyCreationContext#getTypes()}
+ * <p>
+ * Implementations of {@link ProxyFactory} can expect more contextual information
+ * for proxy creation, through custom {@link ProxyCreationContext}.
+ * </p>
+ *
+ * @see ProxyCreationContext#getTypes()
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface ProxyFactory
+{
+
+ /**
+ * Creates and returns a proxy which is castable to the {@link Class}(es) specified in the passed
+ * <code>proxyCreationContext</code>.
+ *
+ * @param proxyCreationContext Contextual information for creating of proxies
+ * @return Returns a proxy which is castable to the {@link Class}(es) specified in the passed <code>proxyCreationContext</code>
+ * @see ProxyCreationContext#getTypes()
+ */
+ Object createProxy(Class<?>[] interfaces, InvocationHandler invocationHandler);
+}
Added: projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteInvocationHandler.java
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteInvocationHandler.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteInvocationHandler.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -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.proxy.impl;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.container.spi.remote.RemotingContainer;
+
+/**
+ * SingletonBeanRemoteInvocationHandler
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonBeanRemoteInvocationHandler implements InvocationHandler, Serializable
+{
+
+ private RemotingContainer remotingContainer;
+
+ private Class<?> businessInterface;
+
+ public SingletonBeanRemoteInvocationHandler(RemotingContainer remotingContainer)
+ {
+ this.remotingContainer = remotingContainer;
+ }
+
+ public SingletonBeanRemoteInvocationHandler(RemotingContainer remotingContainer, Class<?> businessInterface)
+ {
+ this(remotingContainer);
+ this.businessInterface = businessInterface;
+ }
+
+ /**
+ * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
+ */
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return this.remotingContainer.invoke(null, method, args, this.businessInterface);
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteJNDIBinder.java
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteJNDIBinder.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonBeanRemoteJNDIBinder.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,158 @@
+/*
+* 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.proxy.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.container.spi.EJBContainer;
+import org.jboss.ejb3.container.spi.remote.RemotingContainer;
+import org.jboss.ejb3.proxy.spi.ProxyFactory;
+import org.jboss.ejb3.singleton.impl.remoting.JBossRemotingContainer;
+import org.jboss.ejb3.singleton.spi.ContainerRegistry;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndi.resolver.impl.JNDIPolicyBasedJNDINameResolverFactory;
+import org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.DefaultJNDIBindingPolicyFactory;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.util.naming.Util;
+
+/**
+ * SingletonBeanJNDIRegistrar
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonBeanRemoteJNDIBinder
+{
+
+ private EJBContainer container;
+
+ private JBossSessionBeanMetaData sessionBeanMetadata;
+
+ public SingletonBeanRemoteJNDIBinder(EJBContainer container)
+ {
+ this.container = container;
+ JBossEnterpriseBeanMetaData enterpriseBean = this.container.getMetaData();
+ if (!enterpriseBean.isSession())
+ {
+ throw new IllegalStateException("Bean " + enterpriseBean.getEjbName() + " is not a session bean");
+ }
+ // if (!sessionbean.isSingleton())
+ // {
+ // throw new IllegalStateException("Bean " + sessionbean.getEjbName() + " is not a singleton bean");
+ // }
+ this.sessionBeanMetadata = (JBossSessionBeanMetaData) enterpriseBean;
+
+ }
+
+ /**
+ * Binds the no-interface view of the bean <code>beanClass</code> to the JNDI,
+ * at the provided <code>jndiCtx</code> context.
+ *
+ * @param jndiCtx The jndi context to which the no-interface view has to be bound
+ * @param beanClass The EJB class
+ * @param beanMetaData The metadata of the bean
+ *
+ * @return Returns the jndi-name where the no-interface view has been bound
+ * @throws NamingException If any exception while binding to JNDI
+ * @throws IllegalStateException If a no-interface view is not applicable for this bean
+ */
+ public void bind(Context jndiCtx) throws NamingException, IllegalStateException
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();// get from container
+ BusinessRemotesMetaData businessRemotes = this.sessionBeanMetadata.getBusinessRemotes();
+ if (businessRemotes == null || businessRemotes.size() == 0)
+ {
+ throw new IllegalStateException("No business remotes found for bean " + sessionBeanMetadata.getEjbName());
+ }
+ Set<Class<?>> interfaces = new HashSet<Class<?>>();
+ for (String businessRemote : businessRemotes)
+ {
+ try
+ {
+ Class<?> businessRemoteIntf = cl.loadClass(businessRemote);
+ interfaces.add(businessRemoteIntf);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new RuntimeException("Could not load business remote interface " + businessRemote, cnfe);
+ }
+
+ }
+ // TODO : Move this out of here and generate the key through some SPI
+ String containerRegistryKey = this.sessionBeanMetadata.getEjbName() + "/" + UUID.randomUUID();
+ // TODO: Move this out of here
+ // register the container in a registry
+
+ ContainerRegistry.INSTANCE.registerContainer(containerRegistryKey, container);
+ // TODO: Obviously should NOT be hardcoded and should not even be here probably
+ final String DEFAULT_REMOTING_URL = "socket://0.0.0.0:3873";
+ // create a remoting container
+ // TODO: Not the responsibility of a jndibinder, so move this out of here
+ RemotingContainer remotingContainer = new JBossRemotingContainer(containerRegistryKey, DEFAULT_REMOTING_URL);
+ // create an invocation handler
+ InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(remotingContainer);
+
+ // time to create a proxy
+ ProxyFactory proxyFactory = new SingletonProxyFactory();
+ Object proxy = proxyFactory.createProxy(interfaces.toArray(new Class<?>[interfaces.size()]), invocationHandler);
+
+ // bind to jndi
+ JBossSessionBeanMetaData sessionBeanMetadata = (JBossSessionBeanMetaData) container.getMetaData();
+ DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
+ SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
+ sessionBeanMetadata, jndibindingPolicy);
+ String defaultRemoteJNDIName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBeanMetadata);
+ Util.bind(jndiCtx, defaultRemoteJNDIName, proxy);
+
+
+ }
+
+ /**
+ * Unbind the no-interface view of the bean <code>beanClass</code> from the JNDI
+ * at the provided <code>jndiCtx</code> context.
+ *
+ * @param jndiCtx The jndi context from where the no-interface view has to be unbound
+ * @param beanClass The EJB class
+ * @param beanMetaData The metadata of the bean
+ *
+ * @throws NamingException If any exception while unbinding from JNDI
+ * @throws IllegalStateException If a no-interface view is not applicable for this bean
+ */
+ public void unbind(Context jndiCtx) throws NamingException, IllegalStateException
+ {
+ DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
+ SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
+ this.sessionBeanMetadata, jndibindingPolicy);
+ String defaultRemoteJNDIName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(this.sessionBeanMetadata);
+ Util.unbind(jndiCtx, defaultRemoteJNDIName);
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonProxyFactory.java
===================================================================
--- projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonProxyFactory.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/SingletonProxyFactory.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,50 @@
+/*
+* 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.proxy.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+import org.jboss.ejb3.proxy.spi.ProxyFactory;
+
+/**
+ * SingletonProxyFactory
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonProxyFactory implements ProxyFactory
+{
+
+ /**
+ * @see org.jboss.ejb3.proxy.spi.ProxyFactory#createProxy(java.lang.Class<?>[], java.lang.reflect.InvocationHandler)
+ */
+ @Override
+ public Object createProxy(Class<?>[] interfaces, InvocationHandler invocationHandler)
+ {
+ ClassLoader cl = interfaces[0].getClassLoader();
+ return Proxy.newProxyInstance(cl, interfaces, invocationHandler);
+ }
+
+
+
+}
Modified: projects/ejb3/components/singleton/trunk/spi/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/spi/pom.xml 2010-03-01 14:09:53 UTC (rev 101657)
+++ projects/ejb3/components/singleton/trunk/spi/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -28,6 +28,7 @@
<version.ejb3.container.spi>1.0.0-SNAPSHOT</version.ejb3.container.spi>
</properties>
+
<dependencies>
<dependency>
Added: projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/ContainerRegistry.java
===================================================================
--- projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/ContainerRegistry.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/spi/src/main/java/org/jboss/ejb3/singleton/spi/ContainerRegistry.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -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.spi;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.ejb3.container.spi.EJBContainer;
+
+/**
+ * ContainerRegistry
+ *
+ * TODO: This is WIP and needs better javadoc. But before that, i need
+ * to figure out the scope of this registry and how/whether it relates to
+ * Ejb3Registry
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ContainerRegistry
+{
+
+ public static final ContainerRegistry INSTANCE = new ContainerRegistry();
+
+ private Map<String, EJBContainer> containers = new ConcurrentHashMap<String, EJBContainer>();
+
+ private ContainerRegistry()
+ {
+
+ }
+
+
+
+ public void registerContainer(String containerRegistryKey, EJBContainer container)
+ {
+ this.containers.put(containerRegistryKey, container);
+ }
+
+ public void unregisterContainer(String containerRegistryKey)
+ {
+ if (!this.containers.containsKey(containerRegistryKey))
+ {
+ throw new IllegalArgumentException("Container with key " + containerRegistryKey
+ + " was not registered, so cannot be unregistered");
+ }
+ this.containers.remove(containerRegistryKey);
+ }
+
+ public EJBContainer getContainer(String containerRegistryKey)
+ {
+ if (!this.containers.containsKey(containerRegistryKey))
+ {
+ throw new IllegalArgumentException("Container with key " + containerRegistryKey + " was not registered");
+ }
+ return this.containers.get(containerRegistryKey);
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/pom.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/pom.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/pom.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,362 @@
+<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>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-testsuite</artifactId>
+
+
+ <name>JBoss EJB3.1 Singleton component Testsuite</name>
+ <description>Testsuite for JBoss EJB3.1 singleton component</description>
+
+ <properties>
+ <jboss.server.config>all</jboss.server.config>
+ <!--
+ The jboss.home "intermediate" property would not have been
+ necessary, if Maven's enforcer plugin supported enforcing
+ setting of a "System" environment variable. Details here
+ http://markmail.org/message/jwfmtrjesuyag7bh This
+ intermediate property is a workaround to use in the enforcer
+ plugin to ensure that the JBOSS_HOME is set. And now that we
+ have an intermediate jboss.home, let's use this throughout
+ the pom instead of JBOSS_HOME.
+ -->
+ <jboss.home>${JBOSS_HOME}</jboss.home>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <!-- Enforce JDK6 -->
+ <execution>
+ <id>enforce-jdk6</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <version>1.6</version>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </execution>
+
+ <!--
+ Enforce presence of JBOSS_HOME during
+ pre-intregation-test phase (i.e. during server
+ startup
+ -->
+ <execution>
+ <id>enforce-jboss-home</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>jboss.home</property>
+ <message>"Please set
+ JBOSS_HOME"</message>
+ </requireProperty>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Use the correct "javac" -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <executable>${JAVA_HOME}/bin/javac</executable>
+ </configuration>
+ </plugin>
+
+ <!--
+ Skip unit tests and instead run integration-test. Before
+ running the integration test, start the server and after
+ the tests, stop the server
+ -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- skip unit test -->
+ <skipTests>true</skipTests>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <printSummary>true</printSummary>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <!-- Override the earlier set value to now run integration tests -->
+ <skipTests>false</skipTests>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Setup the package manager and no-interface package so
+ that it can be installed later into the AS
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <!-- The package manager installer -->
+ <artifactItem>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-package-manager</artifactId>
+ <classifier>installer</classifier>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}/dependencies/package-manager</outputDirectory>
+ </artifactItem>
+ <!--
+ The singleton packages -->
+ <artifactItem>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-impl</artifactId>
+ <classifier>package</classifier>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/dependencies/packages</outputDirectory>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-proxy-impl</artifactId>
+ <classifier>package</classifier>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/dependencies/packages</outputDirectory>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-aop-impl</artifactId>
+ <classifier>package</classifier>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/dependencies/packages</outputDirectory>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-deployer</artifactId>
+ <classifier>package</classifier>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/dependencies/packages</outputDirectory>
+ </artifactItem>
+
+ </artifactItems>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <stripVersion>true</stripVersion>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+
+ </plugin>
+
+ <!--
+ Install singleton packages in pre-integration-test
+ phase -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-singleton-packages</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="${project.build.directory}/test-classes/build-test.xml" target="install-singleton-packages" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ After installing the no-interface package, now start the
+ server in pre-integration-test phase
+ -->
+ <plugin>
+ <groupId>org.jboss.maven.plugins.jbossas</groupId>
+ <artifactId>maven-jboss-as-control-plugin</artifactId>
+ <version>0.1.1</version>
+ <executions>
+ <!-- Start AS -->
+ <execution>
+ <id>start-jboss-as</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <serverConfigName>${jboss.server.config}</serverConfigName>
+ <jvmArgs>
+ <jvmArg>-Xms128m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ <jvmArg>-XX:MaxPermSize=256m</jvmArg>
+ <jvmArg>-Dorg.jboss.resolver.warning=true</jvmArg>
+ <jvmArg>-Dsun.rmi.dgc.client.gcInterval=3600000</jvmArg>
+ <jvmArg>-Dsun.rmi.dgc.server.gcInterval=3600000</jvmArg>
+ <!-- Temporary, till AS boots without this property JBAS-6744 -->
+ <jvmArg>-Dxb.builder.useUnorderedSequence=true</jvmArg>
+ </jvmArgs>
+ <jboss.test.run>true</jboss.test.run>
+ </configuration>
+ </execution>
+
+ <!-- Stop AS -->
+ <execution>
+ <id>stop-jboss-as</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <serverConfigName>${jboss.server.config}</serverConfigName>
+ <jboss.test.run>true</jboss.test.run>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-impl-base</artifactId>
+ <version>1.0.0-alpha-2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api_3.1</artifactId>
+ <version>1.0-alpha-1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnpserver</artifactId>
+ <version>5.0.3.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <scope>test</scope>
+ <version>5.1.0.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-ejb3</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ TODO: Remove this dependency and instead depend on the
+ components
+ -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3_1</artifactId>
+ <scope>test</scope>
+ <version>1.0.2</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>package</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-aop-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>package</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-proxy-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>package</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3.singleton</groupId>
+ <artifactId>jboss-ejb3-singleton-deployer</artifactId>
+ <version>${project.version}</version>
+ <classifier>package</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ The package manager installer which we use to install the
+ no-interface package into AS
+ -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-package-manager</artifactId>
+ <version>1.0.0-alpha-2</version>
+ <scope>test</scope>
+ <classifier>installer</classifier>
+ <type>zip</type>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/common/AbstractSingletonTestCase.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/common/AbstractSingletonTestCase.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/common/AbstractSingletonTestCase.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,365 @@
+/*
+* 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.integration.test.common;
+
+
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.importer.ExplodedImporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * AbstractNoInterfaceTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class AbstractSingletonTestCase
+{
+
+ private final static String DEPLOYER_NAME = "jboss.system:service=MainDeployer";
+
+ protected MBeanServerConnection server;
+
+ private Context ctx;
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(AbstractSingletonTestCase.class);
+
+ /**
+ * basedir (set through Maven)
+ */
+ protected static final File BASEDIR = new File(System.getProperty("basedir"));
+
+ /**
+ * Target directory
+ */
+ protected static final File TARGET_DIRECTORY = new File(BASEDIR, "target");
+
+ /**
+ * The directory into which the deployments required by the tests will be placed
+ */
+ protected static final File TEST_DEPLOYMENTS_FOLDER = new File(TARGET_DIRECTORY, "test-lib");
+
+ /**
+ * The <project>/src/test/resources folder
+ */
+ protected static final File TEST_SRC_RESOURCES = new File(BASEDIR, "src/test/resources");
+
+ static
+ {
+ if (!TEST_DEPLOYMENTS_FOLDER.exists())
+ {
+ TEST_DEPLOYMENTS_FOLDER.mkdir();
+ }
+ }
+
+ /**
+ * @param name
+ */
+ public AbstractSingletonTestCase()
+ {
+ try
+ {
+ this.ctx = new InitialContext();
+ }
+ catch (NamingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the URL to the {@code resourceName}. The resource is looked
+ * under {@code klass}'s package name. For example, if the
+ * klass is org.jboss.ejb3.nointerface.integration.test.simple.unit.BasicTestCase and the
+ * resource name is ejb-jar.xml, then this method looks for ejb-jar.xml under
+ * org/jboss/ejb3/nointerface/integration/test/simple/unit in the classpath.
+ *
+ * This method returns null if the resource was not found in the classpath
+ * @param klass The Class under whose package the resources are searched for
+ * @param resourceName The name of the resource
+ * @return Returns the URL to the resource or NULL if not found in classpath
+ */
+ protected static URL getResource(Class<?> klass, String resourceName)
+ {
+ String resourceDir = klass.getPackage().getName().toString() + ".";
+ resourceDir = resourceDir.replace('.', '/');
+ String resourcePath = resourceDir + resourceName;
+ return klass.getClassLoader().getResource(resourcePath);
+ }
+
+ /**
+ * Returns the URLs to the {@code resources}. The resources are looked
+ * under {@code klass}'s package name. For example, if the
+ * klass is org.jboss.ejb3.nointerface.integration.test.simple.unit.BasicTestCase and the
+ * resource name is ejb-jar.xml, then this method looks for ejb-jar.xml under
+ * org/jboss/ejb3/nointerface/integration/test/simple/unit in the classpath.
+ *
+ * Note: The list returned by the method could contain null elements if the
+ * corresponding resource wasn't found in the classpath.
+ *
+ * @param klass The Class under whose package the resources are searched for
+ * @param resources The name of the resources
+ * @return Returns a list of resource URLs
+ */
+ protected static List<URL> getResources(Class<?> klass, String... resources)
+ {
+ List<URL> urls = new ArrayList<URL>();
+ for (String resource : resources)
+ {
+ urls.add(getResource(klass, resource));
+ }
+ return urls;
+ }
+
+ /**
+ * Creates a jar file with the name <code>jarName</code> including in that jar, the packages
+ * <code>testArtifactPackages</code>, and classes under those packages.
+ *
+ * @param jarName Name of the jar file (including the .jar extension)
+ * @param testArtifactPackages The test packages
+ * @return Returns the created jar file
+ * @throws IOException
+ */
+ protected static File buildSimpleJar(String jarName, Package... testArtifactPackages) throws IOException
+ {
+ JavaArchive jar = Archives.create(jarName, JavaArchive.class);
+ jar.addPackages(false, testArtifactPackages);
+ // also add any files from test/resources/<packagename>/*
+ for (Package testPackage : testArtifactPackages)
+ {
+ if (TEST_SRC_RESOURCES.exists())
+ {
+ //replace the "." with "/" in the packagename
+ String resourceRelativePath = testPackage.getName().replaceAll("\\.", "/");
+ File resourceAbsolutePath = new File(TEST_SRC_RESOURCES, resourceRelativePath);
+ if (resourceAbsolutePath.exists())
+ {
+ // add all files, folders, sub-folders under this location to the root of the archive
+ jar.as(ExplodedImporter.class).importDirectory(resourceAbsolutePath);
+ }
+ }
+ }
+ return writeToFileSystem(jar);
+ }
+
+ /**
+ * Creates a ear file with the name <code>earName</code>. The .ear will include the
+ * (at the root) the files passed through the <code>deployments</code> param.
+ *
+ * @param earName Name of the ear file (including the .ear extension)
+ * @param deployments The files to be included in the .ear
+ * @return Returns the created ear file
+ * @throws IOException
+ */
+ protected static File buildSimpleEAR(String earName, File... deployments) throws IOException,
+ IllegalArgumentException
+ {
+ if (earName == null || deployments == null)
+ {
+ throw new IllegalArgumentException("earName and deployments are mandatory");
+ }
+ JavaArchive ear = Archives.create(earName, JavaArchive.class);
+
+ for (File deployment : deployments)
+ {
+ ear.addResource(deployment);
+ }
+ return writeToFileSystem(ear);
+ }
+
+ /**
+ * Writes out a {@link JavaArchive} to the file system
+ * @param javaArchive The {@link JavaArchive} which will be written out to the file system
+ * @return Returns the {@link File} corresponding to the {@link JavaArchive} which
+ * was written out to the file system
+ * @throws IOException
+ */
+ protected static File writeToFileSystem(JavaArchive javaArchive) throws IOException
+ {
+ InputStream inputStream = javaArchive.as(ZipExporter.class).exportZip();
+ String jarFileName = javaArchive.getName();
+ logger.debug("Writing out jar " + jarFileName + " : " + javaArchive.toString(true));
+ File jarFile = new File(TEST_DEPLOYMENTS_FOLDER, jarFileName);
+ FileOutputStream fos = new FileOutputStream(jarFile);
+ BufferedOutputStream bos = null;
+ BufferedInputStream bis = null;
+ try
+ {
+ bos = new BufferedOutputStream(fos);
+ bis = new BufferedInputStream(inputStream);
+ byte[] content = new byte[4096];
+ int length;
+ while ((length = bis.read(content)) != -1)
+ {
+ bos.write(content, 0, length);
+ }
+ bos.flush();
+ }
+ finally
+ {
+ if (bos != null)
+ {
+ bos.close();
+ }
+ if (bis != null)
+ {
+ bis.close();
+ }
+ }
+ return jarFile;
+ }
+
+ /**
+ * invoke wraps an invoke call to the mbean server in a lot of exception
+ * unwrapping.
+ *
+ * @param name ObjectName of the mbean to be called
+ * @param method mbean method to be called
+ * @param args Object[] of arguments for the mbean method.
+ * @param sig String[] of types for the mbean methods parameters.
+ * @return Object returned by mbean method invocation.
+ * @exception Exception Description of Exception
+ */
+ protected Object invoke(ObjectName name, String method, Object[] args, String[] sig) throws Exception
+ {
+ return invoke(getServer(), name, method, args, sig);
+ }
+
+ protected Object invoke(MBeanServerConnection server, ObjectName name, String method, Object[] args, String[] sig)
+ throws Exception
+ {
+ try
+ {
+ this.logger.debug("Invoking " + name.getCanonicalName() + " method=" + method);
+ if (args != null)
+ this.logger.debug("args=" + Arrays.asList(args));
+ return server.invoke(name, method, args, sig);
+ }
+ catch (javax.management.MBeanException e)
+ {
+ logger.error("MbeanException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.ReflectionException e)
+ {
+ logger.error("ReflectionException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeOperationsException e)
+ {
+ logger.error("RuntimeOperationsException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeMBeanException e)
+ {
+ logger.error("RuntimeMbeanException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeErrorException e)
+ {
+ logger.error("RuntimeErrorException", e.getTargetError());
+ throw e.getTargetError();
+ }
+ }
+
+ /**
+ * Deploy a package with the main deployer. The supplied name is
+ * interpreted as a url, or as a filename in jbosstest.deploy.lib or output/lib.
+ *
+ * @param name filename/url of package to deploy.
+ * @exception Exception Description of Exception
+ */
+ public void deploy(URL deployURL) throws Exception
+ {
+ invoke(getDeployerName(), "deploy", new Object[]
+ {deployURL}, new String[]
+ {"java.net.URL"});
+ }
+
+ public void redeploy(URL deployURL) throws Exception
+ {
+ invoke(getDeployerName(), "redeploy", new Object[]
+ {deployURL}, new String[]
+ {"java.net.URL"});
+ }
+
+ private ObjectName getDeployerName() throws MalformedObjectNameException
+ {
+ return new ObjectName(DEPLOYER_NAME);
+ }
+
+ /**
+ * Gets the Server attribute of the JBossTestCase object
+ *
+ * @return The Server value
+ * @throws Exception for any error
+ */
+ protected MBeanServerConnection getServer() throws Exception
+ {
+ if (server == null)
+ {
+ String adaptorName = System.getProperty("jbosstest.server.name", "jmx/invoker/RMIAdaptor");
+ server = (MBeanServerConnection) new InitialContext().lookup(adaptorName);
+ }
+ return server;
+ }
+
+ public void undeploy(URL deployURL) throws Exception
+ {
+
+ Object[] args =
+ {deployURL};
+ String[] sig =
+ {"java.net.URL"};
+ invoke(getDeployerName(), "undeploy", args, sig);
+ }
+
+ protected Context getInitialContext()
+ {
+ return this.ctx;
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/Counter.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/Counter.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/Counter.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,35 @@
+/*
+* 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.integration.test.deployment;
+
+/**
+ * Counter
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface Counter
+{
+ void incrementCount();
+
+ int getCount();
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/SimpleSingletonBean.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/SimpleSingletonBean.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/SimpleSingletonBean.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,60 @@
+/*
+* 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.integration.test.deployment;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Remote;
+import javax.ejb.Singleton;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * SimpleSingletonBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+ at Remote (Counter.class)
+ at RemoteBinding(jndiBinding = SimpleSingletonBean.JNDI_NAME)
+public class SimpleSingletonBean implements Counter
+{
+ private int count;
+
+ public static final String JNDI_NAME = "SimpleSingletonRemoteCounter";
+
+ @PostConstruct
+ public void onConstruct()
+ {
+ this.incrementCount();
+ }
+
+ public int getCount()
+ {
+ return this.count;
+ }
+
+ public void incrementCount()
+ {
+ this.count ++;
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/unit/SingletonDeploymentUnitTestCase.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/unit/SingletonDeploymentUnitTestCase.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/deployment/unit/SingletonDeploymentUnitTestCase.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,89 @@
+/*
+* 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.integration.test.deployment.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.ejb3.singleton.integration.test.common.AbstractSingletonTestCase;
+import org.jboss.ejb3.singleton.integration.test.deployment.Counter;
+import org.jboss.ejb3.singleton.integration.test.deployment.SimpleSingletonBean;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * SingletonDeploymentUnitTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonDeploymentUnitTestCase extends AbstractSingletonTestCase
+{
+
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = "simple-singleton-bean.jar";
+ File jar = buildSimpleJar(jarName, SimpleSingletonBean.class.getPackage());
+ this.deployment = jar.toURI().toURL();
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSingletonBeanAccess() throws Exception
+ {
+ Counter counter = (Counter) this.getInitialContext().lookup(SimpleSingletonBean.JNDI_NAME);
+ int initialCount = counter.getCount();
+ assertEquals("Unexpected initial counter value - @PostConstruct on singleton bean not called?", 1, initialCount);
+ // increment 10 times
+ final int NUM_TIMES = 10;
+ for (int i = 0; i < NUM_TIMES; i++)
+ {
+ counter.incrementCount();
+ }
+ int currentCount = counter.getCount();
+ assertEquals("Unexpected counter count after increment", initialCount + NUM_TIMES, currentCount);
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SimpleInterceptor.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SimpleInterceptor.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SimpleInterceptor.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,47 @@
+/*
+* 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.integration.test.interceptor;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * SimpleInterceptor
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SimpleInterceptor
+{
+
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception
+ {
+ Object args[] = ctx.getParameters();
+ String message = (String) args[0];
+
+ String interceptedMessage = message + "-intercepted";
+ ctx.setParameters(new Object[]{interceptedMessage});
+ return ctx.proceed();
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SingletonBeanWithInterceptor.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SingletonBeanWithInterceptor.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/SingletonBeanWithInterceptor.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,47 @@
+/*
+* 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.integration.test.interceptor;
+
+import javax.ejb.Singleton;
+import javax.interceptor.Interceptors;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * SingletonBeanWithInterceptor
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Interceptors (SimpleInterceptor.class)
+ at Singleton
+ at RemoteBinding (jndiBinding = SingletonBeanWithInterceptor.JNDI_NAME)
+public class SingletonBeanWithInterceptor
+{
+
+ public static final String JNDI_NAME = "SingletonInterceptorTestBean";
+
+ public String echo(String message)
+ {
+ return message;
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/unit/SingletonBeanInterceptorTestCase.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/unit/SingletonBeanInterceptorTestCase.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/interceptor/unit/SingletonBeanInterceptorTestCase.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,82 @@
+/*
+* 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.integration.test.interceptor.unit;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.jboss.ejb3.singleton.integration.test.common.AbstractSingletonTestCase;
+import org.jboss.ejb3.singleton.integration.test.interceptor.SingletonBeanWithInterceptor;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * SingletonBeanInterceptorTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonBeanInterceptorTestCase extends AbstractSingletonTestCase
+{
+
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = "singleton-bean-interceptor-test.jar";
+ File jar = buildSimpleJar(jarName, SingletonBeanWithInterceptor.class.getPackage());
+ this.deployment = jar.toURI().toURL();
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testInterception() throws Exception
+ {
+ SingletonBeanWithInterceptor singleton = (SingletonBeanWithInterceptor) this.getInitialContext().lookup(SingletonBeanWithInterceptor.JNDI_NAME);
+ String message = "some message which will be intercepted";
+ String expectedInterceptedMessage = message + "-intercepted";
+ String result = singleton.echo(message);
+
+ Assert.assertNotNull("Singleton bean method invocation returned null", result);
+ Assert.assertEquals("Unexpected return message", expectedInterceptedMessage, result);
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/TxAwareSingletonBean.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/TxAwareSingletonBean.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/TxAwareSingletonBean.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,69 @@
+/*
+* 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.integration.test.tx;
+
+import javax.ejb.Remote;
+import javax.ejb.Singleton;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * TxAwareSingletonBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+ at Remote (UserManager.class)
+ at RemoteBinding (jndiBinding = TxAwareSingletonBean.JNDI_NAME)
+public class TxAwareSingletonBean implements UserManager
+{
+
+ public static final String JNDI_NAME = "Tx-UserManagerBean";
+
+ @PersistenceContext
+ private EntityManager em;
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.singleton.integration.test.tx.UserManager#createUser(java.lang.String)
+ */
+ @Override
+ public long createUser(String userName)
+ {
+ User user = new User(userName);
+ this.em.persist(user);
+
+ return user.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.singleton.integration.test.tx.UserManager#getUser(long)
+ */
+ @Override
+ public User getUser(long id)
+ {
+ return this.em.find(User.class, id);
+ }
+
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/User.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/User.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/User.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -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.integration.test.tx;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * User
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Entity
+ at Table(name = "TestUser")
+public class User implements Serializable
+{
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long id;
+
+ private String name;
+
+ public User()
+ {
+
+ }
+
+ public User(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public long getId()
+ {
+ return this.id;
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/UserManager.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/UserManager.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/UserManager.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,37 @@
+/*
+* 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.integration.test.tx;
+
+/**
+ * UserManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface UserManager
+{
+
+ long createUser(String userName);
+
+ User getUser(long id);
+
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/unit/SingletonBeanTxSemanticsTestCase.java
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/unit/SingletonBeanTxSemanticsTestCase.java (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/tx/unit/SingletonBeanTxSemanticsTestCase.java 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,87 @@
+/*
+* 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.integration.test.tx.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.ejb3.singleton.integration.test.common.AbstractSingletonTestCase;
+import org.jboss.ejb3.singleton.integration.test.tx.TxAwareSingletonBean;
+import org.jboss.ejb3.singleton.integration.test.tx.User;
+import org.jboss.ejb3.singleton.integration.test.tx.UserManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * SingletonBeanTxSemanticsTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SingletonBeanTxSemanticsTestCase extends AbstractSingletonTestCase
+{
+
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = "singleton-tx-test.jar";
+ File jar = buildSimpleJar(jarName, TxAwareSingletonBean.class.getPackage());
+ this.deployment = jar.toURI().toURL();
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSingletonBeanTx() throws Exception
+ {
+ UserManager userManager = (UserManager) this.getInitialContext().lookup(TxAwareSingletonBean.JNDI_NAME);
+ String userOneName = "User123";
+ long userOneId = userManager.createUser(userOneName);
+
+ User userOne = userManager.getUser(userOneId);
+ assertNotNull("Singleton user manager bean returned null user for id " + userOneId, userOne);
+ assertEquals("Unexpected user returned by singleton user manager bean", userOneName, userOne.getName());
+ }
+}
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/build-test.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/build-test.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/build-test.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="JBoss EJB3.1 no-interface testsuite setup" default="install-no-interface-package">
+
+ <property environment="env"/>
+ <!-- Enforce JBOSS_HOME -->
+ <fail unless="env.JBOSS_HOME" message="JBOSS_HOME not set"/>
+ <property name="JBOSS_HOME" value="${env.JBOSS_HOME}"/>
+
+ <property name="location.target" value="${basedir}/target"/>
+ <property name="location.dependencies" value="${location.target}/dependencies"/>
+ <property name="location.packagemanager" value="${location.dependencies}/package-manager"/>
+ <property name="location.packagemanager.zip.file" value="${location.packagemanager}/jboss-ejb3-package-manager-installer.zip"/>
+ <property name="location.singleton.packages" value="${location.dependencies}/packages"/>
+ <property name="location.singleton.deployer.package" value="${location.singleton.packages}/jboss-ejb3-singleton-deployer-package.jar"/>
+ <property name="location.singleton.aop.impl.package" value="${location.singleton.packages}/jboss-ejb3-singleton-aop-impl-package.jar"/>
+ <property name="location.singleton.impl.package" value="${location.singleton.packages}/jboss-ejb3-singleton-impl-package.jar"/>
+ <property name="location.singleton.proxy.impl.package" value="${location.singleton.packages}/jboss-ejb3-singleton-proxy-impl-package.jar"/>
+ <property name="packagemanager.home" value="${location.packagemanager}/jboss-package-manager"/>
+
+ <path id="package.manager.classpath">
+ <fileset dir="${packagemanager.home}/lib" includes="**/*.jar"/>
+ </path>
+
+ <target name="install-singleton-packages" description="Install singleton component packages into JBoss AS">
+ <!--Unzip the package manager installer -->
+ <antcall target="unzip-package-manager"/>
+
+ <!-- Setup package manager itself -->
+ <antcall target="setup-package-manager"/>
+
+ <!-- Install the singleton packages through the package manager -->
+ <echo>Installing singleton deployer package</echo>
+ <java classname="org.jboss.ejb3.packagemanager.main.Main" classpathref="package.manager.classpath" fork="true">
+
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- JBoss Home -->
+ <arg value="-s"/>
+ <arg value="${JBOSS_HOME}"/>
+ <arg value="-u"/>
+ <arg value="${location.singleton.deployer.package}"/>
+ </java>
+ <echo>Installing singleton aop package</echo>
+ <java classname="org.jboss.ejb3.packagemanager.main.Main" classpathref="package.manager.classpath" fork="true">
+
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- JBoss Home -->
+ <arg value="-s"/>
+ <arg value="${JBOSS_HOME}"/>
+ <arg value="-u"/>
+ <arg value="${location.singleton.aop.impl.package}"/>
+ </java>
+ <echo>Installing singleton impl package</echo>
+ <java classname="org.jboss.ejb3.packagemanager.main.Main" classpathref="package.manager.classpath" fork="true">
+
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- JBoss Home -->
+ <arg value="-s"/>
+ <arg value="${JBOSS_HOME}"/>
+ <arg value="-u"/>
+ <arg value="${location.singleton.impl.package}"/>
+ </java>
+ <echo>Installing singleton proxy package</echo>
+ <java classname="org.jboss.ejb3.packagemanager.main.Main" classpathref="package.manager.classpath" fork="true">
+
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- JBoss Home -->
+ <arg value="-s"/>
+ <arg value="${JBOSS_HOME}"/>
+ <arg value="-u"/>
+ <arg value="${location.singleton.proxy.impl.package}"/>
+ </java>
+
+ </target>
+
+ <target name="unzip-package-manager">
+ <unzip dest="${location.packagemanager}" src="${location.packagemanager.zip.file}"/>
+ </target>
+
+ <target name="setup-package-manager">
+
+ <java classname="org.jboss.ejb3.packagemanager.main.Setup" classpathref="package.manager.classpath" fork="true">
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- Schema script -->
+ <arg value="-f"/>
+ <arg value="${packagemanager.home}/script/schema.sql"/>
+ </java>
+
+ </target>
+
+
+
+</project>
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/jndi.properties
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/jndi.properties (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/jndi.properties 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
Added: projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/META-INF/persistence.xml
===================================================================
--- projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/META-INF/persistence.xml (rev 0)
+++ projects/ejb3/components/singleton/trunk/testsuite/src/test/resources/org/jboss/ejb3/singleton/integration/test/tx/META-INF/persistence.xml 2010-03-01 14:11:24 UTC (rev 101658)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="tempdb">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+</persistence>
More information about the jboss-cvs-commits
mailing list