[jboss-cvs] JBossAS SVN: r106469 - in projects/ejb3/components/async/trunk: build and 24 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 6 16:05:29 EDT 2010
Author: ALRubinger
Date: 2010-07-06 16:05:27 -0400 (Tue, 06 Jul 2010)
New Revision: 106469
Added:
projects/ejb3/components/async/trunk/deployer/
projects/ejb3/components/async/trunk/deployer/pom.xml
projects/ejb3/components/async/trunk/deployer/src/
projects/ejb3/components/async/trunk/deployer/src/main/
projects/ejb3/components/async/trunk/deployer/src/main/java/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/deployer/
projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployer.java
projects/ejb3/components/async/trunk/deployer/src/main/resources/
projects/ejb3/components/async/trunk/deployer/src/main/resources/META-INF/
projects/ejb3/components/async/trunk/deployer/src/main/resources/META-INF/ejb3-async-deployer-jboss-beans.xml
projects/ejb3/components/async/trunk/deployer/src/test/
projects/ejb3/components/async/trunk/deployer/src/test/java/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployerTestCase.java
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/CachingDeployer.java
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaData.java
projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaDataDeployer.java
projects/ejb3/components/async/trunk/deployer/src/test/resources/
projects/ejb3/components/async/trunk/deployer/src/test/resources/ejb3-async-mock-deployer-jboss-beans.xml
projects/ejb3/components/async/trunk/deployer/src/test/resources/log4j.xml
projects/ejb3/components/async/trunk/spi/src/main/java/org/jboss/ejb3/async/spi/container/AttachmentNames.java
Modified:
projects/ejb3/components/async/trunk/build/pom.xml
projects/ejb3/components/async/trunk/impl/pom.xml
projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/RemotableFutureInterceptor.java
projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/r2/RemotableAsyncFutureInvocationHandler.java
projects/ejb3/components/async/trunk/pom.xml
projects/ejb3/components/async/trunk/spi/pom.xml
Log:
[EJBTHREE-1721] Add an Asynchronous ExecutorService deployer
Modified: projects/ejb3/components/async/trunk/build/pom.xml
===================================================================
--- projects/ejb3/components/async/trunk/build/pom.xml 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/build/pom.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -17,7 +17,7 @@
<!-- Artifact Configuration -->
<groupId>org.jboss.ejb3.async</groupId>
- <artifactId>async-build</artifactId>
+ <artifactId>jboss-ejb3-async-build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>JBoss EJB 3.1+ @Asynchronous Build</name>
<description>Centralized Build Configuration for EJB 3.1+ @Asynchronous Support</description>
Property changes on: projects/ejb3/components/async/trunk/deployer
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
bin
Added: projects/ejb3/components/async/trunk/deployer/pom.xml
===================================================================
--- projects/ejb3/components/async/trunk/deployer/pom.xml (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/pom.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,160 @@
+<!--
+ 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">
+
+ <!-- Define Parent -->
+ <parent>
+ <groupId>org.jboss.ejb3.async</groupId>
+ <artifactId>jboss-ejb3-async-build</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+
+ <!-- Maven POM Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Information -->
+ <artifactId>jboss-ejb3-async-deployer</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss EJB 3.1+ @Asynchronous Deployer</name>
+ <description>Microcontainer Integration Deployer Support for EJB 3.1+ @Asynchronous</description>
+
+ <!-- Build Configuration -->
+ <build>
+
+ </build>
+
+ <properties>
+
+ <!-- Versioning -->
+ <version.org.jboss.shrinkwrap>1.0.0-alpha-10</version.org.jboss.shrinkwrap>
+ <version.org.jboss.arquillian>1.0.0.Alpha2</version.org.jboss.arquillian>
+ <version.org.jboss.deployers.jboss_deployers_spi>2.2.0.Alpha4</version.org.jboss.deployers.jboss_deployers_spi>
+ <version.org.jboss.kernel>2.2.0.Alpha2</version.org.jboss.kernel>
+ <version.org.jboss.metadata_jboss.metadata>1.0.4</version.org.jboss.metadata_jboss.metadata>
+ <version.org.jboss.bootstrap>2.1.0-alpha-5</version.org.jboss.bootstrap>
+ <version.org.jboss.reloaded>0.1.2</version.org.jboss.reloaded>
+ <version.org.jboss.threads>2.0.0.CR4</version.org.jboss.threads>
+
+ </properties>
+
+ <dependencies>
+
+ <!--
+ Dependencies: org.jboss.ejb3
+ -->
+
+ <!-- org.jboss.ejb3.async:async-spi -->
+ <dependency>
+ <groupId>org.jboss.ejb3.async</groupId>
+ <artifactId>jboss-ejb3-async-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!--
+ Dependencies: External to EJB3
+ -->
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.org.jboss.kernel}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.org.jboss.deployers.jboss_deployers_spi}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-impl-mc</artifactId>
+ <version>${version.org.jboss.bootstrap}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.reloaded</groupId>
+ <artifactId>jboss-reloaded-vdf-bootstrap-minimal</artifactId>
+ <version>${version.org.jboss.reloaded}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ <version>${version.org.jboss.metadata_jboss.metadata}</version>
+ <scope>provided</scope>
+ <!-- Correct versions should come in through Reloaded or Deployers -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.threads</groupId>
+ <artifactId>jboss-threads</artifactId>
+ <version>${version.org.jboss.threads}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.threads</groupId>
+ <artifactId>jboss-threads-metadata</artifactId>
+ <version>${version.org.jboss.threads}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- junit:junit -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Arquillian -->
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${version.org.jboss.arquillian}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-reloaded</artifactId>
+ <version>${version.org.jboss.arquillian}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- ShrinkWrap -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-api</artifactId>
+ <version>${version.org.jboss.shrinkwrap}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-impl-base</artifactId>
+ <version>${version.org.jboss.shrinkwrap}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-extension-vfs3</artifactId>
+ <version>${version.org.jboss.shrinkwrap}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Added: projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployer.java
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployer.java (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/main/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployer.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.deployer;
+
+import java.util.concurrent.ExecutorService;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.async.spi.container.AttachmentNames;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * Deployer to attach a {@link ExecutorService} implementation
+ * to the current EJB 3.1 {@link DeploymentUnit}
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class AsyncExecutorServiceDeployer extends AbstractDeployer
+{
+ // ------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(AsyncExecutorServiceDeployer.class);
+
+ // ------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * {@link ExecutorService} implementation to attach to the {@link DeploymentUnit}
+ * if it's an EJB3 deployment
+ */
+ private final ExecutorService asyncExecutorService;
+
+ static String KEY_OUTPUT = AsyncExecutorServiceDeployer.class.getSimpleName();
+
+ // ------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ public AsyncExecutorServiceDeployer(@Inject final ExecutorService asyncExecutorService)
+ {
+ this.asyncExecutorService = asyncExecutorService;
+ this.setInput(JBossMetaData.class);
+ this.addOutput(KEY_OUTPUT);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ public void deploy(final DeploymentUnit unit) throws DeploymentException
+ {
+ log.info("Processing: " + unit);
+ // If not an EJB3 deployment, take no action
+ if (!this.isEjb3Deployment(unit))
+ {
+ return;
+ }
+
+ // Ensure the ES was injected
+ if (asyncExecutorService == null)
+ {
+ throw new IllegalStateException(ExecutorService.class.getSimpleName() + " implemenentation was not injected");
+ }
+
+ // Attach the ES
+ unit.addAttachment(AttachmentNames.ASYNC_INVOCATION_PROCESSOR, asyncExecutorService);
+ if (log.isTraceEnabled())
+ {
+ log.trace("Using async " + ExecutorService.class.getSimpleName() + " " + asyncExecutorService + " for "
+ + unit);
+ }
+ // Mark we've been here
+ unit.addAttachment(KEY_OUTPUT, Boolean.TRUE);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Helper Methods ---------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /*
+ * These may be overridden for testing purposes
+ */
+
+ /**
+ * Returns whether this is an EJB3 Deployment, determining if we should take action
+ * @param unit
+ * @return
+ */
+ boolean isEjb3Deployment(final DeploymentUnit unit)
+ {
+ // Obtain the Merged Metadata
+ final JBossMetaData md = unit.getAttachment(JBossMetaData.class);
+
+ // If metadata's not present as an attachment, return
+ if (md == null)
+ {
+ return false;
+ }
+
+ // If this is not an EJB3 Deployment, return
+ if (!md.isEJB3x())
+ {
+ return false;
+ }
+
+ // Meets conditions
+ return true;
+ }
+
+}
Added: projects/ejb3/components/async/trunk/deployer/src/main/resources/META-INF/ejb3-async-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/main/resources/META-INF/ejb3-async-deployer-jboss-beans.xml (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/main/resources/META-INF/ejb3-async-deployer-jboss-beans.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ EJB 3.1 @Asynchronous Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="org.jboss.ejb3.AsyncExecutorServiceDeployer"
+ class="org.jboss.ejb3.async.deployer.AsyncExecutorServiceDeployer">
+ <constructor>
+ <parameter name="asyncExecutorService"><inject name="org.jboss.ejb3.async.ExecutorService"/></parameter>
+ </constructor>
+ </bean>
+
+ <!-- Deployment configuration for a VFS TempFileProvider
+
+ <threads xmlns="urn:jboss:threads:2.0">
+ <thread-factory name="something"/>
+ <scheduled-thread-pool-executor name="somethingelse">
+ <max-threads count="1" per-cpu="1"/>
+ <thread-factory name="something"/>
+ </scheduled-thread-pool-executor>
+ </threads>
+
+ Currently fails with:
+
+ org.jboss.joinpoint.spi.JoinpointException: Constructor not found
+ org.jboss.threads.QueuelessExecutor[int, java.util.concurrent.ThreadFactory] in
+ [ReflectConstructorInfoImpl at 11afd9cc{[ReflectClassInfoImpl at 3003e926{name=java.util.concurrent.ThreadFactory},
+ ReflectClassInfoImpl at 50bfd66a{name=org.jboss.threads.DirectExecutor},
+ ReflectClassInfoImpl at 6295f290{name=java.util.concurrent.Executor}, long]}]
+
+ FIXME: Example on http://community.jboss.org/wiki/ThreadPoolConfiguration might need to be updated
+ Ask DML
+
+ -->
+
+ <!--
+ Define the Executor, but this should really be done in threads.xsd
+ format above
+ TODO Remove this when the above works
+ -->
+ <bean name="org.jboss.ejb3.async.ExecutorService" class="org.jboss.threads.JBossScheduledThreadPoolExecutor">
+ <constructor>
+ <parameter>1</parameter>
+ </constructor>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Added: projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployerTestCase.java
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployerTestCase.java (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/AsyncExecutorServiceDeployerTestCase.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.deployer;
+
+import java.util.concurrent.ExecutorService;
+import java.util.logging.Logger;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.async.spi.container.AttachmentNames;
+import org.jboss.reloaded.shrinkwrap.api.ShrinkWrapDeployer;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests to ensure the {@link AsyncExecutorServiceDeployer}
+ * is working as expected
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ */
+ at RunWith(Arquillian.class)
+public class AsyncExecutorServiceDeployerTestCase
+{
+
+ // ------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(AsyncExecutorServiceDeployerTestCase.class.getName());
+
+ /**
+ * The deployment containing the deployer chain under test
+ */
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "async-deployer.jar").addPackage(
+ AsyncExecutorServiceDeployer.class.getPackage())
+ .addResource("META-INF/ejb3-async-deployer-jboss-beans.xml").addManifestResource(
+ "ejb3-async-mock-deployer-jboss-beans.xml").addClasses(MockEjb3MetaData.class,
+ MockEjb3MetaDataDeployer.class);
+ log.info(archive.toString(true));
+ return archive;
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Deployer
+ */
+ @Inject
+ private ShrinkWrapDeployer deployer;
+
+ // ------------------------------------------------------------------------------||
+ // Tests ------------------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Ensures that the {@link AsyncExecutorServiceDeployer} attaches an {@link ExecutorService}
+ * implementation to incoming EJB3 deployments under name {@link AttachmentNames#ASYNC_INVOCATION_PROCESSOR}
+ */
+ @Test
+ public void attachesExecutorService() throws Exception
+ {
+ // Make a new fake deployment
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class).addClass(AsyncExecutorServiceDeployer.class);
+
+ // Deploy
+ deployer.deploy(archive);
+ try
+ {
+
+ // Grab the last DU as cached from the chain
+ final DeploymentUnit du = CachingDeployer.lastDeployed;
+ Assert.assertNotNull("Last deployment was not cached/processed", du);
+ log.info("Got last deployment: " + du);
+
+ // See that the ES was attached
+ final ExecutorService es = (ExecutorService) du.getAttachment(AttachmentNames.ASYNC_INVOCATION_PROCESSOR);
+ Assert.assertNotNull(ExecutorService.class.getSimpleName() + " was not attached to the incoming DU", es);
+ log.info("Got: " + es);
+ }
+ finally
+ {
+ // Undeploy
+ deployer.undeploy(archive);
+ }
+ }
+
+}
Added: projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/CachingDeployer.java
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/CachingDeployer.java (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/CachingDeployer.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.deployer;
+
+import java.util.logging.Logger;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Caches the last incoming {@link DeploymentUnit}
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class CachingDeployer extends AbstractDeployer
+{
+ static DeploymentUnit lastDeployed;
+
+ private static final Logger log = Logger.getLogger(CachingDeployer.class.getName());
+
+ public CachingDeployer()
+ {
+ this.addInput(AsyncExecutorServiceDeployer.KEY_OUTPUT);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ @Override
+ public void deploy(final DeploymentUnit unit) throws DeploymentException
+ {
+ log.info("Processing: " + unit);
+ lastDeployed = unit;
+ }
+}
Added: projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaData.java
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaData.java (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaData.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.deployer;
+
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * {@link JBossMetaData} implementation always reporting as EJB3
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class MockEjb3MetaData extends JBossMetaData
+{
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Always reports as EJB3.x
+ * @see org.jboss.metadata.ejb.jboss.JBossMetaData#isEJB3x()
+ */
+ @Override
+ public boolean isEJB3x()
+ {
+ return true;
+ }
+
+}
Added: projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaDataDeployer.java
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaDataDeployer.java (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/java/org/jboss/ejb3/async/deployer/MockEjb3MetaDataDeployer.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.deployer;
+
+import java.util.logging.Logger;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * Deployer to attach a mock EJB3 metadata to the current {@link DeploymentUnit}
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class MockEjb3MetaDataDeployer extends AbstractDeployer
+{
+ private static final Logger log = Logger.getLogger(CachingDeployer.class.getName());
+
+ public MockEjb3MetaDataDeployer()
+ {
+ this.setOutput(JBossMetaData.class);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ */
+ @Override
+ public void deploy(final DeploymentUnit unit) throws DeploymentException
+ {
+ // Attach mock EJB3 metadata
+ log.info("Processing: " + unit);
+ unit.addAttachment(JBossMetaData.class.getName(), new MockEjb3MetaData());
+ }
+}
Added: projects/ejb3/components/async/trunk/deployer/src/test/resources/ejb3-async-mock-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/resources/ejb3-async-mock-deployer-jboss-beans.xml (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/resources/ejb3-async-mock-deployer-jboss-beans.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="org.jboss.ejb3.mock.MockEjb3MetaDataDeployer"
+ class="org.jboss.ejb3.async.deployer.MockEjb3MetaDataDeployer" />
+
+ <bean name="org.jboss.ejb3.mock.CachingDeployer" class="org.jboss.ejb3.async.deployer.CachingDeployer" />
+
+</deployment>
\ No newline at end of file
Added: projects/ejb3/components/async/trunk/deployer/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/components/async/trunk/deployer/src/test/resources/log4j.xml (rev 0)
+++ projects/ejb3/components/async/trunk/deployer/src/test/resources/log4j.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A size based file rolling appender
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="DEBUG"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit JBoss categories to INFO
+ <category name="org.jboss">
+ <priority value="INFO" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!-- Increase the priority threshold for the DefaultDS category
+ <category name="DefaultDS">
+ <priority value="FATAL"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <category name="org.jboss.aop">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <!--
+ Unnecessary, EJB3 is exposed as DEBUG
+ <category name="org.jboss.ejb3.interceptors.aop.DomainClassLoader">
+ <priority value="DEBUG"/>
+ </category> -->
+
+ <category name="org.jboss.ejb3">
+ <priority value="DEBUG"/>
+ </category>
+
+ <category name="org.jboss.ejb3.async">
+ <priority value="ALL"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN" />
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Modified: projects/ejb3/components/async/trunk/impl/pom.xml
===================================================================
--- projects/ejb3/components/async/trunk/impl/pom.xml 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/impl/pom.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -8,7 +8,7 @@
<!-- Define Parent -->
<parent>
<groupId>org.jboss.ejb3.async</groupId>
- <artifactId>async-build</artifactId>
+ <artifactId>jboss-ejb3-async-build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../build/pom.xml</relativePath>
</parent>
@@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<!-- Artifact Information -->
- <artifactId>async-impl</artifactId>
+ <artifactId>jboss-ejb3-async-impl</artifactId>
<packaging>jar</packaging>
<name>JBoss EJB 3.1+ @Asynchronous Implementation (Internals)</name>
<description>Implementation Support for EJB 3.1+ @Asynchronous</description>
@@ -49,8 +49,8 @@
<!-- org.jboss.ejb3.async:async-spi -->
<dependency>
<groupId>org.jboss.ejb3.async</groupId>
- <artifactId>async-spi</artifactId>
- <version>${version}</version>
+ <artifactId>jboss-ejb3-async-spi</artifactId>
+ <version>${project.version}</version>
</dependency>
<!-- org.jboss.javaee:jboss-ejb-api_3.1 -->
Modified: projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/RemotableFutureInterceptor.java
===================================================================
--- projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/RemotableFutureInterceptor.java 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/RemotableFutureInterceptor.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -90,7 +90,7 @@
if (this.isRemoteInvocation(invocation))
{
// If the return value is a Future
- if (returnValue instanceof Future)
+ if (returnValue instanceof Future<?>)
{
// Cast
final Future<?> futureReturnValue = (Future<?>) returnValue;
Modified: projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/r2/RemotableAsyncFutureInvocationHandler.java
===================================================================
--- projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/r2/RemotableAsyncFutureInvocationHandler.java 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/impl/src/main/java/org/jboss/ejb3/async/impl/remote/r2/RemotableAsyncFutureInvocationHandler.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -79,7 +79,7 @@
* @return
* @throws NotBoundException If the specified invokerName is not bound in MC
*/
- private static InvokerLocator getClientBinding(String invokerName) throws NotBoundException
+ private static InvokerLocator getClientBinding(final String invokerName) throws NotBoundException
{
// Initialize
String url = null;
Modified: projects/ejb3/components/async/trunk/pom.xml
===================================================================
--- projects/ejb3/components/async/trunk/pom.xml 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/pom.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -45,6 +45,7 @@
<modules>
<module>spi</module>
<module>build</module>
+ <module>deployer</module>
<module>impl</module>
</modules>
Modified: projects/ejb3/components/async/trunk/spi/pom.xml
===================================================================
--- projects/ejb3/components/async/trunk/spi/pom.xml 2010-07-06 19:11:24 UTC (rev 106468)
+++ projects/ejb3/components/async/trunk/spi/pom.xml 2010-07-06 20:05:27 UTC (rev 106469)
@@ -8,7 +8,7 @@
<!-- Define Parent -->
<parent>
<groupId>org.jboss.ejb3.async</groupId>
- <artifactId>async-build</artifactId>
+ <artifactId>jboss-ejb3-async-build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../build/pom.xml</relativePath>
</parent>
@@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<!-- Artifact Information -->
- <artifactId>async-spi</artifactId>
+ <artifactId>jboss-ejb3-async-spi</artifactId>
<packaging>jar</packaging>
<name>JBoss EJB 3.1+ @Asynchronous SPI</name>
<description>Service Provider Interface for JBoss EJB 3.1+ @Asynchronous</description>
Added: projects/ejb3/components/async/trunk/spi/src/main/java/org/jboss/ejb3/async/spi/container/AttachmentNames.java
===================================================================
--- projects/ejb3/components/async/trunk/spi/src/main/java/org/jboss/ejb3/async/spi/container/AttachmentNames.java (rev 0)
+++ projects/ejb3/components/async/trunk/spi/src/main/java/org/jboss/ejb3/async/spi/container/AttachmentNames.java 2010-07-06 20:05:27 UTC (rev 106469)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.async.spi.container;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * Contract of deployment attachment names for the EJB 3.1 Asynchronous
+ * Implementation
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ */
+public interface AttachmentNames
+{
+ // ------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Name of the asynchronous {@link ExecutorService} used to process incoming
+ * async invocations
+ */
+ String ASYNC_INVOCATION_PROCESSOR = "org.jboss.ejb3.async." + ExecutorService.class.getSimpleName();
+}
More information about the jboss-cvs-commits
mailing list