Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BulkResponseImpl |
|
| 0.0;0 |
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 at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * 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 and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.apache.ws.scout.registry; | |
18 | ||
19 | import java.util.ArrayList; | |
20 | import java.util.Collection; | |
21 | import java.util.LinkedHashSet; | |
22 | ||
23 | import javax.xml.registry.BulkResponse; | |
24 | import javax.xml.registry.JAXRException; | |
25 | ||
26 | /** | |
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 | */ | |
33 | public class BulkResponseImpl extends JAXRResponseImpl implements BulkResponse | |
34 | { | |
35 | 0 | private boolean partialResponse = false; |
36 | ||
37 | 0 | private Collection<Exception> exceptions = new ArrayList<Exception>(); |
38 | 0 | private Collection<? extends Object> collection = new ArrayList<Object>(); |
39 | /** | |
40 | * Creates a new instance of BulkResponseImpl | |
41 | */ | |
42 | public BulkResponseImpl() | |
43 | 0 | { |
44 | 0 | } |
45 | ||
46 | BulkResponseImpl(LinkedHashSet<? extends Object> collection) | |
47 | 0 | { |
48 | 0 | this.collection = collection; |
49 | 0 | } |
50 | ||
51 | /** | |
52 | * Get Collection of RegistryObjects * | |
53 | */ | |
54 | public Collection<? extends Object> getCollection() throws JAXRException | |
55 | { | |
56 | 0 | return this.collection; |
57 | } | |
58 | ||
59 | /** | |
60 | * The javadoc is unclear. it says for getExceptions() : | |
61 | * "Get the Collection of RegistryException instances in case of partial | |
62 | * 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 otherwise | |
68 | * | |
69 | * @return Collection Exceptions | |
70 | * @throws JAXRException | |
71 | */ | |
72 | public Collection getExceptions() throws JAXRException | |
73 | { | |
74 | 0 | return (this.exceptions.size() == 0 ? null : exceptions); |
75 | } | |
76 | ||
77 | public boolean isPartialResponse() throws JAXRException | |
78 | { | |
79 | 0 | if (exceptions.size() > 0) { |
80 | 0 | this.partialResponse = true; |
81 | } | |
82 | 0 | return this.partialResponse; |
83 | } | |
84 | ||
85 | public void setPartialResponse(boolean b) throws JAXRException | |
86 | { | |
87 | 0 | this.partialResponse = b; |
88 | 0 | } |
89 | ||
90 | public void setCollection(Collection<? extends Object> coll) throws JAXRException | |
91 | { | |
92 | 0 | this.collection = coll; |
93 | 0 | } |
94 | ||
95 | /** | |
96 | * Setter for property exceptions. | |
97 | * | |
98 | * @param exceptions New value of property exceptions. | |
99 | */ | |
100 | public void setExceptions(Collection<Exception> exceptions) | |
101 | { | |
102 | 0 | this.exceptions = exceptions; |
103 | 0 | } |
104 | ||
105 | } |