X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-jmx-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyangjmxgenerator%2FServiceInterfaceEntry.java;h=ee02b303e0b2aa1778d2b45cffd421946411ae4f;hb=73e969cf365dd78772596c71e940ae44fe2f22d3;hp=aa2d6a5d7f044dde8d84b49fff2d8fa3ed28f383;hpb=576aa6018e48dfca8f223b7ac929139a32135201;p=controller.git
diff --git a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ServiceInterfaceEntry.java b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ServiceInterfaceEntry.java
index aa2d6a5d7f..ee02b303e0 100644
--- a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ServiceInterfaceEntry.java
+++ b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ServiceInterfaceEntry.java
@@ -7,10 +7,7 @@
*/
package org.opendaylight.controller.config.yangjmxgenerator;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.lang.String.format;
-import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.SERVICE_TYPE_Q_NAME;
-
+import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -18,15 +15,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.lang.String.format;
+import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.SERVICE_TYPE_Q_NAME;
/**
* Represents identity derived from {@link ConfigConstants#SERVICE_TYPE_Q_NAME}.
@@ -49,7 +46,7 @@ import com.google.common.base.Optional;
*
*/
public class ServiceInterfaceEntry extends AbstractEntry {
- private static final Logger logger = LoggerFactory
+ private static final Logger LOGGER = LoggerFactory
.getLogger(ServiceInterfaceEntry.class);
private static final String CLASS_NAME_SUFFIX = "ServiceInterface";
@@ -123,17 +120,17 @@ public class ServiceInterfaceEntry extends AbstractEntry {
* values
*/
public static Map create(Module currentModule,
- String packageName) {
- logger.debug("Generating ServiceInterfaces from {} to package {}",
+ String packageName,Map definedSEItracker) {
+ LOGGER.debug("Generating ServiceInterfaces from {} to package {}",
currentModule.getNamespace(), packageName);
Map identitiesToSIs = new HashMap<>();
Set notVisited = new HashSet<>(
currentModule.getIdentities());
int lastSize = notVisited.size() + 1;
- while (notVisited.size() > 0) {
+ while (!notVisited.isEmpty()) {
if (notVisited.size() == lastSize) {
- logger.debug(
+ LOGGER.debug(
"Following identities will be ignored while generating ServiceInterfaces, as they are not derived from {} : {}",
SERVICE_TYPE_Q_NAME, notVisited);
break;
@@ -152,7 +149,7 @@ public class ServiceInterfaceEntry extends AbstractEntry {
// this is a base type
created = new ServiceInterfaceEntry(identity, packageName, ModuleUtil.getQName(currentModule));
} else {
- ServiceInterfaceEntry foundBase = identitiesToSIs
+ ServiceInterfaceEntry foundBase = definedSEItracker
.get(identity.getBaseIdentity());
// derived type, did we convert the parent?
if (foundBase != null) {
@@ -160,12 +157,15 @@ public class ServiceInterfaceEntry extends AbstractEntry {
Optional.of(foundBase), identity, packageName, ModuleUtil.getQName(currentModule));
}
}
+
+
if (created != null) {
created.setYangModuleName(currentModule.getName());
// TODO how to get local name
created.setYangModuleLocalname(identity.getQName()
.getLocalName());
identitiesToSIs.put(identity, created);
+ definedSEItracker.put(identity, created);
iterator.remove();
}
}
@@ -175,7 +175,7 @@ public class ServiceInterfaceEntry extends AbstractEntry {
for (ServiceInterfaceEntry sie : identitiesToSIs.values()) {
resultMap.put(sie.getQName(), sie);
}
- logger.debug("Number of ServiceInterfaces to be generated: {}",
+ LOGGER.debug("Number of ServiceInterfaces to be generated: {}",
resultMap.size());
return resultMap;
}
@@ -198,25 +198,33 @@ public class ServiceInterfaceEntry extends AbstractEntry {
@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (o == null || getClass() != o.getClass())
+ }
+ if (o == null || getClass() != o.getClass()) {
return false;
+ }
ServiceInterfaceEntry that = (ServiceInterfaceEntry) o;
- if (!maybeBaseCache.equals(that.maybeBaseCache))
+ if (!maybeBaseCache.equals(that.maybeBaseCache)) {
return false;
- if (!nullableDescription.equals(that.nullableDescription))
+ }
+ if (!nullableDescription.equals(that.nullableDescription)) {
return false;
- if (!exportedOsgiClassName.equals(that.exportedOsgiClassName))
+ }
+ if (!exportedOsgiClassName.equals(that.exportedOsgiClassName)) {
return false;
- if (!qName.equals(that.qName))
+ }
+ if (!qName.equals(that.qName)) {
return false;
- if (!packageName.equals(that.packageName))
+ }
+ if (!packageName.equals(that.packageName)) {
return false;
- if (!typeName.equals(that.typeName))
+ }
+ if (!typeName.equals(that.typeName)) {
return false;
+ }
return true;
}