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:
20: package org.apache.axis2.jaxws.binding;
21:
22: import java.util.ArrayList;
23: import java.util.List;
24: import java.util.Set;
25:
26: import javax.xml.ws.Binding;
27: import javax.xml.ws.handler.Handler;
28:
29: import org.apache.axis2.jaxws.description.EndpointDescription;
30: import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
31:
32: /**
33: * @author rott classes that would normally "implement javax.xml.ws.Binding"
34: * should extend this class instead.
35: */
36: public class BindingImpl implements Binding {
37:
38: // an unsorted list of handlers
39: private List<Handler> handlers = null;
40:
41: protected String bindingId = null;
42:
43: private EndpointDescription endpointDesc;
44:
45: protected Set<String> roles = null;
46:
47: protected static final String SOAP11_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
48:
49: protected static final String SOAP12_ENV_NS = "http://www.w3.org/2003/05/soap-envelope";
50:
51: public BindingImpl(String bindingId) {
52: this .bindingId = bindingId;
53: }
54:
55: public BindingImpl(EndpointDescription endpointDesc) {
56: this .endpointDesc = endpointDesc;
57: // client
58: this .bindingId = endpointDesc.getClientBindingID();
59: if (this .bindingId == null) {
60: // server
61: this .bindingId = endpointDesc.getBindingType();
62: }
63: }
64:
65: public List<Handler> getHandlerChain() {
66: if (handlers == null) {
67: // non-null so client apps can manipulate
68: handlers = new HandlerResolverImpl(endpointDesc
69: .getServiceDescription())
70: .getHandlerChain(endpointDesc.getPortInfo());
71: }
72: return handlers;
73: }
74:
75: public void setHandlerChain(List<Handler> list) {
76: // handlers cannot be null so a client app can request and manipulate it
77: if (list == null) {
78: handlers = new ArrayList<Handler>(); // non-null, but rather
79: // empty
80: } else {
81: this.handlers = list;
82: }
83: }
84:
85: }
|