01: package org.objectweb.celtix.bus.busimpl;
02:
03: import org.objectweb.celtix.Bus;
04: import org.objectweb.celtix.application.ApplicationPluginManager;
05: import org.objectweb.celtix.buslifecycle.BusLifeCycleListener;
06: import org.objectweb.celtix.configuration.Configuration;
07: import org.objectweb.celtix.plugins.PluginException;
08:
09: 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 getPluginClassLoader() {
21: return getClass().getClassLoader();
22: }
23:
24: /* (non-Javadoc)
25: * @see org.objectweb.celtix.application.ApplicationPluginManager#getConfiguration()
26: */
27: @Override
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 plugin)
38: throws PluginException {
39: super .registerPlugin(plugin);
40: if (plugin instanceof BusLifeCycleListener) {
41: bus.getLifeCycleManager().registerLifeCycleListener(
42: (BusLifeCycleListener) plugin);
43: }
44: }
45:
46: /*
47: * (non-Javadoc)
48: *
49: * @see org.objectweb.celtix.plugins.PluginManager#unregisterPlugin(java.lang.String)
50: */
51: public synchronized void unregisterPlugin(Object plugin)
52: throws PluginException {
53: if (plugin instanceof BusLifeCycleListener) {
54: bus.getLifeCycleManager().registerLifeCycleListener(
55: (BusLifeCycleListener) plugin);
56: }
57: super.unregisterPlugin(plugin);
58: }
59:
60: }
|