KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > IASEjbCMPEntityDescriptor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment;
25
26 import java.io.*;
27 import java.util.*;
28 import java.util.logging.*;
29 import java.lang.reflect.*;
30
31 import com.sun.enterprise.util.TypeUtil;
32 import com.sun.enterprise.util.*;
33 import com.sun.enterprise.deployment.xml.*;
34 import com.sun.enterprise.deployment.interfaces.QueryParser;
35 import com.sun.enterprise.deployment.runtime.*;
36 import com.sun.enterprise.deployment.util.LogDomains;
37
38 /**
39  * This class contains information about EJB1.1 and EJB2.0 CMP EntityBeans.
40  */

41
42 public class IASEjbCMPEntityDescriptor extends EjbCMPEntityDescriptor {
43
44     private Class JavaDoc ejbClass = null;
45     private String JavaDoc pcImplClassName = null;
46     private String JavaDoc concreteImplClassName = null;
47     private String JavaDoc ejbImplClassName = null;
48     private String JavaDoc mappingProperties;
49     private ClassLoader JavaDoc jcl = null;
50     private String JavaDoc uniqueName = null;
51
52     private String JavaDoc moduleDir = null;
53
54     // for i18N
55
private static LocalStringManagerImpl localStrings =
56         new LocalStringManagerImpl(IASEjbCMPEntityDescriptor.class);
57     private static final Logger _logger = LogDomains.getLogger(LogDomains.DPL_LOGGER);
58
59     // Standard String and Character variables.
60
private static final char DOT = '.'; // NOI18N
61
private static final char LIST_START = '(';// NOI18N
62
private static final char LIST_END = ')'; // NOI18N
63
private static final char LIST_SEPARATOR = ','; // NOI18N
64
private static final char NAME_PART_SEPARATOR = '_'; // NOI18N
65
private static final char NAME_CONCATENATOR = ' '; // NOI18N
66
private static final String JavaDoc FIND = "find"; // NOI18N
67
private static final String JavaDoc EJB_SELECT = "ejbSelect"; // NOI18N
68
private static final String JavaDoc JDOSTATE = "_JDOState"; // NOI18N
69
private static final String JavaDoc CONCRETE_IMPL = "_ConcreteImpl"; // NOI18N
70
private static final String JavaDoc MAPPINGEXT = DOT + "mapping"; // NOI18N
71

72     private Collection finders = null;
73     private Collection selectors = null;
74     private QueryParser queryParser = null;
75     private PrefetchDisabledDescriptor prefetchDisabledDescriptor = null;
76     private static final Map conversionTable = createConversionTable();
77     private Map oneOneFinders = new HashMap();
78     private List arrOneOneFinders = new ArrayList();
79     
80     private void addAllInterfaceMethodsIn(Collection methodDescriptors, Class JavaDoc c) {
81         Method[] methods = c.getMethods();
82         for (int i=0; i<methods.length; i++) {
83             methodDescriptors.add(methods[i]);
84         }
85     }
86
87     private void addAllUniqueInterfaceMethodsIn(Collection methodDescriptors, Class JavaDoc c) {
88         Method[] methods = c.getMethods();
89         for (int i=0; i<methods.length; i++) {
90         if(findEquivalentMethod(methodDescriptors, methods[i]) == null)
91             methodDescriptors.add(methods[i]);
92         }
93     }
94
95     public Collection getAllUniqueMethods() {
96         HashSet methods = new HashSet();
97
98         try {
99             if (isRemoteInterfacesSupported()) {
100                 addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getHomeClassName()));
101                 addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getRemoteClassName()));
102             }
103             if (isLocalInterfacesSupported()) {
104                 addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getLocalHomeClassName()));
105                 addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getLocalClassName()));
106             }
107         } catch (Throwable JavaDoc t) {
108             _logger.log( Level.WARNING,
109                 "enterprise.deployment_error_loading_class_excp", t ); // NOI18N
110
throw new RuntimeException JavaDoc(t.getMessage());
111         }
112         return methods;
113
114     }
115
116     public Collection getAllMethods() {
117
118         HashSet methods = new HashSet();
119
120         try {
121             if (isRemoteInterfacesSupported()) {
122                 addAllInterfaceMethodsIn(methods, jcl.loadClass(getHomeClassName()));
123                 addAllInterfaceMethodsIn(methods, jcl.loadClass(getRemoteClassName()));
124             }
125
126             if (isLocalInterfacesSupported()) {
127                 addAllInterfaceMethodsIn(methods, jcl.loadClass(getLocalHomeClassName()));
128                 addAllInterfaceMethodsIn(methods, jcl.loadClass(getLocalClassName()));
129             }
130         } catch (Throwable JavaDoc t) {
131             _logger.log( Level.WARNING,
132                     "enterprise.deployment_error_loading_class_excp", t ); // NOI18N
133
throw new RuntimeException JavaDoc(t.getMessage());
134         }
135         return methods;
136     }
137
138
139     private Method findEquivalentMethod(Collection methods,
140                                         Method methodToMatch) {
141         if(methods == null)
142             return null;
143
144         Method matchedMethod = null;
145         for(Iterator iter = methods.iterator(); iter.hasNext();) {
146             Method next = (Method) iter.next();
147             // Compare methods, ignoring declaring class.
148
if( methodsEqual(next, methodToMatch, false) ) {
149                 matchedMethod = next;
150                 break;
151             }
152         }
153         return matchedMethod;
154     }
155
156      /**
157      * Checks whether two methods that might have been loaded by
158      * different class loaders are equal.
159      * @param compareDeclaringClass if true, declaring class will
160      * be considered as part of equality test.
161      */

