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_2Impl.java,v 1.2 2007/07/16 16:41:25 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_2;
064:
065: import java.util.logging.Logger;
066:
067: import javax.xml.namespace.QName;
068: import javax.xml.soap.Name;
069: import javax.xml.soap.SOAPElement;
070: import javax.xml.soap.SOAPException;
071:
072: import com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl;
073: import com.sun.xml.messaging.saaj.soap.impl.HeaderElementImpl;
074: import com.sun.xml.messaging.saaj.soap.name.NameImpl;
075:
076: public class HeaderElement1_2Impl extends HeaderElementImpl {
077:
078: private static Logger log = Logger.getLogger(
079: HeaderElement1_2Impl.class.getName(),
080: "com.sun.xml.messaging.saaj.soap.ver1_2.LocalStrings");
081:
082: public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, Name qname) {
083: super (ownerDoc, qname);
084: }
085:
086: public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, QName qname) {
087: super (ownerDoc, qname);
088: }
089:
090: public SOAPElement setElementQName(QName newName)
091: throws SOAPException {
092: HeaderElementImpl copy = new HeaderElement1_2Impl(
093: (SOAPDocumentImpl) getOwnerDocument(), newName);
094: return replaceElementWithSOAPElement(this , copy);
095: }
096:
097: protected NameImpl getRoleAttributeName() {
098: return NameImpl.create("role", null, NameImpl.SOAP12_NAMESPACE);
099: }
100:
101: // Actor equivalent to Role in SOAP 1.2
102: protected NameImpl getActorAttributeName() {
103: return getRoleAttributeName();
104: }
105:
106: protected NameImpl getMustunderstandAttributeName() {
107: return NameImpl.create("mustUnderstand", null,
108: NameImpl.SOAP12_NAMESPACE);
109: }
110:
111: // mustUnderstand attribute has literal value "true" or "false"
112: protected String getMustunderstandLiteralValue(
113: boolean mustUnderstand) {
114: return (mustUnderstand == true ? "true" : "false");
115: }
116:
117: protected boolean getMustunderstandAttributeValue(String mu) {
118: if (mu.equals("true") || mu.equals("1"))
119: return true;
120: return false;
121: }
122:
123: protected NameImpl getRelayAttributeName() {
124: return NameImpl
125: .create("relay", null, NameImpl.SOAP12_NAMESPACE);
126: }
127:
128: //relay attribute has literal value "true" or "false"
129: protected String getRelayLiteralValue(boolean relay) {
130: return (relay == true ? "true" : "false");
131: }
132:
133: protected boolean getRelayAttributeValue(String relay) {
134: if (relay.equals("true") || relay.equals("1"))
135: return true;
136: return false;
137: }
138:
139: protected String getActorOrRole() {
140: return getRole();
141: }
142: }
|