1 17 package org.apache.geronimo.tomcat; 18 19 import java.util.Map ; 20 21 import org.apache.catalina.Realm; 22 import org.apache.geronimo.gbean.GBeanInfo; 23 import org.apache.geronimo.gbean.GBeanInfoBuilder; 24 import org.apache.geronimo.gbean.GBeanLifecycle; 25 26 public class RealmGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever { 27 28 private final Realm realm; 29 30 public RealmGBean(String className, Map initParams) throws Exception { 31 super(); 33 assert className != null; 34 35 realm = (Realm)Class.forName(className).newInstance(); 36 37 setParameters(realm, initParams); 38 39 } 40 41 public Object getInternalObject() { 42 return realm; 43 } 44 45 public void doFail() { 46 } 47 48 public void doStart() throws Exception { 49 } 50 51 public void doStop() throws Exception { 52 } 53 54 public static final GBeanInfo GBEAN_INFO; 55 56 static { 57 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("TomcatRealm", RealmGBean.class); 58 infoFactory.addAttribute("className", String .class, true); 59 infoFactory.addAttribute("initParams", Map .class, true); 60 61 infoFactory.addOperation("getInternalObject"); 62 infoFactory.setConstructor(new String [] { "className", "initParams" }); 63 GBEAN_INFO = infoFactory.getBeanInfo(); 64 } 65 66 public static GBeanInfo getGBeanInfo() { 67 return GBEAN_INFO; 68 } 69 } 70 | Popular Tags |