01: /*
02: * <copyright>
03: *
04: * Copyright 2000-2004 BBNT Solutions, LLC
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26:
27: package org.cougaar.tools.csmart.ui.util;
28:
29: import java.util.ArrayList;
30:
31: public class ServletResult {
32: ArrayList responses;
33: boolean limitExceeded;
34:
35: /**
36: * Results from a servlet.
37: */
38:
39: public ServletResult() {
40: responses = new ArrayList();
41: limitExceeded = false;
42: }
43:
44: /**
45: * Set limit exceeded flag; this flag is true if the servlet had
46: * more objects to send, but the user limited the number of
47: * objects it wished to receive. The default is false.
48: * @param limitExceeded whether or not the limit was exceeded
49: */
50:
51: public void setLimitExceeded(boolean limitExceeded) {
52: this .limitExceeded = limitExceeded;
53: }
54:
55: /**
56: * Returns true if the servlet had more objects to send than the client
57: * was willing to receive.
58: * @return true if limit exceeded, else false
59: */
60:
61: public boolean isLimitExceeded() {
62: return limitExceeded;
63: }
64:
65: // /**
66: // * Add the collection received from an agent; the collection may be null.
67: // * @param c collection of objects received from an agent
68: // */
69: // public void addCollection(Collection c) {
70: // results.add(c);
71: // }
72:
73: // /**
74: // * Return the collections received from all agents;
75: // * there is one collection for each agent contacted;
76: // * the collection may be null.
77: // * @return array list of Collection
78: // */
79: // public ArrayList getCollections() {
80: // return results;
81: // }
82:
83: public void addServletResponse(ServletResponse response) {
84: responses.add(response);
85: }
86:
87: public ServletResponse getServletResponse(int index) {
88: if (index < 0 || index >= responses.size())
89: return null;
90: return (ServletResponse) responses.get(index);
91: }
92:
93: public int getNumberOfResponses() {
94: return responses.size();
95: }
96:
97: }
|