1 17 package org.apache.geronimo.tomcat; 18 19 import java.util.Map ; 20 21 import org.apache.catalina.Manager; 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 import org.apache.geronimo.gbean.GBeanInfo; 25 import org.apache.geronimo.gbean.GBeanInfoBuilder; 26 import org.apache.geronimo.gbean.GBeanLifecycle; 27 28 public class ManagerGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever{ 29 30 private static final Log log = LogFactory.getLog(ManagerGBean.class); 31 32 public static final String J2EE_TYPE = "Manager"; 33 34 protected final Manager manager; 35 36 protected ManagerGBean(String className) throws Exception { 37 super(); 38 manager = (Manager)Class.forName(className).newInstance(); 39 } 40 41 public ManagerGBean(String className, 42 Map initParams) throws Exception { 43 super(); if (className == null){ 46 className = "org.apache.catalina.core.StandardHost"; 47 } 48 49 manager = (Manager)Class.forName(className).newInstance(); 51 52 setParameters(manager, initParams); 54 55 } 56 57 public void doStart() throws Exception { 58 } 59 60 public void doStop() throws Exception { 61 } 62 63 public void doFail() { 64 } 65 66 public Object getInternalObject() { 67 return manager; 69 } 70 71 public static final GBeanInfo GBEAN_INFO; 72 73 static { 74 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("TomcatManager", ManagerGBean.class, J2EE_TYPE); 75 infoFactory.addAttribute("className", String .class, true); 76 infoFactory.addAttribute("initParams", Map .class, true); 77 infoFactory.addOperation("getInternalObject"); 78 infoFactory.setConstructor(new String [] { 79 "className", 80 "initParams"}); 81 GBEAN_INFO = infoFactory.getBeanInfo(); 82 } 83 84 public static GBeanInfo getGBeanInfo() { 85 return GBEAN_INFO; 86 } 87 } 88 | Popular Tags |