[jboss-cvs] JBossAS SVN: r88372 - in projects/ejb3/trunk/endpoint-deployer: src/main/java/org/jboss/ejb3/endpoint/deployers and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 7 12:06:11 EDT 2009
Author: ALRubinger
Date: 2009-05-07 12:06:11 -0400 (Thu, 07 May 2009)
New Revision: 88372
Added:
projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/DefaultEJBIdentifier.java
Modified:
projects/ejb3/trunk/endpoint-deployer/pom.xml
projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/impl/EndpointImpl.java
projects/ejb3/trunk/endpoint-deployer/src/main/resources/META-INF/jboss-beans.xml
projects/ejb3/trunk/endpoint-deployer/src/test/resources/deploy/ejb-container-beans.xml
Log:
[EJBTHREE-1786] Endpoint to support SFSB removal
Modified: projects/ejb3/trunk/endpoint-deployer/pom.xml
===================================================================
--- projects/ejb3/trunk/endpoint-deployer/pom.xml 2009-05-07 16:05:36 UTC (rev 88371)
+++ projects/ejb3/trunk/endpoint-deployer/pom.xml 2009-05-07 16:06:11 UTC (rev 88372)
@@ -127,7 +127,7 @@
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-core</artifactId>
- <version>1.1.4</version>
+ <version>1.1.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.jboss.jbossas</groupId>
Added: projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/DefaultEJBIdentifier.java
===================================================================
--- projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/DefaultEJBIdentifier.java (rev 0)
+++ projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/DefaultEJBIdentifier.java 2009-05-07 16:06:11 UTC (rev 88372)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.endpoint.deployers;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ear.spec.EarMetaData;
+
+/**
+ * DefaultEJBIdentifier
+ *
+ * Default implementation of an EJB Identifier; returns the name under
+ * which a specified EJB (within some scoped DeploymentUnit) is bound into
+ * MC
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DefaultEJBIdentifier implements EJBIdentifier
+{
+
+ private static final Logger log = Logger.getLogger(DefaultEJBIdentifier.class);
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.endpoint.deployers.EJBIdentifier#identifyEJB(org.jboss.deployers.structure.spi.DeploymentUnit, java.lang.String)
+ */
+ public String identifyEJB(DeploymentUnit unit, String ejbName)
+ {
+ // 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 (toplevelUnit.getAttachment(EarMetaData.class) != null)
+ {
+ 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(ejbName);
+
+ log.info("Container name generated for ejb = " + ejbName + " in unit " + unit + " is " + containerName);
+
+ try
+ {
+ ObjectName containerJMXName = new ObjectName(containerName.toString());
+ return containerJMXName.getCanonicalName();
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Modified: projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/impl/EndpointImpl.java
===================================================================
--- projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/impl/EndpointImpl.java 2009-05-07 16:05:36 UTC (rev 88371)
+++ projects/ejb3/trunk/endpoint-deployer/src/main/java/org/jboss/ejb3/endpoint/deployers/impl/EndpointImpl.java 2009-05-07 16:06:11 UTC (rev 88372)
@@ -31,7 +31,6 @@
import org.jboss.ejb3.endpoint.SessionFactory;
import org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandler;
import org.jboss.ejb3.proxy.spi.container.InvokableContext;
-import org.jboss.ejb3.proxy.spi.container.StatefulSessionFactory;
import org.jboss.logging.Logger;
/**
@@ -43,7 +42,7 @@
private static final Logger log = Logger.getLogger(EndpointImpl.class);
private InvokableContext container;
- private StatefulSessionFactory factory;
+ private SessionFactory factory;
public Serializable createSession(Class<?>[] initTypes, Object[] initValues)
{
@@ -51,12 +50,15 @@
throw new UnsupportedOperationException("SessionFactory " + this + " does not support arguments");
if(initValues != null && initValues.length != 0)
throw new UnsupportedOperationException("SessionFactory " + this + " does not support arguments");
- return factory.createSession();
+ return factory.createSession(initTypes, initValues);
}
public void destroySession(Serializable session)
{
- log.debug("Session destruction is not supported");
+ if(factory == null)
+ throw new IllegalStateException("Endpoint " + this + " is not session aware");
+
+ factory.destroySession(session);
}
public SessionFactory getSessionFactory() throws IllegalStateException
@@ -143,8 +145,11 @@
public void setContainer(InvokableContext container)
{
this.container = container;
- log.info("container " + container.getClass().getName());
- if(container instanceof StatefulSessionFactory)
- this.factory = (StatefulSessionFactory) container;
+ if (log.isTraceEnabled())
+ {
+ log.trace("Set container: " + container.getClass().getName());
+ }
+ if(container instanceof SessionFactory)
+ this.factory = (SessionFactory) container;
}
}
Modified: projects/ejb3/trunk/endpoint-deployer/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/endpoint-deployer/src/main/resources/META-INF/jboss-beans.xml 2009-05-07 16:05:36 UTC (rev 88371)
+++ projects/ejb3/trunk/endpoint-deployer/src/main/resources/META-INF/jboss-beans.xml 2009-05-07 16:06:11 UTC (rev 88372)
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<bean name="EJB3EndpointDeployer" class="org.jboss.ejb3.endpoint.deployers.EJB3EndpointDeployer"/>
+
+ <bean name="EJB3EndpointResolver" class="org.jboss.ejb3.endpoint.deployers.DefaultEndpointResolver"/>
+
+ <bean name="EJB3EJBIdentifier" class="org.jboss.ejb3.endpoint.deployers.DefaultEJBIdentifier"/>
</deployment>
\ No newline at end of file
Modified: projects/ejb3/trunk/endpoint-deployer/src/test/resources/deploy/ejb-container-beans.xml
===================================================================
--- projects/ejb3/trunk/endpoint-deployer/src/test/resources/deploy/ejb-container-beans.xml 2009-05-07 16:05:36 UTC (rev 88371)
+++ projects/ejb3/trunk/endpoint-deployer/src/test/resources/deploy/ejb-container-beans.xml 2009-05-07 16:06:11 UTC (rev 88372)
@@ -7,9 +7,9 @@
<bean name="EmbeddedCachedConnectionManagerBridge" class="org.jboss.ejb3.embedded.connectionmanager.EmbeddedCachedConnectionManager"/>
- <bean name="EJBIdentifier" class="org.jboss.ejb3.endpoint.deployers.test.common.MockEJBIdentifier"/>
+ <bean name="MockEJBIdentifier" class="org.jboss.ejb3.endpoint.deployers.test.common.MockEJBIdentifier"/>
- <bean name="EJB3EndpointResolver" class="org.jboss.ejb3.endpoint.deployers.DefaultEndpointResolver"/>
+ <bean name="MockEJB3EndpointResolver" class="org.jboss.ejb3.endpoint.deployers.DefaultEndpointResolver"/>
<bean name="TimerServiceFactory" class="org.jboss.ejb3.endpoint.deployers.test.common.MockTimerServiceFactory"/>
More information about the jboss-cvs-commits
mailing list