Merge "Add reverse() method in Edge and Path classes"
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / CommitInfo.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.config.manager.impl;
9
10 import java.util.Collections;
11 import java.util.List;
12 import java.util.Map;
13
14 import javax.annotation.concurrent.Immutable;
15
16 import org.opendaylight.controller.config.api.ModuleIdentifier;
17 import org.opendaylight.controller.config.manager.impl.dependencyresolver.DestroyedModule;
18 import org.opendaylight.controller.config.manager.impl.dependencyresolver.ModuleInternalTransactionalInfo;
19
20 /**
21  * Structure obtained during first phase commit, contains destroyed modules from
22  * previous transactions that need to be closed and all committed modules with
23  * meta data.
24  */
25 @Immutable
26 public class CommitInfo {
27     private final List<DestroyedModule> destroyedFromPreviousTransactions;
28     private final Map<ModuleIdentifier, ModuleInternalTransactionalInfo> commitMap;
29
30     public CommitInfo(List<DestroyedModule> destroyedFromPreviousTransactions,
31             Map<ModuleIdentifier, ModuleInternalTransactionalInfo> commitMap) {
32         this.destroyedFromPreviousTransactions = Collections
33                 .unmodifiableList(destroyedFromPreviousTransactions);
34         this.commitMap = Collections.unmodifiableMap(commitMap);
35     }
36
37     /**
38      * Get ordered list of modules that can be closed in the same order, i.e.
39      * first element will be a leaf on which no other module depends, n-th
40      * element can only have dependencies with index smaller than n.
41      */
42     public List<DestroyedModule> getDestroyedFromPreviousTransactions() {
43         return destroyedFromPreviousTransactions;
44     }
45
46     public Map<ModuleIdentifier, ModuleInternalTransactionalInfo> getCommitted() {
47         return commitMap;
48     }
49 }