1 25 26 package org.objectweb.jonas.web.catalina55; 27 28 import javax.management.InstanceNotFoundException ; 29 import javax.management.MBeanException ; 30 import javax.management.MBeanServer ; 31 import javax.management.MalformedObjectNameException ; 32 import javax.management.ObjectName ; 33 import javax.management.ReflectionException ; 34 35 import org.objectweb.jonas.server.LoaderManager; 36 37 43 public class WebModuleProxy implements WebModuleProxyMBean { 44 48 private MBeanServer myServer = null; 49 50 54 public void start(String webModuleName) { 55 try { 56 ObjectName onWebModule = ObjectName.getInstance(webModuleName); 57 ClassLoader old = Thread.currentThread().getContextClassLoader(); 59 Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader()); 60 myServer.invoke(onWebModule, "start", null, null); 61 Thread.currentThread().setContextClassLoader(old); 63 } catch (MalformedObjectNameException e) { 64 e.printStackTrace(); 66 } catch (InstanceNotFoundException e) { 67 e.printStackTrace(); 69 } catch (MBeanException e) { 70 e.printStackTrace(); 72 } catch (ReflectionException e) { 73 e.printStackTrace(); 75 } catch (Exception e) { 76 e.printStackTrace(); 78 } 79 } 80 81 85 public void stop(String webModuleName) { 86 try { 87 ObjectName onWebModule = ObjectName.getInstance(webModuleName); 88 ClassLoader old = Thread.currentThread().getContextClassLoader(); 90 Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader()); 91 myServer.invoke(onWebModule, "stop", null, null); 92 Thread.currentThread().setContextClassLoader(old); 94 } catch (MalformedObjectNameException e) { 95 e.printStackTrace(); 97 } catch (InstanceNotFoundException e) { 98 e.printStackTrace(); 100 } catch (MBeanException e) { 101 e.printStackTrace(); 103 } catch (ReflectionException e) { 104 e.printStackTrace(); 106 } catch (Exception e) { 107 e.printStackTrace(); 109 } 110 } 111 112 116 public void reload(String webModuleName) { 117 try { 118 ObjectName onWebModule = ObjectName.getInstance(webModuleName); 119 ClassLoader old = Thread.currentThread().getContextClassLoader(); 121 Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader()); 122 myServer.invoke(onWebModule, "reload", null, null); 123 Thread.currentThread().setContextClassLoader(old); 125 } catch (MalformedObjectNameException e) { 126 e.printStackTrace(); 128 } catch (InstanceNotFoundException e) { 129 e.printStackTrace(); 131 } catch (MBeanException e) { 132 e.printStackTrace(); 134 } catch (ReflectionException e) { 135 e.printStackTrace(); 137 } catch (Exception e) { 138 e.printStackTrace(); 140 } 141 } 142 145 protected void setMyServer(MBeanServer myServer) { 146 this.myServer = myServer; 147 } 148 } 149 | Popular Tags |