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