Bug 2731: Discard changes only when transaction exist.
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / ConfigRegistry.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.api;
9
10 import java.util.List;
11 import java.util.Set;
12 import javax.management.ObjectName;
13 import org.opendaylight.controller.config.api.jmx.CommitStatus;
14 import org.opendaylight.controller.config.api.jmx.constants.ConfigRegistryConstants;
15
16 /**
17  * Provides functionality for working with configuration registry - mainly
18  * creating and committing config transactions.
19  */
20 public interface ConfigRegistry extends LookupRegistry, ServiceReferenceReadableRegistry {
21
22     /**
23      * Only well-known ObjectName in configuration system, under which
24      * ConfigRegisry is registered.
25      */
26     public static final ObjectName OBJECT_NAME = ConfigRegistryConstants.OBJECT_NAME;
27
28     /**
29      * Opens new configuration transaction.
30      *
31      * @return {@link ObjectName} of {@link ConfigTransactionControllerMXBean}
32      */
33     ObjectName beginConfig();
34
35     /**
36      * Verifies and commits transaction.
37      *
38      * @param transactionControllerON
39      *            {@link ObjectName} of
40      *            {@link ConfigTransactionControllerMXBean} that was received in
41      *            {@link #beginConfig()} method call.
42      * @return CommitStatus
43      * @throws ValidationException
44      *             if validation fails
45      * @throws ConflictingVersionException
46      *             if configuration state was changed
47      */
48     CommitStatus commitConfig(ObjectName transactionControllerON)
49             throws ConflictingVersionException, ValidationException;
50
51     /**
52      * @return list of open configuration transactions.
53      */
54     List<ObjectName> getOpenConfigs();
55
56     /**
57      * Will return true unless there was a transaction that succeeded during
58      * validation but failed in second phase of commit. In this case the server
59      * is unstable and its state is undefined.
60      */
61     boolean isHealthy();
62
63     /**
64      * @return module factory names available in the system
65      */
66     Set<String> getAvailableModuleNames();
67
68
69
70     /**
71      * Find all runtime beans
72      *
73      * @return objectNames
74      */
75     Set<ObjectName> lookupRuntimeBeans();
76
77     /**
78      * Find all runtime of specified module
79      *
80      * @param moduleName
81      *            of bean
82      * @param instanceName
83      *            of bean
84      * @return objectNames
85      */
86     Set<ObjectName> lookupRuntimeBeans(String moduleName, String instanceName);
87
88 }