Author: thilina
Date: Mon Feb 19 23:52:25 2007
New Revision: 509445

URL: http://svn.apache.org/viewvc?view=rev&rev=509445
Log:
adding the ability to remove attachments from the map

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java?view=diff&rev=509445&r1=509444&r2=509445
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
 Mon Feb 19 23:52:25 2007
@@ -270,6 +270,28 @@
     {
        attachmentsMap.put(contentID,dataHandler);
     }
+    
+    /**
+     * Removes the DataHandler corresponding to the given contenID.
+     * If it is not present, then trying to find it calling the getNextPart()
+     * till the required part is found.
+     * 
+     * @param blobContentID 
+     */
+    public void removeDataHandler(String blobContentID) {
+        DataHandler dataHandler;
+        if (attachmentsMap.containsKey(blobContentID)) {
+            attachmentsMap.remove(blobContentID);
+        } else if (!noStreams){
+            //This loop will be terminated by the Exceptions thrown if the Mime
+            // part searching was not found
+            while ((dataHandler = this.getNextPartDataHandler())!=null) {
+                if (attachmentsMap.containsKey(blobContentID)) {
+                       attachmentsMap.remove(blobContentID);
+                }
+            }
+        }
+    }
 
     /**
      * @return the InputStream which includes the SOAP Envelope. It assumes 
that
@@ -301,7 +323,7 @@
      *         the MIME message. Else it'll be the content-id of the first MIME
      *         part of the MIME message
      */
-    private String getSOAPPartContentID() {
+    public String getSOAPPartContentID() {
         String rootContentID = contentType.getParameter("start");
 
         // to handle the Start parameter not mentioned situation



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to