001: /*
002: * Copyright (c) 1998-2007 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Emil Ong
028: */
029:
030: package com.caucho.soap.jaxws;
031:
032: import java.util.List;
033: import java.util.Map;
034: import java.util.Set;
035:
036: import java.util.concurrent.CancellationException;
037: import java.util.concurrent.ExecutionException;
038: import java.util.concurrent.TimeUnit;
039:
040: import java.util.logging.Logger;
041: import java.util.logging.Level;
042:
043: import javax.xml.soap.*;
044: import static javax.xml.soap.SOAPConstants.*;
045: import javax.xml.ws.handler.Handler;
046: import javax.xml.ws.soap.SOAPBinding;
047:
048: import com.caucho.util.L10N;
049:
050: public class SOAPBindingImpl extends AbstractBinding implements
051: SOAPBinding {
052: private final static L10N L = new L10N(SOAPBindingImpl.class);
053:
054: private boolean _mtom;
055: private Set<String> _roles;
056:
057: private final MessageFactory _messageFactory;
058: private final SOAPFactory _soapFactory;
059:
060: public SOAPBindingImpl(String bindingId) throws SOAPException {
061: if (bindingId.equals(SOAP11HTTP_BINDING)) {
062: _messageFactory = MessageFactory
063: .newInstance(SOAP_1_1_PROTOCOL);
064: _soapFactory = SOAPFactory.newInstance(SOAP_1_1_PROTOCOL);
065: _mtom = false;
066: } else if (bindingId.equals(SOAP11HTTP_MTOM_BINDING)) {
067: _messageFactory = MessageFactory
068: .newInstance(SOAP_1_1_PROTOCOL);
069: _soapFactory = SOAPFactory.newInstance(SOAP_1_1_PROTOCOL);
070: _mtom = true;
071: } else if (bindingId.equals(SOAP12HTTP_BINDING)) {
072: _messageFactory = MessageFactory
073: .newInstance(SOAP_1_2_PROTOCOL);
074: _soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
075: _mtom = false;
076: } else if (bindingId.equals(SOAP12HTTP_MTOM_BINDING)) {
077: _messageFactory = MessageFactory
078: .newInstance(SOAP_1_2_PROTOCOL);
079: _soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
080: _mtom = true;
081: } else
082: throw new SOAPException(L.l("Unknown SOAP binding: {0}",
083: bindingId));
084: }
085:
086: public MessageFactory getMessageFactory() {
087: return _messageFactory;
088: }
089:
090: public SOAPFactory getSOAPFactory() {
091: return _soapFactory;
092: }
093:
094: public boolean isMTOMEnabled() {
095: return _mtom;
096: }
097:
098: public void setMTOMEnabled(boolean mtom) {
099: _mtom = mtom;
100: }
101:
102: public Set<String> getRoles() {
103: return _roles;
104: }
105:
106: public void setRoles(Set<String> roles) {
107: _roles = roles;
108: }
109: }
|