01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.directwebremoting.extend;
17:
18: import java.util.ArrayList;
19: import java.util.Iterator;
20: import java.util.List;
21:
22: /**
23: * The request made by the browser which consists of a number of function call
24: * requests and some associated information like the request mode (XHR or
25: * iframe).
26: * @author Joe Walker [joe at getahead dot ltd dot uk]
27: */
28: public class Calls implements Iterable<Call> {
29: /**
30: * How many calls are there is this request
31: * @return The total number of calls
32: */
33: public int getCallCount() {
34: return calls.size();
35: }
36:
37: /**
38: * @param index The index (starts at 0) of the call to fetch
39: * @return Returns the calls.
40: */
41: public Call getCall(int index) {
42: return calls.get(index);
43: }
44:
45: /**
46: * Add a call to the collection of calls we are about to make
47: * @param call The call to add
48: */
49: public void addCall(Call call) {
50: calls.add(call);
51: }
52:
53: /**
54: * @param batchId The batchId to set.
55: */
56: public void setBatchId(String batchId) {
57: this .batchId = batchId;
58: }
59:
60: /**
61: * @return Returns the batchId.
62: */
63: public String getBatchId() {
64: return batchId;
65: }
66:
67: /* (non-Javadoc)
68: * @see java.lang.Iterable#iterator()
69: */
70: public Iterator<Call> iterator() {
71: return calls.iterator();
72: }
73:
74: private String batchId = null;
75:
76: /**
77: * The collection of Calls that we should execute
78: */
79: protected List<Call> calls = new ArrayList<Call>();
80: }
|