96fa1ae0c62fa6ba660d73394b814f17123b7212
[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     public static final ObjectName OBJECT_NAME_NO_NOTIFICATIONS = ConfigRegistryConstants.OBJECT_NAME_NO_NOTIFICATIONS;
28
29     /**
30      * Opens new configuration transaction.
31      *
32      * @return {@link ObjectName} of {@link ConfigTransactionControllerMXBean}
33      */
34     ObjectName beginConfig();
35
36     /**
37      * Verifies and commits transaction.
38      *
39      * @param transactionControllerON
40      *            {@link ObjectName} of
41      *            {@link ConfigTransactionControllerMXBean} that was received in
42      *            {@link #beginConfig()} method call.
43      * @return CommitStatus
44      * @throws ValidationException
45      *             if validation fails
46      * @throws ConflictingVersionException
47      *             if configuration state was changed
48      */
49     CommitStatus commitConfig(ObjectName transactionControllerON)
50             throws ConflictingVersionException, ValidationException;
51
52     /**
53      * @return list of open configuration transactions.
54      */
55     List<ObjectName> getOpenConfigs();
56
57     /**
58      * Will return true unless there was a transaction that succeeded during
59      * validation but failed in second phase of commit. In this case the server
60      * is unstable and its state is undefined.
61      */
62     boolean isHealthy();
63
64     /**
65      * @return module factory names available in the system
66      */
67     Set<String> getAvailableModuleNames();
68
69 }