001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */package org.codehaus.xfire.aegis.inheritance.ws1.impl;
019:
020: import java.util.Map;
021:
022: import org.apache.cxf.aegis.services.SimpleBean;
023: import org.codehaus.xfire.aegis.inheritance.ws1.BeanA;
024: import org.codehaus.xfire.aegis.inheritance.ws1.BeanB;
025: import org.codehaus.xfire.aegis.inheritance.ws1.BeanC;
026: import org.codehaus.xfire.aegis.inheritance.ws1.ResultBean;
027: import org.codehaus.xfire.aegis.inheritance.ws1.RootBean;
028: import org.codehaus.xfire.aegis.inheritance.ws1.WS1;
029: import org.codehaus.xfire.aegis.inheritance.ws1.WS1Exception;
030: import org.codehaus.xfire.aegis.inheritance.ws1.WS1ExtendedException;
031:
032: /**
033: * <br/>
034: *
035: * @author xfournet
036: */
037: public class WS1Impl implements WS1 {
038: public BeanA getBeanA() {
039: BeanA a = new BeanA();
040: a.setPropA("valueA");
041: return a;
042: }
043:
044: public BeanB getBeanB() {
045: BeanB b = new BeanB();
046: b.setPropA("valueA");
047: b.setPropB("valueB");
048: return b;
049: }
050:
051: // not exported to interface to "hide" BeanC from interface introspection
052: public BeanC getBeanC() {
053: BeanC c = new BeanC();
054: c.setPropA("valueA");
055: c.setPropB("valueB");
056: c.setPropC("valueC");
057: return c;
058: }
059:
060: public BeanA getBean(String id) {
061: if ("b".equalsIgnoreCase(id)) {
062: return getBeanB();
063: } else if ("c".equalsIgnoreCase(id)) {
064: return getBeanC();
065: } else if ("a".equalsIgnoreCase(id)) {
066: return getBeanA();
067: } else {
068: return null;
069: }
070: }
071:
072: public BeanA[] listBeans() {
073: BeanA[] result = new BeanA[4];
074:
075: result[0] = getBean("b");
076: result[1] = null;
077: result[2] = getBean("a");
078: result[3] = getBean("c");
079:
080: return result;
081: }
082:
083: public RootBean getRootBean(String id) {
084: RootBean rootBean = new RootBean();
085: rootBean.setId(id);
086: rootBean.setChild(getBean(id));
087:
088: return rootBean;
089: }
090:
091: public RootBean[] listRootBeans() {
092: RootBean[] result = new RootBean[4];
093:
094: result[0] = getRootBean("b");
095: result[1] = null;
096: result[2] = getRootBean("a");
097: result[3] = getRootBean("c");
098:
099: return result;
100: }
101:
102: public ResultBean getResultBean() {
103: ResultBean resultBean = new ResultBean();
104: resultBean.setResult1(listBeans());
105: resultBean.setResult2(listRootBeans());
106:
107: return resultBean;
108: }
109:
110: public Map echoMap(Map beans) {
111: return beans;
112: }
113:
114: public void throwException(boolean extendedOne) throws WS1Exception {
115: if (extendedOne) {
116: throw new WS1ExtendedException("WS1 extended exception",
117: 20, 30, new SimpleBean());
118: } else {
119: throw new WS1Exception("WS1 base exception", 10);
120: }
121: }
122: }
|