162     private boolean methodsEqual(Method m1, Method m2,
163                                  boolean compareDeclaringClass) {
164         boolean equal = false;
165
166         do {
167             String JavaDoc m1Name = m1.getName();
168             String JavaDoc m2Name = m2.getName();
169
170             if( !m1Name.equals(m2Name) ) { break; }
171         
172             String JavaDoc m1DeclaringClass = m1.getDeclaringClass().getName();
173             String JavaDoc m2DeclaringClass = m2.getDeclaringClass().getName();
174
175             if( compareDeclaringClass ) {
176                 if( !m1DeclaringClass.equals(m2DeclaringClass) ) { break; }
177             }
178
179             Class JavaDoc[] m1ParamTypes = m1.getParameterTypes();
180             Class JavaDoc[] m2ParamTypes = m2.getParameterTypes();
181
182             if( m1ParamTypes.length != m2ParamTypes.length ) { break; }
183
184             equal = true;
185             for(int pIndex = 0; pIndex < m1ParamTypes.length; pIndex++) {
186                 String JavaDoc m1ParamClass = m1ParamTypes[pIndex].getName();
187                 String JavaDoc m2ParamClass = m2ParamTypes[pIndex].getName();
188                 if( !m1ParamClass.equals(m2ParamClass) ) {
189                     equal = false;
190                     break;
191                 }
192             }
193
194         } while(false);
195
196         return equal;
197     }
198
199     /**
200      * The method returns the class instance for the ejb class.
201      * @return ejb class
202      */

203     private Class JavaDoc getEjbClass() {
204         if (ejbClass == null) {
205             String JavaDoc ejbClassName = getEjbClassName();
206             if(_logger.isLoggable(Level.FINE))
207                 _logger.fine("@@@@@@ Ejb name is "+ ejbClassName); //NOI18N
208
if (jcl == null) {
209                 String JavaDoc msg = localStrings.getLocalString(
210                     "enterprise.deployment.error_missing_classloader", //NOI18N
211
"IASEjbCMPEntityDescriptor.getEjbClass"); //NOI18N
212
_logger.log(Level.WARNING, msg);
213                 throw new RuntimeException JavaDoc(msg);
214             }
215
216             try {
217                 ejbClass=Class.forName(ejbClassName, true, jcl);
218
219             } catch(ClassNotFoundException JavaDoc e) {
220                 String JavaDoc msg = localStrings.getLocalString(
221                     "enterprise.deployment.error_cannot_find_ejbclass", //NOI18N
222
ejbClassName);
223                 _logger.log(Level.WARNING, msg);
224                 throw new RuntimeException JavaDoc(msg);
225             }
226         }
227         return ejbClass;
228     }
229
230     /**
231      * Returns a collection of finder method instances.
232      */

