KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > deployment > rmi > TieGenerator


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * TieGenerator.java
20  *
21  * This class is responsible for generating the tie classes for the RMI
22  * interfaces. These Tie classes will act as container boundary for validation
23  * purposes much like the home interface.
24  */

25
26 // package path
27
package com.rift.coad.lib.deployment.rmi;
28
29 // java imports
30
import java.io.File JavaDoc;
31 import java.io.FileWriter JavaDoc;
32 import java.lang.reflect.Method JavaDoc;
33 import java.lang.reflect.Type JavaDoc;
34 import java.net.URLClassLoader JavaDoc;
35 import java.net.URL JavaDoc;
36 import java.util.StringTokenizer JavaDoc;
37 import java.util.Vector JavaDoc;
38 import java.util.Iterator JavaDoc;
39 import java.util.regex.Matcher JavaDoc;
40 import java.util.regex.Pattern JavaDoc;
41
42 // logging import
43
import org.apache.log4j.Logger;
44
45 // coadunation imports
46
import com.rift.coad.lib.bean.BeanPattern;
47 import com.rift.coad.lib.common.ClassUtil;
48 import com.rift.coad.lib.common.FileUtil;
49 import com.rift.coad.lib.common.RandomGuid;
50 import com.rift.coad.lib.common.ResourceReader;
51 import com.rift.coad.lib.deployment.BeanInfo;
52
53 /**
54  * This class is responsible for generating the tie classes for the RMI
55  * interfaces. These Tie classes will act as container boundary for validation
56  * purposes much like the home interface.
57  *
58  * @author Brett Chaldecott
59  */

