001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: /*
021: * $Id: HeaderElement1_1Impl.java,v 1.2 2007/07/16 16:41:24 ofung Exp $
022: */
023:
024: /*
025: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
026: *
027: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
028: *
029: * The contents of this file are subject to the terms of either the GNU
030: * General Public License Version 2 only ("GPL") or the Common Development
031: * and Distribution License("CDDL") (collectively, the "License"). You
032: * may not use this file except in compliance with the License. You can obtain
033: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
034: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
035: * language governing permissions and limitations under the License.
036: *
037: * When distributing the software, include this License Header Notice in each
038: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
039: * Sun designates this particular file as subject to the "Classpath" exception
040: * as provided by Sun in the GPL Version 2 section of the License file that
041: * accompanied this code. If applicable, add the following below the License
042: * Header, with the fields enclosed by brackets [] replaced by your own
043: * identifying information: "Portions Copyrighted [year]
044: * [name of copyright owner]"
045: *
046: * Contributor(s):
047: *
048: * If you wish your version of this file to be governed by only the CDDL or
049: * only the GPL Version 2, indicate your decision by adding "[Contributor]
050: * elects to include this software in this distribution under the [CDDL or GPL
051: * Version 2] license." If you don't indicate a single choice of license, a
052: * recipient has the option to distribute your version of this file under
053: * either the CDDL, the GPL Version 2 or to extend the choice of license to
054: * its licensees as provided above. However, if you add GPL Version 2 code
055: * and therefore, elected the GPL Version 2 license, then the option applies
056: * only if the new code is made subject to such option by the copyright
057: * holder.
058: */
059:
060: /**
061: *
062: * @author SAAJ RI Development Team
063: */package com.sun.xml.messaging.saaj.soap.ver1_1;
064:
065: import java.util.logging.Level;
066: import java.util.logging.Logger;
067:
068: import javax.xml.namespace.QName;
069: import javax.xml.soap.Name;
070: import javax.xml.soap.SOAPException;
071: import javax.xml.soap.SOAPElement;
072:
073: import com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl;
074: import com.sun.xml.messaging.saaj.soap.impl.HeaderElementImpl;
075: import com.sun.xml.messaging.saaj.soap.name.NameImpl;
076: import com.sun.xml.messaging.saaj.util.LogDomainConstants;
077:
078: public class HeaderElement1_1Impl extends HeaderElementImpl {
079:
080: protected static Logger log = Logger.getLogger(
081: LogDomainConstants.SOAP_VER1_1_DOMAIN,
082: "com.sun.xml.messaging.saaj.soap.ver1_1.LocalStrings");
083:
084: public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, Name qname) {
085: super (ownerDoc, qname);
086: }
087:
088: public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
089: super (ownerDoc, qname);
090: }
091:
092: public SOAPElement setElementQName(QName newName)
093: throws SOAPException {
094: HeaderElementImpl copy = new HeaderElement1_1Impl(
095: (SOAPDocumentImpl) getOwnerDocument(), newName);
096: return replaceElementWithSOAPElement(this , copy);
097: }
098:
099: protected NameImpl getActorAttributeName() {
100: return NameImpl
101: .create("actor", null, NameImpl.SOAP11_NAMESPACE);
102: }
103:
104: // role not supported by SOAP 1.1
105: protected NameImpl getRoleAttributeName() {
106: log.log(Level.SEVERE,
107: "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
108: new String[] { "Role" });
109: throw new UnsupportedOperationException(
110: "Role not supported by SOAP 1.1");
111: }
112:
113: protected NameImpl getMustunderstandAttributeName() {
114: return NameImpl.create("mustUnderstand", null,
115: NameImpl.SOAP11_NAMESPACE);
116: }
117:
118: // mustUnderstand attribute has literal value "1" or "0"
119: protected String getMustunderstandLiteralValue(
120: boolean mustUnderstand) {
121: return (mustUnderstand == true ? "1" : "0");
122: }
123:
124: protected boolean getMustunderstandAttributeValue(String mu) {
125: if ("1".equals(mu) || "true".equalsIgnoreCase(mu))
126: return true;
127: return false;
128: }
129:
130: // relay not supported by SOAP 1.1
131: protected NameImpl getRelayAttributeName() {
132: log.log(Level.SEVERE,
133: "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
134: new String[] { "Relay" });
135: throw new UnsupportedOperationException(
136: "Relay not supported by SOAP 1.1");
137: }
138:
139: protected String getRelayLiteralValue(boolean relayAttr) {
140: log.log(Level.SEVERE,
141: "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
142: new String[] { "Relay" });
143: throw new UnsupportedOperationException(
144: "Relay not supported by SOAP 1.1");
145: }
146:
147: protected boolean getRelayAttributeValue(String mu) {
148: log.log(Level.SEVERE,
149: "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
150: new String[] { "Relay" });
151: throw new UnsupportedOperationException(
152: "Relay not supported by SOAP 1.1");
153: }
154:
155: protected String getActorOrRole() {
156: return getActor();
157: }
158:
159: }
|