233     public Collection getFinders() {
234         if (finders == null) {
235             String JavaDoc ejbClassName = getEjbClassName();
236             Class JavaDoc ejbClass = getEjbClass();
237                 
238             if ( super.isRemoteInterfacesSupported() ) {
239                 Class JavaDoc remoteHomeIntf = null;
240                 if(_logger.isLoggable(Level.FINE))
241                     _logger.fine("@@@@@@ " + ejbClassName + //NOI18N
242
" : Remote Interface is supported "); //NOI18N
243

244                 try {
245                     remoteHomeIntf = ejbClass.getClassLoader().loadClass(
246                         super.getHomeClassName());
247                 } catch (ClassNotFoundException JavaDoc ex) {
248                     _logger.log( Level.WARNING,
249                          "enterprise.deployment_class_not_found", ex ); //NOI18N
250

251                     return null;
252                 }
253
254                 finders = getFinders(remoteHomeIntf);
255                 if(_logger.isLoggable(Level.FINE)) {
256                     for(Iterator iter = finders.iterator(); iter.hasNext();) {
257                         Method remoteHomeMethod=(Method)iter.next();
258                         _logger.fine("@@@@ adding Remote interface method " + //NOI18N
259
remoteHomeMethod.getName() );
260                     }
261                 }
262             } //end of isRemoteInterfaceSupported
263

264             if ( super.isLocalInterfacesSupported() ) {
265                 Class JavaDoc localHomeIntf = null;
266
267                 if(_logger.isLoggable(Level.FINE))
268                     _logger.fine("@@@@@@ " + ejbClassName + ": Local Interface is supported "); //NOI18N
269

270                 try {
271                     localHomeIntf = ejbClass.getClassLoader().loadClass(
272                         super.getLocalHomeClassName());
273                 } catch (ClassNotFoundException JavaDoc ex) {
274                     _logger.log( Level.WARNING,
275                          "enterprise.deployment_class_not_found", ex ); //NOI18N
276
return null;
277                 }
278         
279                 Collection localFinders = getFinders(localHomeIntf);
280                 if(finders == null) {
281                     // if there were no finders specified in the remote
282
// home, the local finders are the finders
283
finders = localFinders;
284
285                 } else if(localFinders != null) {
286                     // Remove the Common Elements from the collections
287
// and keep only unique methods
288
if(_logger.isLoggable(Level.FINE))
289                         _logger.fine("@@@@@@ Trying to remove the Common Elements from HashSet....... "); //NOI18N
290

291                     for(Iterator iter = localFinders.iterator(); iter.hasNext();) {
292                         Method localHomeMethod=(Method)iter.next();
293                         if(findEquivalentMethod(finders, localHomeMethod) == null) {
294                             if(_logger.isLoggable(Level.FINE))
295                                 _logger.fine("@@@@ adding local interface method " + //NOI18N
296
localHomeMethod.getName() );
297
298                             finders.add(localHomeMethod);
299                         }
300                     }
301                 }
302             } //end of isLocalInterfaceSupported
303

304             if (finders == null)
305                 // still not initialized => empty set
306
finders = new HashSet();
307         }
308
309         return finders;
310     }
311
312     /**
313      * Returns a collection of finder methods declared by the home
314      * interface given by a class object.
315      */

316     public Collection getFinders(Class JavaDoc homeIntf) {
317         Method[] methods = homeIntf.getMethods();
318         Collection finders = new HashSet();
319         for(int i=0; i<methods.length; i++) {
320            if(methods[i].getName().startsWith(FIND)) {
321                finders.add(methods[i]);
322            }
323         }
324         
325         return finders;
326     }
327
328     public void setClassLoader(ClassLoader JavaDoc jcl) {
329         this.jcl = jcl;
330     }
331
332     public ClassLoader JavaDoc getClassLoader() {
333         return jcl;
334     }
335
336     public Collection getAllPersistentFields() {
337         PersistenceDescriptor pers = getPersistenceDescriptor();
338         PersistentFieldInfo[] persFields = pers.getPersistentFieldInfo();
339         PersistentFieldInfo[] pkeyFields = pers.getPkeyFieldInfo();
340         HashMap fields = new HashMap();
341
342         for(int i=0; i<persFields.length; i++) {
343             fields.put(persFields[i].name, persFields[i]);
344         }
345         
346         for(int i=0; i<pkeyFields.length; i++) {
347             fields.put(pkeyFields[i].name, pkeyFields[i]);
348         }
349         
350         return fields.values();
351     }
352     
353     public Collection getPersistentFields() {
354         
355         PersistenceDescriptor pers = getPersistenceDescriptor();
356         PersistentFieldInfo[] persFields = pers.getPersistentFieldInfo();
357         
358         HashMap fields = new HashMap();
359
360         for(int i=0; i<persFields.length; i++) {
361             fields.put(persFields[i].name, persFields[i]);
362         }
363         
364         return fields.values();
365     }
366
367     
368     public Collection getPrimaryKeyFields() {
369         
370         PersistenceDescriptor pers = getPersistenceDescriptor();
371         PersistentFieldInfo[] pkeyFields = pers.getPkeyFieldInfo();
372         
373         HashMap pkey = new HashMap();
374         for(int i=0; i<pkeyFields.length; i++) {
375             pkey.put(pkeyFields[i].name, pkeyFields[i]);
376         }
377         
378         return pkey.values();
379         
380     }
381
382     /**
383      * Returns a collection of selector methods.
384      */

