[jboss-cvs] JBossAS SVN: r67469 - in trunk/ejb3/src/main/org/jboss/ejb3: mdb and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 26 19:26:41 EST 2007
Author: ALRubinger
Date: 2007-11-26 19:26:41 -0500 (Mon, 26 Nov 2007)
New Revision: 67469
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
Log:
[EJBTHREE-1122][EJBTHREE-1123][EJBTHREE-1124] - Restrict business interfaces returned by ProxyfactoryHelper to unique values; Set implementation replaces previous List
Modified: trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-11-27 00:23:00 UTC (rev 67468)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-11-27 00:26:41 UTC (rev 67469)
@@ -22,7 +22,9 @@
package org.jboss.ejb3;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.ejb.EJBLocalObject;
import javax.ejb.EJBObject;
@@ -84,7 +86,7 @@
Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
// Obtain all business interfaces
- List<Class<?>> businessInterfaces = getBusinessInterfaces(container.getBeanClass());
+ Set<Class<?>> businessInterfaces = getBusinessInterfaces(container.getBeanClass());
// JIRA EJBTHREE-1062
// EJB 3 4.6.6
@@ -159,7 +161,7 @@
}
}
- Class<?>[] rtn = {(Class<?>) businessInterfaces.get(0)};
+ Class<?>[] rtn = {(Class<?>) businessInterfaces.iterator().next()};
localAnnotation = new LocalImpl(rtn);
((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Local.class, localAnnotation);
return rtn;
@@ -175,7 +177,7 @@
// introspect implemented interfaces.
if (localAnnotation == null)
{
- List<Class<?>> intfs = getBusinessInterfaces(beanClass);
+ Set<Class<?>> intfs = getBusinessInterfaces(beanClass);
ArrayList<Class<?>> locals = new ArrayList<Class<?>>();
for (Class<?> clazz : intfs)
{
@@ -196,10 +198,10 @@
if (localAnnotation == null)
{
// search for default
- List<Class<?>> interfaces = getBusinessInterfaces(beanClass);
+ Set<Class<?>> interfaces = getBusinessInterfaces(beanClass);
if (interfaces.size() != 1) return new Class[]{}; // indeterminate
- Class<?> intf = interfaces.get(0);
+ Class<?> intf = interfaces.iterator().next();
if (remoteInterfaces != null)
{
for (Class<?> rintf : remoteInterfaces)
@@ -249,13 +251,13 @@
* @return a list of potential business interfaces
* @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
*/
- public static List<Class<?>> getBusinessInterfaces(Class<?> beanClass)
+ public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
{
// Obtain all business interfaces implemented by this bean class and its superclasses
- return getBusinessInterfaces(beanClass, new ArrayList<Class<?>>());
+ return getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
}
- private static List<Class<?>> getBusinessInterfaces(Class<?> beanClass, List<Class<?>> interfaces)
+ private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
{
/*
* 4.6.6:
@@ -582,14 +584,19 @@
if (ri.value().length > 0) return ri.value();
+ // Obtain business interfaces
+ Set<Class<?>> set = getBusinessInterfaces(container.getBeanClass());
+
// We have an emtpy @Remote annotated bean class
-
- List<Class<?>> list = getBusinessInterfaces(container.getBeanClass());
- if (list.size() == 0)
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " and there are no valid business interfaces");
- if (list.size() > 1)
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " with more than one default interface " + list);
- Class<?>[] rtn = {(Class<?>) list.get(0)};
+ if (set.size() == 0)
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " and there are no valid business interfaces");
+ // More than one default interface
+ if (set.size() > 1)
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " with more than one default interface " + set);
+ Class<?>[] rtn =
+ {(Class<?>) set.iterator().next()};
ri = new RemoteImpl(rtn);
((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, ri);
return rtn;
Modified: trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java 2007-11-27 00:23:00 UTC (rev 67468)
+++ trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java 2007-11-27 00:26:41 UTC (rev 67469)
@@ -21,6 +21,19 @@
*/
package org.jboss.ejb3.mdb;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
import org.jboss.annotation.ejb.DefaultActivationSpecs;
import org.jboss.aop.AspectManager;
import org.jboss.aop.MethodInfo;
@@ -28,19 +41,7 @@
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
-import org.jboss.ejb3.stateful.StatefulDelegateWrapper;
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
/**
* Comment
*
@@ -72,10 +73,10 @@
messagingType = annotation.messageListenerInterface();
if (messagingType.getName().equals(Object.class.getName()))
{
- List<Class<?>> list = ProxyFactoryHelper.getBusinessInterfaces(clazz);
- if (list.size() > 1 || list.size() == 0)
- throw new RuntimeException("Unable to choose messagingType interface for MDB " + getEjbName() + " from " + list);
- messagingType = list.get(0);
+ Set<Class<?>> businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(clazz);
+ if (businessInterfaces.size() > 1 || businessInterfaces.size() == 0)
+ throw new RuntimeException("Unable to choose messagingType interface for MDB " + getEjbName() + " from " + businessInterfaces);
+ messagingType = businessInterfaces.iterator().next();
}
}
More information about the jboss-cvs-commits
mailing list