001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package com.sun.xml.ws.client;
037:
038: import com.sun.xml.ws.api.handler.MessageHandler;
039:
040: import javax.xml.namespace.QName;
041: import javax.xml.ws.handler.Handler;
042: import javax.xml.ws.handler.LogicalHandler;
043: import javax.xml.ws.handler.soap.SOAPHandler;
044: import java.util.*;
045:
046: /**
047: * This class holds the handler information on the BindingProvider.
048: * HandlerConfiguration is immutable, and a new object is created
049: * when the BindingImpl is created or User calls Binding.setHandlerChain() or
050: * SOAPBinding.setRoles()
051: * During inovcation in Stub.process(), snapshot of the handler configuration is set in
052: * Packet.handlerConfig
053: * The information in the HandlerConfiguration is used by MUPipe and HandlerTube
054: * implementations.
055: *
056: * @author Rama Pulavarthi
057: */
058: public class HandlerConfiguration {
059: private final Set<String> roles;
060: /**
061: * This chain may contain both soap and logical handlers.
062: */
063: private final List<Handler> handlerChain;
064: private final List<LogicalHandler> logicalHandlers;
065: private final List<SOAPHandler> soapHandlers;
066: private final List<MessageHandler> messageHandlers;
067: private Set<QName> knownHeaders;
068: private Set<QName> handlerKnownHeaders;
069:
070: /**
071: * @param roles This contains the roles assumed by the Binding implementation.
072: * @param portKnownHeaders This contains the headers that are bound to the current WSDL Port
073: * @param handlerChain This contains the handler chain set on the Binding
074: * @param logicalHandlers
075: * @param soapHandlers
076: * @param handlerKnownHeaders The set is comprised of headers returned from SOAPHandler.getHeaders()
077: * method calls.
078: */
079: public HandlerConfiguration(Set<String> roles,
080: Set<QName> portKnownHeaders, List<Handler> handlerChain,
081: List<LogicalHandler> logicalHandlers,
082: List<SOAPHandler> soapHandlers,
083: List<MessageHandler> messageHandlers,
084: Set<QName> handlerKnownHeaders) {
085: this .roles = roles;
086: this .handlerChain = handlerChain;
087: this .logicalHandlers = logicalHandlers;
088: this .soapHandlers = soapHandlers;
089: this .messageHandlers = messageHandlers;
090: this .handlerKnownHeaders = handlerKnownHeaders;
091: this .knownHeaders = new HashSet<QName>();
092: if (portKnownHeaders != null)
093: knownHeaders.addAll(portKnownHeaders);
094: if (handlerKnownHeaders != null)
095: knownHeaders.addAll(handlerKnownHeaders);
096: }
097:
098: public Set<String> getRoles() {
099: return roles;
100: }
101:
102: /**
103: *
104: * @return return a copy of handler chain
105: */
106: public List<Handler> getHandlerChain() {
107: if (handlerChain == null)
108: return Collections.emptyList();
109: return new ArrayList<Handler>(handlerChain);
110:
111: }
112:
113: public List<LogicalHandler> getLogicalHandlers() {
114: return logicalHandlers;
115: }
116:
117: public List<SOAPHandler> getSoapHandlers() {
118: return soapHandlers;
119: }
120:
121: public List<MessageHandler> getMessageHandlers() {
122: return messageHandlers;
123: }
124:
125: public Set<QName> getKnownHeaders() {
126: return knownHeaders;
127: }
128:
129: public Set<QName> getHandlerKnownHeaders() {
130: return handlerKnownHeaders;
131: }
132:
133: }
|