385     public Collection getSelectors() {
386         if (selectors == null) {
387             selectors = new HashSet();
388             Class JavaDoc ejbClass = getEjbClass();
389             Method[] methods = ejbClass.getMethods();
390             for(int i=0; i<methods.length; i++) {
391                 if(methods[i].getName().startsWith(EJB_SELECT)) { //NOI18N
392
selectors.add(methods[i]);
393                 }
394             }
395         }
396         
397         return selectors;
398     }
399     
400     
401
402     public String JavaDoc getBaseName(String JavaDoc className) {
403         if (className == null)
404             return null;
405
406         int dot = className.lastIndexOf(DOT);
407         if (dot == -1)
408             return className;
409         return className.substring(dot+1);
410     }
411     
412     public IASEjbCMPEntityDescriptor() {
413     }
414     
415     /**
416      * The copy constructor.Hopefully we wont need it;)
417      */

418     public IASEjbCMPEntityDescriptor(EjbDescriptor other) {
419            super(other);
420
421            setPersistenceType(CONTAINER_PERSISTENCE);
422
423            if ( other instanceof EjbCMPEntityDescriptor ) {
424              EjbCMPEntityDescriptor entity = (EjbCMPEntityDescriptor)other;
425            }
426     }
427  
428   
429     /**
430      * Sets the State class implementation classname.
431      */

432      public void setPcImplClassName(String JavaDoc name) {
433          pcImplClassName = name;
434     }
435   
436     public String JavaDoc getUniqueName() {
437         if(uniqueName == null) {
438             BundleDescriptor bundle = getEjbBundleDescriptor();
439             Application application = bundle.getApplication();
440
441             // Add ejb name and application name.
442
StringBuffer JavaDoc rc = new StringBuffer JavaDoc().
443                     append(getName()).
444                     append(NAME_CONCATENATOR).
445                     append(application.getRegistrationName());
446
447             // If it's not just a module, add a module name.
448
if (!application.isVirtual()) {
449                 rc.append(NAME_CONCATENATOR).
450                    append(bundle.getModuleDescriptor().getArchiveUri());
451             }
452
453             uniqueName = getBaseName(getEjbClassName())
454                     + getUniqueNumber(rc.toString());
455         }
456
457         return uniqueName;
458     }
459
460     public String JavaDoc getUniqueNumber(String JavaDoc num) {
461         //Modified to decrease the possibility of collision
462
String JavaDoc newNum= "" + num.hashCode(); // NOI18N
463
newNum = newNum.replace('-', NAME_PART_SEPARATOR); // NOI18N
464
return newNum;
465      }
466
467
468     public String JavaDoc getPcImplClassName() {
469        if (pcImplClassName == null) {
470            // Check for Null added
471
pcImplClassName = getUniqueName() + JDOSTATE;
472            String JavaDoc packageName = getPackageName(getEjbClassName());
473            if(packageName != null)
474                pcImplClassName = packageName + DOT + pcImplClassName;
475
476             if(_logger.isLoggable(Level.FINE))
477                 _logger.fine("##### PCImplClass Name is " + pcImplClassName); // NOI18N
478
}
479         return pcImplClassName;
480     }
481
482
483       /**
484      * Sets the State class implementation classname.
485      */

