src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/HeaderElement1_1Impl.java

changeset 1
0961a4a21176
child 45
31822b475baa
equal deleted inserted replaced
-1:000000000000 1:0961a4a21176
1 /*
2 * $Id: HeaderElement1_1Impl.java,v 1.29 2006/01/27 12:49:41 vj135062 Exp $
3 */
4
5 /*
6 * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 *
9 * This code is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 only, as
11 * published by the Free Software Foundation. Sun designates this
12 * particular file as subject to the "Classpath" exception as provided
13 * by Sun in the LICENSE file that accompanied this code.
14 *
15 * This code is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * version 2 for more details (a copy is included in the LICENSE file that
19 * accompanied this code).
20 *
21 * You should have received a copy of the GNU General Public License version
22 * 2 along with this work; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
26 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * have any questions.
28 */
29
30 /**
31 *
32 * @author SAAJ RI Development Team
33 */
34 package com.sun.xml.internal.messaging.saaj.soap.ver1_1;
35
36 import java.util.logging.Level;
37 import java.util.logging.Logger;
38
39 import javax.xml.namespace.QName;
40 import javax.xml.soap.Name;
41 import javax.xml.soap.SOAPException;
42 import javax.xml.soap.SOAPElement;
43
44 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
45 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
46 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
47 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
48
49 public class HeaderElement1_1Impl extends HeaderElementImpl {
50
51 protected static Logger log =
52 Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN,
53 "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings");
54
55 public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, Name qname) {
56 super(ownerDoc, qname);
57 }
58 public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
59 super(ownerDoc, qname);
60 }
61
62 public SOAPElement setElementQName(QName newName) throws SOAPException {
63 HeaderElementImpl copy =
64 new HeaderElement1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
65 return replaceElementWithSOAPElement(this,copy);
66 }
67
68 protected NameImpl getActorAttributeName() {
69 return NameImpl.create("actor", null, NameImpl.SOAP11_NAMESPACE);
70 }
71
72 // role not supported by SOAP 1.1
73 protected NameImpl getRoleAttributeName() {
74 log.log(
75 Level.SEVERE,
76 "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
77 new String[] { "Role" });
78 throw new UnsupportedOperationException("Role not supported by SOAP 1.1");
79 }
80
81 protected NameImpl getMustunderstandAttributeName() {
82 return NameImpl.create("mustUnderstand", null, NameImpl.SOAP11_NAMESPACE);
83 }
84
85 // mustUnderstand attribute has literal value "1" or "0"
86 protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
87 return (mustUnderstand == true ? "1" : "0");
88 }
89
90 protected boolean getMustunderstandAttributeValue(String mu) {
91 if ("1".equals(mu) || "true".equalsIgnoreCase(mu))
92 return true;
93 return false;
94 }
95
96 // relay not supported by SOAP 1.1
97 protected NameImpl getRelayAttributeName() {
98 log.log(
99 Level.SEVERE,
100 "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
101 new String[] { "Relay" });
102 throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
103 }
104
105 protected String getRelayLiteralValue(boolean relayAttr) {
106 log.log(
107 Level.SEVERE,
108 "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
109 new String[] { "Relay" });
110 throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
111 }
112
113 protected boolean getRelayAttributeValue(String mu) {
114 log.log(
115 Level.SEVERE,
116 "SAAJ0302.ver1_1.hdr.attr.unsupported.in.SOAP1.1",
117 new String[] { "Relay" });
118 throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
119 }
120
121 protected String getActorOrRole() {
122 return getActor();
123 }
124
125 }

mercurial