1/*2 * Copyright 2001-2004 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617package org.apache.ws.scout.registry;
1819import java.util.ArrayList;
20import java.util.Collection;
21import java.util.LinkedHashSet;
2223import javax.xml.registry.BulkResponse;
24import javax.xml.registry.JAXRException;
2526/**27 * Implements JAXR BulkResponse Interface.28 * For futher details, look into the JAXR API Javadoc.29 *30 * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>31 * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>32 */33publicclassBulkResponseImplextendsJAXRResponseImplimplements BulkResponse
34 {
35privateboolean partialResponse = false;
3637private Collection<Exception> exceptions = new ArrayList<Exception>();
38private Collection<? extends Object> collection = new ArrayList<Object>();
39/**40 * Creates a new instance of BulkResponseImpl41 */42publicBulkResponseImpl()
43 {
44 }
4546BulkResponseImpl(LinkedHashSet<? extends Object> collection)
47 {
48this.collection = collection;
49 }
5051/**52 * Get Collection of RegistryObjects *53 */54public Collection<? extends Object> getCollection() throws JAXRException
55 {
56returnthis.collection;
57 }
5859/**60 * The javadoc is unclear. it says for getExceptions() :61 * "Get the Collection of RegistryException instances in case of partial62 * commit. Caller thread will block here if result is not yet available.63 * Return null if result is available and there is no RegistryException(s)."64 * Yet the return javadoc says :65 * "Collection of RegistryException instances. The Collection may be empty but not null."66 *67 * So my interpretation is return null if result avail, and empty collection otherwise68 *69 * @return Collection Exceptions70 * @throws JAXRException71 */72public Collection getExceptions() throws JAXRException
73 {
74return (this.exceptions.size() == 0 ? null : exceptions);
75 }
7677publicboolean isPartialResponse() throws JAXRException
78 {
79if (exceptions.size() > 0) {
80this.partialResponse = true;
81 }
82returnthis.partialResponse;
83 }
8485publicvoid setPartialResponse(boolean b) throws JAXRException
86 {
87this.partialResponse = b;
88 }
8990publicvoid setCollection(Collection<? extends Object> coll) throws JAXRException
91 {
92this.collection = coll;
93 }
9495/**96 * Setter for property exceptions.97 *98 * @param exceptions New value of property exceptions.99 */100publicvoid setExceptions(Collection<Exception> exceptions)
101 {
102this.exceptions = exceptions;
103 }
104105 }