Author: geirm
Date: Fri Feb 11 04:42:31 2005
New Revision: 153395

URL: http://svn.apache.org/viewcvs?view=rev&rev=153395
Log:
- refactor and fix BulkResponseImpl to reflect the class
  and interface structure of the spec, and also return
  the collection of exceptions

- change deleteOrganizations to handle how jUDDI (and
  probably all UDDI repos handle partial failure of a 
  request.  For efficiency, I'm betting that failure due
  to incorrect key or -ish is rare, so going for 
  bulk requests, and assume that no partial work was done
  (as jUDDI at least is returning a singleton failure 
  message giving no hint that anything useful was acomplished...)
  Future?  maybe on that kind of failure, re-do and see if we 
  can get partial work done..
 

Added:
    
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/JAXRResponseImpl.java
Modified:
    
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BulkResponseImpl.java
    
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java

Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BulkResponseImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BulkResponseImpl.java?view=diff&r1=153394&r2=153395
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BulkResponseImpl.java
 (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BulkResponseImpl.java
 Fri Feb 11 04:42:31 2005
@@ -25,16 +25,11 @@
  * Implements JAXR BulkResponse Interface.
  * For futher details, look into the JAXR API Javadoc.
  *
- * @author Anil Saldhana  <mailto:[EMAIL PROTECTED]>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Anil Saldhana</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  */
-public class BulkResponseImpl implements BulkResponse
+public class BulkResponseImpl extends JAXRResponseImpl implements BulkResponse
 {
-    public static int STATUS_FAILURE = 1;
-    public static int STATUS_SUCCESS = 0;
-    public static int STATUS_UNAVAILABLE = 2;
-    public static int STATUS_WARNING = 3;
-
-    private int status = STATUS_SUCCESS;
     private boolean partialResponse = false;
 
     private Collection exceptions = new ArrayList();
@@ -57,32 +52,19 @@
      */
     public Collection getCollection() throws JAXRException
     {
-        return collection;
+        return this.collection;
     }
 
     public Collection getExceptions() throws JAXRException
     {
-        return null;
-    }
-
-    public String getRequestId() throws JAXRException
-    {
-        return null;
-    }
-
-    public int getStatus() throws JAXRException
-    {
-        return status;
-    }
-
-    public boolean isAvailable() throws JAXRException
-    {
-        return false;
+        return this.exceptions;
     }
 
     public boolean isPartialResponse() throws JAXRException
     {
-        if (exceptions.size() > 0) this.partialResponse = true;
+        if (exceptions.size() > 0) {
+            this.partialResponse = true;
+        }
         return this.partialResponse;
     }
 
@@ -94,11 +76,6 @@
     public void setCollection(Collection coll) throws JAXRException
     {
         this.collection = coll;
-    }
-
-    public void setStatus(int status) throws JAXRException
-    {
-        this.status = status;
     }
 
     /**

Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?view=diff&r1=153394&r2=153395
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
 (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
 Fri Feb 11 04:42:31 2005
@@ -63,7 +63,8 @@
  * Implements JAXR BusinessLifeCycleManager Interface.
  * For futher details, look into the JAXR API Javadoc.
  *
- * @author Anil Saldhana  <[EMAIL PROTECTED]>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Anil Saldhana</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  */
 public class BusinessLifeCycleManagerImpl extends LifeCycleManagerImpl
         implements BusinessLifeCycleManager, Serializable
@@ -499,6 +500,7 @@
         try
         {
             Iterator iter = keys.iterator();
+
             while (iter.hasNext())
             {
                 Key key = (Key) iter.next();
@@ -524,15 +526,29 @@
                     exceptions.add(de);
                 }
             }
+        }
+        catch (RegistryException regExcept) {
+
+            /*
+             * jUDDI (and prollie others) throw an exception on any fault in
+             * the transaction w/ the registry, so we don't get any partial
+             * success
+             */
+            DeleteException de = new DeleteException(regExcept.getFaultCode()
+                    + ":" + regExcept.getFaultString(), regExcept);
 
-            bulk.setCollection(coll);
-            bulk.setExceptions(exceptions);
-        } catch (Exception tran)
+            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+            exceptions.add(de);
+        }
+        catch (JAXRException tran)
         {
             exceptions.add(new JAXRException("Apache JAXR Impl:", tran));
             bulk.setStatus(JAXRResponse.STATUS_FAILURE);
-            bulk.setExceptions(exceptions);
         }
+
+        bulk.setCollection(coll);
+        bulk.setExceptions(exceptions);
+
         return bulk;
     }
 

Added: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/JAXRResponseImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/JAXRResponseImpl.java?view=auto&rev=153395
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/JAXRResponseImpl.java
 (added)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/JAXRResponseImpl.java
 Fri Feb 11 04:42:31 2005
@@ -0,0 +1,45 @@
+package org.apache.ws.scout.registry;
+
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.JAXRException;
+
+/**
+ * Implementation of JAXRResponse
+
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ */
+public class JAXRResponseImpl implements JAXRResponse {
+
+    public final static int STATUS_SUCCESS = 0;
+    public final static int STATUS_FAILURE = 1;
+    public final static int STATUS_UNAVAILABLE = 2;
+    public final static int STATUS_WARNING = 3;
+
+    private int status = STATUS_SUCCESS;
+
+    private String requestId = null;
+    private boolean available = false;
+
+    public String getRequestId() throws JAXRException {
+        return this.requestId;
+    }
+
+    public void setRequestId(String s) {
+        this.requestId = s;
+    }
+
+    public int getStatus() throws JAXRException {
+        return this.status;
+    }
+
+    public void setStatus(int s) {
+        this.status = s;
+    }
+
+    public void setAvailable(boolean b) {
+        this.available = b;
+    }
+    public boolean isAvailable() throws JAXRException {
+        return this.available;
+    }
+}



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

Reply via email to