Exception for URI /restconf/operations/module_name:rpc ended with slash
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / spi / Module.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.spi;
9
10 import javax.annotation.concurrent.NotThreadSafe;
11
12 import org.opendaylight.controller.config.api.ModuleIdentifier;
13 import org.opendaylight.yangtools.concepts.Identifiable;
14
15
16 /**
17  * Represents one service that is to be configured. These methods need to be
18  * implemented in addition to the usual attribute getters/setters. Dependencies
19  * should always be injected as ObjectName references to the corresponding
20  * ConfigBeans.
21  * <p>
22  * In order to guide dependency resolution, the setter method should be
23  * annotated with {@link RequireInterface}.
24  * </p>
25  * <p>
26  * Thread safety note: implementations of this interface are not required to be
27  * thread safe as thread safety is enforced by configuration manager.
28  * </p>
29  */
30 @NotThreadSafe
31 public interface Module extends Identifiable<ModuleIdentifier>{
32     /**
33      * This method will be called as first phase in two phase commit. Instance
34      * can check attributes, but is not allowed to do any kind of work that
35      * could leave any resources open. It is prohibited to call
36      * {@link #getInstance()} on dependent {@link Module} because it would
37      * destroy separation between validation and commit phase.
38      *
39      */
40     void validate();
41
42     /**
43      * Returns 'live' object that was configured using this object. It is
44      * allowed to call this method only after all ConfigBeans were validated. In
45      * this method new resources might be opened or old instance might be
46      * modified. Note that when obtaining dependent Module using
47      * {@link org.opendaylight.controller.config.api.DependencyResolver#validateDependency(Class, javax.management.ObjectName, String)}
48      * a proxy will be created that will disallow calling this method before
49      * second commit phase begins.
50      *
51      * @return closeable instance: After bundle update the factory might be able
52      *         to copy old configuration into new one without being able to cast
53      *         Module or the instance. Thus to clean up old instance, it will
54      *         call close().
55      */
56     AutoCloseable getInstance();
57
58 }