axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ven...@apache.org
Subject svn commit: r179806 [1/3] - in /webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml: namespace/ soap/
Date Fri, 03 Jun 2005 14:54:43 GMT
Author: venkat
Date: Fri Jun  3 07:54:42 2005
New Revision: 179806

URL: http://svn.apache.org/viewcvs?rev=179806&view=rev
Log:
adding sources for saaj spec api (javax.xml.soap stuff) - my svn client skipped thse updates last time.

Added:
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/namespace/QName.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/AttachmentPart.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Detail.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/DetailEntry.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/FactoryFinder.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MessageFactory.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeader.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeaders.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Name.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Node.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBody.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBodyElement.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnection.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnectionFactory.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConstants.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPElement.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPElementFactory.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPEnvelope.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPException.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPFactory.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPFault.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPFaultElement.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPHeader.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPHeaderElement.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPMessage.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPPart.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Text.java

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/namespace/QName.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/namespace/QName.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/namespace/QName.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/namespace/QName.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,221 @@
+/*
+ * Created on Mar 15, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package javax.xml.namespace;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * <code>QName</code> class represents the value of a qualified name
+ * as specified in <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML
+ * Schema Part2: Datatypes specification</a>.
+ * <p>
+ * The value of a QName contains a <b>namespaceURI</b>, a <b>localPart</b> and a
+ * <b>prefix</b>. The localPart provides the local part of the qualified name.
+ * The namespaceURI is a URI reference identifying the namespace.
+ *
+ * @version 1.1
+ */
+public class QName implements Serializable {
+
+    /** Comment/shared empty <code>String</code>. */
+    private static final String emptyString = "".intern();
+
+    private String namespaceURI;
+
+    private String localPart;
+
+    private String prefix;
+
+    /**
+     * Constructor for the QName.
+     *
+     * @param localPart local part of the QName
+     */
+    public QName(String localPart) {
+        this(emptyString, localPart, emptyString);
+    }
+
+    /**
+     * Constructor for the QName.
+     *
+     * @param namespaceURI namespace URI for the QName
+     * @param localPart local part of the QName.
+     */
+    public QName(String namespaceURI, String localPart) {
+        this(namespaceURI, localPart, emptyString);
+    }
+
+    /**
+     * Constructor for the QName.
+     *
+     * @param namespaceURI Namespace URI for the QName
+     * @param localPart Local part of the QName.
+     * @param prefix Prefix of the QName.
+     */
+    public QName(String namespaceURI, String localPart, String prefix) {
+        this.namespaceURI = (namespaceURI == null)
+                ? emptyString
+                : namespaceURI.intern();
+        if (localPart == null) {
+            throw new IllegalArgumentException("invalid QName local part");
+        } else {
+            this.localPart = localPart.intern();
+        }
+
+        if (prefix == null) {
+            throw new IllegalArgumentException("invalid QName prefix");
+        } else {
+            this.prefix = prefix.intern();
+        }
+    }
+
+    /**
+     * Gets the namespace URI for this QName.
+     *
+     * @return namespace URI
+     */
+    public String getNamespaceURI() {
+        return namespaceURI;
+    }
+
+    /**
+     * Gets the local part for this QName.
+     *
+     * @return the local part
+     */
+    public String getLocalPart() {
+        return localPart;
+    }
+
+    /**
+     * Gets the prefix for this QName.
+     *
+     * @return the prefix
+     */
+    public String getPrefix() {
+        return prefix;
+    }
+
+    /**
+     * Returns a string representation of this QName.
+     *
+     * @return  a string representation of the QName
+     */
+    public String toString() {
+
+        return ((namespaceURI == emptyString)
+                ? localPart
+                : '{' + namespaceURI + '}' + localPart);
+    }
+
+    /**
+     * Tests this QName for equality with another object.
+     * <p>
+     * If the given object is not a QName or is null then this method
+     * returns <tt>false</tt>.
+     * <p>
+     * For two QNames to be considered equal requires that both
+     * localPart and namespaceURI must be equal. This method uses
+     * <code>String.equals</code> to check equality of localPart
+     * and namespaceURI. Any class that extends QName is required
+     * to satisfy this equality contract.
+     * <p>
+     * This method satisfies the general contract of the <code>Object.equals</code> method.
+     *
+     * @param obj the reference object with which to compare
+     *
+     * @return <code>true</code> if the given object is identical to this
+     *      QName: <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+
+        if (obj == this) {
+            return true;
+        }
+
+        if (!(obj instanceof QName)) {
+            return false;
+        }
+
+        if ((namespaceURI == ((QName) obj).namespaceURI)
+                && (localPart == ((QName) obj).localPart)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns a QName holding the value of the specified String.
+     * <p>
+     * The string must be in the form returned by the QName.toString()
+     * method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}"
+     * part being optional.
+     * <p>
+     * This method doesn't do a full validation of the resulting QName.
+     * In particular, it doesn't check that the resulting namespace URI
+     * is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting
+     * local part is a legal NCName per the XML Namespaces specification.
+     *
+     * @param s the string to be parsed
+     * @throws java.lang.IllegalArgumentException If the specified String cannot be parsed as a QName
+     * @return QName corresponding to the given String
+     */
+    public static QName valueOf(String s) {
+
+        if ((s == null) || s.equals("")) {
+            throw new IllegalArgumentException("invalid QName literal");
+        }
+
+        if (s.charAt(0) == '{') {
+            int i = s.indexOf('}');
+
+            if (i == -1) {
+                throw new IllegalArgumentException("invalid QName literal");
+            }
+
+            if (i == s.length() - 1) {
+                throw new IllegalArgumentException("invalid QName literal");
+            } else {
+                return new QName(s.substring(1, i), s.substring(i + 1));
+            }
+        } else {
+            return new QName(s);
+        }
+    }
+
+    /**
+     * Returns a hash code value for this QName object. The hash code
+     * is based on both the localPart and namespaceURI parts of the
+     * QName. This method satisfies the  general contract of the
+     * <code>Object.hashCode</code> method.
+     *
+     * @return a hash code value for this Qname object
+     */
+    public int hashCode() {
+        return namespaceURI.hashCode() ^ localPart.hashCode();
+    }
+
+    /**
+     * Ensure that deserialization properly interns the results.
+     * @param in the ObjectInputStream to be read
+     * @throws IOException  if there was a failure in the object input stream
+     * @throws ClassNotFoundException   if the class of any sub-objects could
+     *              not be found
+     */
+    private void readObject(ObjectInputStream in) throws
+            IOException, ClassNotFoundException {
+        in.defaultReadObject();
+
+        namespaceURI = namespaceURI.intern();
+        localPart = localPart.intern();
+        prefix = prefix.intern();
+    }
+}
+

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/AttachmentPart.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/AttachmentPart.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/AttachmentPart.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/AttachmentPart.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,407 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import javax.activation.DataHandler;
+import java.util.Iterator;
+
+/**
+ * <P>A single attachment to a <CODE>SOAPMessage</CODE> object. A
+ *   <CODE>SOAPMessage</CODE> object may contain zero, one, or many
+ *   <CODE>AttachmentPart</CODE> objects. Each <CODE>
+ *   AttachmentPart</CODE> object consists of two parts,
+ *   application-specific content and associated MIME headers. The
+ *   MIME headers consists of name/value pairs that can be used to
+ *   identify and describe the content.</P>
+ *
+ *   <P>An <CODE>AttachmentPart</CODE> object must conform to
+ *   certain standards.</P>
+ *
+ *   <OL>
+ *     <LI>It must conform to <A href=
+ *     "http://www.ietf.org/rfc/rfc2045.txt">MIME [RFC2045]
+ *     standards</A></LI>
+ *
+ *     <LI>It MUST contain content</LI>
+ *
+ *     <LI>
+ *       The header portion MUST include the following header:
+ *
+ *       <UL>
+ *         <LI>
+ *           <CODE>Content-Type</CODE><BR>
+ *            This header identifies the type of data in the content
+ *           of an <CODE>AttachmentPart</CODE> object and MUST
+ *           conform to [RFC2045]. The following is an example of a
+ *           Content-Type header:
+ * <PRE>
+ *      Content-Type:  application/xml
+ *
+ * </PRE>
+ *           The following line of code, in which <CODE>ap</CODE> is
+ *           an <CODE>AttachmentPart</CODE> object, sets the header
+ *           shown in the previous example.
+ * <PRE>
+ *      ap.setMimeHeader("Content-Type", "application/xml");
+ *
+ * </PRE>
+ *
+ *           <P></P>
+ *         </LI>
+ *       </UL>
+ *     </LI>
+ *   </OL>
+ *
+ *   <P>There are no restrictions on the content portion of an
+ *   <CODE>AttachmentPart</CODE> object. The content may be anything
+ *   from a simple plain text object to a complex XML document or
+ *   image file.</P>
+ *
+ *   <P>An <CODE>AttachmentPart</CODE> object is created with the
+ *   method <CODE>SOAPMessage.createAttachmentPart</CODE>. After
+ *   setting its MIME headers, the <CODE>AttachmentPart</CODE>
+ *   object is added to the message that created it with the method
+ *   <CODE>SOAPMessage.addAttachmentPart</CODE>.</P>
+ *
+ *   <P>The following code fragment, in which <CODE>m</CODE> is a
+ *   <CODE>SOAPMessage</CODE> object and <CODE>contentStringl</CODE>
+ *   is a <CODE>String</CODE>, creates an instance of <CODE>
+ *   AttachmentPart</CODE>, sets the <CODE>AttachmentPart</CODE>
+ *   object with some content and header information, and adds the
+ *   <CODE>AttachmentPart</CODE> object to the <CODE>
+ *   SOAPMessage</CODE> object.</P>
+ * <PRE>
+ *    AttachmentPart ap1 = m.createAttachmentPart();
+ *    ap1.setContent(contentString1, "text/plain");
+ *    m.addAttachmentPart(ap1);
+ * </PRE>
+ *
+ *   <P>The following code fragment creates and adds a second <CODE>
+ *   AttachmentPart</CODE> instance to the same message. <CODE>
+ *   jpegData</CODE> is a binary byte buffer representing the jpeg
+ *   file.</P>
+ * <PRE>
+ *    AttachmentPart ap2 = m.createAttachmentPart();
+ *    byte[] jpegData =  ...;
+ *    ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg");
+ *    m.addAttachmentPart(ap2);
+ * </PRE>
+ *
+ *   <P>The <CODE>getContent</CODE> method retrieves the contents
+ *   and header from an <CODE>AttachmentPart</CODE> object.
+ *   Depending on the <CODE>DataContentHandler</CODE> objects
+ *   present, the returned <CODE>Object</CODE> can either be a typed
+ *   Java object corresponding to the MIME type or an <CODE>
+ *   InputStream</CODE> object that contains the content as
+ *   bytes.</P>
+ * <PRE>
+ *    String content1 = ap1.getContent();
+ *    java.io.InputStream content2 = ap2.getContent();
+ * </PRE>
+ *   The method <CODE>clearContent</CODE> removes all the content
+ *   from an <CODE>AttachmentPart</CODE> object but does not affect
+ *   its header information.
+ * <PRE>
+ *    ap1.clearContent();
+ * </PRE>
+ */
+public abstract class AttachmentPart {
+
+    // fixme: should this constructor be protected?
+    /** Create a new AttachmentPart. */
+    public AttachmentPart() {}
+
+    /**
+     * Returns the number of bytes in this <CODE>
+     * AttachmentPart</CODE> object.
+     * @return the size of this <CODE>AttachmentPart</CODE> object
+     *     in bytes or -1 if the size cannot be determined
+     * @throws  SOAPException  if the content of this
+     *     attachment is corrupted of if there was an exception
+     *     while trying to determine the size.
+     */
+    public abstract int getSize() throws SOAPException;
+
+    /**
+     * Clears out the content of this <CODE>
+     * AttachmentPart</CODE> object. The MIME header portion is left
+     * untouched.
+     */
+    public abstract void clearContent();
+
+    /**
+     * Gets the content of this <code>AttachmentPart</code> object as a Java
+     * object. The type of the returned Java object depends on (1) the
+     * <code>DataContentHandler</code> object that is used to interpret the bytes
+     * and (2) the <code>Content-Type</code> given in the header.
+     * <p>
+     * For the MIME content types "text/plain", "text/html" and "text/xml", the
+     * <code>DataContentHandler</code> object does the conversions to and
+     * from the Java types corresponding to the MIME types.
+     * For other MIME types,the <code>DataContentHandler</code> object
+     * can return an <code>InputStream</code> object that contains the content data
+     * as raw bytes.
+     * <p>
+     * A JAXM-compliant implementation must, as a minimum, return a
+     * <code>java.lang.String</code> object corresponding to any content
+     * stream with a <code>Content-Type</code> value of
+     * <code>text/plain</code>, a
+     * <code>javax.xml.transform.StreamSource</code> object corresponding to a
+     * content stream with a <code>Content-Type</code> value of
+     * <code>text/xml</code>, a <code>java.awt.Image</code> object
+     * corresponding to a content stream with a
+     * <code>Content-Type</code> value of <code>image/gif</code> or
+     * <code>image/jpeg</code>.  For those content types that an
+     * installed <code>DataContentHandler</code> object does not understand, the
+     * <code>DataContentHandler</code> object is required to return a
+     * <code>java.io.InputStream</code> object with the raw bytes.
+     *
+     * @return a Java object with the content of this <CODE>
+     *     AttachmentPart</CODE> object
+     * @throws  SOAPException  if there is no content set
+     *     into this <CODE>AttachmentPart</CODE> object or if there
+     *     was a data transformation error
+     */
+    public abstract Object getContent() throws SOAPException;
+
+    /**
+     * Sets the content of this attachment part to that of the
+     * given <CODE>Object</CODE> and sets the value of the <CODE>
+     * Content-Type</CODE> header to the given type. The type of the
+     * <CODE>Object</CODE> should correspond to the value given for
+     * the <CODE>Content-Type</CODE>. This depends on the particular
+     * set of <CODE>DataContentHandler</CODE> objects in use.
+     * @param  object  the Java object that makes up
+     * the content for this attachment part
+     * @param  contentType the MIME string that
+     * specifies the type of the content
+     * @throws java.lang.IllegalArgumentException if
+     *     the contentType does not match the type of the content
+     *     object, or if there was no <CODE>
+     *     DataContentHandler</CODE> object for this content
+     *     object
+     * @see #getContent() getContent()
+     */
+    public abstract void setContent(Object object, String contentType);
+
+    /**
+     * Gets the <CODE>DataHandler</CODE> object for this <CODE>
+     * AttachmentPart</CODE> object.
+     * @return the <CODE>DataHandler</CODE> object associated with
+     *     this <CODE>AttachmentPart</CODE> object
+     * @throws  SOAPException  if there is
+     *     no data in this <CODE>AttachmentPart</CODE> object
+     */
+    public abstract DataHandler getDataHandler() throws SOAPException;
+
+    /**
+     * Sets the given <CODE>DataHandler</CODE> object as the
+     * data handler for this <CODE>AttachmentPart</CODE> object.
+     * Typically, on an incoming message, the data handler is
+     * automatically set. When a message is being created and
+     * populated with content, the <CODE>setDataHandler</CODE>
+     * method can be used to get data from various data sources into
+     * the message.
+     * @param  datahandler  <CODE>DataHandler</CODE> object to
+     *     be set
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified <CODE>
+     *     DataHandler</CODE> object
+     */
+    public abstract void setDataHandler(DataHandler datahandler);
+
+    /**
+     * Gets the value of the MIME header whose name is
+     * "Content-Id".
+     * @return  a <CODE>String</CODE> giving the value of the
+     *     "Content-Id" header or <CODE>null</CODE> if there is
+     *     none
+     * @see #setContentId(java.lang.String) setContentId(java.lang.String)
+     */
+    public String getContentId() {
+
+        String as[] = getMimeHeader("Content-Id");
+
+        if (as != null && as.length > 0) {
+            return as[0];
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Gets the value of the MIME header
+     * "Content-Location".
+     * @return  a <CODE>String</CODE> giving the value of the
+     *     "Content-Location" header or <CODE>null</CODE> if there
+     *     is none
+     */
+    public String getContentLocation() {
+
+        String as[] = getMimeHeader("Content-Location");
+
+        if (as != null && as.length > 0) {
+            return as[0];
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Gets the value of the MIME header "Content-Type".
+     * @return  a <CODE>String</CODE> giving the value of the
+     *     "Content-Type" header or <CODE>null</CODE> if there is
+     *     none
+     */
+    public String getContentType() {
+
+        String as[] = getMimeHeader("Content-Type");
+
+        if (as != null && as.length > 0) {
+            return as[0];
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Sets the MIME header "Content-Id" with the given
+     * value.
+     * @param  contentId a <CODE>String</CODE> giving
+     *     the value of the "Content-Id" header
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified <CODE>
+     *     contentId</CODE> value
+     * @see #getContentId() getContentId()
+     */
+    public void setContentId(String contentId) {
+        setMimeHeader("Content-Id", contentId);
+    }
+
+    /**
+     * Sets the MIME header "Content-Location" with the given
+     * value.
+     * @param  contentLocation a <CODE>String</CODE>
+     *     giving the value of the "Content-Location" header
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified content
+     *     location
+     */
+    public void setContentLocation(String contentLocation) {
+        setMimeHeader("Content-Location", contentLocation);
+    }
+
+    /**
+     * Sets the MIME header "Content-Type" with the given
+     * value.
+     * @param  contentType  a <CODE>String</CODE>
+     *     giving the value of the "Content-Type" header
+     * @throws java.lang.IllegalArgumentException if
+     * there was a problem with the specified content type
+     */
+    public void setContentType(String contentType) {
+        setMimeHeader("Content-Type", contentType);
+    }
+
+    /**
+     * Removes all MIME headers that match the given name.
+     * @param  header - the string name of the MIME
+     *     header/s to be removed
+     */
+    public abstract void removeMimeHeader(String header);
+
+    /** Removes all the MIME header entries. */
+    public abstract void removeAllMimeHeaders();
+
+    /**
+     * Gets all the values of the header identified by the given
+     * <CODE>String</CODE>.
+     * @param   name  the name of the header; example:
+     *     "Content-Type"
+     * @return a <CODE>String</CODE> array giving the value for the
+     *     specified header
+     * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String)
+     */
+    public abstract String[] getMimeHeader(String name);
+
+    /**
+     * Changes the first header entry that matches the given name
+     *   to the given value, adding a new header if no existing
+     *   header matches. This method also removes all matching
+     *   headers but the first.
+     *
+     *   <P>Note that RFC822 headers can only contain US-ASCII
+     *   characters.</P>
+     * @param  name   a <CODE>String</CODE> giving the
+     *     name of the header for which to search
+     * @param  value  a <CODE>String</CODE> giving the
+     *     value to be set for the header whose name matches the
+     *     given name
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified mime header name
+     *     or value
+     */
+    public abstract void setMimeHeader(String name, String value);
+
+    /**
+     * Adds a MIME header with the specified name and value to
+     *   this <CODE>AttachmentPart</CODE> object.
+     *
+     *   <P>Note that RFC822 headers can contain only US-ASCII
+     *   characters.</P>
+     * @param  name   a <CODE>String</CODE> giving the
+     *     name of the header to be added
+     * @param  value  a <CODE>String</CODE> giving the
+     *     value of the header to be added
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified mime header name
+     *     or value
+     */
+    public abstract void addMimeHeader(String name, String value);
+
+    /**
+     * Retrieves all the headers for this <CODE>
+     * AttachmentPart</CODE> object as an iterator over the <CODE>
+     * MimeHeader</CODE> objects.
+     * @return  an <CODE>Iterator</CODE> object with all of the Mime
+     *     headers for this <CODE>AttachmentPart</CODE> object
+     */
+    public abstract Iterator getAllMimeHeaders();
+
+    /**
+     * Retrieves all <CODE>MimeHeader</CODE> objects that match
+     * a name in the given array.
+     * @param   names a <CODE>String</CODE> array with
+     *     the name(s) of the MIME headers to be returned
+     * @return all of the MIME headers that match one of the names
+     *     in the given array as an <CODE>Iterator</CODE>
+     *     object
+     */
+    public abstract Iterator getMatchingMimeHeaders(String names[]);
+
+    /**
+     * Retrieves all <CODE>MimeHeader</CODE> objects whose name
+     * does not match a name in the given array.
+     * @param   names  a <CODE>String</CODE> array with
+     *     the name(s) of the MIME headers not to be returned
+     * @return all of the MIME headers in this <CODE>
+     *     AttachmentPart</CODE> object except those that match one
+     *     of the names in the given array. The nonmatching MIME
+     *     headers are returned as an <CODE>Iterator</CODE>
+     *     object.
+     */
+    public abstract Iterator getNonMatchingMimeHeaders(String names[]);
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Detail.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Detail.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Detail.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Detail.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+
+/**
+ * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code>
+ * objects give detailed error information that is application-specific and
+ * related to the <code>SOAPBody</code> object that contains it.
+ * <P>
+ * A <code>Detail</code> object, which is part of a <code>SOAPFault</code>
+ * object, can be retrieved using the method <code>SOAPFault.getDetail</code>.
+ * The <code>Detail</code> interface provides two methods. One creates a new
+ * <code>DetailEntry</code> object and also automatically adds it to
+ * the <code>Detail</code> object. The second method gets a list of the
+ * <code>DetailEntry</code> objects contained in a <code>Detail</code>
+ * object.
+ * <P>
+ * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code>
+ * object, gets its <code>Detail</code> object (<i>d</i>), adds a new
+ * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the
+ * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a
+ * <code>Name</code> object to pass to the method <code>addDetailEntry</code>.
+ * The variable <i>se</i>, used to create the <code>Name</code> object,
+ * is a <code>SOAPEnvelope</code> object.
+ * <PRE>
+ *    Detail d = sf.getDetail();
+ *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ *                                "http://www.wombat.org/trader");
+ *    d.addDetailEntry(name);
+ *    Iterator it = d.getDetailEntries();
+ * </PRE>
+ */
+public interface Detail extends SOAPFaultElement {
+
+    /**
+     * Creates a new <code>DetailEntry</code> object with the given
+     * name and adds it to this <code>Detail</code> object.
+     * @param   name a <code>Name</code> object identifying the new <code>DetailEntry</code> object
+     * @return DetailEntry.
+     * @throws SOAPException  thrown when there is a problem in adding a DetailEntry object to this Detail object.
+     */
+    public abstract DetailEntry addDetailEntry(Name name) throws SOAPException;
+
+    /**
+     * Gets a list of the detail entries in this <code>Detail</code> object.
+     * @return  an <code>Iterator</code> object over the <code>DetailEntry</code>
+     *        objects in this <code>Detail</code> object
+     */
+    public abstract Iterator getDetailEntries();
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/DetailEntry.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/DetailEntry.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/DetailEntry.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/DetailEntry.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * The content for a <code>Detail</code> object, giving details for
+ * a <code>SOAPFault</code> object.  A <code>DetailEntry</code> object,
+ * which carries information about errors related to the <code>SOAPBody</code>
+ * object that contains it, is application-specific.
+ * <P>
+ */
+public interface DetailEntry extends SOAPElement {}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/FactoryFinder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/FactoryFinder.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/FactoryFinder.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/FactoryFinder.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import java.util.Properties;
+
+/**
+ * This class is used to locate factory classes for javax.xml.soap.
+ * It has package scope since it is not part of JAXM and should not
+ * be accessed from other packages.
+ */
+class FactoryFinder {
+    /**
+     * instantiates an object go the given classname.
+     *
+     * @param factoryClassName
+     * @return a factory object
+     * @throws SOAPException
+     */
+    private static Object newInstance(String factoryClassName) throws SOAPException {
+        ClassLoader classloader = null;
+        try {
+            classloader = Thread.currentThread().getContextClassLoader();
+        } catch (Exception exception) {
+            throw new SOAPException(exception.toString(), exception);
+        }
+
+        try {
+            Class factory = null;
+            if (classloader == null) {
+                factory = Class.forName(factoryClassName);
+            } else {
+                try {
+                    factory = classloader.loadClass(factoryClassName);
+                } catch (ClassNotFoundException cnfe) {}
+            }
+            if (factory == null) {
+                classloader = FactoryFinder.class.getClassLoader();
+                factory = classloader.loadClass(factoryClassName);
+            }
+            return factory.newInstance();
+        } catch (ClassNotFoundException classnotfoundexception) {
+            throw new SOAPException("Provider " + factoryClassName + " not found", classnotfoundexception);
+        } catch (Exception exception) {
+            throw new SOAPException("Provider " + factoryClassName + " could not be instantiated: " + exception, exception);
+        }
+    }
+
+    /**
+     * Instantiates a factory object given the factory's property name and the
+     * default class name.
+     *
+     * @param factoryPropertyName
+     * @param defaultFactoryClassName
+     * @return a factory object
+     * @throws SOAPException
+     */
+    static Object find(String factoryPropertyName, String defaultFactoryClassName) throws SOAPException {
+        try {
+            String factoryClassName = System.getProperty(factoryPropertyName);
+            if (factoryClassName != null) {
+                return newInstance(factoryClassName);
+            }
+        } catch (SecurityException securityexception) {}
+
+        try {
+            String propertiesFileName = System.getProperty("java.home")
+                                        + File.separator + "lib"
+                                        + File.separator + "jaxm.properties";
+            File file = new File(propertiesFileName);
+            if (file.exists()) {
+                FileInputStream fileInput = new FileInputStream(file);
+                Properties properties = new Properties();
+                properties.load(fileInput);
+                fileInput.close();
+                String factoryClassName = properties.getProperty(factoryPropertyName);
+                return newInstance(factoryClassName);
+            }
+        } catch (Exception exception1) {}
+
+        String factoryResource = "META-INF/services/" + factoryPropertyName;
+
+        try {
+            InputStream inputstream = getResource(factoryResource);
+            if (inputstream != null) {
+                BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream, "UTF-8"));
+                String factoryClassName = bufferedreader.readLine();
+                bufferedreader.close();
+                if ((factoryClassName != null) && !"".equals(factoryClassName)) {
+                    return newInstance(factoryClassName);
+                }
+            }
+        } catch (Exception exception2) {}
+
+        if (defaultFactoryClassName == null) {
+            throw new SOAPException("Provider for " + factoryPropertyName + " cannot be found", null);
+        } else {
+            return newInstance(defaultFactoryClassName);
+        }
+    }
+
+    /**
+     * Returns an input stream for the specified resource.
+     *
+     * <p>This method will firstly try
+     * <code>ClassLoader.getSystemResourceAsStream()</code> then
+     * the class loader of the current thread with
+     * <code>getResourceAsStream()</code> and finally attempt
+     * <code>getResourceAsStream()</code> on
+     * <code>FactoryFinder.class.getClassLoader()</code>.
+     *
+     * @param factoryResource  the resource name
+     * @return  an InputStream that can be used to read that resource, or
+     *              <code>null</code> if the resource could not be resolved
+     */
+    private static InputStream getResource(String factoryResource) {
+        ClassLoader classloader = null;
+        try {
+            classloader = Thread.currentThread().getContextClassLoader();
+        } catch (SecurityException securityexception) {}
+
+        InputStream inputstream;
+        if (classloader == null) {
+            inputstream = ClassLoader.getSystemResourceAsStream(factoryResource);
+        } else {
+            inputstream = classloader.getResourceAsStream(factoryResource);
+        }
+
+        if (inputstream == null) {
+            inputstream = FactoryFinder.class.getClassLoader().getResourceAsStream(factoryResource);
+        }
+        return inputstream;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MessageFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MessageFactory.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MessageFactory.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MessageFactory.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * <P>A factory for creating <CODE>SOAPMessage</CODE> objects.</P>
+ *
+ *   <P>A JAXM client performs the following steps to create a
+ *   message.</P>
+ *
+ *   <UL>
+ *     <LI>
+ *       Creates a <CODE>MessageFactory</CODE> object from a <CODE>
+ *       ProviderConnection</CODE> object (<CODE>con</CODE> in the
+ *       following line of code). The <CODE>String</CODE> passed to
+ *       the <CODE>createMessageFactory</CODE> method is the name of
+ *       of a messaging profile, which must be the URL for the
+ *       schema.
+ * <PRE>
+ *      MessageFactory mf = con.createMessageFactory(schemaURL);
+ * </PRE>
+ *     </LI>
+ *
+ *     <LI>
+ *       Calls the method <CODE>createMessage</CODE> on the <CODE>
+ *       MessageFactory</CODE> object. All messages produced by this
+ *       <CODE>MessageFactory</CODE> object will have the header
+ *       information appropriate for the messaging profile that was
+ *       specified when the <CODE>MessageFactory</CODE> object was
+ *       created.
+ * <PRE>
+ *      SOAPMessage m = mf.createMessage();
+ * </PRE>
+ *     </LI>
+ *   </UL>
+ *   It is also possible to create a <CODE>MessageFactory</CODE>
+ *   object using the method <CODE>newInstance</CODE>, as shown in
+ *   the following line of code.
+ * <PRE>
+ *      MessageFactory mf = MessageFactory.newInstance();
+ * </PRE>
+ *   A standalone client (a client that is not running in a
+ *   container) can use the <CODE>newInstance</CODE> method to
+ *   create a <CODE>MessageFactory</CODE> object.
+ *
+ *   <P>All <CODE>MessageFactory</CODE> objects, regardless of how
+ *   they are created, will produce <CODE>SOAPMessage</CODE> objects
+ *   that have the following elements by default:</P>
+ *
+ *   <UL>
+ *     <LI>A <CODE>SOAPPart</CODE> object</LI>
+ *
+ *     <LI>A <CODE>SOAPEnvelope</CODE> object</LI>
+ *
+ *     <LI>A <CODE>SOAPBody</CODE> object</LI>
+ *
+ *     <LI>A <CODE>SOAPHeader</CODE> object</LI>
+ *   </UL>
+ *   If a <CODE>MessageFactory</CODE> object was created using a
+ *   <CODE>ProviderConnection</CODE> object, which means that it was
+ *   initialized with a specified profile, it will produce messages
+ *   that also come prepopulated with additional entries in the
+ *   <CODE>SOAPHeader</CODE> object and the <CODE>SOAPBody</CODE>
+ *   object. The content of a new <CODE>SOAPMessage</CODE> object
+ *   depends on which of the two <CODE>MessageFactory</CODE> methods
+ *   is used to create it.
+ *
+ *   <UL>
+ *     <LI><CODE>createMessage()</CODE> -- message has no
+ *     content<BR>
+ *      This is the method clients would normally use to create a
+ *     request message.</LI>
+ *
+ *     <LI><CODE>createMessage(MimeHeaders,
+ *     java.io.InputStream)</CODE> -- message has content from the
+ *     <CODE>InputStream</CODE> object and headers from the <CODE>
+ *     MimeHeaders</CODE> object<BR>
+ *      This method can be used internally by a service
+ *     implementation to create a message that is a response to a
+ *     request.</LI>
+ *   </UL>
+ */
+public abstract class MessageFactory {
+
+    // fixme: this should be protected as the class is abstract.
+    /** Create a new MessageFactory. */
+    public MessageFactory() {}
+
+    /**
+     * Creates a new <CODE>MessageFactory</CODE> object that is
+     * an instance of the default implementation.
+     * @return a new <CODE>MessageFactory</CODE> object
+     * @throws  SOAPException  if there was an error in
+     *     creating the default implementation of the <CODE>
+     *     MessageFactory</CODE>
+     */
+    public static MessageFactory newInstance() throws SOAPException {
+
+        try {
+            return (MessageFactory) FactoryFinder.find(MESSAGE_FACTORY_PROPERTY,
+                                                       DEFAULT_MESSAGE_FACTORY);
+        } catch (Exception exception) {
+            throw new SOAPException(
+                "Unable to create message factory for SOAP: "
+                + exception.getMessage());
+        }
+    }
+
+    /**
+     * Creates a new <CODE>SOAPMessage</CODE> object with the
+     *   default <CODE>SOAPPart</CODE>, <CODE>SOAPEnvelope</CODE>,
+     *   <CODE>SOAPBody</CODE>, and <CODE>SOAPHeader</CODE> objects.
+     *   Profile-specific message factories can choose to
+     *   prepopulate the <CODE>SOAPMessage</CODE> object with
+     *   profile-specific headers.
+     *
+     *   <P>Content can be added to this message's <CODE>
+     *   SOAPPart</CODE> object, and the message can be sent "as is"
+     *   when a message containing only a SOAP part is sufficient.
+     *   Otherwise, the <CODE>SOAPMessage</CODE> object needs to
+     *   create one or more <CODE>AttachmentPart</CODE> objects and
+     *   add them to itself. Any content that is not in XML format
+     *   must be in an <CODE>AttachmentPart</CODE> object.</P>
+     * @return  a new <CODE>SOAPMessage</CODE> object
+     * @throws  SOAPException if a SOAP error occurs
+     */
+    public abstract SOAPMessage createMessage() throws SOAPException;
+
+    /**
+     * Internalizes the contents of the given <CODE>
+     * InputStream</CODE> object into a new <CODE>SOAPMessage</CODE>
+     * object and returns the <CODE>SOAPMessage</CODE> object.
+     * @param   mimeheaders    the transport-specific headers
+     *     passed to the message in a transport-independent fashion
+     *     for creation of the message
+     * @param   inputstream    the <CODE>InputStream</CODE> object
+     *     that contains the data for a message
+     * @return a new <CODE>SOAPMessage</CODE> object containing the
+     *     data from the given <CODE>InputStream</CODE> object
+     * @throws  IOException    if there is a
+     *     problem in reading data from the input stream
+     * @throws  SOAPException  if the message is invalid
+     */
+    public abstract SOAPMessage createMessage(
+        MimeHeaders mimeheaders, InputStream inputstream)
+            throws IOException, SOAPException;
+
+    private static final String DEFAULT_MESSAGE_FACTORY =
+        "org.apache.axis.saaj.MessageFactoryImpl";
+
+    private static final String MESSAGE_FACTORY_PROPERTY =
+        "javax.xml.soap.MessageFactory";
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeader.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeader.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeader.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeader.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * An object that stores a MIME header name and its value. One
+ *   or more <CODE>MimeHeader</CODE> objects may be contained in a
+ *   <CODE>MimeHeaders</CODE> object.
+ * @see MimeHeaders MimeHeaders
+ */
+public class MimeHeader {
+
+    /**
+     * Constructs a <CODE>MimeHeader</CODE> object initialized
+     * with the given name and value.
+     * @param  name a <CODE>String</CODE> giving the
+     *     name of the header
+     * @param  value a <CODE>String</CODE> giving the
+     *     value of the header
+     */
+    public MimeHeader(String name, String value) {
+        this.name  = name;
+        this.value = value;
+    }
+
+    /**
+     * Returns the name of this <CODE>MimeHeader</CODE>
+     * object.
+     * @return  the name of the header as a <CODE>String</CODE>
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the value of this <CODE>MimeHeader</CODE>
+     * object.
+     * @return the value of the header as a <CODE>String</CODE>
+     */
+    public String getValue() {
+        return value;
+    }
+
+    private String name;
+
+    private String value;
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeaders.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeaders.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeaders.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/MimeHeaders.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * A container for <CODE>MimeHeader</CODE> objects, which
+ *   represent the MIME headers present in a MIME part of a
+ *   message.</P>
+ *
+ *   <P>This class is used primarily when an application wants to
+ *   retrieve specific attachments based on certain MIME headers and
+ *   values. This class will most likely be used by implementations
+ *   of <CODE>AttachmentPart</CODE> and other MIME dependent parts
+ *   of the JAXM API.
+ * @see SOAPMessage#getAttachments() SOAPMessage.getAttachments()
+ * @see AttachmentPart AttachmentPart
+ */
+public class MimeHeaders {
+
+    class MatchingIterator implements Iterator {
+
+        private Object nextMatch() {
+
+            label0:
+            while (iterator.hasNext()) {
+                MimeHeader mimeheader = (MimeHeader) iterator.next();
+
+                if (names == null) {
+                    return match
+                           ? null
+                           : mimeheader;
+                }
+
+                for (int i = 0; i < names.length; i++) {
+                    if (!mimeheader.getName().equalsIgnoreCase(names[i])) {
+                        continue;
+                    }
+
+                    if (match) {
+                        return mimeheader;
+                    }
+
+                    continue label0;
+                }
+
+                if (!match) {
+                    return mimeheader;
+                }
+            }
+
+            return null;
+        }
+
+        public boolean hasNext() {
+
+            if (nextHeader == null) {
+                nextHeader = nextMatch();
+            }
+
+            return nextHeader != null;
+        }
+
+        public Object next() {
+
+            if (nextHeader != null) {
+                Object obj = nextHeader;
+
+                nextHeader = null;
+
+                return obj;
+            }
+
+            if (hasNext()) {
+                return nextHeader;
+            } else {
+                return null;
+            }
+        }
+
+        public void remove() {
+            iterator.remove();
+        }
+
+        private boolean match;
+
+        private Iterator iterator;
+
+        private String names[];
+
+        private Object nextHeader;
+
+        MatchingIterator(String as[], boolean flag) {
+
+            match    = flag;
+            names    = as;
+            iterator = headers.iterator();
+        }
+    }
+
+    /**
+     * Constructs
+     *   a default <CODE>MimeHeaders</CODE> object initialized with
+     *   an empty <CODE>Vector</CODE> object.
+     */
+    public MimeHeaders() {
+        headers = new Vector();
+    }
+
+    /**
+     * Returns all of the values for the specified header as an
+     * array of <CODE>String</CODE> objects.
+     * @param   name  the name of the header for which
+     *     values will be returned
+     * @return a <CODE>String</CODE> array with all of the values
+     *     for the specified header
+     * @see #setHeader(java.lang.String, java.lang.String) setHeader(java.lang.String, java.lang.String)
+     */
+    public String[] getHeader(String name) {
+
+        Vector vector = new Vector();
+
+        for (int i = 0; i < headers.size(); i++) {
+            MimeHeader mimeheader = (MimeHeader) headers.elementAt(i);
+
+            if (mimeheader.getName().equalsIgnoreCase(name)
+                    && (mimeheader.getValue() != null)) {
+                vector.addElement(mimeheader.getValue());
+            }
+        }
+
+        if (vector.size() == 0) {
+            return null;
+        } else {
+            String as[] = new String[vector.size()];
+
+            vector.copyInto(as);
+
+            return as;
+        }
+    }
+
+    /**
+     * Replaces the current value of the first header entry whose
+     *   name matches the given name with the given value, adding a
+     *   new header if no existing header name matches. This method
+     *   also removes all matching headers after the first one.
+     *
+     *   <P>Note that RFC822 headers can contain only US-ASCII
+     *   characters.</P>
+     * @param  name a <CODE>String</CODE> with the
+     *     name of the header for which to search
+     * @param  value a <CODE>String</CODE> with the
+     *     value that will replace the current value of the
+     *     specified header
+     * @throws java.lang.IllegalArgumentException if there was a
+     * problem in the mime header name or the value being set
+     * @see #getHeader(java.lang.String) getHeader(java.lang.String)
+     */
+    public void setHeader(String name, String value) {
+
+        boolean flag = false;
+
+        if ((name == null) || name.equals("")) {
+            throw new IllegalArgumentException(
+                "Illegal MimeHeader name");
+        }
+
+        for (int i = 0; i < headers.size(); i++) {
+            MimeHeader mimeheader = (MimeHeader) headers.elementAt(i);
+
+            if (mimeheader.getName().equalsIgnoreCase(name)) {
+                if (!flag) {
+                    headers.setElementAt(new MimeHeader(mimeheader
+                        .getName(), value), i);
+
+                    flag = true;
+                } else {
+                    headers.removeElementAt(i--);
+                }
+            }
+        }
+
+        if (!flag) {
+            addHeader(name, value);
+        }
+    }
+
+    /**
+     * Adds a <CODE>MimeHeader</CODE> object with the specified
+     *   name and value to this <CODE>MimeHeaders</CODE> object's
+     *   list of headers.
+     *
+     *   <P>Note that RFC822 headers can contain only US-ASCII
+     *   characters.</P>
+     * @param  name   a <CODE>String</CODE> with the
+     *     name of the header to be added
+     * @param  value  a <CODE>String</CODE> with the
+     *     value of the header to be added
+     * @throws java.lang.IllegalArgumentException if
+     *     there was a problem in the mime header name or value
+     *     being added
+     */
+    public void addHeader(String name, String value) {
+
+        if ((name == null) || name.equals("")) {
+            throw new IllegalArgumentException(
+                "Illegal MimeHeader name");
+        }
+
+        int i = headers.size();
+
+        for (int j = i - 1; j >= 0; j--) {
+            MimeHeader mimeheader = (MimeHeader) headers.elementAt(j);
+
+            if (mimeheader.getName().equalsIgnoreCase(name)) {
+                headers.insertElementAt(new MimeHeader(name, value), j + 1);
+
+                return;
+            }
+        }
+
+        headers.addElement(new MimeHeader(name, value));
+    }
+
+    /**
+     * Remove all <CODE>MimeHeader</CODE> objects whose name
+     * matches the the given name.
+     * @param  name  a <CODE>String</CODE> with the
+     *     name of the header for which to search
+     */
+    public void removeHeader(String name) {
+
+        for (int i = 0; i < headers.size(); i++) {
+            MimeHeader mimeheader = (MimeHeader) headers.elementAt(i);
+
+            if (mimeheader.getName().equalsIgnoreCase(name)) {
+                headers.removeElementAt(i--);
+            }
+        }
+    }
+
+    /**
+     * Removes all the header entries from this <CODE>
+     * MimeHeaders</CODE> object.
+     */
+    public void removeAllHeaders() {
+        headers.removeAllElements();
+    }
+
+    /**
+     * Returns all the headers in this <CODE>MimeHeaders</CODE>
+     * object.
+     * @return  an <CODE>Iterator</CODE> object over this <CODE>
+     *     MimeHeaders</CODE> object's list of <CODE>
+     *     MimeHeader</CODE> objects
+     */
+    public Iterator getAllHeaders() {
+        return headers.iterator();
+    }
+
+    /**
+     * Returns all the <CODE>MimeHeader</CODE> objects whose
+     * name matches a name in the given array of names.
+     * @param   names an array of <CODE>String</CODE>
+     *    objects with the names for which to search
+     * @return  an <CODE>Iterator</CODE> object over the <CODE>
+     *     MimeHeader</CODE> objects whose name matches one of the
+     *     names in the given list
+     */
+    public Iterator getMatchingHeaders(String names[]) {
+        return new MatchingIterator(names, true);
+    }
+
+    /**
+     * Returns all of the <CODE>MimeHeader</CODE> objects whose
+     * name does not match a name in the given array of names.
+     * @param   names  an array of <CODE>String</CODE>
+     *     objects with the names for which to search
+     * @return an <CODE>Iterator</CODE> object over the <CODE>
+     *     MimeHeader</CODE> objects whose name does not match one
+     *     of the names in the given list
+     */
+    public Iterator getNonMatchingHeaders(String names[]) {
+        return new MatchingIterator(names, false);
+    }
+
+    // fixme: does this need to be a Vector? Will a non-synchronized impl of
+    // List do?
+    /**
+     * A <code>Vector</code> containing the headers as <code>MimeHeader</code>
+     *              instances.
+     */
+    private Vector headers;
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Name.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Name.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Name.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Name.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of an XML name.  This interface provides methods for
+ * getting the local and namespace-qualified names and also for getting the
+ * prefix associated with the namespace for the name. It is also possible
+ * to get the URI of the namespace.
+ * <P>
+ * The following is an example of a namespace declaration in an element.
+ * <PRE>
+ *  &lt;wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader"&gt;
+ * </PRE>
+ * ("xmlns" stands for "XML namespace".)
+ * The following
+ * shows what the methods in the <code>Name</code> interface will return.
+ * <UL>
+ * <LI><code>getQualifiedName</code> will return "prefix:LocalName" =
+ *     "WOMBAT:GetLastTradePrice"
+ * <LI><code>getURI</code> will return "http://www.wombat.org/trader"
+ * <LI><code>getLocalName</code> will return "GetLastTracePrice"
+ * <LI><code>getPrefix</code> will return "WOMBAT"
+ * </UL>
+ * <P>
+ * XML namespaces are used to disambiguate SOAP identifiers from
+ * application-specific identifiers.
+ * <P>
+ * <code>Name</code> objects are created using the method
+ * <code>SOAPEnvelope.createName</code>, which has two versions.
+ * One method creates <code>Name</code> objects with
+ * a local name, a namespace prefix, and a namespace URI.
+ * and the second creates <code>Name</code> objects with just a local name.
+ * The following line of
+ * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new
+ * <code>Name</code> object with all three.
+ * <PRE>
+ *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ *                               "http://www.wombat.org/trader");
+ * </PRE>
+ * The following line of code gives an example of how a <code>Name</code> object
+ * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object.
+ * This code creates a new <code>SOAPElement</code> object with the given name and
+ * adds it to <i>element</i>.
+ * <PRE>
+ *    element.addChildElement(name);
+ * </PRE>
+ */
+public interface Name {
+
+    /**
+     * Gets the local name part of the XML name that this <code>Name</code>
+     * object represents.
+     * @return  a string giving the local name
+     */
+    public abstract String getLocalName();
+
+    /**
+     * Gets the namespace-qualified name of the XML name that this
+     * <code>Name</code> object represents.
+     * @return  the namespace-qualified name as a string
+     */
+    public abstract String getQualifiedName();
+
+    /**
+     * Returns the prefix associated with the namespace for the XML
+     * name that this <code>Name</code> object represents.
+     * @return  the prefix as a string
+     */
+    public abstract String getPrefix();
+
+    /**
+     * Returns the URI of the namespace for the XML
+     * name that this <code>Name</code> object represents.
+     * @return  the URI as a string
+     */
+    public abstract String getURI();
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Node.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Node.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Node.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/Node.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of a node (element) in a DOM representation of an XML document
+ * that provides some tree manipulation methods.
+ * This interface provides methods for getting the value of a node, for
+ * getting and setting the parent of a node, and for removing a node.
+ */
+public interface Node extends org.w3c.dom.Node {
+
+    /**
+     * Returns the the value of the immediate child of this <code>Node</code>
+     * object if a child exists and its value is text.
+     * @return  a <code>String</code> with the text of the immediate child of
+     *    this <code>Node</code> object if (1) there is a child and
+     *    (2) the child is a <code>Text</code> object;
+     *      <code>null</code> otherwise
+     */
+    public abstract String getValue();
+
+    /**
+     * Sets the parent of this <code>Node</code> object to the given
+     * <code>SOAPElement</code> object.
+     * @param parent the <code>SOAPElement</code> object to be set as
+     *  the parent of this <code>Node</code> object
+     * @throws SOAPException if there is a problem in setting the
+     *                     parent to the given element
+     * @see #getParentElement() getParentElement()
+     */
+    public abstract void setParentElement(SOAPElement parent)
+        throws SOAPException;
+
+    /**
+     * Returns the parent element of this <code>Node</code> object.
+     * This method can throw an <code>UnsupportedOperationException</code>
+     * if the tree is not kept in memory.
+     * @return  the <code>SOAPElement</code> object that is the parent of
+     *    this <code>Node</code> object or <code>null</code> if this
+     *    <code>Node</code> object is root
+     * @throws java.lang.UnsupportedOperationException if the whole tree is not kept in memory
+     * @see #setParentElement(javax.xml.soap.SOAPElement) setParentElement(javax.xml.soap.SOAPElement)
+     */
+    public abstract SOAPElement getParentElement();
+
+    /**
+     * Removes this <code>Node</code> object from the tree. Once
+     * removed, this node can be garbage collected if there are no
+     * application references to it.
+     */
+    public abstract void detachNode();
+
+    /**
+     * Notifies the implementation that this <code>Node</code>
+     * object is no longer being used by the application and that the
+     * implementation is free to reuse this object for nodes that may
+     * be created later.
+     * <P>
+     * Calling the method <code>recycleNode</code> implies that the method
+     * <code>detachNode</code> has been called previously.
+     */
+    public abstract void recycleNode();
+
+    /**
+     * If this is a Text node then this method will set its value, otherwise it
+     * sets the value of the immediate (Text) child of this node. The value of
+     * the immediate child of this node can be set only if, there is one child
+     * node and that node is a Text node, or if there are no children in which
+     * case a child Text node will be created.
+     *
+     * @param value the text to set
+     * @throws IllegalStateException   if the node is not a Text  node and
+     *              either has more than one child node or has a child node that
+     *              is not a Text node
+     */
+
+    public abstract void setValue(String value);
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBody.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBody.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBody.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBody.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import org.w3c.dom.Document;
+
+import java.util.Locale;
+
+/**
+ * An object that represents the contents of the SOAP body
+ * element in a SOAP message. A SOAP body element consists of XML data
+ * that affects the way the application-specific content is processed.
+ * <P>
+ * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
+ * objects, which have the content for the SOAP body.
+ * A <code>SOAPFault</code> object, which carries status and/or
+ * error information, is an example of a <code>SOAPBodyElement</code> object.
+ * @see SOAPFault SOAPFault
+ */
+public interface SOAPBody extends SOAPElement {
+
+    /**
+     * Creates a new <code>SOAPFault</code> object and adds it to
+     * this <code>SOAPBody</code> object.
+     * @return the new <code>SOAPFault</code> object
+     * @throws  SOAPException if there is a SOAP error
+     */
+    public abstract SOAPFault addFault() throws SOAPException;
+
+    /**
+     * Indicates whether a <code>SOAPFault</code> object exists in
+     * this <code>SOAPBody</code> object.
+     * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+     *     this <code>SOAPBody</code> object; <code>false</code>
+     *     otherwise
+     */
+    public abstract boolean hasFault();
+
+    /**
+     * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+     * object.
+     * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+     *    object
+     */
+    public abstract SOAPFault getFault();
+
+    /**
+     * Creates a new <code>SOAPBodyElement</code> object with the
+     * specified name and adds it to this <code>SOAPBody</code> object.
+     * @param name a <code>Name</code> object with the name for the new
+     *   <code>SOAPBodyElement</code> object
+     * @return the new <code>SOAPBodyElement</code> object
+     * @throws SOAPException  if a SOAP error occurs
+     */
+    public abstract SOAPBodyElement addBodyElement(Name name)
+        throws SOAPException;
+
+    /**
+     * Creates a new <code>SOAPFault</code> object and adds it to this
+     * <code>SOAPBody</code> object. The new <code>SOAPFault</code> will have a
+     * <code>faultcode</code> element that is set to the <code>faultCode</code>
+     * parameter and a <code>faultstring</code> set to <code>faultstring</code>
+     * and localized to <code>locale</code>.
+     *
+     * @param faultCode a <code>Name</code> object giving the fault code to be
+     *              set; must be one of the fault codes defined in the SOAP 1.1
+     *              specification and of type QName
+     * @param faultString a <code>String</code> giving an explanation of the
+     *              fault
+     * @param locale a <code>Locale</code> object indicating the native language
+     *              of the <ocde>faultString</code>
+     * @return the new <code>SOAPFault</code> object
+     * @throws SOAPException  if there is a SOAP error
+     */
+    public abstract SOAPFault addFault(Name faultCode,
+                                       String faultString,
+                                       Locale locale) throws SOAPException;
+
+    /**
+     * Creates a new <code>SOAPFault</code> object and adds it to this
+     * <code>SOAPBody</code> object. The new <code>SOAPFault</code> will have a
+     * <code>faultcode</code> element that is set to the <code>faultCode</code>
+     * parameter and a <code>faultstring</code> set to <code>faultstring</code>.
+     *
+     * @param faultCode a <code>Name</code> object giving the fault code to be
+     *              set; must be one of the fault codes defined in the SOAP 1.1
+     *              specification and of type QName
+     * @param faultString a <code>String</code> giving an explanation of the
+     *              fault
+     * @return the new <code>SOAPFault</code> object
+     * @throws SOAPException  if there is a SOAP error
+     */
+    public abstract SOAPFault addFault(Name faultCode, String faultString) throws SOAPException;
+
+    /**
+     * Adds the root node of the DOM <code>Document</code> to this
+     * <code>SOAPBody</code> object.
+     * <p>
+     * Calling this method invalidates the <code>document</code> parameter. The
+     * client application should discard all references to this
+     * <code>Document</code> and its contents upon calling
+     * <code>addDocument</code>. The behavior of an application that continues
+     * to use such references is undefined.
+     *
+     * @param document the <code>Document</code> object whose root node will be
+     *              added to this <code>SOAPBody</code>
+     * @return the <code>SOAPBodyElement</code> that represents the root node
+     *              that was added
+     * @throws SOAPException if the <code>Document</code> cannot be added
+     */
+    public abstract SOAPBodyElement addDocument(Document document) throws SOAPException;
+    }

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBodyElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBodyElement.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBodyElement.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPBodyElement.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A <code>SOAPBodyElement</code> object represents the contents in
+ * a <code>SOAPBody</code> object.  The <code>SOAPFault</code> interface
+ * is a <code>SOAPBodyElement</code> object that has been defined.
+ * <P>
+ * A new <code>SOAPBodyElement</code> object can be created and added
+ * to a <code>SOAPBody</code> object with the <code>SOAPBody</code>
+ * method <code>addBodyElement</code>. In the following line of code,
+ * <code>sb</code> is a <code>SOAPBody</code> object, and
+ * <code>myName</code> is a <code>Name</code> object.
+ * <PRE>
+ *   SOAPBodyElement sbe = sb.addBodyElement(myName);
+ * </PRE>
+ */
+public interface SOAPBodyElement extends SOAPElement {}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnection.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnection.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnection.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnection.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A point-to-point connection that a client can use for sending messages
+ * directly to a remote party (represented by a URL, for instance).
+ * <p>
+ * A client can obtain a <code>SOAPConnection</code> object simply by
+ * calling the following static method.
+ * <pre>
+ *
+ *      SOAPConnection con = SOAPConnection.newInstance();
+ * </pre>
+ * A <code>SOAPConnection</code> object can be used to send messages
+ * directly to a URL following the request/response paradigm.  That is,
+ * messages are sent using the method <code>call</code>, which sends the
+ * message and then waits until it gets a reply.
+ */
+public abstract class SOAPConnection {
+
+    public SOAPConnection() {}
+
+    /**
+     * Sends the given message to the specified endpoint and
+     * blocks until it has returned the response.
+     * @param request the <CODE>SOAPMessage</CODE>
+     *     object to be sent
+     * @param endpoint an <code>Object</code> that identifies
+     *            where the message should be sent. It is required to
+     *            support Objects of type
+     *            <code>java.lang.String</code>,
+     *            <code>java.net.URL</code>, and when JAXM is present
+     *            <code>javax.xml.messaging.URLEndpoint</code>
+     * @return the <CODE>SOAPMessage</CODE> object that is the
+     *     response to the message that was sent
+     * @throws  SOAPException if there is a SOAP error
+     */
+    public abstract SOAPMessage call(SOAPMessage request, Object endpoint)
+        throws SOAPException;
+
+    /**
+     * Closes this <CODE>SOAPConnection</CODE> object.
+     * @throws  SOAPException if there is a SOAP error
+     */
+    public abstract void close() throws SOAPException;
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnectionFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnectionFactory.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnectionFactory.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConnectionFactory.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A factory for creating <code>SOAPConnection</code> objects. Implementation of
+ * this class is optional. If <code>SOAPConnectionFactory.newInstance()</code>
+ * throws an <code>UnsupportedOperationException</code> then the implementation
+ * does not support the SAAJ communication infrastructure. Otherwise
+ * <code>SOAPConnection</code> objects can be created by calling
+ * <code>createConnection()</code> on the newly created
+ * <code>SOAPConnectionFactory</code> object.
+ */
+public abstract class SOAPConnectionFactory {
+
+    public SOAPConnectionFactory() {}
+
+    /**
+     * Creates an instance of the default <CODE>
+     * SOAPConnectionFactory</CODE> object.
+     * @return a new instance of a default <CODE>
+     *     SOAPConnectionFactory</CODE> object
+     * @throws  SOAPException  if there was an error creating
+     *     the <CODE>SOAPConnectionFactory
+     * @throws UnsupportedOperationException  if newInstance is not supported.
+     */
+    public static SOAPConnectionFactory newInstance()
+            throws SOAPException, UnsupportedOperationException {
+
+        try {
+            return (SOAPConnectionFactory) FactoryFinder.find(SF_PROPERTY,
+                    DEFAULT_SOAP_CONNECTION_FACTORY);
+        } catch (Exception exception) {
+            throw new SOAPException("Unable to create SOAP connection factory: "
+                                    + exception.getMessage());
+        }
+    }
+
+    /**
+     * Create a new <CODE>SOAPConnection</CODE>.
+     * @return the new <CODE>SOAPConnection</CODE> object.
+     * @throws  SOAPException if there was an exception
+     *     creating the <CODE>SOAPConnection</CODE> object.
+     */
+    public abstract SOAPConnection createConnection() throws SOAPException;
+
+    private static final String DEFAULT_SOAP_CONNECTION_FACTORY =
+        "org.apache.axis.saaj.SOAPConnectionFactoryImpl";
+
+    private static final String SF_PROPERTY =
+        "javax.xml.soap.SOAPConnectionFactory";
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConstants.java?rev=179806&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConstants.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/javax/xml/soap/SOAPConstants.java Fri Jun  3 07:54:42 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/** The definition of constants pertaining to the SOAP 1.1 protocol. */
+public interface SOAPConstants {
+
+    /** The namespace identifier for the SOAP envelope. */
+    public static final String URI_NS_SOAP_ENVELOPE =
+        "http://schemas.xmlsoap.org/soap/envelope/";
+
+    /**
+     * The namespace identifier for the SOAP encoding (see section 5 of
+     * the SOAP 1.1 specification).
+     */
+    public static final String URI_NS_SOAP_ENCODING =
+        "http://schemas.xmlsoap.org/soap/encoding/";
+
+    /**
+     * The URI identifying the first application processing a SOAP request as the intended
+     * actor for a SOAP header entry (see section 4.2.2 of the SOAP 1.1 specification).
+     */
+    public static final String URI_SOAP_ACTOR_NEXT =
+        "http://schemas.xmlsoap.org/soap/actor/next";
+}



Mime
View raw message