[jboss-cvs] JBossAS SVN: r67225 - trunk/ejb3/src/main/org/jboss/ejb3.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Nov 17 15:51:41 EST 2007
Author: ALRubinger
Date: 2007-11-17 15:51:41 -0500 (Sat, 17 Nov 2007)
New Revision: 67225
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
Log:
[EJBTHREE-1066][EJBTHREE-712]: Added interfaces declared in ejb-jar.xml "business-remote"/"business-local" elements as @Remote or @Local
Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2007-11-17 20:49:39 UTC (rev 67224)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2007-11-17 20:51:41 UTC (rev 67225)
@@ -173,6 +173,8 @@
import org.jboss.metadata.ejb.spec.AroundInvokeMetaData;
import org.jboss.metadata.ejb.spec.AroundInvokesMetaData;
import org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
import org.jboss.metadata.ejb.spec.ContainerTransactionMetaData;
import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
import org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData;
@@ -732,40 +734,109 @@
{
if (enterpriseBean != null)
{
+ // Initialize
+ List<Class<?>> localClasses = new ArrayList<Class<?>>();
+ List<Class<?>> remoteClasses = new ArrayList<Class<?>>();
+ List<String> localClassNames = new ArrayList<String>();
+ List<String> remoteClassNames = new ArrayList<String>();
+
+ // Obtain business interfaces (local and remote)
+ BusinessLocalsMetaData businessLocals = enterpriseBean.getBusinessLocals();
+ BusinessRemotesMetaData businessRemotes = enterpriseBean.getBusinessRemotes();
+
+ // Obtain local and remote interfaces
String local = enterpriseBean.getLocal();
String remote = enterpriseBean.getRemote();
+
+ // If business locals are defined
+ if (businessLocals != null)
+ {
+ localClassNames.addAll(businessLocals);
+ }
- if (remote != null)
+ // If business remotes are defined
+ if (businessRemotes != null)
{
- StringTokenizer classes = new StringTokenizer(remote, ",");
- List<Class<?>> remoteClasses = new ArrayList<Class<?>>();
+ remoteClassNames.addAll(businessRemotes);
+ }
+
+ // If local interface(s) is/are defined
+ if (local != null)
+ {
+ // Add all defines local interfaces to list
+ StringTokenizer classes = new StringTokenizer(local, ",");
while (classes.hasMoreTokens())
{
String token = classes.nextToken();
String classname = token.trim();
- remoteClasses.add(di.getClassLoader().loadClass(classname));
-
+ localClassNames.add(classname);
}
- Class<?>[] intfs = new Class[remoteClasses.size()];
- intfs = remoteClasses.toArray(intfs);
- addClassAnnotation(container, Remote.class, new RemoteImpl(intfs));
}
-
- if (local != null)
+
+ // If remote interface(s) is/are defined
+ if (remote != null)
{
- StringTokenizer classes = new StringTokenizer(local, ",");
- List<Class<?>> localClasses = new ArrayList<Class<?>>();
+ // Add all defined remote interfaces to list
+ StringTokenizer classes = new StringTokenizer(remote, ",");
while (classes.hasMoreTokens())
{
String token = classes.nextToken();
String classname = token.trim();
- localClasses.add(di.getClassLoader().loadClass(classname));
+ remoteClassNames.add(classname);
+ }
+ }
+
+ // For each of the local and business local interfaces
+ for (String localClassName : localClassNames)
+ {
+ // Obtain class
+ Class<?> localClass = di.getClassLoader().loadClass(localClassName);
+ // Ensure specified class is an interface
+ if (!localClass.isInterface())
+ {
+ throw new RuntimeException("Specified class for @Local " + localClass.getName()
+ + " is not an interface");
}
- Class<?>[] intfs = new Class[localClasses.size()];
- intfs = localClasses.toArray(intfs);
- addClassAnnotation(container, Local.class, new LocalImpl(intfs));
+
+ // Log and add the business remote interface to the list of classes to be added as @Local
+ log.debug("Adding @Local interface " + localClass.getName() + " as specified in metadata");
+ localClasses.add(localClass);
}
+
+ // For each of the remote and business remote interfaces
+ for (String remoteClassName : remoteClassNames)
+ {
+ // Obtain class
+ Class<?> remoteClass = di.getClassLoader().loadClass(remoteClassName);
+
+ // Ensure specified class is an interface
+ if (!remoteClass.isInterface())
+ {
+ throw new RuntimeException("Specified class for @Remote " + remoteClass.getName()
+ + " is not an interface");
+ }
+
+ // Log and add the business remote interface to the list
+ log.debug("Adding @Remote interface " + remoteClass.getName() + " as specified in metadata");
+ remoteClasses.add(remoteClass);
+ }
+
+ // Add @Local to local and local business interfaces
+ if (localClasses.size() > 0)
+ {
+ Class<?>[] lIntfs = new Class[localClasses.size()];
+ lIntfs = localClasses.toArray(lIntfs);
+ addClassAnnotation(container, Local.class, new LocalImpl(lIntfs));
+ }
+
+ // Add @Remote to remote and remote business interfaces
+ if (remoteClasses.size() > 0)
+ {
+ Class<?>[] rIntfs = new Class[remoteClasses.size()];
+ rIntfs = remoteClasses.toArray(rIntfs);
+ addClassAnnotation(container, Remote.class, new RemoteImpl(rIntfs));
+ }
}
}
More information about the jboss-cvs-commits
mailing list