Add ModuleFactory#getDefaultModules method to config-api.
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / spi / ModuleFactory.java
index 00db2c2cd4182d0d888c92a4f7f6ef10c2d56524..e300523913f818ed17b20dce3baf32098aca1cb4 100644 (file)
@@ -10,9 +10,12 @@ package org.opendaylight.controller.config.spi;
 import javax.management.DynamicMBean;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.DependencyResolverFactory;
 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
 
+import java.util.Set;
+
 /**
  * Factory which creates {@link Module instances. An instance of this interface
  * needs to be exported into the OSGi Service Registry. Such an instance
@@ -88,4 +91,15 @@ public interface ModuleFactory {
     boolean isModuleImplementingServiceInterface(
             Class<? extends AbstractServiceInterface> serviceInterface);
 
+    /**
+     * Called when ModuleFactory is registered to config manager.
+     * Useful for populating the registry with pre-existing state. Since
+     * the method is called for each ModuleFactory separately and transaction
+     * is committed automatically, returned modules MUST be valid and commitable
+     * without any manual intervention.
+     * @param dependencyResolverFactory factory for getting dependency resolvers for each module.
+     * @return set of default modules. Null is not allowed.
+     */
+    public Set<? extends Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory);
+
 }