X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fmapping%2Fconfig%2FInstanceConfig.java;fp=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fmapping%2Fconfig%2FInstanceConfig.java;h=b9f4cda834ca742d39ba6eaedeaf8e1b0d9f118f;hb=e331fa568ee0b7a33ec451a104123bcbf7d86e78;hp=a66fd75dbddfd2a04a69d658b31b2c829284a7ff;hpb=cbcc2b61265e903959f11d44c292771e76b3926e;p=controller.git diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfig.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfig.java index a66fd75dbd..b9f4cda834 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfig.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfig.java @@ -49,8 +49,8 @@ public final class InstanceConfig { private final Map jmxToAttrConfig; private final BeanReader configRegistryClient; - public InstanceConfig(BeanReader configRegistryClient, Map yangNamesToAttributes, - String nullableDummyContainerName) { + public InstanceConfig(final BeanReader configRegistryClient, final Map yangNamesToAttributes, + final String nullableDummyContainerName) { this.yangToAttrConfig = yangNamesToAttributes; this.nullableDummyContainerName = nullableDummyContainerName; @@ -58,7 +58,7 @@ public final class InstanceConfig { this.configRegistryClient = configRegistryClient; } - private Map getMappedConfiguration(ObjectName on, final EnumResolver enumResolver) { + private Map getMappedConfiguration(final ObjectName on, final EnumResolver enumResolver) { // TODO make field, mappingStrategies can be instantiated only once Map>> mappingStrategies = new ObjectMapper() @@ -80,7 +80,7 @@ public final class InstanceConfig { continue; } toXml.put(configDefEntry.getValue().getAttributeYangName(), a.get()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Unable to map value " + value + " to attribute " + configDefEntry.getKey(), e); } @@ -88,7 +88,7 @@ public final class InstanceConfig { return toXml; } - public Element toXml(ObjectName on, String namespace, Document document, Element rootElement, final EnumResolver enumResolver) { + public Element toXml(final ObjectName on, final String namespace, final Document document, final Element rootElement, final EnumResolver enumResolver) { Map strats = new ObjectXmlWriter().prepareWriting(yangToAttrConfig, document); Map mappedConfig = getMappedConfiguration(on, enumResolver); Element parentElement; @@ -102,7 +102,7 @@ public final class InstanceConfig { for (Entry mappingEntry : mappedConfig.entrySet()) { try { strats.get(mappingEntry.getKey()).writeElement(parentElement, namespace, mappingEntry.getValue()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Unable to write value " + mappingEntry.getValue() + " for attribute " + mappingEntry.getValue(), e); } @@ -110,7 +110,7 @@ public final class InstanceConfig { return rootElement; } - private void resolveConfiguration(InstanceConfigElementResolved mappedConfig, ServiceRegistryWrapper depTracker, final EnumResolver enumResolver) { + private void resolveConfiguration(final InstanceConfigElementResolved mappedConfig, final ServiceRegistryWrapper depTracker, final EnumResolver enumResolver) { // TODO make field, resolvingStrategies can be instantiated only once Map>> resolvingStrategies = new ObjectResolver( @@ -127,16 +127,16 @@ public final class InstanceConfig { value.resolveValue(attributeResolvingStrategy, attributeName); value.setJmxName( yangToAttrConfig.get(attributeName).getUpperCaseCammelCase()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Unable to resolve value " + value + " to attribute " + attributeName, e); } } } - public InstanceConfigElementResolved fromXml(XmlElement moduleElement, ServiceRegistryWrapper services, String moduleNamespace, - EditStrategyType defaultStrategy, - Map> identityMap, final EnumResolver enumResolver) throws DocumentedException { + public InstanceConfigElementResolved fromXml(XmlElement moduleElement, final ServiceRegistryWrapper services, final String moduleNamespace, + final EditStrategyType defaultStrategy, + final Map> identityMap, final EnumResolver enumResolver) throws DocumentedException { Map retVal = Maps.newHashMap(); Map strats = new ObjectXmlReader().prepareReading(yangToAttrConfig, identityMap); @@ -159,7 +159,7 @@ public final class InstanceConfig { if (size == expectedChildNodes) { try { moduleElement = moduleElement.getOnlyChildElement(nullableDummyContainerName, moduleNamespace); - } catch (DocumentedException e) { + } catch (final DocumentedException e) { throw new DocumentedException("Error reading module " + typeElement.getTextContent() + " : " + nameElement.getTextContent() + " - Expected child node with name " + nullableDummyContainerName + "." + e.getMessage()); @@ -177,7 +177,7 @@ public final class InstanceConfig { recognisedChildren.addAll(typeAndNameElements); try { moduleElement.checkUnrecognisedElements(recognisedChildren); - } catch (DocumentedException e) { + } catch (final DocumentedException e) { throw new DocumentedException("Error reading module " + typeElement.getTextContent() + " : " + nameElement.getTextContent() + " - " + e.getMessage(), e.getErrorType(), e.getErrorTag(),e.getErrorSeverity(),e.getErrorInfo()); @@ -193,8 +193,8 @@ public final class InstanceConfig { return instanceConfigElementResolved; } - private List getConfigNodes(XmlElement moduleElement, String moduleNamespace, String name, - List recognisedChildren, List typeAndName) throws DocumentedException { + private List getConfigNodes(final XmlElement moduleElement, final String moduleNamespace, final String name, + final List recognisedChildren, final List typeAndName) throws DocumentedException { List foundConfigNodes = moduleElement.getChildElementsWithinNamespace(name, moduleNamespace); if (foundConfigNodes.isEmpty()) { LOG.debug("No config nodes {}:{} found in {}", moduleNamespace, name, moduleElement); @@ -225,7 +225,7 @@ public final class InstanceConfig { return foundConfigNodes; } - private static Map reverseMap(Map yangNameToAttr) { + private static Map reverseMap(final Map yangNameToAttr) { Map reversednameToAtr = Maps.newHashMap(); for (Entry entry : yangNameToAttr.entrySet()) {