KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > cxf > CXFWebServiceContainerFactoryGBean


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.cxf;
19
20 import org.apache.cxf.Bus;
21 import org.apache.cxf.bus.cxf.CXFBusFactory;
22 import org.apache.geronimo.gbean.GBeanInfo;
23 import org.apache.geronimo.gbean.GBeanInfoBuilder;
24 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
25 import org.apache.geronimo.webservices.WebServiceContainer;
26 import org.apache.geronimo.webservices.WebServiceContainerFactory;
27
28 /**
29  * @version $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $
30  */

31 public class CXFWebServiceContainerFactoryGBean implements WebServiceContainerFactory {
32
33     private final PortInfo portInfo;
34     private final Bus bus;
35     private final Object JavaDoc endpointInstance;
36
37     public CXFWebServiceContainerFactoryGBean(PortInfo portInfo, String JavaDoc endpointClassName, ClassLoader JavaDoc classLoader) throws ClassNotFoundException JavaDoc, IllegalAccessException JavaDoc, InstantiationException JavaDoc {
38         this.portInfo = portInfo;
39         this.bus = new CXFBusFactory().getDefaultBus();
40         Class JavaDoc endpointClass = classLoader.loadClass(endpointClassName);
41         endpointInstance = endpointClass.newInstance();
42     }
43
44     public WebServiceContainer getWebServiceContainer() {
45         return new CXFWebServiceContainer(portInfo, endpointInstance, bus);
46     }
47
48     public static final GBeanInfo GBEAN_INFO;
49
50     static {
51         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CXFWebServiceContainerFactoryGBean.class, NameFactory.GERONIMO_SERVICE);
52         infoBuilder.addAttribute("portInfo", PortInfo.class, true, true);
53         infoBuilder.addAttribute("endpointClassName", String JavaDoc.class, true, true);
54         infoBuilder.addAttribute("classLoader", ClassLoader JavaDoc.class, false);
55         infoBuilder.setConstructor(new String JavaDoc[] {"portInfo", "endpointClassName", "classLoader"});
56         GBEAN_INFO = infoBuilder.getBeanInfo();
57     }
58
59     public static GBeanInfo getGBeanInfo() {
60         return GBEAN_INFO;
61     }
62 }
63
Popular Tags