1 /*
2 * $Id: HeaderElement1_2Impl.java,v 1.29 2006/01/27 12:49:48 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_2;
35
36 import java.util.logging.Logger;
37
38 import javax.xml.namespace.QName;
39 import javax.xml.soap.Name;
40 import javax.xml.soap.SOAPElement;
41 import javax.xml.soap.SOAPException;
42
43 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
44 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
45 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
46
47 public class HeaderElement1_2Impl extends HeaderElementImpl {
48
49 private static Logger log =
50 Logger.getLogger(HeaderElement1_2Impl.class.getName(),
51 "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
52
53 public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, Name qname) {
54 super(ownerDoc, qname);
55 }
56 public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, QName qname) {
57 super(ownerDoc, qname);
58 }
59
60 public SOAPElement setElementQName(QName newName) throws SOAPException {
61 HeaderElementImpl copy =
62 new HeaderElement1_2Impl((SOAPDocumentImpl)getOwnerDocument(), newName);
63 return replaceElementWithSOAPElement(this,copy);
64 }
65
66 protected NameImpl getRoleAttributeName() {
67 return NameImpl.create("role", null, NameImpl.SOAP12_NAMESPACE);
68 }
69
70 // Actor equivalent to Role in SOAP 1.2
71 protected NameImpl getActorAttributeName() {
72 return getRoleAttributeName();
73 }
74
75 protected NameImpl getMustunderstandAttributeName() {
76 return NameImpl.create("mustUnderstand", null, NameImpl.SOAP12_NAMESPACE);
77 }
78
79 // mustUnderstand attribute has literal value "true" or "false"
80 protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
81 return (mustUnderstand == true ? "true" : "false");
82 }
83
84 protected boolean getMustunderstandAttributeValue(String mu) {
85 if (mu.equals("true") || mu.equals("1"))
86 return true;
87 return false;
88 }
89
90 protected NameImpl getRelayAttributeName() {
91 return NameImpl.create("relay", null, NameImpl.SOAP12_NAMESPACE);
92 }
93
94 //relay attribute has literal value "true" or "false"
95 protected String getRelayLiteralValue(boolean relay) {
96 return (relay == true ? "true" : "false");
97 }
98
99 protected boolean getRelayAttributeValue(String relay) {
100 if (relay.equals("true") || relay.equals("1"))
101 return true;
102 return false;
103 }
104
105 protected String getActorOrRole() {
106 return getRole();
107 }
108 }