KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > busimpl > BusPluginManager


1 package org.objectweb.celtix.bus.busimpl;
2
3 import org.objectweb.celtix.Bus;
4 import org.objectweb.celtix.application.ApplicationPluginManager;
5 import org.objectweb.celtix.buslifecycle.BusLifeCycleListener;
6 import org.objectweb.celtix.configuration.Configuration;
7 import org.objectweb.celtix.plugins.PluginException;
8
9 public class BusPluginManager extends ApplicationPluginManager {
10
11     private final Bus bus;
12     
13     BusPluginManager(Bus b) {
14         bus = b;
15     }
16  
17     /* (non-Javadoc)
18      * @see org.objectweb.celtix.plugins.PluginManager#getPluginClassLoader()
19      */

20     public ClassLoader JavaDoc getPluginClassLoader() {
21         return getClass().getClassLoader();
22     }
23
24     /* (non-Javadoc)
25      * @see org.objectweb.celtix.application.ApplicationPluginManager#getConfiguration()
26      */

27     @Override JavaDoc
28     public Configuration getConfiguration() {
29         return bus.getConfiguration();
30     }
31     
32     /*
33      * (non-Javadoc)
34      *
35      * @see org.objectweb.celtix.plugins.PluginManager#registerPlugin(org.objectweb.celtix.plugins.Plugin)
36      */

37     public synchronized void registerPlugin(Object JavaDoc plugin) throws PluginException {
38         super.registerPlugin(plugin);
39         if (plugin instanceof BusLifeCycleListener) {
40             bus.getLifeCycleManager().registerLifeCycleListener((BusLifeCycleListener)plugin);
41         }
42     }
43     
44     /*
45      * (non-Javadoc)
46      *
47      * @see org.objectweb.celtix.plugins.PluginManager#unregisterPlugin(java.lang.String)
48      */

49     public synchronized void unregisterPlugin(Object JavaDoc plugin) throws PluginException {
50         if (plugin instanceof BusLifeCycleListener) {
51             bus.getLifeCycleManager().registerLifeCycleListener((BusLifeCycleListener)plugin);
52         }
53         super.unregisterPlugin(plugin);
54     }
55     
56 }
57
Popular Tags