src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CommentImpl.java

Fri, 07 Aug 2009 11:27:00 -0700

author
asaha
date
Fri, 07 Aug 2009 11:27:00 -0700
changeset 78
860b95cc8d1d
parent 50
42dfec6871f6
permissions
-rw-r--r--

6813167: 6u14 JAX-WS audit mutable static bugs
6803688: Integrate latest JAX-WS (2.1.6) in to JDK 6u14
Reviewed-by: darcy, ramap

     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  */
    27 package com.sun.xml.internal.messaging.saaj.soap.impl;
    29 import java.util.ResourceBundle;
    30 import java.util.logging.Logger;
    32 import javax.xml.soap.SOAPElement;
    33 import javax.xml.soap.SOAPException;
    35 import org.w3c.dom.DOMException;
    36 import org.w3c.dom.Text;
    38 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
    39 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
    41 public class CommentImpl
    42     extends com.sun.org.apache.xerces.internal.dom.CommentImpl
    43     implements javax.xml.soap.Text, org.w3c.dom.Comment {
    45     protected static final Logger log =
    46         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
    47                          "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
    48     protected static ResourceBundle rb =
    49         log.getResourceBundle();
    51     public CommentImpl(SOAPDocumentImpl ownerDoc, String text) {
    52         super(ownerDoc, text);
    53     }
    55     public String getValue() {
    56         String nodeValue = getNodeValue();
    57         return (nodeValue.equals("") ? null : nodeValue);
    58     }
    60     public void setValue(String text) {
    61         setNodeValue(text);
    62     }
    65     public void setParentElement(SOAPElement element) throws SOAPException {
    66         if (element == null) {
    67             log.severe("SAAJ0112.impl.no.null.to.parent.elem");
    68             throw new SOAPException("Cannot pass NULL to setParentElement");
    69         }
    70         ((ElementImpl) element).addNode(this);
    71     }
    73     public SOAPElement getParentElement() {
    74         return (SOAPElement) getParentNode();
    75     }
    77     public void detachNode() {
    78         org.w3c.dom.Node parent = getParentNode();
    79         if (parent != null) {
    80             parent.removeChild(this);
    81         }
    82     }
    84     public void recycleNode() {
    85         detachNode();
    86         // TBD
    87         //  - add this to the factory so subsequent
    88         //    creations can reuse this object.
    89     }
    91     public boolean isComment() {
    92         return true;
    93     }
    95     public Text splitText(int offset) throws DOMException {
    96         log.severe("SAAJ0113.impl.cannot.split.text.from.comment");
    97         throw new UnsupportedOperationException("Cannot split text from a Comment Node.");
    98     }
   100     public Text replaceWholeText(String content) throws DOMException {
   101         log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment");
   102         throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node.");
   103     }
   105     public String getWholeText() {
   106         //TODO: maybe we have to implement this in future.
   107         throw new UnsupportedOperationException("Not Supported");
   108     }
   110     public boolean isElementContentWhitespace() {
   111         //TODO: maybe we have to implement this in future.
   112         throw new UnsupportedOperationException("Not Supported");
   113     }
   115 }

mercurial