Save This Page
Home » openjdk-7 » javax » xml » soap » [javadoc | source]
    1   /*
    2    * $Id: SOAPElementFactory.java,v 1.4.2.7 2004/08/27 19:00:36 goodwin Exp $
    3    * $Revision: 1.4.2.7 $
    4    * $Date: 2004/08/27 19:00:36 $
    5    */
    6   
    7   /*
    8    * Copyright 2005-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   
   32   package javax.xml.soap;
   33   
   34   /**
   35    * <code>SOAPElementFactory</code> is a factory for XML fragments that
   36    * will eventually end up in the SOAP part. These fragments
   37    * can be inserted as children of the <code>SOAPHeader</code> or
   38    * <code>SOAPBody</code> or <code>SOAPEnvelope</code>.
   39    *
   40    * <p>Elements created using this factory do not have the properties
   41    * of an element that lives inside a SOAP header document. These
   42    * elements are copied into the XML document tree when they are
   43    * inserted.
   44    * @deprecated - Use <code>javax.xml.soap.SOAPFactory</code> for creating SOAPElements.
   45    * @see javax.xml.soap.SOAPFactory
   46    */
   47   public class SOAPElementFactory {
   48   
   49       private SOAPFactory soapFactory;
   50   
   51       private SOAPElementFactory(SOAPFactory soapFactory) {
   52           this.soapFactory = soapFactory;
   53       }
   54   
   55       /**
   56        * Create a <code>SOAPElement</code> object initialized with the
   57        * given <code>Name</code> object.
   58        *
   59        * @param name a <code>Name</code> object with the XML name for
   60        *             the new element
   61        *
   62        * @return the new <code>SOAPElement</code> object that was
   63        *         created
   64        *
   65        * @exception SOAPException if there is an error in creating the
   66        *            <code>SOAPElement</code> object
   67        *
   68        * @deprecated Use
   69        * javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
   70        * instead
   71        *
   72        * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
   73        * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.namespace.QName)
   74        */
   75       public SOAPElement create(Name name) throws SOAPException {
   76           return soapFactory.createElement(name);
   77       }
   78   
   79       /**
   80        * Create a <code>SOAPElement</code> object initialized with the
   81        * given local name.
   82        *
   83        * @param localName a <code>String</code> giving the local name for
   84        *             the new element
   85        *
   86        * @return the new <code>SOAPElement</code> object that was
   87        *         created
   88        *
   89        * @exception SOAPException if there is an error in creating the
   90        *            <code>SOAPElement</code> object
   91        *
   92        * @deprecated Use
   93        * javax.xml.soap.SOAPFactory.createElement(String localName) instead
   94        *
   95        * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
   96        */
   97       public SOAPElement create(String localName) throws SOAPException {
   98           return soapFactory.createElement(localName);
   99       }
  100   
  101       /**
  102        * Create a new <code>SOAPElement</code> object with the given
  103        * local name, prefix and uri.
  104        *
  105        * @param localName a <code>String</code> giving the local name
  106        *                  for the new element
  107        * @param prefix the prefix for this <code>SOAPElement</code>
  108        * @param uri a <code>String</code> giving the URI of the
  109        *            namespace to which the new element belongs
  110        *
  111        * @exception SOAPException if there is an error in creating the
  112        *            <code>SOAPElement</code> object
  113        *
  114        * @deprecated Use
  115        * javax.xml.soap.SOAPFactory.createElement(String localName,
  116        *                      String prefix,
  117        *                      String uri)
  118        * instead
  119        *
  120        * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
  121        */
  122       public SOAPElement create(String localName, String prefix, String uri)
  123           throws SOAPException {
  124           return soapFactory.createElement(localName, prefix, uri);
  125       }
  126   
  127       /**
  128        * Creates a new instance of <code>SOAPElementFactory</code>.
  129        *
  130        * @return a new instance of a <code>SOAPElementFactory</code>
  131        *
  132        * @exception SOAPException if there was an error creating the
  133        *            default <code>SOAPElementFactory</code>
  134        */
  135       public static SOAPElementFactory newInstance() throws SOAPException {
  136           try {
  137               return new SOAPElementFactory(SOAPFactory.newInstance());
  138           } catch (Exception ex) {
  139               throw new SOAPException(
  140                   "Unable to create SOAP Element Factory: " + ex.getMessage());
  141           }
  142       }
  143   }

Save This Page
Home » openjdk-7 » javax » xml » soap » [javadoc | source]