01: /*
02: * Javassist, a Java-bytecode translator toolkit.
03: * Copyright (C) 2006 JBoss Inc. All Rights Reserved.
04: *
05: * The contents of this file are subject to the Mozilla Public License Version
06: * 1.1 (the "License"); you may not use this file except in compliance with
07: * the License. Alternatively, the contents of this file may be used under
08: * the terms of the GNU Lesser General Public License Version 2.1 or later.
09: *
10: * Software distributed under the License is distributed on an "AS IS" basis,
11: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12: * for the specific language governing rights and limitations under the
13: * License.
14: */
15:
16: package javassist.scopedpool;
17:
18: import java.util.Map;
19:
20: import javassist.ClassPool;
21:
22: /**
23: * An interface to <code>ScopedClassPoolRepositoryImpl</code>.
24: *
25: * @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
26: * @version $Revision: 1.3 $
27: */
28: public interface ScopedClassPoolRepository {
29: /**
30: * Records a factory.
31: */
32: void setClassPoolFactory(ScopedClassPoolFactory factory);
33:
34: /**
35: * Obtains the recorded factory.
36: */
37: ScopedClassPoolFactory getClassPoolFactory();
38:
39: /**
40: * Returns whether or not the class pool is pruned.
41: *
42: * @return the prune.
43: */
44: boolean isPrune();
45:
46: /**
47: * Sets the prune flag.
48: *
49: * @param prune a new value.
50: */
51: void setPrune(boolean prune);
52:
53: /**
54: * Create a scoped classpool.
55: *
56: * @param cl the classloader.
57: * @param src the original classpool.
58: * @return the classpool.
59: */
60: ScopedClassPool createScopedClassPool(ClassLoader cl, ClassPool src);
61:
62: /**
63: * Finds a scoped classpool registered under the passed in classloader.
64: *
65: * @param cl the classloader.
66: * @return the classpool.
67: */
68: ClassPool findClassPool(ClassLoader cl);
69:
70: /**
71: * Register a classloader.
72: *
73: * @param ucl the classloader.
74: * @return the classpool.
75: */
76: ClassPool registerClassLoader(ClassLoader ucl);
77:
78: /**
79: * Get the registered classloaders.
80: *
81: * @return the registered classloaders.
82: */
83: Map getRegisteredCLs();
84:
85: /**
86: * This method will check to see if a register classloader has been
87: * undeployed (as in JBoss).
88: */
89: void clearUnregisteredClassLoaders();
90:
91: /**
92: * Unregisters a classpool and unregisters its classloader.
93: *
94: * @param cl the classloader the pool is stored under.
95: */
96: void unregisterClassLoader(ClassLoader cl);
97: }
|