01: /*
02: * Copyright 2004-2006 the original author or authors.
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:
17: package org.compass.gps.device.jdbc.snapshot;
18:
19: import java.io.Serializable;
20: import java.util.HashMap;
21: import java.util.Iterator;
22:
23: /**
24: * A system level (collection of aliases - <code>ResultSet</code>s)
25: * snapshots. Holds a collection of
26: * {@link org.compass.gps.device.jdbc.snapshot.JdbcAliasSnapshot}s.
27: *
28: * @author kimchy
29: */
30: public class JdbcSnapshot implements Serializable {
31:
32: private static final long serialVersionUID = 5118761723679749546L;
33:
34: private HashMap aliasSnapshots = new HashMap();
35:
36: public void putAliasSnapshot(JdbcAliasSnapshot aliasSnapshot) {
37: aliasSnapshots.put(aliasSnapshot.getAlias(), aliasSnapshot);
38: }
39:
40: public JdbcAliasSnapshot getAliasSnapshot(String alias) {
41: return (JdbcAliasSnapshot) aliasSnapshots.get(alias);
42: }
43:
44: public String toString() {
45: StringBuffer sb = new StringBuffer();
46: sb.append("Snapshot ");
47: for (Iterator it = aliasSnapshots.values().iterator(); it
48: .hasNext();) {
49: sb.append(it.next());
50: }
51: return sb.toString();
52: }
53: }
|