01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.openejb.server.axis2.ejb;
17:
18: import org.apache.openejb.DeploymentInfo;
19: import org.apache.openejb.core.webservices.PortData;
20: import org.apache.openejb.server.axis2.Axis2WsContainer;
21: import org.apache.openejb.server.axis2.AxisServiceGenerator;
22:
23: import javax.xml.ws.WebServiceException;
24:
25: public class EjbWsContainer extends Axis2WsContainer {
26: private DeploymentInfo deploymnetInfo;
27:
28: public EjbWsContainer(PortData portData,
29: DeploymentInfo deploymentInfo) {
30: super (portData, deploymentInfo.getBeanClass(), deploymentInfo
31: .getJndiEnc());
32: this .deploymnetInfo = deploymentInfo;
33: }
34:
35: public void start() throws Exception {
36: super .start();
37:
38: String rootContext = null;
39: String servicePath = null;
40: String location = trimContext(this .port.getLocation());
41: int pos = location.indexOf('/');
42: if (pos > 0) {
43: rootContext = location.substring(0, pos);
44: servicePath = location.substring(pos + 1);
45: } else {
46: rootContext = "/";
47: servicePath = location;
48: }
49:
50: this .configurationContext.setServicePath(servicePath);
51: //need to setContextRoot after servicePath as cachedServicePath is only built
52: //when setContextRoot is called.
53: this .configurationContext.setContextRoot(rootContext);
54:
55: // configure handlers
56: try {
57: configureHandlers();
58: } catch (Exception e) {
59: throw new WebServiceException("Error configuring handlers",
60: e);
61: }
62: }
63:
64: protected AxisServiceGenerator createServiceGenerator() {
65: AxisServiceGenerator serviceGenerator = super
66: .createServiceGenerator();
67: EjbMessageReceiver messageReceiver = new EjbMessageReceiver(
68: this , endpointClass, deploymnetInfo);
69: serviceGenerator.setMessageReceiver(messageReceiver);
70: return serviceGenerator;
71: }
72:
73: public void destroy() {
74: // call handler preDestroy
75: destroyHandlers();
76: super.destroy();
77: }
78: }
|