001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.deployment;
017:
018: import org.apache.geronimo.gbean.GBeanInfo;
019: import org.apache.geronimo.gbean.GBeanInfoBuilder;
020:
021: /**
022: *
023: *
024: * @version $Rev: 486195 $ $Date: 2006-12-12 07:42:02 -0800 (Tue, 12 Dec 2006) $
025: */
026: public class MockGBean implements MockEndpoint {
027: private final String name;
028: private String value;
029: private int intValue;
030:
031: private FooBarBean fooBarBean;
032:
033: private MockEndpoint endpoint;
034:
035: public MockGBean(String name) {
036: this .name = name;
037: }
038:
039: public String getName() {
040: return name;
041: }
042:
043: public String getValue() {
044: return value;
045: }
046:
047: public void setValue(String value) {
048: this .value = value;
049: }
050:
051: public int getIntValue() {
052: return intValue;
053: }
054:
055: public void setIntValue(int intValue) {
056: this .intValue = intValue;
057: }
058:
059: public FooBarBean getFooBarBean() {
060: return fooBarBean;
061: }
062:
063: public void setFooBarBean(FooBarBean fooBarBean) {
064: this .fooBarBean = fooBarBean;
065: }
066:
067: public MockEndpoint getMockEndpoint() {
068: return endpoint;
069: }
070:
071: public void setMockEndpoint(MockEndpoint endpoint) {
072: this .endpoint = endpoint;
073: }
074:
075: public String doSomething(String name) {
076: return name;
077: }
078:
079: public String checkEndpoint() {
080: if (endpoint == null) {
081: return "no endpoint";
082: }
083: return endpoint.doSomething("endpointCheck");
084: }
085:
086: public static final GBeanInfo GBEAN_INFO;
087:
088: static {
089: GBeanInfoBuilder infoFactory = GBeanInfoBuilder
090: .createStatic(MockGBean.class);
091:
092: infoFactory.addAttribute("name", String.class, true);
093: infoFactory.addAttribute("value", String.class, true);
094: infoFactory.addAttribute("intValue", int.class, true);
095: infoFactory.addAttribute("fooBarBean", FooBarBean.class, true);
096:
097: infoFactory.addOperation("checkEndpoint");
098: infoFactory.addOperation("doSomething",
099: new Class[] { String.class });
100:
101: infoFactory.addReference("MockEndpoint", MockEndpoint.class,
102: null);
103:
104: infoFactory.setConstructor(new String[] { "name" });
105:
106: GBEAN_INFO = infoFactory.getBeanInfo();
107: }
108:
109: public static GBeanInfo getGBeanInfo() {
110: return GBEAN_INFO;
111: }
112: }
|