486     public void setConcreteImplClassName(String JavaDoc name) {
487          concreteImplClassName = name;
488     }
489     
490     public String JavaDoc getPackageName(String JavaDoc className) {
491         int dot = className.lastIndexOf(DOT);
492         if (dot == -1)
493             return null;
494         return className.substring(0, dot);
495      }
496
497
498     /** IASRI 4725194
499      * Returns the Execution class, which is sam as the user-specified class
500      * in case of Message, Session and Bean Managed Persistence Entity Beans
501      * but is different for Container Mananged Persistence Entity Bean
502      * Therefore, the implementation in the base class is to return
503      * getEjbClassName() and the method is redefined in IASEjbCMPDescriptor.
504      *
505      */

506     public String JavaDoc getEjbImplClassName() {
507         if (ejbImplClassName == null) {
508             String JavaDoc packageName = getPackageName(getEjbClassName());
509             ejbImplClassName = getConcreteImplClassName();
510             if(packageName != null)
511                 ejbImplClassName = packageName + DOT + ejbImplClassName;
512         }
513         return ejbImplClassName;
514     }
515
516     /**
517      * Returns the classname of the State class impl.
518      */

519  
520     public String JavaDoc getConcreteImplClassName() {
521         if (concreteImplClassName == null) {
522         /** The Ear may contain two jar files with beans with same ejb names
523         */

524              concreteImplClassName = getUniqueName() + CONCRETE_IMPL;
525         }
526
527         return concreteImplClassName;
528     }
529
530     public void setModuleDir(String JavaDoc moduleRootDir) {
531         moduleDir = moduleRootDir;
532     }
533
534     /**
535     * Returns the Module root of this module.
536     */

537     public String JavaDoc getModuleDir() {
538         //FIXME:this needs to be changed when the API is available.
539
if(moduleDir != null)
540             return moduleDir;
541         else
542             return null;
543     }
544
545     public void setMappingProperties(String JavaDoc mappingProperties) {
546          this.mappingProperties = mappingProperties;
547     }
548     
549     
550     /**
551      * Returns the classname of the State class impl.
552      */

553     public String JavaDoc getMappingProperties() {
554          return mappingProperties;
555     }
556     
557     
558     /**
559      * Called from EjbBundleDescriptor/EjbBundleArchivist
560      * when some classes in this bean are updated.
561      */

562     public boolean classesChanged() {
563
564         /** No Implementation Yet
565         boolean superChanged = super.classesChanged();
566
567         boolean persChanged = pers.classesChanged();
568
569         // Send changed event only if parent didn't already do it.
570         if( !superChanged && persChanged ) {
571             changed();
572         }
573
574         return (superChanged || persChanged);
575         */

576         
577         return false;
578     }
579
580     /**
581      * This method sets the parser which would be used to parse the query
582      * parameter declaration given in sun-ejb-jar.xml.
583      * This method is called from JDOCodenerator class 's generate() method.
584      */

585     public void setQueryParser(QueryParser inParser) {
586         queryParser = inParser;
587     }
588     
589     /**
590      * Returns the query parser object
591      */

592     public QueryParser getQueryParser() {
593         return queryParser;
594     }
595
596     /**
597      * This method returns the conversion table which maps the unqualified
598      * name (e.g., String) of the java.lang classes to their fully qualified
599      * name (e.g., java.lang.String)
600      */

601     private static Map createConversionTable () {
602
603         HashMap conversionTable = new HashMap();
604         conversionTable.put("Boolean", "java.lang.Boolean"); //NOI18N
605
conversionTable.put("Byte", "java.lang.Byte"); //NOI18N
606
conversionTable.put("Character", "java.lang.Character"); //NOI18N
607
conversionTable.put("Double", "java.lang.Double"); //NOI18N
608
conversionTable.put("Float", "java.lang.Float"); //NOI18N
609
conversionTable.put("Integer", "java.lang.Integer"); //NOI18N
610
conversionTable.put("Long", "java.lang.Long"); //NOI18N
611
conversionTable.put("Number", "java.lang.Number"); //NOI18N
612
conversionTable.put("Short", "java.lang.Short"); //NOI18N
613
conversionTable.put("String", "java.lang.String"); //NOI18N
614
conversionTable.put("Object", "java.lang.Object"); //NOI18N
615
return conversionTable;
616     }
617     
618     private String JavaDoc getFullyQualifiedType(String JavaDoc type) {
619         String JavaDoc knownType=(String JavaDoc)conversionTable.get(type);
620         return knownType == null ? type : knownType;
621     }
622
623      /**
624       * Getter for prefetch-disabled
625       * @return Value of prefetchDisabledDescriptor
626       */

