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

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
0961a4a21176
child 45
31822b475baa
permissions
-rw-r--r--

Initial load

     1 /*
     2  * $Id: CommentImpl.java,v 1.17 2006/01/27 12:49:34 vj135062 Exp $
     3  * $Revision: 1.17 $
     4  * $Date: 2006/01/27 12:49:34 $
     5  */
     7 /*
     8  * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
     9  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10  *
    11  * This code is free software; you can redistribute it and/or modify it
    12  * under the terms of the GNU General Public License version 2 only, as
    13  * published by the Free Software Foundation.  Sun designates this
    14  * particular file as subject to the "Classpath" exception as provided
    15  * by Sun in the LICENSE file that accompanied this code.
    16  *
    17  * This code is distributed in the hope that it will be useful, but WITHOUT
    18  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    19  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    20  * version 2 for more details (a copy is included in the LICENSE file that
    21  * accompanied this code).
    22  *
    23  * You should have received a copy of the GNU General Public License version
    24  * 2 along with this work; if not, write to the Free Software Foundation,
    25  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    26  *
    27  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    28  * CA 95054 USA or visit www.sun.com if you need additional information or
    29  * have any questions.
    30  */
    31 package com.sun.xml.internal.messaging.saaj.soap.impl;
    33 import java.util.ResourceBundle;
    34 import java.util.logging.Logger;
    36 import javax.xml.soap.SOAPElement;
    37 import javax.xml.soap.SOAPException;
    39 import org.w3c.dom.DOMException;
    40 import org.w3c.dom.Text;
    42 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
    43 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
    45 public class CommentImpl
    46     extends com.sun.org.apache.xerces.internal.dom.CommentImpl
    47     implements javax.xml.soap.Text, org.w3c.dom.Comment {
    49     protected static Logger log =
    50         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
    51                          "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
    52     protected static ResourceBundle rb =
    53         log.getResourceBundle();
    55     public CommentImpl(SOAPDocumentImpl ownerDoc, String text) {
    56         super(ownerDoc, text);
    57     }
    59     public String getValue() {
    60         String nodeValue = getNodeValue();
    61         return (nodeValue.equals("") ? null : nodeValue);
    62     }
    64     public void setValue(String text) {
    65         setNodeValue(text);
    66     }
    69     public void setParentElement(SOAPElement element) throws SOAPException {
    70         if (element == null) {
    71             log.severe("SAAJ0112.impl.no.null.to.parent.elem");
    72             throw new SOAPException("Cannot pass NULL to setParentElement");
    73         }
    74         ((ElementImpl) element).addNode(this);
    75     }
    77     public SOAPElement getParentElement() {
    78         return (SOAPElement) getParentNode();
    79     }
    81     public void detachNode() {
    82         org.w3c.dom.Node parent = getParentNode();
    83         if (parent != null) {
    84             parent.removeChild(this);
    85         }
    86     }
    88     public void recycleNode() {
    89         detachNode();
    90         // TBD
    91         //  - add this to the factory so subsequent
    92         //    creations can reuse this object.
    93     }
    95     public boolean isComment() {
    96         return true;
    97     }
    99     public Text splitText(int offset) throws DOMException {
   100         log.severe("SAAJ0113.impl.cannot.split.text.from.comment");
   101         throw new UnsupportedOperationException("Cannot split text from a Comment Node.");
   102     }
   104     public Text replaceWholeText(String content) throws DOMException {
   105         log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment");
   106         throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node.");
   107     }
   109     public String getWholeText() {
   110         //TODO: maybe we have to implement this in future.
   111         throw new UnsupportedOperationException("Not Supported");
   112     }
   114     public boolean isElementContentWhitespace() {
   115         //TODO: maybe we have to implement this in future.
   116         throw new UnsupportedOperationException("Not Supported");
   117     }
   119 }

mercurial