KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > api > BeanDesc


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: BeanDesc.java,v 1.59 2005/07/13 06:29:45 durieuxp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas_ejb.deployment.api;
27
28 import java.lang.reflect.Modifier JavaDoc;
29 import java.rmi.RemoteException JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.Arrays JavaDoc;
32 import java.util.Comparator JavaDoc;
33 import java.util.HashMap JavaDoc;
34 import java.util.Iterator JavaDoc;
35 import java.util.LinkedList JavaDoc;
36 import java.util.List JavaDoc;
37 import java.util.Properties JavaDoc;
38
39 import org.omg.CSI.ITTAbsent;
40 import org.omg.CSI.ITTAnonymous;
41 import org.omg.CSI.ITTDistinguishedName;
42 import org.omg.CSI.ITTPrincipalName;
43 import org.omg.CSI.ITTX509CertChain;
44 import org.omg.CSIIOP.Confidentiality;
45 import org.omg.CSIIOP.EstablishTrustInClient;
46 import org.omg.CSIIOP.EstablishTrustInTarget;
47 import org.omg.CSIIOP.IdentityAssertion;
48 import org.omg.CSIIOP.Integrity;
49
50 import org.objectweb.carol.util.csiv2.SasComponent;
51 import org.objectweb.carol.util.csiv2.struct.AsStruct;
52 import org.objectweb.carol.util.csiv2.struct.SasStruct;
53 import org.objectweb.carol.util.csiv2.struct.TransportStruct;
54
55 import org.objectweb.jonas_ejb.container.BeanFactory;
56 import org.objectweb.jonas_ejb.container.TraceEjb;
57 import org.objectweb.jonas_ejb.deployment.xml.AsContextMapping;
58 import org.objectweb.jonas_ejb.deployment.xml.AssemblyDescriptor;
59 import org.objectweb.jonas_ejb.deployment.xml.CommonEjb;
60 import org.objectweb.jonas_ejb.deployment.xml.ContainerTransaction;
61 import org.objectweb.jonas_ejb.deployment.xml.IorSecurityConfigMapping;
62 import org.objectweb.jonas_ejb.deployment.xml.JonasCommonEjb;
63 import org.objectweb.jonas_ejb.deployment.xml.Method;
64 import org.objectweb.jonas_ejb.deployment.xml.MethodPermission;
65 import org.objectweb.jonas_ejb.deployment.xml.SasContextMapping;
66 import org.objectweb.jonas_ejb.deployment.xml.TransportConfigMapping;
67 import org.objectweb.jonas_ejb.lib.BeanNaming;
68 import org.objectweb.jonas_ejb.lib.JavaType;
69
70 import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
71 import org.objectweb.jonas_lib.deployment.api.EjbLocalRefDesc;
72 import org.objectweb.jonas_lib.deployment.api.EjbRefDesc;
73 import org.objectweb.jonas_lib.deployment.api.EnvEntryDesc;
74 import org.objectweb.jonas_lib.deployment.api.JndiEnvRefsGroupDesc;
75 import org.objectweb.jonas_lib.deployment.api.MessageDestinationRefDesc;
76 import org.objectweb.jonas_lib.deployment.api.ResourceEnvRefDesc;
77 import org.objectweb.jonas_lib.deployment.api.ResourceRefDesc;
78 import org.objectweb.jonas_lib.deployment.api.SecurityRoleRefDesc;
79 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
80 import org.objectweb.jonas_lib.deployment.xml.RunAs;
81 import org.objectweb.jonas_lib.deployment.xml.SecurityRole;
82 import org.objectweb.jonas_lib.deployment.xml.SecurityRoleRef;
83
84 import org.objectweb.jonas_ws.deployment.api.ServiceRefDesc;
85
86 import org.objectweb.util.monolog.api.BasicLevel;
87 import org.objectweb.util.monolog.api.Logger;
88
89 /**
90  * Class to hold meta-information related to any enterprise-beans
91  *
92  * @author Christophe Ney [cney@batisseurs.com] : Initial developer
93  * @author Helene Joanin
94  * @author Jeff Mesnil
95  * @author Philippe Coq
96  * @author Florent Benoit & Ludovic Bert : ejb_link
97  */

