axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r289289 [83/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/ap...
Date Thu, 15 Sep 2005 19:07:03 GMT
Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/namespace/QName.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/namespace/QName.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/namespace/QName.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/namespace/QName.java Thu Sep 15 11:52:11 2005
@@ -1,230 +1,230 @@
-/*
- * Copyright 2004,2005 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.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;
-        }
-
-        return (namespaceURI.equals(((QName) obj).namespaceURI))
-                && (localPart.equals(((QName) obj).localPart));
-
-    }
-
-    /**
-     * 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
-     * @return QName corresponding to the given String
-     * @throws java.lang.IllegalArgumentException
-     *          If the specified String cannot be parsed as a QName
-     */
-    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();
-    }
-}
-
+/*
+ * Copyright 2004,2005 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.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;
+        }
+
+        return (namespaceURI.equals(((QName) obj).namespaceURI))
+                && (localPart.equals(((QName) obj).localPart));
+
+    }
+
+    /**
+     * 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
+     * @return QName corresponding to the given String
+     * @throws java.lang.IllegalArgumentException
+     *          If the specified String cannot be parsed as a QName
+     */
+    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();
+    }
+}
+

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/namespace/QName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/AttachmentPart.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/AttachmentPart.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/AttachmentPart.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/AttachmentPart.java Thu Sep 15 11:52:11 2005
@@ -1,436 +1,436 @@
-/*
- * Copyright 2004,2005 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/>
- * <P>An <CODE>AttachmentPart</CODE> object must conform to
- * certain standards.</P>
- * <p/>
- * <OL>
- * <LI>It must conform to <A href=
- * "http://www.ietf.org/rfc/rfc2045.txt">MIME [RFC2045]
- * standards</A></LI>
- * <p/>
- * <LI>It MUST contain content</LI>
- * <p/>
- * <LI>
- * The header portion MUST include the following header:
- * <p/>
- * <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
- * <p/>
- * </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");
- * <p/>
- * </PRE>
- * <p/>
- * <P></P>
- * </LI>
- * </UL>
- * </LI>
- * </OL>
- * <p/>
- * <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/>
- * <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/>
- * <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/>
- * <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/>
- * <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/>
-     * <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/>
-     * <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[]);
-}
+/*
+ * Copyright 2004,2005 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/>
+ * <P>An <CODE>AttachmentPart</CODE> object must conform to
+ * certain standards.</P>
+ * <p/>
+ * <OL>
+ * <LI>It must conform to <A href=
+ * "http://www.ietf.org/rfc/rfc2045.txt">MIME [RFC2045]
+ * standards</A></LI>
+ * <p/>
+ * <LI>It MUST contain content</LI>
+ * <p/>
+ * <LI>
+ * The header portion MUST include the following header:
+ * <p/>
+ * <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
+ * <p/>
+ * </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");
+ * <p/>
+ * </PRE>
+ * <p/>
+ * <P></P>
+ * </LI>
+ * </UL>
+ * </LI>
+ * </OL>
+ * <p/>
+ * <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/>
+ * <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/>
+ * <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/>
+ * <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/>
+ * <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/>
+     * <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/>
+     * <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[]);
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/AttachmentPart.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/Detail.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/Detail.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/Detail.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/Detail.java Thu Sep 15 11:52:11 2005
@@ -1,67 +1,67 @@
-/*
- * Copyright 2004,2005 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();
-}
+/*
+ * Copyright 2004,2005 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();
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/Detail.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/DetailEntry.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/DetailEntry.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/DetailEntry.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/DetailEntry.java Thu Sep 15 11:52:11 2005
@@ -1,26 +1,26 @@
-/*
- * Copyright 2004,2005 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 {
-}
+/*
+ * Copyright 2004,2005 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 {
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/DetailEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/FactoryFinder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/FactoryFinder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/FactoryFinder.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/FactoryFinder.java Thu Sep 15 11:52:11 2005
@@ -1,167 +1,167 @@
-/*
- * Copyright 2004,2005 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.*;
-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/>
-     * <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;
-    }
-}
+/*
+ * Copyright 2004,2005 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.*;
+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/>
+     * <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;
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/FactoryFinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/MessageFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/MessageFactory.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/MessageFactory.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/MessageFactory.java Thu Sep 15 11:52:11 2005
@@ -1,175 +1,175 @@
-/*
- * Copyright 2004,2005 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/>
- * <P>A JAXM client performs the following steps to create a
- * message.</P>
- * <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>
- * <p/>
- * <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/>
- * <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>
- * <p/>
- * <UL>
- * <LI>A <CODE>SOAPPart</CODE> object</LI>
- * <p/>
- * <LI>A <CODE>SOAPEnvelope</CODE> object</LI>
- * <p/>
- * <LI>A <CODE>SOAPBody</CODE> object</LI>
- * <p/>
- * <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.
- * <p/>
- * <UL>
- * <LI><CODE>createMessage()</CODE> -- message has no
- * content<BR>
- * This is the method clients would normally use to create a
- * request message.</LI>
- * <p/>
- * <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/>
-     * <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.axis2.saaj.MessageFactoryImpl";
-
-    private static final String MESSAGE_FACTORY_PROPERTY =
-            "javax.xml.soap.MessageFactory";
-}
+/*
+ * Copyright 2004,2005 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/>
+ * <P>A JAXM client performs the following steps to create a
+ * message.</P>
+ * <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>
+ * <p/>
+ * <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/>
+ * <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>
+ * <p/>
+ * <UL>
+ * <LI>A <CODE>SOAPPart</CODE> object</LI>
+ * <p/>
+ * <LI>A <CODE>SOAPEnvelope</CODE> object</LI>
+ * <p/>
+ * <LI>A <CODE>SOAPBody</CODE> object</LI>
+ * <p/>
+ * <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.
+ * <p/>
+ * <UL>
+ * <LI><CODE>createMessage()</CODE> -- message has no
+ * content<BR>
+ * This is the method clients would normally use to create a
+ * request message.</LI>
+ * <p/>
+ * <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/>
+     * <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.axis2.saaj.MessageFactoryImpl";
+
+    private static final String MESSAGE_FACTORY_PROPERTY =
+            "javax.xml.soap.MessageFactory";
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/src/javax/xml/soap/MessageFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message