60 public class TieGenerator {
61     
62     // the class constants
63
private final static String JavaDoc TIE_TEMPLATE =
64             "com/rift/coad/lib/deployment/rmi/resources/TieTemplate.txt";
65     private final static String JavaDoc METHOD_TEMPLATE =
66             "com/rift/coad/lib/deployment/rmi/resources/BasicMethodTemplate.txt";
67     private final static String JavaDoc VOID_METHOD_TEMPLATE =
68             "com/rift/coad/lib/deployment/rmi/resources/" +
69             "VoidMethodTemplate.txt";
70     private final static String JavaDoc CACHE_METHOD_TEMPLATE =
71             "com/rift/coad/lib/deployment/rmi/resources/CacheMethodTemplate.txt";
72     private final static String JavaDoc KEY_CACHE_ADD_METHOD_TEMPLATE =
73             "com/rift/coad/lib/deployment/rmi/resources/" +
74             "KeyCacheAddMethodTemplate.txt";
75     private final static String JavaDoc KEY_CACHE_FIND_METHOD_TEMPLATE =
76             "com/rift/coad/lib/deployment/rmi/resources/" +
77             "KeyCacheFindMethodTemplate.txt";
78     private final static String JavaDoc KEY_CACHE_REMOVE_METHOD_TEMPLATE =
79             "com/rift/coad/lib/deployment/rmi/resources/" +
80             "KeyCacheRemoveMethodTemplate.txt";
81     private final static String JavaDoc VOID_KEY_CACHE_REMOVE_METHOD_TEMPLATE =
82             "com/rift/coad/lib/deployment/rmi/resources/" +
83             "VoidKeyCacheRemoveMethodTemplate.txt";
84     private final static String JavaDoc TRANSACTION_METHOD_TEMPLATE =
85             "com/rift/coad/lib/deployment/rmi/resources/" +
86             "TransactionBasicMethodTemplate.txt";
87     private final static String JavaDoc TRANSACTION_VOID_METHOD_TEMPLATE =
88             "com/rift/coad/lib/deployment/rmi/resources/" +
89             "TransactionVoidMethodTemplate.txt";
90     private final static String JavaDoc TRANSACTION_CACHE_METHOD_TEMPLATE =
91             "com/rift/coad/lib/deployment/rmi/resources/" +
92             "TransactionCacheMethodTemplate.txt";
93     private final static String JavaDoc TRANSACTION_KEY_CACHE_ADD_METHOD_TEMPLATE =
94             "com/rift/coad/lib/deployment/rmi/resources/" +
95             "TransactionKeyCacheAddMethodTemplate.txt";
96     private final static String JavaDoc TRANSACTION_KEY_CACHE_FIND_METHOD_TEMPLATE =
97             "com/rift/coad/lib/deployment/rmi/resources/" +
98             "TransactionKeyCacheFindMethodTemplate.txt";
99     private final static String JavaDoc TRANSACTION_KEY_CACHE_REMOVE_METHOD_TEMPLATE =
100             "com/rift/coad/lib/deployment/rmi/resources/" +
101             "TransactionKeyCacheRemoveMethodTemplate.txt";
102     private final static String JavaDoc
103             TRANSACTION_VOID_KEY_CACHE_REMOVE_METHOD_TEMPLATE =
104             "com/rift/coad/lib/deployment/rmi/resources/" +
105             "TransactionVoidKeyCacheRemoveMethodTemplate.txt";
106     private final static String JavaDoc METHOD_PARAMETER = "%s%s p%d";
107     private final static String JavaDoc PARAMETER = "%s p%d";
108     private final static String JavaDoc TIE_CLASS_NAME = "%s_CoadTie";
109     
110     // the class log variable
111
protected Logger log =
112             Logger.getLogger(TieGenerator.class.getName());
113     
114     // private member variables
115
private File JavaDoc dir = null;
116     private File JavaDoc targetDir = null;
117     private BeanInfo beanInfo = null;
118     private ClassLoader JavaDoc classLoader = null;
119     
120     // templates
121
private String JavaDoc tieTemplate = null;
122     private String JavaDoc basicMethodTemplate = null;
123     private String JavaDoc voidMethodTemplate = null;
124     private String JavaDoc cacheMethodTemplate = null;
125     private String JavaDoc keyCacheAddMethodTemplate = null;
126     private String JavaDoc keyCacheFindMethodTemplate = null;
127     private String JavaDoc keyCacheRemoveMethodTemplate = null;
128     private String JavaDoc voidKeyCacheRemoveMethodTemplate = null;
129     private String JavaDoc transactionBasicMethodTemplate = null;
130     private String JavaDoc transactionVoidMethodTemplate = null;
131     private String JavaDoc transactionCacheMethodTemplate = null;
132     private String JavaDoc transactionKeyCacheAddMethodTemplate = null;
133     private String JavaDoc transactionKeyCacheFindMethodTemplate = null;
134     private String JavaDoc transactionKeyCacheRemoveMethodTemplate = null;
135     private String JavaDoc transactionVoidKeyCacheRemoveMethodTemplate = null;
136     
137     /**
138      * Creates a new instance of TieGenerator
139      *
140      * @param dir The directory containing all the jars.
141      * @param targetDir The target directory for the tie class.
142      * @param classes The class to generate the ties for.
143      * @exception RMIException
144      */

145     public TieGenerator(File JavaDoc dir, File JavaDoc targetDir, BeanInfo beanInfo) throws
146             RMIException {
147         this.dir = dir;
148         this.targetDir = targetDir;
149         this.beanInfo = beanInfo;
150         initClassLoader();
151         
152         try {
153             tieTemplate = new ResourceReader(TIE_TEMPLATE).getDocument();
154             basicMethodTemplate =
155                     new ResourceReader(METHOD_TEMPLATE).getDocument();
156             voidMethodTemplate =
157                     new ResourceReader(VOID_METHOD_TEMPLATE).getDocument();
158             cacheMethodTemplate =
159                     new ResourceReader(CACHE_METHOD_TEMPLATE).getDocument();
160             keyCacheAddMethodTemplate =
161                     new ResourceReader(KEY_CACHE_ADD_METHOD_TEMPLATE)
162                     .getDocument();
163             keyCacheFindMethodTemplate =
164                     new ResourceReader(KEY_CACHE_FIND_METHOD_TEMPLATE)
165                     .getDocument();
166             keyCacheRemoveMethodTemplate =
167                     new ResourceReader(KEY_CACHE_REMOVE_METHOD_TEMPLATE)
168                     .getDocument();
169             voidKeyCacheRemoveMethodTemplate =
170                     new ResourceReader(VOID_KEY_CACHE_REMOVE_METHOD_TEMPLATE)
171                     .getDocument();
172             transactionBasicMethodTemplate =
173                     new ResourceReader(TRANSACTION_METHOD_TEMPLATE).
174                     getDocument();
175             transactionVoidMethodTemplate =
176                     new ResourceReader(TRANSACTION_VOID_METHOD_TEMPLATE).
177                     getDocument();
178             transactionCacheMethodTemplate =
179                     new ResourceReader(
180                     TRANSACTION_CACHE_METHOD_TEMPLATE).
181                     getDocument();
182             transactionKeyCacheAddMethodTemplate =
183                     new ResourceReader(
184                     TRANSACTION_KEY_CACHE_ADD_METHOD_TEMPLATE)
185                     .getDocument();
186             transactionKeyCacheFindMethodTemplate =
187                     new ResourceReader(
188                     TRANSACTION_KEY_CACHE_FIND_METHOD_TEMPLATE)
189                     .getDocument();
190             transactionKeyCacheRemoveMethodTemplate =
191                     new ResourceReader(
192                     TRANSACTION_KEY_CACHE_REMOVE_METHOD_TEMPLATE)
193                     .getDocument();
194             transactionVoidKeyCacheRemoveMethodTemplate =
195                     new ResourceReader(
196                     TRANSACTION_VOID_KEY_CACHE_REMOVE_METHOD_TEMPLATE)
197                     .getDocument();
198         } catch (Exception JavaDoc ex) {
199             log.error("Failed retrieve the resource : " + ex.getMessage(),ex);
200             throw new RMIException("Failed retrieve the resource : " +
201                     ex.getMessage(),ex);
202         }
203     }
204     
205     
206     /**
207      * This method generates the Tie classes.
208      *
209      * @exception RMIException
210      */

211     public void generate() throws RMIException {
212         Class JavaDoc ref = getClass(beanInfo.getClassName());
213         createTie(targetDir,ref);
214         
215         // misc classes
216
Vector JavaDoc classes = beanInfo.getClasses();
217         for (int index = 0; index < classes.size(); index++) {
218             ref = getClass((String JavaDoc)classes.get(index));
219             createTie(targetDir,ref);
220         }
221     }
222     
223     
224     /**
225      * This method inits the class loader.
226      *
227      * @exception RMIException
228      */

229     private void initClassLoader() throws RMIException {
230         try {
231             File JavaDoc[] jars = FileUtil.filter(dir.listFiles(),"jar");
232             URL JavaDoc[] urls = new URL JavaDoc[jars.length + 1];
233             urls[0] = dir.toURL();
234             for (int index = 0; index < jars.length; index++) {
235                 urls[index+1] = jars[index].toURL();
236             }
237             
238             classLoader = new URLClassLoader JavaDoc(
239                     urls,this.getClass().getClassLoader());
240         } catch (Exception JavaDoc ex) {
241             log.error("Failed to init the class loader : " + ex.getMessage(),ex);
242             throw new RMIException("Failed to init the class loader : " +
243                     ex.getMessage(),ex);
244         }
245     }
246     
247     
248     /**
249      * This method returns a reference to the class using the class name.
250      *
251      * @return The reference to the class to retrieve.
252      * @param className The name of the class to retrieve.
253      * @exception RMIException
254      */

255     private Class JavaDoc getClass(String JavaDoc className) throws RMIException {
256         try {
257             return classLoader.loadClass(className);
258         } catch (Exception JavaDoc ex) {
259             log.error("Failed to retrieve the class: " + ex.getMessage(),ex);
260             throw new RMIException("Failed to retrieve the class : " +
261                     ex.getMessage(),ex);
262         }
263     }
264     
265     
266     /**
267      * This method creates the package directory.
268      *
269      * @return The package directory
270      * @param ref The reference to the class to retrieve.
271      * @exception RMIException
272      */

273     private File JavaDoc createPackageDir(File JavaDoc tmpDir,Class JavaDoc ref) throws RMIException {
274         try {
275             String JavaDoc className = ref.getCanonicalName();
276             StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(className,".");
277             File JavaDoc base = tmpDir;
278             int numElements = tokenizer.countTokens() - 1;
279             String JavaDoc seperator = "";
280             for(int count = 0; count < numElements; count++) {
281                 File JavaDoc newDir = new File JavaDoc(base,tokenizer.nextToken());
282                 newDir.mkdir();
283                 base = newDir;
284             }
285             return base;
286         } catch (Exception JavaDoc ex) {
287             log.error("Failed to create the package: " + ex.getMessage(),ex);
288             throw new RMIException("Failed to create the package dir : " +
289                     ex.getMessage(),ex);
290         }
291     }
292     
293     
294     /**
295      * This method creates the tie file.
296      *
297      * @param ref The reference to the class.
298      * @param packageDir The package directory.
299      * @exception RMIException
300      */

301     private void createTie(File JavaDoc tmpDir,Class JavaDoc ref) throws RMIException {
302         try {
303             if (!ClassUtil.testForParent(ref,
304                     java.rmi.Remote JavaDoc.class)) {
305                 // ignore as it has not remote interface
306
return;
307             }
308             File JavaDoc packageDir = createPackageDir(tmpDir,ref);
309             Vector JavaDoc interfaces = getInterfaces(ref);
310             String JavaDoc methods = "";
311             Iterator JavaDoc iter = interfaces.iterator();
312             String JavaDoc interfaceList = getImplements(ref);
313             while(iter.hasNext()) {
314                 Class JavaDoc interfaceRef = (Class JavaDoc)iter.next();
315                 Method JavaDoc[] methodList = interfaceRef.getDeclaredMethods();
316                 for (int index = 0; index < methodList.length; index++) {
317                     methods += generateCodeForMethod(methodList[index]);
318                 }
319             }
320             
321             // parse the tie class template
322
String JavaDoc tieClassName = String.format(TIE_CLASS_NAME,ref.
323                     getSimpleName());
324             String JavaDoc tieClass = new String JavaDoc(tieTemplate);
325             tieClass = tieClass.replaceAll("%package%","package " +
326                     ref.getPackage().getName() + ";");
327             tieClass = tieClass.replaceAll("%tieClassName%",tieClassName);
328             tieClass = tieClass.replaceAll("%implements%",interfaceList);
329             tieClass = tieClass.replaceAll("%target%",ref.getName());
330             tieClass = tieClass.replaceAll("%methods%",methods);
331             
332             // write out the tie class
333
File JavaDoc tieClassFile = new File JavaDoc(packageDir,tieClassName + ".java");
334             FileWriter JavaDoc fileWriter = new FileWriter JavaDoc(tieClassFile);
335             fileWriter.write(tieClass);
336             fileWriter.close();
337         } catch (Exception JavaDoc ex) {
338             log.error("Failed to create the tie : " + ex.getMessage(),ex);
339             throw new RMIException("Failed to create the tie : " +
340                     ex.getMessage(),ex);
341         }
342     }
343     
344     
345     /**
346      * This recursive method retrieve a lit of interfaces that inherit from
347      * Remote.
348      *
349      * @return The list of interfaces that inherit from remote.
350      * @param ref The reference to the class to retrieve the list for.
351      * @exception RMIException
352      */

353     private Vector JavaDoc getInterfaces(Class JavaDoc ref) throws RMIException {
354         if (ref == null) {
355             return new Vector JavaDoc();
356         } else if (ref.getName().equals(java.lang.Object JavaDoc.class.getName())) {
357             return new Vector JavaDoc();
358         }
359         Vector JavaDoc results = new Vector JavaDoc();
360         Class JavaDoc[] interfaces = ref.getInterfaces();
361         for (int index = 0; index < interfaces.length; index++) {
362             if (ClassUtil.testForParent(interfaces[index],"java.rmi.Remote")) {
363                 results.add(interfaces[index]);
364                 results.addAll(getInterfaces(interfaces[index]));
365             }
366         }
367         results.addAll(getInterfaces(ref.getSuperclass()));
368         return results;
369     }
370     
371     /**
372      * This method returns the list of RMI implemented interfaces.
373      *
374      * @return The list of implemented interfaces.
375      * @param ref The reference.
376      * @exception RMIException
377      */

378     public String JavaDoc getImplements(Class JavaDoc ref) throws RMIException {
379         String JavaDoc interfaceList = "";
380         Class JavaDoc[] interfaces = ref.getInterfaces();
381         for (int index = 0; index < interfaces.length; index++) {
382             if (ClassUtil.testForParent(interfaces[index],"java.rmi.Remote")) {
383                 interfaceList += "," + interfaces[index].getName();
384             }
385         }
386         return interfaceList;
387     }
388     
389     
390     /**
391      * This method generates the code for a given method.
392      *
393      * @return The string containing the code for the tie method.
394      * @param method The method that the code is getting generated for.
395      * @exception RMIException
396      */

397     private String JavaDoc generateCodeForMethod(Method JavaDoc method)
398             throws RMIException {
399         String JavaDoc methodName = method.getName();
400         String JavaDoc returnType = classTypeToString(method.getReturnType());
401         Class JavaDoc[] parametersTypes = method.getParameterTypes();
402         String JavaDoc fullParameters = "";
403         String JavaDoc parameters = "";
404         String JavaDoc seperator = "";
405         for (int index = 0; index < parametersTypes.length; index++) {
406             fullParameters += String.format(METHOD_PARAMETER,seperator,
407                     classTypeToString(parametersTypes[index]),index+1);
408             parameters += String.format(PARAMETER,seperator,index+1);
409             seperator = ",";
410         }
411         
412         // validate exceptions on interface
413
Class JavaDoc[] exceptionList = method.getExceptionTypes();
414         if (!findException(exceptionList, java.rmi.RemoteException JavaDoc.class)) {
415             throw new RMIException("Interface method [" + method.getName() +
416                     "] must throw a java.rmi.RemoteException");
417         }
418         
419         // process the exceptions
420
String JavaDoc exceptions = "";
421         seperator = "";
422         for (int index = 0; index < exceptionList.length; index++) {
423             exceptions += seperator + exceptionList[index].getName();
424             seperator = ",";
425         }
426         // retrieve a copy of the template to parse
427
String JavaDoc template = new String JavaDoc(getTemplate(method));
428         template = template.replaceAll("%methodName%",methodName);
429         template = template.replaceAll("%returnType%",returnType);
430         template = template.replaceAll("%fullParameters%",fullParameters);
431         template = template.replaceAll("%parameters%",parameters);
432         template = template.replaceAll("%exceptions%",exceptions);
433         return template;
434     }
435     
436     
437     /**
438      * This method converts the class type to a string.
439      *
440      * @return The string definition of the object.
441      * @param The type of object.
442      */

443     private String JavaDoc classTypeToString(Class JavaDoc type) {
444         // deal with a basic type
445
if (type.isArray()) {
446             return type.getComponentType().getName() + "[]";
447         }
448         return type.getName();
449     }
450     
451     
452     /**
453      * This method returns the template for the given class.
454      *
455      * @return The string containing the template.
456      * @param method The method to retrieve the template for.
457      * @exception RMIException
458      */

459     private String JavaDoc getTemplate(Method JavaDoc method) throws RMIException {
460         
461         // retrieve the method and parameter list and check for a remove cache
462
// method.
463
String JavaDoc methodName = method.getName();
464         Pattern JavaDoc removePattern = Pattern.compile(BeanPattern.REMOVE_PATTERN);
465         Class JavaDoc[] parametersTypes = method.getParameterTypes();
466         Class JavaDoc returnType = method.getReturnType();
467         if (beanInfo.getCacheResults() && !beanInfo.getTransaction() &&
468                 (parametersTypes.length == 1) && (
469                 ClassUtil.testForParent(parametersTypes[0],
470                 java.io.Serializable JavaDoc.class)) && removePattern.matcher(methodName)
471                 .find() && returnType.getName().equals("void")) {
472             return voidKeyCacheRemoveMethodTemplate;
473         } else if (beanInfo.getCacheResults() && beanInfo.getTransaction()
474         && (parametersTypes.length == 1) && (
475                 ClassUtil.testForParent(parametersTypes[0],
476                 java.io.Serializable JavaDoc.class)) && removePattern.matcher(methodName)
477                 .find() && returnType.getName().equals("void")) {
478             return transactionVoidKeyCacheRemoveMethodTemplate;
479         } else if (beanInfo.getCacheResults() && !beanInfo.getTransaction()
480         && (parametersTypes.length == 1) && (
481                 ClassUtil.testForParent(parametersTypes[0],
482                 java.io.Serializable JavaDoc.class)) && removePattern.matcher(methodName)
483                 .find()) {
484             return keyCacheRemoveMethodTemplate;
485         } else if (beanInfo.getCacheResults() && beanInfo.getTransaction()
486         && (parametersTypes.length == 1) && (
487                 ClassUtil.testForParent(parametersTypes[0],
488                 java.io.Serializable JavaDoc.class)) && removePattern.matcher(methodName)
489                 .find()) {
490             return transactionKeyCacheRemoveMethodTemplate;
491         } else if (beanInfo.getCacheResults() &&
492                 removePattern.matcher(methodName).find()) {
493             throw new RMIException("The bean cache result flag is set but " +
494                     "there is no way identifying this entry in cache. Must " +
495                     "supply the index key as a serializable object to a remove " +
496                     "method.");
497         } else if (returnType.getName().equals("void") &&
498                 !beanInfo.getTransaction()) {
499             return voidMethodTemplate;
500         } else if (returnType.getName().equals("void") &&
501                 beanInfo.getTransaction()) {
502             return transactionVoidMethodTemplate;
503         }
504         
505         // check for a basic return type
506
if (!ClassUtil.testForParent(returnType,java.rmi.Remote JavaDoc.class) &&
507                 !beanInfo.getTransaction()) {
508             return basicMethodTemplate;
509         } else if (!ClassUtil.testForParent(returnType,java.rmi.Remote JavaDoc.class) &&
510                 beanInfo.getTransaction()) {
511             return transactionBasicMethodTemplate;
512         }
513         
514         // check for a caching return type
515
Pattern JavaDoc findPattern = Pattern.compile(BeanPattern.FIND_PATTERN);
516         Pattern JavaDoc addPattern = Pattern.compile(BeanPattern.ADD_PATTERN);
517         if (beanInfo.getCacheResults() && !beanInfo.getTransaction() &&
518                 addPattern.matcher(methodName).find()) {
519             return keyCacheAddMethodTemplate;
520         } else if (beanInfo.getCacheResults() && beanInfo.getTransaction() &&
521                 addPattern.matcher(methodName).find()) {
522             return transactionKeyCacheAddMethodTemplate;
523         } else if (beanInfo.getCacheResults() && !beanInfo.getTransaction()
524         && findPattern.matcher(methodName).find()&&
525                 (parametersTypes.length == 1) && (
526                 ClassUtil.testForParent(parametersTypes[0],
527                 java.io.Serializable JavaDoc.class))) {
528             return keyCacheFindMethodTemplate;
529         } else if (beanInfo.getCacheResults() && beanInfo.getTransaction()
530         && findPattern.matcher(methodName).find()&&
531                 (parametersTypes.length == 1) && (
532                 ClassUtil.testForParent(parametersTypes[0],
533                 java.io.Serializable JavaDoc.class))) {
534             return transactionKeyCacheFindMethodTemplate;
535         } else if (beanInfo.getCacheResults()
536         && findPattern.matcher(methodName).find()&&
537                 (parametersTypes.length != 1)) {
538             throw new RMIException("The bean cache result flag is set but " +
539                     "there is no way identifying this entry in cache. Must " +
540                     "supply the index key as a serializable object to a find " +
541                     "method.");
542         }
543         
544         // return a none caching method
545
if (beanInfo.getTransaction()) {
546             return transactionCacheMethodTemplate;
547         } else {
548             return cacheMethodTemplate;
549         }
550     }
551     
552     
553     /**
554      * This method will return true if the exception is found in the list of
555      * exceptions.
556      *
557      * @return TRUE if the exception is found.
558      * @param list The list of exceptions to check.
559      * @param exception The exception to perform the comparison for.
560      */

561     private boolean findException(Class JavaDoc[] list, Class JavaDoc exception) {
562         for (int index = 0; index < list.length; index++) {
563             if (list[index].getName().equals(exception.getName())) {
564                 return true;
565             }
566         }
567         return false;
568     }
569 }
570
Popular Tags