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