*/
package org.opendaylight.controller.config.manager.impl.dependencyresolver;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.concurrent.GuardedBy;
-import javax.management.InstanceAlreadyExistsException;
-
import org.opendaylight.controller.config.api.JmxAttribute;
import org.opendaylight.controller.config.api.JmxAttributeValidationException;
import org.opendaylight.controller.config.api.ModuleIdentifier;
import org.opendaylight.controller.config.spi.Module;
import org.opendaylight.controller.config.spi.ModuleFactory;
+import javax.annotation.concurrent.GuardedBy;
+import javax.management.InstanceAlreadyExistsException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* Represents modules to be committed.
*/
public Map<ModuleIdentifier, Module> getAllModules() {
Map<ModuleIdentifier, Module> result = new HashMap<>();
for (ModuleInternalTransactionalInfo entry : commitMap.values()) {
- ModuleIdentifier name = entry.getName();
+ ModuleIdentifier name = entry.getIdentifier();
result.put(name, entry.getModule());
}
return result;
@Override
public void put(
ModuleInternalTransactionalInfo moduleInternalTransactionalInfo) {
- commitMap.put(moduleInternalTransactionalInfo.getName(),
+ commitMap.put(moduleInternalTransactionalInfo.getIdentifier(),
moduleInternalTransactionalInfo);
}
@Override
public ModuleInternalTransactionalInfo destroyModule(
ModuleIdentifier moduleIdentifier) {
- ModuleInternalTransactionalInfo found = commitMap
- .remove(moduleIdentifier);
- if (found == null)
+ ModuleInternalTransactionalInfo found = commitMap.remove(moduleIdentifier);
+ if (found == null) {
throw new IllegalStateException("Not found:" + moduleIdentifier);
+ }
if (found.hasOldModule()) {
unorderedDestroyedFromPreviousTransactions.add(found);
}
throws InstanceAlreadyExistsException {
if (commitMap.containsKey(moduleIdentifier)) {
throw new InstanceAlreadyExistsException(
- "There is an instance registered with name "
- + moduleIdentifier);
+ "There is an instance registered with name " + moduleIdentifier);
}
}
public Collection<ModuleInternalTransactionalInfo> getAllInfos(){
return commitMap.values();
}
+
+ @Override
+ public ModuleInternalTransactionalInfo findModuleInternalTransactionalInfo(ModuleIdentifier moduleIdentifier) {
+ ModuleInternalTransactionalInfo found = commitMap.get(moduleIdentifier);
+ if (found == null) {
+ throw new IllegalStateException("Not found:" + moduleIdentifier);
+ }
+ return found;
+ }
}