KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > util > loader > ModuleListener


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17
18 package org.apache.tomcat.util.loader;
19
20 public interface ModuleListener {
21     
22     /** Called when a module group is created. This is only called when a new group
23      * is added to a running engine - we may cache a the list of groups and reuse
24      * it on restarts.
25      *
26      * @param manager
27      */

28     public void repositoryAdd( Repository manager );
29     
30     /** Notification that a module has been added. You can get the group
31      * with getGroup().
32      *
33      * Adding a module doesn't imply that the module is started or the class loader
34      * created - this happens only on start() ( TODO: or when a class is accessed ? ).
35      *
36      * This callback is only called for new modules, deployed while the engine is
37      * running, or in some cases when the module engine is reseting the cache. For
38      * old modules - you need to get a list from the ModuleGroup.
39      *
40      *
41      * @param module
42      */

43     public void moduleAdd( Module module );
44     
45     /** Notification that a module has been removed.
46      *
47      * @param module
48      */

49     public void moduleRemove( Module module );
50     
51     /** Module reload - whenever reload happens, a reload notification will be generated.
52      * Sometimes a remove/add will do the same.
53      *
54      * @param module
55      */

56     public void moduleReload( Module module );
57     
58     /** Called when a module is started.
59      *
60      * This is called after the class loader is created, to allow listeners to use classes
61      * from the module to initialize.
62      *
63      * I think it would be good to have the module 'started' on first class loaded
64      * and 'stopped' explicitely.
65      *
66      * @param module
67      */

68     public void moduleStart(Module module);
69     
70     /**
71      * Called when a module is stopped. Stoping a module will stop the class
72      * loader and remove all references to it. When a module is stopped, all attempts
73      * to load classes will result in exceptions.
74      *
75      * The callback is called before the class loader is stopped - this allows listeners
76      * to use classes from the module to deinitialize.
77      *
78      * @param module
79      */

80     public void moduleStop(Module module);
81     
82     /** Pass a reference to the loader.
83      *
84      * This is the only supported way to get it - no static methods are
85      * provided. From loader you can control all repositories and modules.
86      *
87      * Note that ModuleClassLoader does not provide a way to retrieve the Module -
88      * you need to have a reference to the Loader to get the Module for a
89      * ClassLoader.
90      * @param main
91      */

92     public void setLoader(Loader main);
93
94     /** Start the listener.
95      * TODO: this is only used by Loader to pass control to the listener -
96      * instead of introspection for main()
97      */

98     public void start();
99
100 }
Popular Tags