98 public abstract class BeanDesc extends JndiEnvRefsGroupDesc {
99
100     /**
101      * Bean transaction type
102      */

103     protected static final int BEAN_TRANSACTION_TYPE = 1;
104
105     /**
106      * Container transaction type
107      */

108     protected static final int CONTAINER_TRANSACTION_TYPE = 2;
109
110     protected static final String JavaDoc[] TRANS = {null, "BEAN_TRANSACTION_TYPE", "CONTAINER_TRANSACTION_TYPE"};
111
112     private static final String JavaDoc ejb10PropertiesPrefix = "ejb10-properties/";
113
114     /**
115      * When no jndi-name specified, jndi name is set to Ejb-Name + "Home"
116      */

117     private static final String JavaDoc REMOTEDEFAULTSUFFIX = "Home";
118
119     /**
120      * When no local-jndi-name specified, local jndi name is set to jndi-name +
121      * "_L"
122      */

123     private static final String JavaDoc LOCALDEFAULTSUFFIX = "_L";
124
125     /**
126      * Package prefix for generated files
127      */

128     public static final String JavaDoc GENERATED_PREFIX = "org.objectweb.jonas_gen.";
129
130     /**
131      * name of the Bean
132      */

133     protected String JavaDoc ejbName = null;
134
135     /**
136      * JNDI name of the Bean
137      */

138     protected String JavaDoc jndiName = null;
139
140     /**
141      * JNDI local name of the Bean
142      */

143     protected String JavaDoc jndiLocalName = null;
144
145     /**
146      * Home Class
147      */

148     protected Class JavaDoc home = null;
149
150     /**
151      * Remote Class
152      */

153     protected Class JavaDoc remote = null;
154
155     /**
156      * LocalHome Class
157      */

158     protected Class JavaDoc localhome = null;
159
160     /**
161      * Local Class
162      */

163     protected Class JavaDoc local = null;
164
165     /**
166      * Bean Class
167      */

168     protected Class JavaDoc ejbClass = null;
169
170     /**
171      * bean identification string
172      */

173     protected String JavaDoc beanIdentification = null;
174     
175     /**
176      * EJB 1.0 Environment as Properties
177      */

178     protected Properties JavaDoc ejb10EnvProps = new Properties JavaDoc();
179
180     /**
181      * logger
182      */

183     protected Logger logger = null;
184
185     /**
186      * array of methods meta-info
187      */

188     private ArrayList JavaDoc methodDesc = new ArrayList JavaDoc();
189
190     /**
191      * hash map of the methods
192      */

193     private HashMap JavaDoc methodDescMap = new HashMap JavaDoc();
194
195     /**
196      * List of SecurityRoleRefDesc for JACC
197      */

198     protected List JavaDoc securityRoleRefDescList = null;
199
200     /**
201      * DeploymentDesc parent of this BeanDesc
202      */

203     protected DeploymentDesc deploymentDesc = null;
204
205     /**
206      * JOnAS Remote Wrapper fully qualified classname
207      */

208     private String JavaDoc fullWrpRemoteName = null;
209
210     /**
211      * JOnAS Remote Wrapper Classname
212      */

213     private String JavaDoc wrpRemoteName = null;
214
215     /**
216      * JOnAS Home Wrapper fully qualified classname
217      */

218     private String JavaDoc fullWrpHomeName = null;
219
220     /**
221      * JOnAS Home Wrapper Classname
222      */

223     private String JavaDoc wrpHomeName = null;
224
225     /**
226      * JOnAS Local Wrapper fully qualified classname
227      */

228     private String JavaDoc fullWrpLocalName = null;
229
230     /**
231      * JOnAS Local Wrapper Classname
232      */

233     private String JavaDoc wrpLocalName = null;
234
235     /**
236      * JOnAS LocalHome Wrapper fully qualified classname
237      */

238     private String JavaDoc fullWrpLocalHomeName = null;
239
240     /**
241      * JOnAS LocalHome Wrapper Classname
242      */

243     private String JavaDoc wrpLocalHomeName = null;
244
245     /**
246      * JOnAS Handle Wrapper fully qualified classname
247      */

248     private String JavaDoc fullWrpHandleName = null;
249
250     /**
251      * JOnAS Handle Wrapper Classname
252      */

253     private String JavaDoc wrpHandleName = null;
254
255     /**
256      * Bean fully qualified classname
257      */

258     protected String JavaDoc fullDerivedBeanName = null;
259
260     /**
261      * Bean classname
262      */

263     protected String JavaDoc derivedBeanName = null;
264
265     /**
266      * Run-as role
267      */

268     private String JavaDoc runAsRole = null;
269
270     /**
271      * Run-as principal name
272      */

273     private String JavaDoc runAsPrincipalName = null;
274
275     /**
276      * Minimum Bean Pool size
277      */

278     protected int poolMin = 0;
279
280     /**
281      * Maximum Bean Cache size
282      */

283     protected int cacheMax = 0;
284
285     /**
286      * SasComponent (for CSIv2 over IIOP)
287      */

288     private SasComponent sasComponent = null;
289
290     protected int timerTxAttribute = MethodDesc.TX_REQUIRES_NEW; // default
291

292     protected String JavaDoc ejbTimeoutSignature;
293
294     /**
295      * BeanFactory when the bean has been loaded.
296      */

297     protected BeanFactory bf = null;
298
299     /**
300      * Constructor to be used by parent node
301      *
302      * @param classLoader ClassLoader used to load Bean's classes
303      * @param ejb XML Element from standard Deployment Descriptor
304      * @param jonasEjb XML Element from jonas specific Deployment Descriptor
305      * @param asd XML Element for the AssemblyDescriptor
306      * @param fileName jar filename
307      *
308      * @throws DeploymentDescException when BeanDesc cannot be instanciated
309      * (class loading problem, ...)
310      */

311     public BeanDesc(ClassLoader JavaDoc classLoader, CommonEjb ejb, JonasCommonEjb jonasEjb, AssemblyDescriptor asd,
312             JLinkedList jMDRList, String JavaDoc fileName) throws DeploymentDescException {
313
314         super(classLoader, ejb, jonasEjb, fileName);
315         securityRoleRefDescList = new LinkedList JavaDoc();
316         if (ejb.getEjbName() != null) {
317             ejbName = ejb.getEjbName();
318         } else {
319             ejbName = null;
320         }
321
322         // If no value given specifically, we use ejbName+Home as JNDI name.
323
if (jonasEjb.getJndiName() != null) {
324             jndiName = jonasEjb.getJndiName();
325         } else {
326             jndiName = ejbName + REMOTEDEFAULTSUFFIX;
327         }
328         // If no value given specifically, we use jndiName+_L as JNDI local
329
// name.
330
if (jonasEjb.getJndiLocalName() != null) {
331             jndiLocalName = jonasEjb.getJndiLocalName();
332         } else {
333             jndiLocalName = jndiName + LOCALDEFAULTSUFFIX;
334         }
335
336         // classes
337
// --------------------------------------------------
338
if (ejb.getHome() != null) {
339             try {
340                 this.home = classLoader.loadClass(ejb.getHome());
341                 // check home extends javax.ejb.EJBHome
342
if (!javax.ejb.EJBHome JavaDoc.class.isAssignableFrom(this.home)) {
343                     throw new DeploymentDescException("Home class '" + ejb.getHome()
344                             + "' doesn't not extends javax.ejb.EJBHome");
345                 }
346             } catch (ClassNotFoundException JavaDoc e) {
347                 throw new DeploymentDescException("Home class not found for bean " + ejbName, e);
348             }
349         }
350
351         if (ejb.getRemote() != null) {
352             try {
353                 this.remote = classLoader.loadClass(ejb.getRemote());
354                 // check remote extends javax.ejb.EJBObject
355
if (!javax.ejb.EJBObject JavaDoc.class.isAssignableFrom(this.remote)) {
356                     throw new DeploymentDescException("Remote class '" + ejb.getRemote()
357                             + "' doesn't not extends javax.ejb.EJBObject");
358                 }
359             } catch (ClassNotFoundException JavaDoc e) {
360                 throw new DeploymentDescException("Remote class not found for bean " + ejbName, e);
361             }
362         }
363
364         String JavaDoc localhomename = ejb.getLocalHome();
365         // Note: Should do this only if bean is implied in a relation.
366
if (localhomename == null && this instanceof EntityCmp2Desc) {
367             localhomename = "javax.ejb.EJBLocalHome";
368         }
369         if (localhomename != null) {
370             try {
371                 this.localhome = classLoader.loadClass(localhomename);
372                 // check localhome extends javax.ejb.EJBLocalHome
373
if (!javax.ejb.EJBLocalHome JavaDoc.class.isAssignableFrom(this.localhome)) {
374                     throw new DeploymentDescException("LocalHome class '" + localhomename
375                             + "' doesn't not extends javax.ejb.EJBLocalHome");
376                 }
377             } catch (ClassNotFoundException JavaDoc e) {
378                 throw new DeploymentDescException("LocalHome class not found for bean " + ejbName, e);
379             }
380         }
381
382         String JavaDoc localname = ejb.getLocal();
383         // Note: Should do this only if bean is implied in a relation.
384
if (localname == null && this instanceof EntityCmp2Desc) {
385             localname = "javax.ejb.EJBLocalObject";
386         }
387         if (localname != null) {
388             try {
389                 this.local = classLoader.loadClass(localname);
390                 // check local extends javax.ejb.EJBLocalObject
391
if (!javax.ejb.EJBLocalObject JavaDoc.class.isAssignableFrom(this.local)) {
392                     throw new DeploymentDescException("Local class '" + localname
393                             + "' doesn't not extends javax.ejb.EJBLocalObject");
394                 }
395             } catch (ClassNotFoundException JavaDoc e) {
396                 throw new DeploymentDescException("Local class not found for bean " + ejbName, e);
397             }
398         }
399
400         // permit to load service-endpoint class
401
loadExtraClasses(ejb, classLoader);
402
403         try {
404             this.ejbClass = classLoader.loadClass(ejb.getEjbClass());
405             // check ejb-class extends javax.ejb.EnterpriseBean
406
if (!javax.ejb.EnterpriseBean JavaDoc.class.isAssignableFrom(this.ejbClass)) {
407                 throw new DeploymentDescException("Ejb class '" + ejb.getEjbClass()
408                         + "' doesn't not extends javax.ejb.EnterpriseBean");
409             }
410         } catch (ClassNotFoundException JavaDoc e) {
411             throw new DeploymentDescException("Ejb class not found for bean " + ejbName, e);
412         }
413
414         // Set EJB 1.0 Environment properties from env entries
415
EnvEntryDesc[] envt = getEnvEntryDesc();
416         for (int i = 0; i < envt.length; i++) {
417             if (envt[i].getName().startsWith(ejb10PropertiesPrefix)) {
418                 String JavaDoc newName = envt[i].getName().substring(ejb10PropertiesPrefix.length());
419                 String JavaDoc value = new String JavaDoc();
420                 if (envt[i].hasValue()) {
421                     value = envt[i].getValue().toString();
422                 }
423                 ejb10EnvProps.put(newName, value);
424             }
425         }
426
427         // run-as
428
if (ejb.getSecurityIdentity() != null) {
429             RunAs runAsElem = ejb.getSecurityIdentity().getRunAs();
430             if (runAsElem != null) {
431                 String JavaDoc roleName = runAsElem.getRoleName();
432                 if (roleName != null) {
433                     runAsRole = roleName;
434                     boolean runAsRoleFound = false;
435                     for (Iterator JavaDoc j = asd.getSecurityRoleList().iterator(); j.hasNext();) {
436                         SecurityRole securityRole = (SecurityRole) j.next();
437                         // role name of a security-role element defined in the
438
// assembly descriptor
439
String JavaDoc r = securityRole.getRoleName();
440                         if (r.equals(runAsRole)) {
441                             runAsRoleFound = true;
442                         }
443                     }
444                     //if there are no matching run-as and security-role
445
if (!runAsRoleFound) {
446                         throw new DeploymentDescException("There is no security-role defined for the run-as role: "
447                                 + runAsRole);
448                     }
449                 }
450                 // Run-as principal name
451
runAsPrincipalName = jonasEjb.getRunAsPrincipalName();
452                 // if no principal name set in JOnAS DD, set it to run-as role
453
if (runAsPrincipalName == null) {
454                     runAsPrincipalName = runAsRole;
455                 }
456             }
457         }
458
459         // populate array with all methods
460
try {
461             java.lang.reflect.Method JavaDoc[] m;
462             int beginIdx = methodDesc.size();
463             int len = 0;
464             if ((this.home != null) && (this.remote != null)) {
465                 // session bean or entity bean with remote interface
466
m = this.home.getMethods();
467                 for (int i = 0; i < m.length; i++) {
468                     if (!m[i].getDeclaringClass().equals(javax.ejb.EJBHome JavaDoc.class)
469                         || m[i].getName().equals("remove")) {
470                         addMethodDesc(m[i], this.home);
471                         len++;
472                         // check RemoteException is thrown
473
checkRemoteException(m[i], true);
474                         /*
475                          * // arguments and return types must be valid types for
476                          * RMI if
477                          * (!m[i].getDeclaringClass().equals(javax.ejb.EJBHome.class) &&
478                          * !m[i].getName().equals("findByPrimaryKey")) {
479                          * checkValidTypesForRmi(m[i]); }
480                          */

481                     }
482                 }
483
484                 m = this.remote.getMethods();
485                 for (int i = 0; i < m.length; i++) {
486                     if (!m[i].getDeclaringClass().equals(javax.ejb.EJBObject JavaDoc.class)
487                         || m[i].getName().equals("remove")) {
488                         addMethodDesc(m[i], this.remote);
489                         len++;
490                         // check RemoteException is thrown
491
checkRemoteException(m[i], true);
492                         /*
493                          * // arguments and return types must be valid for RMI
494                          * if
495                          * (!m[i].getDeclaringClass().equals(javax.ejb.EJBObject.class)) {
496                          * checkValidTypesForRmi(m[i]); }
497                          */

498                     }
499                 }
500             }
501             if ((this.localhome != null) && (this.local != null)) {
502                 // session bean or entity bean with local interface
503
m = this.localhome.getMethods();
504                 for (int i = 0; i < m.length; i++) {
505                     if (!m[i].getDeclaringClass().equals(javax.ejb.EJBLocalHome JavaDoc.class)
506                             || m[i].getName().equals("remove")) {
507                         addMethodDesc(m[i], this.localhome);
508                         len++;
509                         // check RemoteException is NOT thrown
510
checkRemoteException(m[i], false);
511                     }
512                 }
513                 m = this.local.getMethods();
514                 for (int i = 0; i < m.length; i++) {
515                     if (!m[i].getDeclaringClass().equals(javax.ejb.EJBLocalObject JavaDoc.class)
516                         || m[i].getName().equals("remove")) {
517                         addMethodDesc(m[i], this.local);
518                         len++;
519                         // check RemoteException is NOT thrown
520
checkRemoteException(m[i], false);
521                     }
522                 }
523             }
524             if (this.home == null && this.localhome == null) {
525
526                 if (ejb.getMessagingType() != null) {
527                     // message driven bean & endpoints
528
String JavaDoc msgType = ejb.getMessagingType();
529                     try {
530                         m = classLoader.loadClass(msgType).getMethods();
531                         for (int i = 0; i < m.length; i++) {
532                             addMethodDesc(m[i], m[i].getDeclaringClass());
533                             len++;
534                         }
535                     } catch (Exception JavaDoc ex) {
536                         throw new DeploymentDescException("Cannot load messaging type class (" + msgType + ") for "
537                                 + ejbName, ex);
538                     }
539                 }
540                 // (web)service-endpoints may have no home or local-home too !!
541
}
542
543             if (javax.ejb.EntityBean JavaDoc.class.isAssignableFrom(this.ejbClass)) {
544                 // ejbSelect methods
545
m = this.ejbClass.getMethods();
546                 for (int i = 0; i < m.length; i++) {
547                     if (m[i].getName().startsWith("ejbSelect") && Modifier.isAbstract(m[i].getModifiers())) {
548                         addMethodDesc(m[i], this.ejbClass);
549                         len++;
550                     }
551                 }
552             }
553
554             if (javax.ejb.TimedObject JavaDoc.class.isAssignableFrom(this.ejbClass)) {
555                 try {
556                     java.lang.reflect.Method JavaDoc timeout = this.ejbClass.getMethod("ejbTimeout",
557                             new Class JavaDoc[]{javax.ejb.Timer JavaDoc.class});
558                     addMethodDesc(timeout, this.ejbClass);
559                     len++;
560                 } catch (NoSuchMethodException JavaDoc e) {
561                     throw new DeploymentDescException("ejbTimeout not implemented in " + ejbName);
562                 }
563             }
564
565             len = addEJBMethodDesc(len);
566             orderMethodDesc(methodDesc, beginIdx, len);
567         } catch (SecurityException JavaDoc e) {
568             throw new DeploymentDescException("Cannot use java reflection on " + ejbName, e);
569         }
570
571         // populate HashMap with all security role references
572
// for each security-role-ref of the bean
573
if (ejb.getSecurityRoleRefList() != null) {
574             for (Iterator JavaDoc i = ejb.getSecurityRoleRefList().iterator(); i.hasNext();) {
575                 SecurityRoleRef sRoleRef = (SecurityRoleRef) i.next();
576                 // test if the assembly-descriptor element exists
577
if (asd == null) {
578                     throw new DeploymentDescException(
579                             "No assembly-descriptor element (and security-role elements) whereas security-role-ref element(s) are defined");
580                 } else {
581                     // test if the assembly-descriptor element contains
582
// security-role elements
583
if (asd.getSecurityRoleList().isEmpty()) {
584                         throw new DeploymentDescException(
585                                 "No security-role elements defined in the assembly-descriptor element whereas security-role-ref element(s) are defined");
586                     }
587                 }
588                 // test if the role-link element of the security-role-ref
589
// element exists
590
if (sRoleRef.getRoleLink() == null) {
591                     throw new DeploymentDescException(
592                             "No role-link element in a security-role-ref element with role-name element : "
593                                     + sRoleRef.getRoleName());
594                 }
595                 String JavaDoc roleLink = sRoleRef.getRoleLink();
596                 // correspond to role-name element in security-role-ref element
597
String JavaDoc roleRefName = sRoleRef.getRoleName();
598                 // to know if there are corresponding roleLink and roleRefName
599
boolean correspondingRoles = false;
600                 for (Iterator JavaDoc j = asd.getSecurityRoleList().iterator(); j.hasNext();) {
601                     SecurityRole securityRole = (SecurityRole) j.next();
602                     // role name of a security-role element defined in the
603
// assembly descriptor
604
String JavaDoc roleName = securityRole.getRoleName();
605                     if (roleName.equals(roleLink)) {
606                         securityRoleRefDescList.add(new SecurityRoleRefDesc(ejbName, sRoleRef, true));
607                         correspondingRoles = true;
608                     }
609                 }
610                 //if there are no matching roleLink and roleName
611
if (!correspondingRoles) {
612                     throw new DeploymentDescException(
613                             "No corresponding role-name in a security-role element for role-link : " + roleLink);
614                 }
615             }
616         }
617
618         // check if there are corresponding role-name element in security-role
619
// and method-permission element of the Assembly Descriptor
620
if (asd != null) {
621             verifyRoleName(asd);
622             // set method descriptor values for method permissions
623
for (Iterator JavaDoc i = asd.getMethodPermissionList().iterator(); i.hasNext();) {
624                 MethodPermission methodPermission = (MethodPermission) i.next();
625                 for (Iterator JavaDoc j = methodPermission.getMethodList().iterator(); j.hasNext();) {
626                     Method m = ((Method) j.next());
627                     // check method applies to current bean
628
if (!m.getEjbName().equals(ejbName)) {
629                         continue;
630                     }
631                     // selection of interface home/remote
632
Class JavaDoc pClass = null;
633                     if (m.getMethodIntf() != null) {
634                         pClass = getParentClass(m.getMethodIntf());
635                     }
636                     for (int k = 0; k < methodDesc.size(); k++) {
637                         MethodDesc md = (MethodDesc) methodDesc.get(k);
638                         int matchStatus = md.matchPattern(pClass, m.getMethodName(), m.getMethodParams());
639                         for (Iterator JavaDoc l = methodPermission.getRoleNameList().iterator(); l.hasNext();) {
640                             String JavaDoc roleName = (String JavaDoc) l.next();
641                             // Add only if it greater than APPLY_TO_NOTHING
642
if (matchStatus > MethodDesc.APPLY_TO_NOTHING) {
643                                 md.addRoleName(roleName);
644                             }
645                         }
646                     }
647                 }
648             }
649         }
650
651         // Set excluded method
652
if (asd != null && asd.getExcludeList() != null) {
653             // For each excluded method, find a methodDesc corresponding to this excluded method
654
for (Iterator JavaDoc i = asd.getExcludeList().getMethodList().iterator(); i.hasNext();) {
655                 Method m = (Method) i.next();
656                 // check method applies to current bean
657
if (!m.getEjbName().equals(ejbName)) {
658                     continue;
659                 }
660                 // selection of interface home/remote
661
Class JavaDoc pClass = null;
662                 if (m.getMethodIntf() != null) {
663                     pClass = getParentClass(m.getMethodIntf());
664                 }
665                 // Find methodDesc with matching pattern of excluded method
666
for (int k = 0; k < methodDesc.size(); k++) {
667                     MethodDesc md = (MethodDesc) methodDesc.get(k);
668                     int matchStatus = md.matchPattern(pClass, m.getMethodName(), m.getMethodParams());
669                     // Add only if it greater than APPLY_TO_NOTHING
670
if (matchStatus > MethodDesc.APPLY_TO_NOTHING) {
671                         md.setExcluded(true);
672                     }
673                 }
674             }
675         }
676
677         // set method descriptor values for container transactions
678
if (asd != null) {
679             // Loop on ContainerTransaction list
680
Iterator JavaDoc i = asd.getContainerTransactionList().iterator();
681             while (i.hasNext()) {
682                 ContainerTransaction cotr = (ContainerTransaction) i.next();
683                 // Loop on Method list
684
Iterator JavaDoc j = cotr.getMethodList().iterator();
685                 while (j.hasNext()) {
686                     Method m = (Method) j.next();
687                     // check method applies to current bean
688
if (!m.getEjbName().equals(ejbName)) {
689                         continue;
690                     }
691
692                     // selection of interface home/remote
693