1 18 package org.apache.geronimo.interop; 19 20 import java.util.Properties ; 21 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 import org.omg.IOP.IOR ; 28 29 30 35 public class InteropGBean implements GBeanLifecycle { 36 37 private final Log log = LogFactory.getLog(InteropGBean.class); 38 39 private IOR ior; 40 41 private Properties properties; 42 private String strprop; 43 private String name; 44 45 50 public InteropGBean(String name, String strprop, Properties properties) { 51 this.name = name; 52 this.strprop = strprop; 53 this.properties = (properties == null ? new Properties () : properties); 54 } 55 56 59 public String getAStrProp() { 60 return strprop; 61 } 62 63 68 public void setAStrProp(String strprop) { 69 this.strprop = strprop; 70 } 71 72 75 public Properties getProperties() { 76 return properties; 77 } 78 79 84 public void setProperties(Properties properties) { 85 this.properties = properties; 86 } 87 88 91 public String getName() { 92 return name; 93 } 94 95 98 public void echo(String msg) { 99 log.info(getName() + ": Echo " + msg); 100 } 101 102 105 106 public void doStart() throws Exception { 107 log.info("Started " + getName()); 108 } 109 110 public void doStop() throws Exception { 111 log.info("Stopped " + getName()); 112 } 113 114 public void doFail() { 115 log.info("Failed " + getName()); 116 } 117 118 121 122 public static final GBeanInfo GBEAN_INFO; 123 124 static { 125 GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(InteropGBean.class); 126 127 infoFactory.addAttribute("name", String .class, true); 128 infoFactory.addAttribute("strprop", String .class, true); 129 infoFactory.addAttribute("properties", Properties .class, true); 130 131 infoFactory.addOperation("echo", new Class []{String .class}); 132 133 infoFactory.setConstructor(new String []{"name", "strprop", "properties"}); 134 135 GBEAN_INFO = infoFactory.getBeanInfo(); 136 } 137 138 public static GBeanInfo getGBeanInfo() { 139 return GBEAN_INFO; 140 } 141 } 142 | Popular Tags |