627     public PrefetchDisabledDescriptor getPrefetchDisabledDescriptor() {
628         return prefetchDisabledDescriptor;
629     }
630
631     /**
632      * Setter for prefetch-disabled
633      * @param prefetchDisabledDescriptor
634      * New value of prefetchDisabledDescriptor.
635      */

636     public void setPrefetchDisabledDescriptor(
637         PrefetchDisabledDescriptor prefetchDisabledDescriptor) {
638         this.prefetchDisabledDescriptor = prefetchDisabledDescriptor;
639     }
640
641     
642     /*
643      * Adds the given OneOneFinder to the HashMap
644      * @Param finder represents the EJB 1.1 Finder
645      */

646     public void addOneOneFinder (IASEjbCMPFinder finder) {
647         arrOneOneFinders.add(finder);
648     }
649     
650     /**
651      * Returns a Map which maps between a method signature and the
652      * corresponding IASEjbCMPFinder instance. The key is the method
653      * signature as a string and consists of methodName(type1, type2.....).
654      */

655     public Map getOneOneFinders() {
656         // update the oneOneFinders map if there are any entries pending in
657
// the array arrOneOneFinders.
658
if (!arrOneOneFinders.isEmpty()) {
659             if (queryParser == null) {
660                 String JavaDoc msg = localStrings.getLocalString(
661                     "enterprise.deployment.error_missing_queryparser", //NOI18N
662
"IASEjbCMPEntityDescriptor.getOneOneFinders"); //NOI18N
663
_logger.log(Level.WARNING, msg);
664                 throw new RuntimeException JavaDoc(msg);
665             }
666             
667             //parse the query declaration parameter and store the query object
668
for ( Iterator i = arrOneOneFinders.iterator(); i.hasNext(); ) {
669                 IASEjbCMPFinder finder = ( IASEjbCMPFinder )i.next();
670                 String JavaDoc key = generateKey(finder, queryParser);
671                 oneOneFinders.put(key, finder);
672             }
673             arrOneOneFinders.clear();
674         }
675         return oneOneFinders;
676     }
677     
678     /*
679      * @returns the key used to store 1.1 Finder Object.
680      * the key is methodName(param0, param1.....)
681      * @param finder is the object which represents the EJB 1.1 Finder
682      */

683     private String JavaDoc generateKey(IASEjbCMPFinder finder, QueryParser parser) {
684         
685         StringBuffer JavaDoc key = new StringBuffer JavaDoc();
686         key.append(finder.getMethodName()).append(LIST_START);
687
688         String JavaDoc queryParams = finder.getQueryParameterDeclaration();
689         Iterator iter = parser.parameterTypeIterator(queryParams);
690         while ( iter.hasNext() ) {
691             String JavaDoc type = ( String JavaDoc ) iter.next() ;
692             key.append(getFullyQualifiedType(type)) ;
693             if( iter.hasNext() ) {
694                 key.append(LIST_SEPARATOR);
695             }
696         }
697         key.append(LIST_END);
698
699         return key.toString().intern();
700     }
701     
702     /*
703      * @returns The finder object for the particular Method object.
704      * @param method object for which the Finder Object needs to be found
705      */

706     public IASEjbCMPFinder getIASEjbCMPFinder(Method method) {
707         //Checks if the given method is present in the interfaces.
708
if(findEquivalentMethod(getFinders(), method) == null ) {
709             return null;
710         }
711         String JavaDoc methodName = method.getName();
712         
713         //key is of the form methodName(param0, param1, ....)
714
StringBuffer JavaDoc key = new StringBuffer JavaDoc();
715         key.append(methodName);
716         key.append(LIST_START);
717         Class JavaDoc paramList[] = method.getParameterTypes();
718         for (int index = 0 ; index < paramList.length ; index++ ) {
719             if(index>0) {
720                 key.append(LIST_SEPARATOR);
721             }
722             key.append(paramList[index].getName());
723         }
724         key.append(LIST_END);
725         return (IASEjbCMPFinder)getOneOneFinders().get(key.toString());
726     }
727 }
728
Popular Tags