WebModuleProxy.java

00001 
00026 package org.objectweb.jonas.web.catalina50;
00027 
00028 import javax.management.InstanceNotFoundException;
00029 import javax.management.MBeanException;
00030 import javax.management.MBeanServer;
00031 import javax.management.MalformedObjectNameException;
00032 import javax.management.ObjectName;
00033 import javax.management.ReflectionException;
00034 
00035 import org.objectweb.jonas.server.LoaderManager;
00036 
00043 public class WebModuleProxy implements WebModuleProxyMBean {
00048     private MBeanServer myServer = null;
00049 
00054     public void start(String webModuleName) {
00055         try {
00056             ObjectName onWebModule = ObjectName.getInstance(webModuleName);
00057             // Set Catalina class loader before making the invoke
00058             ClassLoader old = Thread.currentThread().getContextClassLoader();
00059             Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader());
00060             myServer.invoke(onWebModule, "start", null, null);
00061             // Restore the class loader
00062             Thread.currentThread().setContextClassLoader(old);
00063         } catch (MalformedObjectNameException e) {
00064             // TODO Auto-generated catch block
00065             e.printStackTrace();
00066         } catch (InstanceNotFoundException e) {
00067             // TODO Auto-generated catch block
00068             e.printStackTrace();
00069         } catch (MBeanException e) {
00070             // TODO Auto-generated catch block
00071             e.printStackTrace();
00072         } catch (ReflectionException e) {
00073             // TODO Auto-generated catch block
00074             e.printStackTrace();
00075         } catch (Exception e) {
00076             // TODO Auto-generated catch block
00077             e.printStackTrace();
00078         }
00079     }
00080 
00085     public void stop(String webModuleName) {
00086         try {
00087             ObjectName onWebModule = ObjectName.getInstance(webModuleName);
00088             // Set Catalina class loader before making the invoke
00089             ClassLoader old = Thread.currentThread().getContextClassLoader();
00090             Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader());
00091             myServer.invoke(onWebModule, "stop", null, null);
00092             // Restore the class loader
00093             Thread.currentThread().setContextClassLoader(old);
00094         } catch (MalformedObjectNameException e) {
00095             // TODO Auto-generated catch block
00096             e.printStackTrace();
00097         } catch (InstanceNotFoundException e) {
00098             // TODO Auto-generated catch block
00099             e.printStackTrace();
00100         } catch (MBeanException e) {
00101             // TODO Auto-generated catch block
00102             e.printStackTrace();
00103         } catch (ReflectionException e) {
00104             // TODO Auto-generated catch block
00105             e.printStackTrace();
00106         } catch (Exception e) {
00107             // TODO Auto-generated catch block
00108             e.printStackTrace();
00109         }
00110     }
00111 
00116     public void reload(String webModuleName) {
00117         try {
00118             ObjectName onWebModule = ObjectName.getInstance(webModuleName);
00119             // Set Catalina class loader before making the invoke
00120             ClassLoader old = Thread.currentThread().getContextClassLoader();
00121             Thread.currentThread().setContextClassLoader(LoaderManager.getInstance().getCatalinaLoader());
00122             myServer.invoke(onWebModule, "reload", null, null);
00123             // Restore the class loader
00124             Thread.currentThread().setContextClassLoader(old);
00125         } catch (MalformedObjectNameException e) {
00126             // TODO Auto-generated catch block
00127             e.printStackTrace();
00128         } catch (InstanceNotFoundException e) {
00129             // TODO Auto-generated catch block
00130             e.printStackTrace();
00131         } catch (MBeanException e) {
00132             // TODO Auto-generated catch block
00133             e.printStackTrace();
00134         } catch (ReflectionException e) {
00135             // TODO Auto-generated catch block
00136             e.printStackTrace();
00137         } catch (Exception e) {
00138             // TODO Auto-generated catch block
00139             e.printStackTrace();
00140         }
00141     }
00145     protected void setMyServer(MBeanServer myServer) {
00146         this.myServer = myServer;
00147     }
00148 }

Generated on Tue Feb 15 15:05:25 2005 for JOnAS by  doxygen 1.3.9.1