Merge "Added sun.misc to jre.properties"
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / spi / Module.java
index b11d5f8beb1620c4d0e86b25c3ee1180565c2536..53f03a2398ef9cf8b854fd0bcc7e6959b8304ba5 100644 (file)
@@ -8,10 +8,9 @@
 package org.opendaylight.controller.config.spi;
 
 import javax.annotation.concurrent.NotThreadSafe;
-
 import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.config.api.annotations.RequireInterface;
-import org.opendaylight.protocol.concepts.NamedObject;
+import org.opendaylight.yangtools.concepts.Identifiable;
+
 
 /**
  * Represents one service that is to be configured. These methods need to be
@@ -20,7 +19,7 @@ import org.opendaylight.protocol.concepts.NamedObject;
  * ConfigBeans.
  * <p>
  * In order to guide dependency resolution, the setter method should be
- * annotated with {@link RequireInterface}.
+ * annotated with {@link org.opendaylight.controller.config.api.annotations.RequireInterface}.
  * </p>
  * <p>
  * Thread safety note: implementations of this interface are not required to be
@@ -28,7 +27,7 @@ import org.opendaylight.protocol.concepts.NamedObject;
  * </p>
  */
 @NotThreadSafe
-public interface Module extends NamedObject<ModuleIdentifier> {
+public interface Module extends Identifiable<ModuleIdentifier>{
     /**
      * This method will be called as first phase in two phase commit. Instance
      * can check attributes, but is not allowed to do any kind of work that
@@ -43,10 +42,10 @@ public interface Module extends NamedObject<ModuleIdentifier> {
      * Returns 'live' object that was configured using this object. It is
      * allowed to call this method only after all ConfigBeans were validated. In
      * this method new resources might be opened or old instance might be
-     * modified. Note that when obtaining dependent Module using
-     * {@link org.opendaylight.controller.config.api.DependencyResolver#validateDependency(Class, javax.management.ObjectName, String)}
-     * a proxy will be created that will disallow calling this method before
-     * second commit phase begins.
+     * modified. This method must be implemented so that it returns same
+     * result for a single transaction. Since Module is created per transaction
+     * this means that it must be safe to cache result of first call.
+     *
      *
      * @return closeable instance: After bundle update the factory might be able
      *         to copy old configuration into new one without being able to cast
@@ -55,4 +54,17 @@ public interface Module extends NamedObject<ModuleIdentifier> {
      */
     AutoCloseable getInstance();
 
+
+    /**
+     * Compare current module with oldModule and if the instance/live object
+     * produced by the old module can be reused in this module as well return true.
+     * Typically true should be returned if the old module had the same configuration.
+     *
+     *
+     * @param oldModule old instance of Module
+     * @return true if the instance produced by oldModule can be reused with current instance as well.
+     */
+    public boolean canReuse(Module oldModule);
+
+
 }