bd9002c62487d2c5506599ec35219278527b9377
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / ConfigTransactionController.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.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      * @param instanceName
25      * @return ObjectName of newly created module
26      * @throws InstanceAlreadyExistsException
27      *             if given ifcName and instanceName is already registered
28      */
29     ObjectName createModule(String moduleName, String instanceName)
30             throws InstanceAlreadyExistsException;
31
32     /**
33      * Re-creates an existing module configuration bean.
34      *
35      * @param objectName
36      *            can be either read-only module name that can be obtained using
37      *            {@link ConfigRegistry#lookupConfigBean(String, String)} or
38      *            writable module name that must contain current transaction name.
39      * @throws InstanceNotFoundException
40      *             if module is not found
41      * @throws IllegalArgumentException
42      *             if object name contains wrong transaction name or domain
43      */
44     void reCreateModule(ObjectName objectName) throws InstanceNotFoundException;
45
46     /**
47      * Destroy existing module.
48      *
49      * @param objectName
50      *            can be either read-only module name that can be obtained using
51      *            {@link ConfigRegistry#lookupConfigBean(String, String)} or
52      *            writable module name that must contain current transaction
53      *            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      *
76      * @return transactionName
77      */
78     String getTransactionName();
79
80     /**
81      * @return all known module factory names as reported by {@link org.opendaylight.controller.config.spi.ModuleFactory#getImplementationName()}
82      */
83     Set<String> getAvailableModuleNames();
84
85 }