Merge "Remove raw references to Map in XSQL"
[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 import javax.annotation.concurrent.Immutable;
14 import org.opendaylight.controller.config.api.ModuleIdentifier;
15 import org.opendaylight.controller.config.manager.impl.dependencyresolver.DestroyedModule;
16 import org.opendaylight.controller.config.manager.impl.dependencyresolver.ModuleInternalTransactionalInfo;
17
18 /**
19  * Structure obtained during first phase commit, contains destroyed modules from
20  * previous transactions that need to be closed and all committed modules with
21  * meta data.
22  */
23 @Immutable
24 public class CommitInfo {
25     private final List<DestroyedModule> destroyedFromPreviousTransactions;
26     private final Map<ModuleIdentifier, ModuleInternalTransactionalInfo> commitMap;
27
28     public CommitInfo(List<DestroyedModule> destroyedFromPreviousTransactions,
29             Map<ModuleIdentifier, ModuleInternalTransactionalInfo> commitMap) {
30         this.destroyedFromPreviousTransactions = Collections
31                 .unmodifiableList(destroyedFromPreviousTransactions);
32         this.commitMap = Collections.unmodifiableMap(commitMap);
33     }
34
35     /**
36      * Get ordered list of modules that can be closed in the same order, i.e.
37      * first element will be a leaf on which no other module depends, n-th
38      * element can only have dependencies with index smaller than n.
39      */
40     public List<DestroyedModule> getDestroyedFromPreviousTransactions() {
41         return destroyedFromPreviousTransactions;
42     }
43
44     public Map<ModuleIdentifier, ModuleInternalTransactionalInfo> getCommitted() {
45         return commitMap;
46     }
47 }