1 17 18 package org.apache.geronimo.deployment; 19 20 import org.apache.geronimo.gbean.GBeanInfo; 21 import org.apache.geronimo.gbean.GBeanInfoBuilder; 22 23 28 public class MockGBean implements MockEndpoint { 29 private final String name; 30 private String value; 31 private int intValue; 32 33 private FooBarBean fooBarBean; 34 35 private MockEndpoint endpoint; 36 37 public MockGBean(String name) { 38 this.name = name; 39 } 40 41 public String getName() { 42 return name; 43 } 44 45 public String getValue() { 46 return value; 47 } 48 49 public void setValue(String value) { 50 this.value = value; 51 } 52 53 public int getIntValue() { 54 return intValue; 55 } 56 57 public void setIntValue(int intValue) { 58 this.intValue = intValue; 59 } 60 61 public FooBarBean getFooBarBean() { 62 return fooBarBean; 63 } 64 65 public void setFooBarBean(FooBarBean fooBarBean) { 66 this.fooBarBean = fooBarBean; 67 } 68 69 public MockEndpoint getMockEndpoint() { 70 return endpoint; 71 } 72 73 public void setMockEndpoint(MockEndpoint endpoint) { 74 this.endpoint = endpoint; 75 } 76 77 public String doSomething(String name) { 78 return name; 79 } 80 81 public String checkEndpoint() { 82 if (endpoint == null) { 83 return "no endpoint"; 84 } 85 return endpoint.doSomething("endpointCheck"); 86 } 87 88 public static final GBeanInfo GBEAN_INFO; 89 90 static { 91 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(MockGBean.class); 92 93 infoFactory.addAttribute("name", String .class, true); 94 infoFactory.addAttribute("value", String .class, true); 95 infoFactory.addAttribute("intValue", int.class, true); 96 infoFactory.addAttribute("fooBarBean", FooBarBean.class, true); 97 98 infoFactory.addOperation("checkEndpoint"); 99 infoFactory.addOperation("doSomething", new Class []{String .class}); 100 101 infoFactory.addReference("MockEndpoint", MockEndpoint.class, null); 102 103 infoFactory.setConstructor(new String [] {"name"}); 104 105 GBEAN_INFO = infoFactory.getBeanInfo(); 106 } 107 108 public static GBeanInfo getGBeanInfo() { 109 return GBEAN_INFO; 110 } 111 } 112 | Popular Tags |