c234da7df590c0743e4be3e3b916a365bc7a59d9
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / ConfigTransactionController.java
1 /*
2  * Copyright (c) 2013, 2017 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.Set;
11 import javax.management.InstanceAlreadyExistsException;
12 import javax.management.InstanceNotFoundException;
13 import javax.management.ObjectName;
14
15 /**
16  * Represents functionality provided by configuration transaction.
17  */
18 public interface ConfigTransactionController extends LookupRegistry, ServiceReferenceWritableRegistry {
19
20     /**
21      * Create new configuration bean.
22      *
23      * @param moduleName
24      *            name of the module
25      * @param instanceName
26      *            name of the instance
27      * @return ObjectName of newly created module
28      * @throws InstanceAlreadyExistsException
29      *             if given ifcName and instanceName is already registered
30      */
31     ObjectName createModule(String moduleName, String instanceName) throws InstanceAlreadyExistsException;
32
33     /**
34      * Re-creates an existing module configuration bean.
35      *
36      * @param objectName
37      *            can be either read-only module name that can be obtained using
38      *            {@link ConfigRegistry#lookupConfigBean(String, String)} or
39      *            writable module name that must contain current transaction name.
40      * @throws InstanceNotFoundException
41      *             if module is not found
42      * @throws IllegalArgumentException
43      *             if object name contains wrong transaction name or domain
44      */
45     void reCreateModule(ObjectName objectName) throws InstanceNotFoundException;
46
47     /**
48      * Destroy existing module.
49      *
50      * @param objectName
51      *            can be either read-only module name that can be obtained using
52      *            {@link ConfigRegistry#lookupConfigBean(String, String)} or
53      *            writable module name that must contain current transaction name.
54      * @throws InstanceNotFoundException
55      *             if module is not found
56      * @throws IllegalArgumentException
57      *             if object name contains wrong transaction name or domain
58      */
59     void destroyModule(ObjectName objectName) throws InstanceNotFoundException;
60
61     /**
62      * Destroy current transaction.
63      */
64     void abortConfig();
65
66     /**
67      * This method can be called multiple times, has no side effects.
68      *
69      * @throws ValidationException
70      *             if validation fails
71      */
72     void validateConfig() throws ValidationException;
73
74     /**
75      * Get the name of the transaction.
76      *
77      * @return transactionName
78      */
79     String getTransactionName();
80
81     /**
82      * Get the names of all available modules.
83      *
84      * @return all known module factory names as reported by
85      *         {@link org.opendaylight.controller.config.spi.ModuleFactory#getImplementationName()}
86      */
87     Set<String> getAvailableModuleNames();
88 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.