01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.server.axis2;
18:
19: import org.apache.openejb.DeploymentInfo;
20: import org.apache.openejb.core.webservices.PortData;
21: import org.apache.openejb.server.httpd.HttpListener;
22: import org.apache.openejb.server.axis2.ejb.EjbWsContainer;
23: import org.apache.openejb.server.axis2.pojo.PojoWsContainer;
24: import org.apache.openejb.server.webservices.WsService;
25:
26: import javax.naming.Context;
27: import java.net.URL;
28: import java.util.Map;
29: import java.util.TreeMap;
30:
31: public class Axis2Service extends WsService {
32: private final Map<String, Axis2WsContainer> wsContainers = new TreeMap<String, Axis2WsContainer>();
33:
34: public String getName() {
35: return "axis2";
36: }
37:
38: protected HttpListener createEjbWsContainer(URL moduleBaseUrl,
39: PortData port, DeploymentInfo deploymentInfo)
40: throws Exception {
41: EjbWsContainer container = new EjbWsContainer(port,
42: deploymentInfo);
43: container.start();
44: wsContainers.put(deploymentInfo.getDeploymentID().toString(),
45: container);
46: return container;
47: }
48:
49: protected void destroyEjbWsContainer(String deploymentId) {
50: Axis2WsContainer container = wsContainers.remove(deploymentId);
51: if (container != null) {
52: container.destroy();
53: }
54: }
55:
56: protected HttpListener createPojoWsContainer(URL moduleBaseUrl,
57: PortData port, String serviceId, Class target,
58: Context context, String contextRoot) throws Exception {
59: PojoWsContainer container = new PojoWsContainer(port, target,
60: context, contextRoot);
61: container.start();
62: wsContainers.put(serviceId, container);
63: return container;
64: }
65:
66: protected void destroyPojoWsContainer(String serviceId) {
67: Axis2WsContainer container = wsContainers.remove(serviceId);
68: if (container != null) {
69: container.destroy();
70: }
71: }
72: }
|