01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with 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,
13: * software distributed under the License is distributed on an
14: * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.wso2.esb.transport.tomcat;
20:
21: import org.apache.axis2.AxisFault;
22: import org.apache.axis2.addressing.EndpointReference;
23: import org.apache.axis2.context.ConfigurationContext;
24: import org.apache.axis2.description.Parameter;
25: import org.apache.axis2.description.TransportInDescription;
26: import org.apache.commons.logging.Log;
27: import org.apache.commons.logging.LogFactory;
28: import org.wso2.esb.ServiceBusConstants;
29: import org.wso2.esb.ServiceBusManager;
30: import org.wso2.utils.transport.AbstractTransportListener;
31:
32: /**
33: *
34: */
35:
36: public class HttpsTransportListener extends AbstractTransportListener {
37:
38: private static Log log = LogFactory
39: .getLog(HttpsTransportListener.class);
40:
41: public void init(ConfigurationContext configContext,
42: TransportInDescription transportIn) throws AxisFault {
43: this .configurationContext = configContext;
44: Parameter portParam = transportIn.getParameter(PARAM_PORT);
45: if (portParam != null) {
46: Object value = portParam.getValue();
47: if (value != null) {
48: try {
49: this .port = Integer.parseInt(value.toString()
50: .trim());
51: } catch (NumberFormatException ignored) {
52: this .port = ServiceBusManager.getInstance()
53: .getHttpsPort();
54: log.info("The given port number( " + value
55: + " ) was an invalid number."
56: + " Therefore,the default port number ( "
57: + this .port + " ) will use ");
58: }
59: }
60: } else {
61: this .port = ServiceBusManager.getInstance().getHttpsPort();
62: }
63: this .tInDescription = transportIn;
64: }
65:
66: public void start() throws AxisFault {
67:
68: }
69:
70: public EndpointReference getEPRForService(String serviceName,
71: String ip) throws AxisFault {
72: return getEPR(ServiceBusConstants.HTTPS_TRANSPORT, serviceName,
73: ip);
74: }
75:
76: public EndpointReference[] getEPRsForService(String serviceName,
77: String ip) throws AxisFault {
78: return new EndpointReference[] { getEPRForService(serviceName,
79: ip) };
80: }
81: }
|