2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import java.util.ArrayList;
11 import java.util.List;
14 * Stores a list of DatastoreSnapshot instances.
16 * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshotList} instead.
19 public class DatastoreSnapshotList extends ArrayList<DatastoreSnapshot> {
20 private static final long serialVersionUID = 1L;
22 public DatastoreSnapshotList() {
25 public DatastoreSnapshotList(List<DatastoreSnapshot> snapshots) {
29 private Object readResolve() {
30 List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot> snapshots =
31 new ArrayList<>(size());
32 for (DatastoreSnapshot legacy: this) {
33 snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot(
34 legacy.getType(), legacy.getShardManagerSnapshot(), fromLegacy(legacy.getShardSnapshots())));
37 return new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshotList(snapshots);
40 private List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot> fromLegacy(
41 List<DatastoreSnapshot.ShardSnapshot> from) {
42 List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot> snapshots =
43 new ArrayList<>(from.size());
44 for (DatastoreSnapshot.ShardSnapshot legacy: from) {
45 snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot(
46 legacy.getName(), legacy.getSnapshot()));