KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quilt > reg > QuiltRegistry


1 /* QuiltRegistry.java */
2 package org.quilt.reg;
3
4 import org.quilt.cl.*;
5
6 /**
7  * A registry for use by Quilt class loaders. Adds transformers to the
8  * class loader prior to use. Stores information collected while loading
9  * classes under a String array key. Dumps that information on request.
10  *
11  * @author <a HREF="jddixon@users.sourceforge.net">Jim Dixon</a>
12  */

13 public abstract class QuiltRegistry extends Registry {
14
15     /** List of class transformers associated with this registry. */
16     protected ClassXformer cxf[];
17
18     /** List of method transformers associated with this registry. */
19     protected MethodXformer mxf[];
20
21     /** List of graph transformers associated with this registry. */
22     protected GraphXformer gxf[];
23
24     /** The Quilt class loader using this registry. */
25     protected QuiltClassLoader qcl_;
26
27     public QuiltRegistry ( QuiltClassLoader qcl ) {
28         super();
29         if (qcl == null) {
30             throw new IllegalArgumentException JavaDoc("null QuiltClassLoader");
31         }
32         qcl_ = qcl;
33     }
34
35     /**
36      * Attaches transformers to the class loader; classes extending
37      * this class should call in the constructor after setting up the
38      * lists.
39      */

40     public final void setTransformers () {
41         if (cxf != null) {
42             for (int i = 0; i < cxf.length; i++) {
43                 qcl_.addClassXformer(cxf[i]);
44             }
45         }
46         if (mxf != null) {
47             for (int i = 0; i < mxf.length; i++) {
48                 qcl_.addMethodXformer(mxf[i]);
49             }
50         }
51         if (gxf != null) {
52             for (int i = 0; i < gxf.length; i++) {
53                 qcl_.addGraphXformer(gxf[i]);
54             }
55         }
56     }
57     /** Resets items in the registry in an application-specific manner. */
58     abstract public void reset();
59
60     /** Dumps the registry in a form appropriate to the application. */
61     abstract public String JavaDoc getReport ();
62
63 }
64
Popular Tags