/** * Helper method for adding to the response's already existing collection. This method should only * be called before returning the response to the client. */ public void addCollection(Collection bCollection) { if (bCollection != null) { Iterator iter = bCollection.iterator(); while (iter.hasNext()) { collection.add(iter.next()); } } }
/** * Bindings classes return a string rather than boolean, which is passed here to set isPartial. * This should be set before setting the collection when creating a bulk response. */ public void setPartialResponse(String isPartial) throws JAXRException { if (collection.size() > 0) { throw new JAXRException( ResourceBundle.getBundle("com/sun/xml/registry/common/LocalStrings") .getString("BulkResponseImpl:Cannot_set_isPartial_with_collection_already_set.")); } this.isPartial = Boolean.valueOf(isPartial).booleanValue(); }
/** * Add multiple exceptions to exception collection. This method should only be called before * returning the response to the client. */ public void addException(Collection bException) { if (bException != null && bException.size() > 0) { setStatus(STATUS_FAILURE); initExceptions(); Iterator iter = bException.iterator(); while (iter.hasNext()) { exceptions.add(iter.next()); } } }
/** * Get the Collection of of objects returned as a response of a bulk operation. This method should * block when the response content is not yet available. */ public Collection getCollection() throws JAXRException { synchronized (this) { while (!isAvailable()) { try { this.wait(); } catch (InterruptedException e) { } } return (Collection) collection.clone(); } }
/** * Get the JAXRException in case of partial commit. Return null if none. This method should block * when the response content is not yet available. */ public Collection getExceptions() throws JAXRException { synchronized (this) { while (!isAvailable()) { try { this.wait(); } catch (InterruptedException e) { } } // exceptions collection is null if there are no errors if (exceptions != null) { return (Collection) exceptions.clone(); } else { return null; } } }
/** * Add single exception to exceptions collection. This method should only be called before * returning the response to the client. */ public void addException(JAXRException except) { initExceptions(); exceptions.add(except); setStatus(STATUS_FAILURE); }