Mon, 04 May 2009 21:10:41 -0700
6658158: Mutable statics in SAAJ (findbugs)
6658163: txw2.DatatypeWriter.BUILDIN is a mutable static (findbugs)
Reviewed-by: darcy
1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 /*
26 *
27 */
31 /**
32 *
33 * @author SAAJ RI Development Team
34 */
35 package com.sun.xml.internal.messaging.saaj.soap.ver1_2;
37 import java.util.logging.Logger;
39 import javax.xml.namespace.QName;
40 import javax.xml.soap.Name;
41 import javax.xml.soap.SOAPElement;
42 import javax.xml.soap.SOAPException;
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;
48 public class HeaderElement1_2Impl extends HeaderElementImpl {
50 private static final Logger log =
51 Logger.getLogger(HeaderElement1_2Impl.class.getName(),
52 "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
54 public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, Name qname) {
55 super(ownerDoc, qname);
56 }
57 public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, QName qname) {
58 super(ownerDoc, qname);
59 }
61 public SOAPElement setElementQName(QName newName) throws SOAPException {
62 HeaderElementImpl copy =
63 new HeaderElement1_2Impl((SOAPDocumentImpl)getOwnerDocument(), newName);
64 return replaceElementWithSOAPElement(this,copy);
65 }
67 protected NameImpl getRoleAttributeName() {
68 return NameImpl.create("role", null, NameImpl.SOAP12_NAMESPACE);
69 }
71 // Actor equivalent to Role in SOAP 1.2
72 protected NameImpl getActorAttributeName() {
73 return getRoleAttributeName();
74 }
76 protected NameImpl getMustunderstandAttributeName() {
77 return NameImpl.create("mustUnderstand", null, NameImpl.SOAP12_NAMESPACE);
78 }
80 // mustUnderstand attribute has literal value "true" or "false"
81 protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
82 return (mustUnderstand == true ? "true" : "false");
83 }
85 protected boolean getMustunderstandAttributeValue(String mu) {
86 if (mu.equals("true") || mu.equals("1"))
87 return true;
88 return false;
89 }
91 protected NameImpl getRelayAttributeName() {
92 return NameImpl.create("relay", null, NameImpl.SOAP12_NAMESPACE);
93 }
95 //relay attribute has literal value "true" or "false"
96 protected String getRelayLiteralValue(boolean relay) {
97 return (relay == true ? "true" : "false");
98 }
100 protected boolean getRelayAttributeValue(String relay) {
101 if (relay.equals("true") || relay.equals("1"))
102 return true;
103 return false;
104 }
106 protected String getActorOrRole() {
107 return getRole();
108 }
109 }