From e331fa568ee0b7a33ec451a104123bcbf7d86e78 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Fri, 12 May 2017 09:42:45 +0200 Subject: [PATCH] config-manager-facade-xml: final parameters This automatically-generated patch flags all appropriate parameters as final (including caught exceptions). Change-Id: I957543aa948a5d2473b7b61ffc3de52467f11d76 Signed-off-by: Stephen Kitt --- .../xml/CandidateDatastoreQueryStrategy.java | 4 +- .../config/facade/xml/ConfigExecution.java | 10 ++-- .../facade/xml/ConfigSubsystemFacade.java | 45 +++++++++-------- .../config/facade/xml/Datastore.java | 4 +- .../config/facade/xml/RpcFacade.java | 2 +- .../xml/RunningDatastoreQueryStrategy.java | 4 +- .../config/facade/xml/TestOption.java | 2 +- .../facade/xml/mapping/IdentityMapping.java | 4 +- .../AttributeIfcSwitchStatement.java | 18 +++---- .../AbstractAttributeReadingStrategy.java | 6 +-- .../ArrayAttributeReadingStrategy.java | 4 +- .../fromxml/AttributeConfigElement.java | 12 ++--- .../CompositeAttributeReadingStrategy.java | 6 +-- .../ObjectNameAttributeReadingStrategy.java | 8 +-- .../attributes/fromxml/ObjectXmlReader.java | 24 ++++----- .../SimpleAttributeReadingStrategy.java | 10 ++-- .../SimpleBinaryAttributeReadingStrategy.java | 6 +-- ...mpleCompositeAttributeReadingStrategy.java | 6 +-- ...leIdentityRefAttributeReadingStrategy.java | 8 +-- .../SimpleUnionAttributeReadingStrategy.java | 6 +-- .../AbstractAttributeMappingStrategy.java | 2 +- .../ArrayAttributeMappingStrategy.java | 6 +-- .../CompositeAttributeMappingStrategy.java | 10 ++-- .../mapping/EnumAttributeMappingStrategy.java | 4 +- .../attributes/mapping/ObjectMapper.java | 22 ++++---- .../ObjectNameAttributeMappingStrategy.java | 6 +-- .../SimpleAttributeMappingStrategy.java | 8 +-- ...nionCompositeAttributeMappingStrategy.java | 4 +- .../AbstractAttributeResolvingStrategy.java | 2 +- .../ArrayAttributeResolvingStrategy.java | 16 +++--- .../CompositeAttributeResolvingStrategy.java | 10 ++-- .../EnumAttributeResolvingStrategy.java | 4 +- .../ObjectNameAttributeResolvingStrategy.java | 4 +- .../attributes/resolving/ObjectResolver.java | 26 +++++----- .../SimpleAttributeResolvingStrategy.java | 24 ++++----- ...onCompositeAttributeResolvingStrategy.java | 6 +-- .../toxml/ArrayAttributeWritingStrategy.java | 4 +- .../CompositeAttributeWritingStrategy.java | 6 +-- .../ObjectNameAttributeWritingStrategy.java | 4 +- .../attributes/toxml/ObjectXmlWriter.java | 26 +++++----- .../RuntimeBeanEntryWritingStrategy.java | 6 +-- .../toxml/SimpleAttributeWritingStrategy.java | 8 +-- .../SimpleBinaryAttributeWritingStrategy.java | 4 +- ...mpleCompositeAttributeWritingStrategy.java | 4 +- ...leIdentityRefAttributeWritingStrategy.java | 6 +-- .../SimpleUnionAttributeWritingStrategy.java | 4 +- .../facade/xml/mapping/config/Config.java | 50 +++++++++---------- .../xml/mapping/config/InstanceConfig.java | 32 ++++++------ .../config/InstanceConfigElementResolved.java | 8 +-- .../xml/mapping/config/ModuleConfig.java | 8 +-- .../config/ModuleElementDefinition.java | 4 +- .../mapping/config/ModuleElementResolved.java | 2 +- .../config/ServiceRegistryWrapper.java | 6 +-- .../facade/xml/mapping/config/Services.java | 16 +++--- .../facade/xml/rpc/InstanceRuntimeRpc.java | 10 ++-- .../xml/transactions/TransactionProvider.java | 20 ++++---- 56 files changed, 287 insertions(+), 284 deletions(-) diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/CandidateDatastoreQueryStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/CandidateDatastoreQueryStrategy.java index 971fc44e82..3f2fcfaf6f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/CandidateDatastoreQueryStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/CandidateDatastoreQueryStrategy.java @@ -18,12 +18,12 @@ public class CandidateDatastoreQueryStrategy implements DatastoreQueryStrategy { private final TransactionProvider transactionProvider; - public CandidateDatastoreQueryStrategy(TransactionProvider transactionProvider) { + public CandidateDatastoreQueryStrategy(final TransactionProvider transactionProvider) { this.transactionProvider = transactionProvider; } @Override - public Set queryInstances(ConfigRegistryClient configRegistryClient) { + public Set queryInstances(final ConfigRegistryClient configRegistryClient) { ObjectName on = transactionProvider.getOrCreateTransaction(); ConfigTransactionClient proxy = configRegistryClient.getConfigTransactionClient(on); return proxy.lookupConfigBeans(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigExecution.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigExecution.java index 0d49dbf637..26ba0eafc4 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigExecution.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigExecution.java @@ -28,7 +28,7 @@ public class ConfigExecution { private final Config configResolver; private final XmlElement configElement; - public ConfigExecution(Config configResolver, XmlElement configElement, TestOption testOption, EditStrategyType defaultStrategy) throws DocumentedException { + public ConfigExecution(final Config configResolver, final XmlElement configElement, final TestOption testOption, final EditStrategyType defaultStrategy) throws DocumentedException { Config.checkUnrecognisedChildren(configElement); this.configResolver = configResolver; this.configElement = configElement; @@ -45,16 +45,18 @@ public class ConfigExecution { return testOption == TestOption.set || testOption == TestOption.testThenSet; } - public Map> getResolvedXmlElements(ServiceReferenceReadableRegistry serviceRegistry) throws DocumentedException { + public Map> getResolvedXmlElements( + final ServiceReferenceReadableRegistry serviceRegistry) throws DocumentedException { return configResolver.fromXmlModulesResolved(configElement, defaultEditStrategyType, getServiceRegistryWrapper(serviceRegistry)); } - public ServiceRegistryWrapper getServiceRegistryWrapper(ServiceReferenceReadableRegistry serviceRegistry) { + public ServiceRegistryWrapper getServiceRegistryWrapper(final ServiceReferenceReadableRegistry serviceRegistry) { // TODO cache service registry return new ServiceRegistryWrapper(serviceRegistry); } - public Map> getModulesDefinition(ServiceReferenceReadableRegistry serviceRegistry) throws DocumentedException { + public Map> getModulesDefinition( + final ServiceReferenceReadableRegistry serviceRegistry) throws DocumentedException { return configResolver.fromXmlModulesMap(configElement, defaultEditStrategyType, getServiceRegistryWrapper(serviceRegistry)); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigSubsystemFacade.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigSubsystemFacade.java index d47383469a..781bda575f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigSubsystemFacade.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigSubsystemFacade.java @@ -71,7 +71,7 @@ public class ConfigSubsystemFacade implements Closeable { private final ConfigRegistryClient configRegistryClientNoNotifications; private final RpcFacade rpcFacade; - public ConfigSubsystemFacade(ConfigRegistryClient configRegistryClient, ConfigRegistryClient configRegistryClientNoNotifications, YangStoreService yangStoreService, String id) { + public ConfigSubsystemFacade(final ConfigRegistryClient configRegistryClient, final ConfigRegistryClient configRegistryClientNoNotifications, final YangStoreService yangStoreService, final String id) { this.configRegistryClient = configRegistryClient; this.configRegistryClientNoNotifications = configRegistryClientNoNotifications; this.yangStoreService = yangStoreService; @@ -79,7 +79,7 @@ public class ConfigSubsystemFacade implements Closeable { rpcFacade = new RpcFacade(yangStoreService, configRegistryClient); } - public ConfigSubsystemFacade(ConfigRegistryClient configRegistryClient, ConfigRegistryClient configRegistryClientNoNotifications, YangStoreService yangStoreService, TransactionProvider txProvider) { + public ConfigSubsystemFacade(final ConfigRegistryClient configRegistryClient, final ConfigRegistryClient configRegistryClientNoNotifications, final YangStoreService yangStoreService, final TransactionProvider txProvider) { this.configRegistryClient = configRegistryClient; this.configRegistryClientNoNotifications = configRegistryClientNoNotifications; this.yangStoreService = yangStoreService; @@ -118,7 +118,7 @@ public class ConfigSubsystemFacade implements Closeable { } } - public void executeConfigExecution(ConfigExecution configExecution) throws DocumentedException, ValidationException { + public void executeConfigExecution(final ConfigExecution configExecution) throws DocumentedException, ValidationException { if (configExecution.shouldTest()) { executeTests(configExecution); } @@ -140,17 +140,17 @@ public class ConfigSubsystemFacade implements Closeable { return status; } - private void executeSet(ConfigExecution configExecution) throws DocumentedException { + private void executeSet(final ConfigExecution configExecution) throws DocumentedException { set(configExecution); LOG.debug("Set phase for {} operation successful, element: ", configExecution.getDefaultStrategy(), configExecution.getConfigElement()); } - private void executeTests(ConfigExecution configExecution) throws DocumentedException, ValidationException { + private void executeTests(final ConfigExecution configExecution) throws DocumentedException, ValidationException { test(configExecution, configExecution.getDefaultStrategy()); LOG.debug("Test phase for {} operation successful, element: ", configExecution.getDefaultStrategy(), configExecution.getConfigElement()); } - private void test(ConfigExecution execution, EditStrategyType editStrategyType) throws ValidationException, DocumentedException { + private void test(final ConfigExecution execution, final EditStrategyType editStrategyType) throws ValidationException, DocumentedException { ObjectName taON = transactionProvider.getTestTransaction(); try { // default strategy = replace wipes config @@ -169,7 +169,7 @@ public class ConfigSubsystemFacade implements Closeable { } } - private void set(ConfigExecution ConfigExecution) throws DocumentedException { + private void set(final ConfigExecution ConfigExecution) throws DocumentedException { ObjectName taON = transactionProvider.getOrCreateTransaction(); // default strategy = replace wipes config @@ -184,7 +184,7 @@ public class ConfigSubsystemFacade implements Closeable { setOnTransaction(ta, ConfigExecution); } - private void setServicesOnTransaction(ConfigTransactionClient ta, ConfigExecution execution) throws DocumentedException { + private void setServicesOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution) throws DocumentedException { Services services = execution.getServices(); @@ -208,7 +208,7 @@ public class ConfigSubsystemFacade implements Closeable { LOG.debug("Saving service {} with on {} under name {} with service on {}", qnameOfService, on, refNameToServiceEntry.getKey(), saved); } - } catch (InstanceNotFoundException e) { + } catch (final InstanceNotFoundException e) { throw new DocumentedException(String.format("Unable to edit ref name " + refNameToServiceEntry.getKey() + " for instance " + on, e), ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, @@ -219,11 +219,11 @@ public class ConfigSubsystemFacade implements Closeable { } } - private String getQname(ConfigTransactionClient ta, String namespace, String serviceName) { + private String getQname(final ConfigTransactionClient ta, final String namespace, final String serviceName) { return ta.getServiceInterfaceName(namespace, serviceName); } - private void setOnTransaction(ConfigTransactionClient ta, ConfigExecution execution) throws DocumentedException { + private void setOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution) throws DocumentedException { for (Multimap modulesToResolved : execution.getResolvedXmlElements(ta).values()) { @@ -240,8 +240,8 @@ public class ConfigSubsystemFacade implements Closeable { } } - private void handleMisssingInstancesOnTransaction(ConfigTransactionClient ta, - ConfigExecution execution) throws DocumentedException { + private void handleMisssingInstancesOnTransaction(final ConfigTransactionClient ta, + final ConfigExecution execution) throws DocumentedException { for (Multimap modulesToResolved : execution.getModulesDefinition(ta).values()) { for (Map.Entry moduleToResolved : modulesToResolved.entries()) { @@ -262,7 +262,7 @@ public class ConfigSubsystemFacade implements Closeable { return new Config(factories, identitiesMap, snapshot.getEnumResolver()); } - private static Map> transformIdentities(Set modules) { + private static Map> transformIdentities(final Set modules) { Map> mappedIds = Maps.newHashMap(); for (Module module : modules) { String namespace = module.getNamespace().toString(); @@ -291,14 +291,15 @@ public class ConfigSubsystemFacade implements Closeable { public Map> transformMbeToModuleConfigs( - Map> mBeanEntries) { return transformMbeToModuleConfigs(configRegistryClient, mBeanEntries); } public Map> transformMbeToModuleConfigs(BeanReader reader, - Map> transformMbeToModuleConfigs( + final BeanReader reader, + final Map> mBeanEntries) { Map> namespaceToModuleNameToModuleConfig = Maps.newHashMap(); @@ -328,8 +329,8 @@ public class ConfigSubsystemFacade implements Closeable { return new ConfigExecution(configMapping, XmlElement.fromDomElement(xmlToBePersisted), TestOption.testThenSet, EditStrategyType.getDefaultStrategy()); } - private Map> createModuleRuntimes(ConfigRegistryClient configRegistryClient, - Map> mBeanEntries) { + private Map> createModuleRuntimes(final ConfigRegistryClient configRegistryClient, + final Map> mBeanEntries) { Map> retVal = Maps.newHashMap(); for (Map.Entry> namespaceToModuleEntry : mBeanEntries.entrySet()) { @@ -363,7 +364,7 @@ public class ConfigSubsystemFacade implements Closeable { return retVal; } - private InstanceRuntime createInstanceRuntime(RuntimeBeanEntry root, Map cache) { + private InstanceRuntime createInstanceRuntime(final RuntimeBeanEntry root, final Map cache) { Map children = Maps.newHashMap(); for (RuntimeBeanEntry child : root.getChildren()) { children.put(child.getJavaNamePrefix(), createInstanceRuntime(child, cache)); @@ -372,7 +373,7 @@ public class ConfigSubsystemFacade implements Closeable { return new InstanceRuntime(cache.get(root), children, createJmxToYangMap(root.getChildren())); } - private Map createJmxToYangMap(List children) { + private Map createJmxToYangMap(final List children) { Map jmxToYangNamesForChildRbe = Maps.newHashMap(); for (RuntimeBeanEntry rbe : children) { jmxToYangNamesForChildRbe.put(rbe.getJavaNamePrefix(), rbe.getYangName()); @@ -380,7 +381,7 @@ public class ConfigSubsystemFacade implements Closeable { return jmxToYangNamesForChildRbe; } - public Element get(Document document) throws DocumentedException { + public Element get(final Document document) throws DocumentedException { final ObjectName testTransaction = transactionProvider.getOrCreateReadTransaction(); final ConfigTransactionClient txClient = configRegistryClient.getConfigTransactionClient(testTransaction); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/Datastore.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/Datastore.java index c908df8547..22c97c46dc 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/Datastore.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/Datastore.java @@ -19,8 +19,8 @@ public enum Datastore { * @param transactionProvider * @return */ - public static DatastoreQueryStrategy getInstanceQueryStrategy(Datastore source, - TransactionProvider transactionProvider) { + public static DatastoreQueryStrategy getInstanceQueryStrategy(final Datastore source, + final TransactionProvider transactionProvider) { switch (source) { case running: return new RunningDatastoreQueryStrategy(transactionProvider); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RpcFacade.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RpcFacade.java index 60c0e72e26..dd4bd5b9de 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RpcFacade.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RpcFacade.java @@ -145,7 +145,7 @@ public class RpcFacade { return configRegistryClient.invokeMethod(execution.on, execution.operationName, params, signature); } - public Element toXml(Document doc, Object result, OperationExecution execution) throws DocumentedException { + public Element toXml(final Document doc, final Object result, final OperationExecution execution) throws DocumentedException { AttributeMappingStrategy> mappingStrategy = new ObjectMapper().prepareStrategy(execution.getReturnType()); Optional mappedAttributeOpt = mappingStrategy.mapAttribute(result); Preconditions.checkState(mappedAttributeOpt.isPresent(), "Unable to map return value %s as %s", result, execution.getReturnType().getOpenType()); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RunningDatastoreQueryStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RunningDatastoreQueryStrategy.java index 08b9499acf..28f203b4d9 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RunningDatastoreQueryStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/RunningDatastoreQueryStrategy.java @@ -18,12 +18,12 @@ public class RunningDatastoreQueryStrategy implements DatastoreQueryStrategy { private final TransactionProvider transactionProvider; - public RunningDatastoreQueryStrategy(TransactionProvider transactionProvider) { + public RunningDatastoreQueryStrategy(final TransactionProvider transactionProvider) { this.transactionProvider = transactionProvider; } @Override - public Set queryInstances(ConfigRegistryClient configRegistryClient) { + public Set queryInstances(final ConfigRegistryClient configRegistryClient) { ObjectName on = transactionProvider.getOrCreateReadTransaction(); ConfigTransactionClient proxy = configRegistryClient.getConfigTransactionClient(on); return proxy.lookupConfigBeans(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/TestOption.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/TestOption.java index 52e8d17938..312717ad90 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/TestOption.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/TestOption.java @@ -13,7 +13,7 @@ import java.util.Arrays; public enum TestOption { testOnly, set, testThenSet; - public static TestOption getFromXmlName(String testOptionXmlName) { + public static TestOption getFromXmlName(final String testOptionXmlName) { switch (testOptionXmlName) { case "test-only": return testOnly; diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/IdentityMapping.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/IdentityMapping.java index e937e2645b..759e33e0a6 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/IdentityMapping.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/IdentityMapping.java @@ -20,13 +20,13 @@ public class IdentityMapping { this.identityNameToSchemaNode = Maps.newHashMap(); } - public void addIdSchemaNode(IdentitySchemaNode node) { + public void addIdSchemaNode(final IdentitySchemaNode node) { String name = node.getQName().getLocalName(); Preconditions.checkState(!identityNameToSchemaNode.containsKey(name)); identityNameToSchemaNode.put(name, node); } - public boolean containsIdName(String idName) { + public boolean containsIdName(final String idName) { return identityNameToSchemaNode.containsKey(idName); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/AttributeIfcSwitchStatement.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/AttributeIfcSwitchStatement.java index 8ee33c9650..9c2aaeda49 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/AttributeIfcSwitchStatement.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/AttributeIfcSwitchStatement.java @@ -24,7 +24,7 @@ public abstract class AttributeIfcSwitchStatement { private AttributeIfc lastAttribute; - public T switchAttribute(AttributeIfc attributeIfc) { + public T switchAttribute(final AttributeIfc attributeIfc) { this.lastAttribute = attributeIfc; @@ -43,7 +43,7 @@ public abstract class AttributeIfcSwitchStatement { } else { return caseJavaAttribute(openType); } - } catch (UnknownOpenTypeException e) { + } catch (final UnknownOpenTypeException e) { throw getIllegalArgumentException(attributeIfc); } @@ -64,28 +64,28 @@ public abstract class AttributeIfcSwitchStatement { return lastAttribute; } - protected T caseJavaIdentityRefAttribute(OpenType openType) { + protected T caseJavaIdentityRefAttribute(final OpenType openType) { return caseJavaAttribute(openType); } - protected T caseJavaUnionAttribute(OpenType openType) { + protected T caseJavaUnionAttribute(final OpenType openType) { return caseJavaAttribute(openType); } - protected T caseJavaEnumAttribute(OpenType openType) { + protected T caseJavaEnumAttribute(final OpenType openType) { return caseJavaAttribute(openType); } - protected T caseJavaBinaryAttribute(OpenType openType) { + protected T caseJavaBinaryAttribute(final OpenType openType) { return caseJavaAttribute(openType); } - private IllegalArgumentException getIllegalArgumentException(AttributeIfc attributeIfc) { + private IllegalArgumentException getIllegalArgumentException(final AttributeIfc attributeIfc) { return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc + " with open type:" + attributeIfc.getOpenType()); } - public final T caseJavaAttribute(OpenType openType) { + public final T caseJavaAttribute(final OpenType openType) { if (openType instanceof SimpleType) { return caseJavaSimpleAttribute((SimpleType) openType); } else if (openType instanceof ArrayType) { @@ -114,7 +114,7 @@ public abstract class AttributeIfcSwitchStatement { private static class UnknownOpenTypeException extends RuntimeException { private static final long serialVersionUID = 1L; - public UnknownOpenTypeException(String message) { + public UnknownOpenTypeException(final String message) { super(message); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java index a1f185a10e..d0642944a6 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java @@ -16,7 +16,7 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi private final String nullableDefault; - public AbstractAttributeReadingStrategy(String nullableDefault) { + public AbstractAttributeReadingStrategy(final String nullableDefault) { this.nullableDefault = nullableDefault; } @@ -25,7 +25,7 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi } @Override - public AttributeConfigElement readElement(List configNodes) throws DocumentedException { + public AttributeConfigElement readElement(final List configNodes) throws DocumentedException { if (configNodes.size() == 0){ return AttributeConfigElement.createNullValue(postprocessNullableDefault(nullableDefault)); } @@ -34,7 +34,7 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi abstract AttributeConfigElement readElementHook(List configNodes) throws DocumentedException; - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault; } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ArrayAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ArrayAttributeReadingStrategy.java index 5f169de9fb..f2a67cce45 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ArrayAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ArrayAttributeReadingStrategy.java @@ -18,13 +18,13 @@ public class ArrayAttributeReadingStrategy extends AbstractAttributeReadingStrat private final AttributeReadingStrategy innerStrategy; - public ArrayAttributeReadingStrategy(String nullableDefault, AttributeReadingStrategy innerStrategy) { + public ArrayAttributeReadingStrategy(final String nullableDefault, final AttributeReadingStrategy innerStrategy) { super(nullableDefault); this.innerStrategy = innerStrategy; } @Override - AttributeConfigElement readElementHook(List configNodes) throws DocumentedException { + AttributeConfigElement readElementHook(final List configNodes) throws DocumentedException { List innerList = Lists.newArrayList(); EditStrategyType innerEditStrategy= null; for (XmlElement configNode : configNodes) { diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AttributeConfigElement.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AttributeConfigElement.java index 8ca9616fcc..850d0bea33 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AttributeConfigElement.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AttributeConfigElement.java @@ -27,13 +27,13 @@ public class AttributeConfigElement { private Object resolvedDefaultValue; private String jmxName; - public AttributeConfigElement(Object defaultValue, Object value, final EditStrategyType editStrategyType) { + public AttributeConfigElement(final Object defaultValue, final Object value, final EditStrategyType editStrategyType) { this.defaultValue = defaultValue; this.value = value; this.editStrategy = Optional.fromNullable(editStrategyType); } - public void setJmxName(String jmxName) { + public void setJmxName(final String jmxName) { this.jmxName = jmxName; } @@ -41,8 +41,8 @@ public class AttributeConfigElement { return jmxName; } - public void resolveValue(AttributeResolvingStrategy> attributeResolvingStrategy, - String attrName) throws DocumentedException { + public void resolveValue(final AttributeResolvingStrategy> attributeResolvingStrategy, + final String attrName) throws DocumentedException { resolvedValue = attributeResolvingStrategy.parseAttribute(attrName, value); Optional resolvedDefault = attributeResolvingStrategy.parseAttribute(attrName, defaultValue); resolvedDefaultValue = resolvedDefault.isPresent() ? resolvedDefault.get() : null; @@ -52,11 +52,11 @@ public class AttributeConfigElement { return editStrategy; } - public static AttributeConfigElement create(Object nullableDefault, Object value) { + public static AttributeConfigElement create(final Object nullableDefault, final Object value) { return new AttributeConfigElement(nullableDefault, value, null); } - public static AttributeConfigElement createNullValue(Object nullableDefault) { + public static AttributeConfigElement createNullValue(final Object nullableDefault) { return new AttributeConfigElement(nullableDefault, null, null); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/CompositeAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/CompositeAttributeReadingStrategy.java index 6f4aefd9e1..461ac339e9 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/CompositeAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/CompositeAttributeReadingStrategy.java @@ -24,14 +24,14 @@ public class CompositeAttributeReadingStrategy extends AbstractAttributeReadingS private final Map innerStrategies; - public CompositeAttributeReadingStrategy(String nullableDefault, - Map innerStrategies) { + public CompositeAttributeReadingStrategy(final String nullableDefault, + final Map innerStrategies) { super(nullableDefault); this.innerStrategies = innerStrategies; } @Override - AttributeConfigElement readElementHook(List configNodes) throws DocumentedException { + AttributeConfigElement readElementHook(final List configNodes) throws DocumentedException { Preconditions.checkState(configNodes.size() == 1, "This element should be present only once %s", configNodes); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java index 725d73a7f7..12d68cefa6 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java @@ -19,12 +19,12 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading private static final Object PREFIX_SEPARATOR = ":"; - public ObjectNameAttributeReadingStrategy(String nullableDefault) { + public ObjectNameAttributeReadingStrategy(final String nullableDefault) { super(nullableDefault); } @Override - AttributeConfigElement readElementHook(List configNodes) throws DocumentedException { + AttributeConfigElement readElementHook(final List configNodes) throws DocumentedException { XmlElement firstChild = configNodes.get(0); Preconditions.checkState(configNodes.size() == 1, "This element should be present only once " + firstChild @@ -34,7 +34,7 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading return AttributeConfigElement.create(getNullableDefault(), resolve(firstChild)); } - private ObjectNameAttributeMappingStrategy.MappedDependency resolve(XmlElement firstChild) throws DocumentedException{ + private ObjectNameAttributeMappingStrategy.MappedDependency resolve(final XmlElement firstChild) throws DocumentedException{ XmlElement typeElement = firstChild.getOnlyChildElementWithSameNamespace(XmlMappingConstants.TYPE_KEY); Map.Entry prefixNamespace = typeElement.findNamespaceOfTextContent(); @@ -47,7 +47,7 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading dependencyName); } - public static String checkPrefixAndExtractServiceName(XmlElement typeElement, Map.Entry prefixNamespace) throws DocumentedException { + public static String checkPrefixAndExtractServiceName(final XmlElement typeElement, final Map.Entry prefixNamespace) throws DocumentedException { String serviceName = typeElement.getTextContent(); Preconditions.checkNotNull(prefixNamespace.getKey(), "Service %s value cannot be linked to namespace", XmlMappingConstants.TYPE_KEY); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java index a9c0723869..2fe373475f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java @@ -31,7 +31,7 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement> identityMap; - public Map prepareReading(Map yangToAttrConfig, Map> identityMap) { + public Map prepareReading(final Map yangToAttrConfig, final Map> identityMap) { Map strategies = Maps.newHashMap(); this.identityMap = identityMap; @@ -42,42 +42,42 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { + protected AttributeReadingStrategy caseJavaBinaryAttribute(final OpenType openType) { return new SimpleBinaryAttributeReadingStrategy(getLastAttribute().getNullableDefault()); } @Override - protected AttributeReadingStrategy caseJavaUnionAttribute(OpenType openType) { + protected AttributeReadingStrategy caseJavaUnionAttribute(final OpenType openType) { String mappingKey = JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION; return new SimpleUnionAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey); } @Override - public AttributeReadingStrategy caseJavaSimpleAttribute(SimpleType openType) { + public AttributeReadingStrategy caseJavaSimpleAttribute(final SimpleType openType) { return new SimpleAttributeReadingStrategy(getLastAttribute().getNullableDefault()); } @Override - public AttributeReadingStrategy caseJavaArrayAttribute(ArrayType openType) { + public AttributeReadingStrategy caseJavaArrayAttribute(final ArrayType openType) { SimpleAttributeReadingStrategy innerStrategy = new SimpleAttributeReadingStrategy(getLastAttribute().getNullableDefault()); return new ArrayAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategy); } @Override - public AttributeReadingStrategy caseJavaCompositeAttribute(CompositeType openType) { + public AttributeReadingStrategy caseJavaCompositeAttribute(final CompositeType openType) { Preconditions.checkState(openType.keySet().size() == 1, "Unexpected number of elements for open type %s, should be 1", openType); String mappingKey = openType.keySet().iterator().next(); return new SimpleCompositeAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey); } @Override - protected AttributeReadingStrategy caseJavaIdentityRefAttribute(OpenType openType) { + protected AttributeReadingStrategy caseJavaIdentityRefAttribute(final OpenType openType) { Preconditions.checkState(openType instanceof CompositeType); Set keys = ((CompositeType) openType).keySet(); Preconditions.checkState(keys.size() == 1, "Unexpected number of elements for open type %s, should be 1", openType); @@ -86,12 +86,12 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { + protected AttributeReadingStrategy caseDependencyAttribute(final SimpleType openType) { return new ObjectNameAttributeReadingStrategy(getLastAttribute().getNullableDefault()); } @Override - protected AttributeReadingStrategy caseTOAttribute(CompositeType openType) { + protected AttributeReadingStrategy caseTOAttribute(final CompositeType openType) { AttributeIfc lastAttribute = getLastAttribute(); Preconditions.checkState(lastAttribute instanceof TOAttribute); Map inner = ((TOAttribute)lastAttribute).getYangPropertiesToTypesMap(); @@ -108,7 +108,7 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { + protected AttributeReadingStrategy caseListAttribute(final ArrayType openType) { AttributeIfc lastAttribute = getLastAttribute(); Preconditions.checkState(lastAttribute instanceof ListAttribute); AttributeReadingStrategy innerStrategy = prepareReadingStrategy(key, ((ListAttribute) lastAttribute).getInnerAttribute()); @@ -116,7 +116,7 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { + protected AttributeReadingStrategy caseListDependeciesAttribute(final ArrayType openType) { AttributeIfc lastAttribute = getLastAttribute(); Preconditions.checkState(lastAttribute instanceof ListDependenciesAttribute); AttributeReadingStrategy innerStrategy = caseDependencyAttribute(SimpleType.OBJECTNAME); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java index 0fa0358cb1..db2d9c1d1e 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java @@ -14,12 +14,12 @@ import org.opendaylight.controller.config.util.xml.DocumentedException; import org.opendaylight.controller.config.util.xml.XmlElement; public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStrategy { - public SimpleAttributeReadingStrategy(String nullableDefault) { + public SimpleAttributeReadingStrategy(final String nullableDefault) { super(nullableDefault); } @Override - AttributeConfigElement readElementHook(List configNodes) throws DocumentedException { + AttributeConfigElement readElementHook(final List configNodes) throws DocumentedException { XmlElement xmlElement = configNodes.get(0); Preconditions.checkState(configNodes.size() == 1, "This element should be present only once " + xmlElement + " but was " + configNodes.size()); @@ -29,16 +29,16 @@ public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStra postprocessParsedValue(textContent)); } - protected String readElementContent(XmlElement xmlElement) throws DocumentedException { + protected String readElementContent(final XmlElement xmlElement) throws DocumentedException { return xmlElement.getTextContent(); } @Override - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault; } - protected Object postprocessParsedValue(String textContent) { + protected Object postprocessParsedValue(final String textContent) { return textContent; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleBinaryAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleBinaryAttributeReadingStrategy.java index 12b118e59b..5353049b4d 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleBinaryAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleBinaryAttributeReadingStrategy.java @@ -14,12 +14,12 @@ import java.util.List; public class SimpleBinaryAttributeReadingStrategy extends SimpleAttributeReadingStrategy { - public SimpleBinaryAttributeReadingStrategy(String nullableDefault) { + public SimpleBinaryAttributeReadingStrategy(final String nullableDefault) { super(nullableDefault); } @Override - protected Object postprocessParsedValue(String textContent) { + protected Object postprocessParsedValue(final String textContent) { BaseEncoding en = BaseEncoding.base64(); byte[] decode = en.decode(textContent); List parsed = Lists.newArrayListWithCapacity(decode.length); @@ -30,7 +30,7 @@ public class SimpleBinaryAttributeReadingStrategy extends SimpleAttributeReading } @Override - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault == null ? null : postprocessParsedValue(nullableDefault); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleCompositeAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleCompositeAttributeReadingStrategy.java index 211dba990d..764629bf7c 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleCompositeAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleCompositeAttributeReadingStrategy.java @@ -15,20 +15,20 @@ public class SimpleCompositeAttributeReadingStrategy extends SimpleAttributeRead private final String key; - public SimpleCompositeAttributeReadingStrategy(String nullableDefault, String key) { + public SimpleCompositeAttributeReadingStrategy(final String nullableDefault, final String key) { super(nullableDefault); this.key = key; } @Override - protected Object postprocessParsedValue(String textContent) { + protected Object postprocessParsedValue(final String textContent) { HashMap map = Maps.newHashMap(); map.put(key, textContent); return map; } @Override - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault == null ? null : postprocessParsedValue(nullableDefault); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java index 2bd4356ef4..35af46c5f3 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java @@ -25,14 +25,14 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe private final String key; private final Map> identityMap; - public SimpleIdentityRefAttributeReadingStrategy(String nullableDefault, String key, Map> identityMap) { + public SimpleIdentityRefAttributeReadingStrategy(final String nullableDefault, final String key, final Map> identityMap) { super(nullableDefault); this.key = key; this.identityMap = identityMap; } @Override - protected String readElementContent(XmlElement xmlElement) throws DocumentedException { + protected String readElementContent(final XmlElement xmlElement) throws DocumentedException { Map.Entry namespaceOfTextContent = xmlElement.findNamespaceOfTextContent(); String content = xmlElement.getTextContent(); @@ -65,14 +65,14 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe } @Override - protected Object postprocessParsedValue(String textContent) { + protected Object postprocessParsedValue(final String textContent) { HashMap map = Maps.newHashMap(); map.put(key, textContent); return map; } @Override - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault == null ? null : postprocessParsedValue(nullableDefault); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleUnionAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleUnionAttributeReadingStrategy.java index 7377da4f7d..d2466bbad9 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleUnionAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleUnionAttributeReadingStrategy.java @@ -17,13 +17,13 @@ public class SimpleUnionAttributeReadingStrategy extends SimpleAttributeReadingS private final String key; - public SimpleUnionAttributeReadingStrategy(String nullableDefault, String key) { + public SimpleUnionAttributeReadingStrategy(final String nullableDefault, final String key) { super(nullableDefault); this.key = key; } @Override - protected Object postprocessParsedValue(String textContent) { + protected Object postprocessParsedValue(final String textContent) { char[] charArray = textContent.toCharArray(); List chars = Lists.newArrayListWithCapacity(charArray.length); @@ -37,7 +37,7 @@ public class SimpleUnionAttributeReadingStrategy extends SimpleAttributeReadingS } @Override - protected Object postprocessNullableDefault(String nullableDefault) { + protected Object postprocessNullableDefault(final String nullableDefault) { return nullableDefault == null ? null : postprocessParsedValue(nullableDefault); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/AbstractAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/AbstractAttributeMappingStrategy.java index 46e098bcbd..7ff7cfade9 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/AbstractAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/AbstractAttributeMappingStrategy.java @@ -15,7 +15,7 @@ public abstract class AbstractAttributeMappingStrategy> private final O attrOpenType; - public AbstractAttributeMappingStrategy(O attributeIfc) { + public AbstractAttributeMappingStrategy(final O attributeIfc) { this.attrOpenType = attributeIfc; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ArrayAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ArrayAttributeMappingStrategy.java index 471072bba1..0c593ebf3d 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ArrayAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ArrayAttributeMappingStrategy.java @@ -20,14 +20,14 @@ public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrat private final AttributeMappingStrategy> innerElementStrategy; - public ArrayAttributeMappingStrategy(ArrayType arrayType, - AttributeMappingStrategy> innerElementStrategy) { + public ArrayAttributeMappingStrategy(final ArrayType arrayType, + final AttributeMappingStrategy> innerElementStrategy) { super(arrayType); this.innerElementStrategy = innerElementStrategy; } @Override - public Optional> mapAttribute(Object value) { + public Optional> mapAttribute(final Object value) { if (value == null){ return Optional.absent(); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/CompositeAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/CompositeAttributeMappingStrategy.java index 1bc78f3339..7c1357005b 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/CompositeAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/CompositeAttributeMappingStrategy.java @@ -24,16 +24,16 @@ public class CompositeAttributeMappingStrategy extends private final Map>> innerStrategies; private final Map jmxToJavaNameMapping; - public CompositeAttributeMappingStrategy(CompositeType compositeType, - Map>> innerStrategies, - Map jmxToJavaNameMapping) { + public CompositeAttributeMappingStrategy(final CompositeType compositeType, + final Map>> innerStrategies, + final Map jmxToJavaNameMapping) { super(compositeType); this.innerStrategies = innerStrategies; this.jmxToJavaNameMapping = jmxToJavaNameMapping; } @Override - public Optional> mapAttribute(Object value) { + public Optional> mapAttribute(final Object value) { if (value == null){ return Optional.absent(); } @@ -62,7 +62,7 @@ public class CompositeAttributeMappingStrategy extends return Optional.of(retVal); } - protected Optional mapInnerAttribute(CompositeDataSupport compositeData, String jmxName, String description) { + protected Optional mapInnerAttribute(final CompositeDataSupport compositeData, final String jmxName, final String description) { Object innerValue = compositeData.get(jmxName); AttributeMappingStrategy> attributeMappingStrategy = innerStrategies diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/EnumAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/EnumAttributeMappingStrategy.java index bafb33b88d..6ff56d0452 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/EnumAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/EnumAttributeMappingStrategy.java @@ -16,13 +16,13 @@ public class EnumAttributeMappingStrategy extends AbstractAttributeMappingStrate private final EnumResolver enumResolver; - public EnumAttributeMappingStrategy(CompositeType openType, final EnumResolver enumResolver) { + public EnumAttributeMappingStrategy(final CompositeType openType, final EnumResolver enumResolver) { super(openType); this.enumResolver = enumResolver; } @Override - public Optional mapAttribute(Object value) { + public Optional mapAttribute(final Object value) { if (value == null){ return Optional.absent(); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java index 65a3367a6b..9e2c69b9f3 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java @@ -29,7 +29,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement>> prepareMapping( - Map configDefinition, EnumResolver enumResolver) { + final Map configDefinition, final EnumResolver enumResolver) { this.enumResolver = Preconditions.checkNotNull(enumResolver); Map>> strategies = Maps.newHashMap(); @@ -40,7 +40,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> prepareStrategy(AttributeIfc attributeIfc) { + public AttributeMappingStrategy> prepareStrategy(final AttributeIfc attributeIfc) { if(attributeIfc instanceof DependencyAttribute) { namespaceOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString(); @@ -51,7 +51,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement createJmxToYangMapping(TOAttribute attributeIfc) { + private Map createJmxToYangMapping(final TOAttribute attributeIfc) { Map retVal = Maps.newHashMap(); for (Entry entry : attributeIfc.getJmxPropertiesToTypesMap().entrySet()) { retVal.put(entry.getKey(), (entry.getValue()).getAttributeYangName()); @@ -60,7 +60,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaSimpleAttribute(SimpleType openType) { + protected AttributeMappingStrategy> caseJavaSimpleAttribute(final SimpleType openType) { return new SimpleAttributeMappingStrategy(openType); } @@ -70,7 +70,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaArrayAttribute(ArrayType openType) { + protected AttributeMappingStrategy> caseJavaArrayAttribute(final ArrayType openType) { AttributeMappingStrategy> innerStrategy = new SimpleAttributeMappingStrategy( (SimpleType) openType.getElementOpenType()); @@ -78,7 +78,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaCompositeAttribute(CompositeType openType) { + protected AttributeMappingStrategy> caseJavaCompositeAttribute(final CompositeType openType) { Map>> innerStrategies = Maps.newHashMap(); Map attributeMapping = Maps.newHashMap(); @@ -93,7 +93,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaUnionAttribute(OpenType openType) { + protected AttributeMappingStrategy> caseJavaUnionAttribute(final OpenType openType) { Map>> innerStrategies = Maps.newHashMap(); Map attributeMapping = Maps.newHashMap(); @@ -112,12 +112,12 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseDependencyAttribute( - SimpleType openType) { + final SimpleType openType) { return new ObjectNameAttributeMappingStrategy(openType, namespaceOfDepAttr); } @Override - protected AttributeMappingStrategy> caseTOAttribute(CompositeType openType) { + protected AttributeMappingStrategy> caseTOAttribute(final CompositeType openType) { Map>> innerStrategies = Maps.newHashMap(); Preconditions.checkState(getLastAttribute() instanceof TOAttribute); @@ -132,14 +132,14 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseListAttribute(ArrayType openType) { + protected AttributeMappingStrategy> caseListAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListAttribute); return new ArrayAttributeMappingStrategy(openType, prepareStrategy(((ListAttribute) getLastAttribute()).getInnerAttribute())); } @Override - protected AttributeMappingStrategy> caseListDependeciesAttribute(ArrayType openType) { + protected AttributeMappingStrategy> caseListDependeciesAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute); return new ArrayAttributeMappingStrategy(openType, caseDependencyAttribute(SimpleType.OBJECTNAME)); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java index 73c8f47b58..3874c3a641 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java @@ -21,13 +21,13 @@ public class ObjectNameAttributeMappingStrategy extends private final String namespace; - public ObjectNameAttributeMappingStrategy(SimpleType openType, String namespace) { + public ObjectNameAttributeMappingStrategy(final SimpleType openType, final String namespace) { super(openType); this.namespace = namespace; } @Override - public Optional mapAttribute(Object value) { + public Optional mapAttribute(final Object value) { if (value == null){ return Optional.absent(); } @@ -50,7 +50,7 @@ public class ObjectNameAttributeMappingStrategy extends public static class MappedDependency { private final String namespace, serviceName, refName; - public MappedDependency(String namespace, String serviceName, String refName) { + public MappedDependency(final String namespace, final String serviceName, final String refName) { this.serviceName = serviceName; this.refName = refName; this.namespace = namespace; diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/SimpleAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/SimpleAttributeMappingStrategy.java index 5b9c2a2b2f..aacdd93b51 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/SimpleAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/SimpleAttributeMappingStrategy.java @@ -18,12 +18,12 @@ import org.opendaylight.controller.config.facade.xml.util.Util; public class SimpleAttributeMappingStrategy extends AbstractAttributeMappingStrategy> { - public SimpleAttributeMappingStrategy(SimpleType openType) { + public SimpleAttributeMappingStrategy(final SimpleType openType) { super(openType); } @Override - public Optional mapAttribute(Object value) { + public Optional mapAttribute(final Object value) { if (value == null){ return Optional.absent(); } @@ -55,7 +55,7 @@ public class SimpleAttributeMappingStrategy extends AbstractAttributeMappingStra static class DefaultWriterPlugin implements WriterPlugin { @Override - public String writeObject(Object value) { + public String writeObject(final Object value) { return value.toString(); } } @@ -63,7 +63,7 @@ public class SimpleAttributeMappingStrategy extends AbstractAttributeMappingStra static class DatePlugin implements WriterPlugin { @Override - public String writeObject(Object value) { + public String writeObject(final Object value) { Preconditions.checkArgument(value instanceof Date, "Attribute must be Date"); return Util.writeDate((Date) value); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/UnionCompositeAttributeMappingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/UnionCompositeAttributeMappingStrategy.java index 21c0e05389..d15777cb8c 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/UnionCompositeAttributeMappingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/UnionCompositeAttributeMappingStrategy.java @@ -19,12 +19,12 @@ public class UnionCompositeAttributeMappingStrategy extends CompositeAttributeMappingStrategy { - public UnionCompositeAttributeMappingStrategy(CompositeType compositeType, Map>> innerStrategies, Map jmxToJavaNameMapping) { + public UnionCompositeAttributeMappingStrategy(final CompositeType compositeType, final Map>> innerStrategies, final Map jmxToJavaNameMapping) { super(compositeType, innerStrategies, jmxToJavaNameMapping); } @Override - protected Optional mapInnerAttribute(CompositeDataSupport compositeData, String jmxName, String description) { + protected Optional mapInnerAttribute(final CompositeDataSupport compositeData, final String jmxName, final String description) { if(!description.equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION)){ return Optional.absent(); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/AbstractAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/AbstractAttributeResolvingStrategy.java index 56b11aa564..0443013a3f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/AbstractAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/AbstractAttributeResolvingStrategy.java @@ -13,7 +13,7 @@ import javax.management.openmbean.OpenType; abstract class AbstractAttributeResolvingStrategy> implements AttributeResolvingStrategy { private O openType; - public AbstractAttributeResolvingStrategy(O openType) { + public AbstractAttributeResolvingStrategy(final O openType) { this.openType = openType; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java index 73b9dd9cbc..5daf5a42a9 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java @@ -27,14 +27,14 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt private static final Logger LOG = LoggerFactory.getLogger(ArrayAttributeResolvingStrategy.class); - public ArrayAttributeResolvingStrategy(AttributeResolvingStrategy> innerTypeResolved, - ArrayType openType) { + public ArrayAttributeResolvingStrategy(final AttributeResolvingStrategy> innerTypeResolved, + final ArrayType openType) { super(openType); this.innerTypeResolvingStrategy = innerTypeResolved; } @Override - public Optional parseAttribute(String attrName, Object value) throws DocumentedException { + public Optional parseAttribute(final String attrName, final Object value) throws DocumentedException { if (value == null) { return Optional.absent(); } @@ -49,7 +49,7 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt } else { try { innerTypeClass = Class.forName(getOpenType().getElementOpenType().getClassName()); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { throw new IllegalStateException("Unable to locate class for " + getOpenType().getElementOpenType().getClassName(), e); } @@ -80,7 +80,7 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt final ArrayType openType = new ArrayType<>(getOpenType().getDimension(), innerTypeResolvingStrategy.getOpenType()); setOpenType(openType); - } catch (OpenDataException e) { + } catch (final OpenDataException e) { throw new IllegalStateException("An error occurred during restoration of array type " + this + " for attribute " + attrName + " from value " + value, e); } @@ -92,7 +92,7 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt return Optional.of(parsedArray); } - private static String toStringArray(Object array) { + private static String toStringArray(final Object array) { StringBuilder build = new StringBuilder(array.toString()); build.append(" ["); for (int i = 0; i < Array.getLength(array); i++) { @@ -103,10 +103,10 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt return build.toString(); } - private static Class getPrimitiveType(Class innerTypeClass) { + private static Class getPrimitiveType(final Class innerTypeClass) { try { return (Class) innerTypeClass.getField("TYPE").get(null); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Unable to determine primitive type to " + innerTypeClass); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java index 7988a4c7f5..920b5dcd88 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java @@ -29,8 +29,8 @@ class CompositeAttributeResolvingStrategy extends private static final Logger LOG = LoggerFactory.getLogger(CompositeAttributeResolvingStrategy.class); - CompositeAttributeResolvingStrategy(Map>> innerTypes, - CompositeType openType, Map yangToJavaAttrMapping) { + CompositeAttributeResolvingStrategy(final Map>> innerTypes, + final CompositeType openType, final Map yangToJavaAttrMapping) { super(openType); this.innerTypes = innerTypes; this.yangToJavaAttrMapping = yangToJavaAttrMapping; @@ -42,7 +42,7 @@ class CompositeAttributeResolvingStrategy extends } @Override - public Optional parseAttribute(String attrName, Object value) throws DocumentedException { + public Optional parseAttribute(final String attrName, final Object value) throws DocumentedException { if (value == null) { return Optional.absent(); @@ -96,7 +96,7 @@ class CompositeAttributeResolvingStrategy extends setOpenType(new CompositeType(getOpenType().getTypeName(), getOpenType().getDescription(), names, descriptions, itemTypes)); LOG.debug("Attribute {}. Open type reconstructed to {}", attrName, getOpenType(), getOpenType()); parsedValue = new CompositeDataSupport(getOpenType(), items); - } catch (OpenDataException e) { + } catch (final OpenDataException e) { throw new IllegalStateException("An error occurred during restoration of composite type " + this + " for attribute " + attrName + " from value " + value, e); } @@ -107,7 +107,7 @@ class CompositeAttributeResolvingStrategy extends } - protected Map preprocessValueMap(Map valueMap) { + protected Map preprocessValueMap(final Map valueMap) { return valueMap; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/EnumAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/EnumAttributeResolvingStrategy.java index 15f8d77b9a..7a66e421cf 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/EnumAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/EnumAttributeResolvingStrategy.java @@ -23,7 +23,7 @@ final class EnumAttributeResolvingStrategy extends AbstractAttributeResolvingStr private static final Logger LOG = LoggerFactory.getLogger(EnumAttributeResolvingStrategy.class); private final EnumResolver enumResolver; - EnumAttributeResolvingStrategy(CompositeType simpleType, final EnumResolver enumResolver) { + EnumAttributeResolvingStrategy(final CompositeType simpleType, final EnumResolver enumResolver) { super(simpleType); this.enumResolver = enumResolver; } @@ -34,7 +34,7 @@ final class EnumAttributeResolvingStrategy extends AbstractAttributeResolvingStr } @Override - public Optional parseAttribute(String attrName, Object value) throws DocumentedException { + public Optional parseAttribute(final String attrName, final Object value) throws DocumentedException { if (value == null) { return Optional.absent(); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java index 71dee55d56..086c18198f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java @@ -22,13 +22,13 @@ public class ObjectNameAttributeResolvingStrategy extends AbstractAttributeResol private final ServiceRegistryWrapper serviceTracker; private static final Logger LOG = LoggerFactory.getLogger(ObjectNameAttributeResolvingStrategy.class); - ObjectNameAttributeResolvingStrategy(ServiceRegistryWrapper serviceTracker) { + ObjectNameAttributeResolvingStrategy(final ServiceRegistryWrapper serviceTracker) { super(SimpleType.OBJECTNAME); this.serviceTracker = serviceTracker; } @Override - public Optional parseAttribute(String attrName, Object value) { + public Optional parseAttribute(final String attrName, final Object value) { if (value == null) { return Optional.absent(); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectResolver.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectResolver.java index eccd9caeb0..c1eeef5cbf 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectResolver.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectResolver.java @@ -29,12 +29,12 @@ public class ObjectResolver extends AttributeIfcSwitchStatement>> prepareResolving( - Map configDefinition, final EnumResolver enumResolver) { + final Map configDefinition, final EnumResolver enumResolver) { this.enumResolver = enumResolver; Map>> strategies = Maps.newHashMap(); @@ -47,11 +47,11 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> prepareStrategy(AttributeIfc attributeIfc) { + private AttributeResolvingStrategy> prepareStrategy(final AttributeIfc attributeIfc) { return switchAttribute(attributeIfc); } - private Map createYangToJmxMapping(TOAttribute attributeIfc) { + private Map createYangToJmxMapping(final TOAttribute attributeIfc) { Map retVal = Maps.newHashMap(); for (Entry entry : attributeIfc.getYangPropertiesToTypesMap().entrySet()) { retVal.put(entry.getKey(), (entry.getValue()).getLowerCaseCammelCase()); @@ -65,12 +65,12 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> caseJavaSimpleAttribute(SimpleType openType) { + protected AttributeResolvingStrategy> caseJavaSimpleAttribute(final SimpleType openType) { return new SimpleAttributeResolvingStrategy(openType); } @Override - protected AttributeResolvingStrategy> caseJavaArrayAttribute(ArrayType openType) { + protected AttributeResolvingStrategy> caseJavaArrayAttribute(final ArrayType openType) { SimpleType innerType = (SimpleType) openType.getElementOpenType(); AttributeResolvingStrategy> strat = new SimpleAttributeResolvingStrategy(innerType); @@ -78,7 +78,7 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> caseJavaCompositeAttribute(CompositeType openType) { + protected AttributeResolvingStrategy> caseJavaCompositeAttribute(final CompositeType openType) { Map>> innerMap = Maps.newHashMap(); Map yangToJmxMapping = Maps.newHashMap(); @@ -86,7 +86,7 @@ public class ObjectResolver extends AttributeIfcSwitchStatement>> innerMap, Map yangToJmxMapping) { + private void fillMappingForComposite(final CompositeType openType, final Map>> innerMap, final Map yangToJmxMapping) { for (String innerAttributeKey : openType.keySet()) { innerMap.put(innerAttributeKey, caseJavaAttribute(openType.getType(innerAttributeKey))); yangToJmxMapping.put(innerAttributeKey, innerAttributeKey); @@ -94,7 +94,7 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> caseJavaUnionAttribute(OpenType openType) { + protected AttributeResolvingStrategy> caseJavaUnionAttribute(final OpenType openType) { Preconditions.checkState(openType instanceof CompositeType, "Unexpected open type, expected %s but was %s"); CompositeType compositeType = (CompositeType) openType; @@ -108,12 +108,12 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> caseDependencyAttribute( - SimpleType openType) { + final SimpleType openType) { return new ObjectNameAttributeResolvingStrategy(serviceTracker); } @Override - protected AttributeResolvingStrategy> caseTOAttribute(CompositeType openType) { + protected AttributeResolvingStrategy> caseTOAttribute(final CompositeType openType) { Preconditions.checkState(getLastAttribute() instanceof TOAttribute); TOAttribute toAttribute = (TOAttribute) getLastAttribute(); @@ -129,14 +129,14 @@ public class ObjectResolver extends AttributeIfcSwitchStatement> caseListAttribute(ArrayType openType) { + protected AttributeResolvingStrategy> caseListAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListAttribute); AttributeIfc innerAttribute = ((ListAttribute) getLastAttribute()).getInnerAttribute(); return new ArrayAttributeResolvingStrategy(prepareStrategy(innerAttribute), openType); } @Override - protected AttributeResolvingStrategy> caseListDependeciesAttribute(ArrayType openType) { + protected AttributeResolvingStrategy> caseListDependeciesAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute); return new ArrayAttributeResolvingStrategy(caseDependencyAttribute(SimpleType.OBJECTNAME), openType); } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java index 5412882e33..f639ed9cbe 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java @@ -27,7 +27,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS private static final Logger LOG = LoggerFactory.getLogger(SimpleAttributeResolvingStrategy.class); - SimpleAttributeResolvingStrategy(SimpleType simpleType) { + SimpleAttributeResolvingStrategy(final SimpleType simpleType) { super(simpleType); } @@ -37,7 +37,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS } @Override - public Optional parseAttribute(String attrName, Object value) throws DocumentedException { + public Optional parseAttribute(final String attrName, final Object value) throws DocumentedException { if (value == null) { return Optional.absent(); } @@ -45,7 +45,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS Class cls; try { cls = Class.forName(getOpenType().getClassName()); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { throw new RuntimeException("Unable to locate class for " + getOpenType().getClassName(), e); } @@ -78,10 +78,10 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class DefaultResolver implements Resolver { @Override - public Object resolveObject(Class type, String attrName, String value) throws DocumentedException { + public Object resolveObject(final Class type, final String attrName, final String value) throws DocumentedException { try { return parseObject(type, value); - } catch (Exception e) { + } catch (final Exception e) { throw new DocumentedException("Unable to resolve attribute " + attrName + " from " + value, DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED, @@ -89,7 +89,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS } } - protected Object parseObject(Class type, String value) throws DocumentedException { + protected Object parseObject(final Class type, final String value) throws DocumentedException { Method method = null; try { method = type.getMethod("valueOf", String.class); @@ -107,7 +107,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class StringResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) { + protected Object parseObject(final Class type, final String value) { return value; } } @@ -115,7 +115,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class BigIntegerResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) { + protected Object parseObject(final Class type, final String value) { return new BigInteger(value); } } @@ -123,7 +123,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class BigDecimalResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) { + protected Object parseObject(final Class type, final String value) { return new BigDecimal(value); } } @@ -131,17 +131,17 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class CharResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) { + protected Object parseObject(final Class type, final String value) { return value.charAt(0); } } static class DateResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) throws DocumentedException { + protected Object parseObject(final Class type, final String value) throws DocumentedException { try { return Util.readDate(value); - } catch (ParseException e) { + } catch (final ParseException e) { LOG.trace("Unable parse value {} due to ",value, e); throw new DocumentedException("Unable to parse value "+value+" as date.", DocumentedException.ErrorType.APPLICATION, diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/UnionCompositeAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/UnionCompositeAttributeResolvingStrategy.java index 05dc488ffa..c47087f5b0 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/UnionCompositeAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/UnionCompositeAttributeResolvingStrategy.java @@ -17,12 +17,12 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribu final class UnionCompositeAttributeResolvingStrategy extends CompositeAttributeResolvingStrategy { - UnionCompositeAttributeResolvingStrategy(Map>> innerTypes, - CompositeType openType, Map yangToJavaAttrMapping) { + UnionCompositeAttributeResolvingStrategy(final Map>> innerTypes, + final CompositeType openType, final Map yangToJavaAttrMapping) { super(innerTypes, openType, yangToJavaAttrMapping); } - protected Map preprocessValueMap(Map valueMap) { + protected Map preprocessValueMap(final Map valueMap) { CompositeType openType = getOpenType(); Preconditions.checkArgument( diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ArrayAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ArrayAttributeWritingStrategy.java index 2401371823..311ab1d512 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ArrayAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ArrayAttributeWritingStrategy.java @@ -16,12 +16,12 @@ public class ArrayAttributeWritingStrategy implements AttributeWritingStrategy { private final AttributeWritingStrategy innnerStrategy; - public ArrayAttributeWritingStrategy(AttributeWritingStrategy innerStrategy) { + public ArrayAttributeWritingStrategy(final AttributeWritingStrategy innerStrategy) { this.innnerStrategy = innerStrategy; } @Override - public void writeElement(Element parentElement, String namespace, Object value) { + public void writeElement(final Element parentElement, final String namespace, final Object value) { Util.checkType(value, List.class); for (Object innerObject : ((List) value)) { diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/CompositeAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/CompositeAttributeWritingStrategy.java index ee4b009fff..58579f72c7 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/CompositeAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/CompositeAttributeWritingStrategy.java @@ -22,15 +22,15 @@ public class CompositeAttributeWritingStrategy implements AttributeWritingStrate private final Document document; private final Map innerStrats; - public CompositeAttributeWritingStrategy(Document document, String key, - Map innerStrats) { + public CompositeAttributeWritingStrategy(final Document document, final String key, + final Map innerStrats) { this.document = document; this.key = key; this.innerStrats = innerStrats; } @Override - public void writeElement(Element parentElement, String namespace, Object value) { + public void writeElement(final Element parentElement, final String namespace, final Object value) { Util.checkType(value, Map.class); Element innerNode = XmlUtil.createElement(document, key, Optional.of(namespace)); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectNameAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectNameAttributeWritingStrategy.java index 95bb96708f..0dc8731d4c 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectNameAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectNameAttributeWritingStrategy.java @@ -25,13 +25,13 @@ public class ObjectNameAttributeWritingStrategy implements AttributeWritingStrat * @param document * @param key */ - public ObjectNameAttributeWritingStrategy(Document document, String key) { + public ObjectNameAttributeWritingStrategy(final Document document, final String key) { this.document = document; this.key = key; } @Override - public void writeElement(Element parentElement, String namespace, Object value) { + public void writeElement(final Element parentElement, final String namespace, final Object value) { Util.checkType(value, ObjectNameAttributeMappingStrategy.MappedDependency.class); Element innerNode = XmlUtil.createElement(document, key, Optional.of(namespace)); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectXmlWriter.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectXmlWriter.java index 3eb6fcebf1..d72d65baa8 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectXmlWriter.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectXmlWriter.java @@ -28,8 +28,8 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement prepareWriting(Map yangToAttrConfig, - Document document) { + public Map prepareWriting(final Map yangToAttrConfig, + final Document document) { Map preparedWriting = Maps.newHashMap(); @@ -43,7 +43,7 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement openType) { + protected AttributeWritingStrategy caseJavaBinaryAttribute(final OpenType openType) { return new SimpleBinaryAttributeWritingStrategy(document, key); } @@ -62,38 +62,38 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement openType) { + protected AttributeWritingStrategy caseJavaSimpleAttribute(final SimpleType openType) { return new SimpleAttributeWritingStrategy(document, key); } @Override - protected AttributeWritingStrategy caseJavaArrayAttribute(ArrayType openType) { + protected AttributeWritingStrategy caseJavaArrayAttribute(final ArrayType openType) { AttributeWritingStrategy innerStrategy = new SimpleAttributeWritingStrategy(document, key); return new ArrayAttributeWritingStrategy(innerStrategy); } @Override - protected AttributeWritingStrategy caseJavaIdentityRefAttribute(OpenType openType) { + protected AttributeWritingStrategy caseJavaIdentityRefAttribute(final OpenType openType) { return new SimpleIdentityRefAttributeWritingStrategy(document, key); } @Override - protected AttributeWritingStrategy caseJavaCompositeAttribute(CompositeType openType) { + protected AttributeWritingStrategy caseJavaCompositeAttribute(final CompositeType openType) { return new SimpleCompositeAttributeWritingStrategy(document, key); } @Override - protected AttributeWritingStrategy caseJavaUnionAttribute(OpenType openType) { + protected AttributeWritingStrategy caseJavaUnionAttribute(final OpenType openType) { return new SimpleUnionAttributeWritingStrategy(document, key); } @Override - protected AttributeWritingStrategy caseDependencyAttribute(SimpleType openType) { + protected AttributeWritingStrategy caseDependencyAttribute(final SimpleType openType) { return new ObjectNameAttributeWritingStrategy(document, key); } @Override - protected AttributeWritingStrategy caseTOAttribute(CompositeType openType) { + protected AttributeWritingStrategy caseTOAttribute(final CompositeType openType) { Preconditions.checkState(getLastAttribute() instanceof TOAttribute); Map innerStrats = Maps.newHashMap(); @@ -109,7 +109,7 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement openType) { + protected AttributeWritingStrategy caseListAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListAttribute); AttributeIfc innerAttribute = ((ListAttribute) getLastAttribute()).getInnerAttribute(); @@ -118,7 +118,7 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement openType) { + protected AttributeWritingStrategy caseListDependeciesAttribute(final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute); AttributeWritingStrategy innerStrategy = caseDependencyAttribute(SimpleType.OBJECTNAME); return new ArrayAttributeWritingStrategy(innerStrategy); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/RuntimeBeanEntryWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/RuntimeBeanEntryWritingStrategy.java index f85117eaa2..f0a1121958 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/RuntimeBeanEntryWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/RuntimeBeanEntryWritingStrategy.java @@ -18,13 +18,13 @@ import org.w3c.dom.Element; public class RuntimeBeanEntryWritingStrategy extends CompositeAttributeWritingStrategy { - public RuntimeBeanEntryWritingStrategy(Document document, String key, - Map innerStrats) { + public RuntimeBeanEntryWritingStrategy(final Document document, final String key, + final Map innerStrats) { super(document, key, innerStrats); } @Override - public void writeElement(Element parentElement, String namespace, Object value) { + public void writeElement(final Element parentElement, final String namespace, final Object value) { Util.checkType(value, Map.class); Element innerNode = XmlUtil.createElement(getDocument(), getKey(), Optional.absent()); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java index 5e2f0c7405..c8e218aae8 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java @@ -23,26 +23,26 @@ public class SimpleAttributeWritingStrategy implements AttributeWritingStrategy * @param document * @param key */ - public SimpleAttributeWritingStrategy(Document document, String key) { + public SimpleAttributeWritingStrategy(final Document document, final String key) { this.document = document; this.key = key; } @Override - public void writeElement(Element parentElement, String namespace, Object value) { + public void writeElement(final Element parentElement, final String namespace, Object value) { value = preprocess(value); Util.checkType(value, String.class); Element innerNode = createElement(document, key, (String) value, Optional.of(namespace)); parentElement.appendChild(innerNode); } - protected Element createElement(Document document, String key, String value, Optional namespace) { + protected Element createElement(final Document document, final String key, final String value, final Optional namespace) { Element typeElement = XmlUtil.createElement(document, key, namespace); typeElement.appendChild(document.createTextNode(value)); return typeElement; } - protected Object preprocess(Object value) { + protected Object preprocess(final Object value) { return value; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java index d6db3c3211..f56ee73703 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java @@ -20,12 +20,12 @@ public class SimpleBinaryAttributeWritingStrategy extends SimpleAttributeWriting * @param document * @param key */ - public SimpleBinaryAttributeWritingStrategy(Document document, String key) { + public SimpleBinaryAttributeWritingStrategy(final Document document, final String key) { super(document, key); } @Override - protected Object preprocess(Object value) { + protected Object preprocess(final Object value) { Util.checkType(value, List.class); BaseEncoding en = BaseEncoding.base64(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleCompositeAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleCompositeAttributeWritingStrategy.java index 5bd34e588c..b67371a927 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleCompositeAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleCompositeAttributeWritingStrategy.java @@ -19,11 +19,11 @@ public class SimpleCompositeAttributeWritingStrategy extends SimpleAttributeWrit * @param document * @param key */ - public SimpleCompositeAttributeWritingStrategy(Document document, String key) { + public SimpleCompositeAttributeWritingStrategy(final Document document, final String key) { super(document, key); } - protected Object preprocess(Object value) { + protected Object preprocess(final Object value) { Util.checkType(value, Map.class); Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value); return ((Map)value).values().iterator().next(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java index 44b1f3eb21..aba1173921 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java @@ -25,11 +25,11 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr * @param document * @param key */ - public SimpleIdentityRefAttributeWritingStrategy(Document document, String key) { + public SimpleIdentityRefAttributeWritingStrategy(final Document document, final String key) { super(document, key); } - protected Object preprocess(Object value) { + protected Object preprocess(final Object value) { Util.checkType(value, Map.class); Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value); Object stringValue = ((Map) value).values().iterator().next(); @@ -39,7 +39,7 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr } @Override - protected Element createElement(Document doc, String key, String value, Optional namespace) { + protected Element createElement(final Document doc, final String key, final String value, final Optional namespace) { QName qName = QName.create(value); String identityValue = qName.getLocalName(); String identityNamespace = qName.getNamespace().toString(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java index 969ef002af..d3b0c00114 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java @@ -20,11 +20,11 @@ public class SimpleUnionAttributeWritingStrategy extends SimpleAttributeWritingS * @param document * @param key */ - public SimpleUnionAttributeWritingStrategy(Document document, String key) { + public SimpleUnionAttributeWritingStrategy(final Document document, final String key) { super(document, key); } - protected Object preprocess(Object value) { + protected Object preprocess(final Object value) { Util.checkType(value, Map.class); Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value); Object listOfStrings = ((Map) value).values().iterator().next(); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java index 10602ce7e5..21b74da6cd 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java @@ -44,18 +44,18 @@ public class Config { private final EnumResolver enumResolver; - public Config(Map> moduleConfigs, final EnumResolver enumResolver) { + public Config(final Map> moduleConfigs, final EnumResolver enumResolver) { this(moduleConfigs, Collections.>emptyMap(), enumResolver); } - public Config(Map> moduleConfigs, Map> identityMap, final EnumResolver enumResolver) { + public Config(final Map> moduleConfigs, final Map> identityMap, final EnumResolver enumResolver) { this.moduleConfigs = moduleConfigs; this.identityMap = identityMap; this.enumResolver = enumResolver; } - public static Map>> getMappedInstances(Set instancesToMap, - Map> configs) { + public static Map>> getMappedInstances(final Set instancesToMap, + final Map> configs) { Multimap moduleToInstances = mapInstancesToModules(instancesToMap); Map>> retVal = Maps.newLinkedHashMap(); @@ -85,7 +85,7 @@ public class Config { return retVal; } - private static Multimap mapInstancesToModules(Set instancesToMap) { + private static Multimap mapInstancesToModules(final Set instancesToMap) { Multimap retVal = HashMultimap.create(); for (ObjectName objectName : instancesToMap) { @@ -95,8 +95,8 @@ public class Config { return retVal; } - public Element toXml(Set instancesToMap, Optional maybeNamespace, Document document, - Element dataElement, ServiceRegistryWrapper serviceTracker) { + public Element toXml(final Set instancesToMap, final Optional maybeNamespace, final Document document, + final Element dataElement, final ServiceRegistryWrapper serviceTracker) { Map>> moduleToInstances = getMappedInstances(instancesToMap, moduleConfigs); @@ -129,8 +129,8 @@ public class Config { return dataElement; } - public Element moduleToXml(String moduleNamespace, String factoryName, String instanceName, - ObjectName instanceON, Document document) { + public Element moduleToXml(final String moduleNamespace, final String factoryName, final String instanceName, + final ObjectName instanceON, final Document document) { ModuleConfig moduleConfig = getModuleMapping(moduleNamespace, instanceName, factoryName); return moduleConfig.toXml(instanceON, document, moduleNamespace, enumResolver); } @@ -139,7 +139,7 @@ public class Config { // TODO refactor, replace Map->Multimap with e.g. ConfigElementResolved // class - public Map> fromXmlModulesResolved(XmlElement xml, EditStrategyType defaultEditStrategyType, ServiceRegistryWrapper serviceTracker) throws DocumentedException { + public Map> fromXmlModulesResolved(final XmlElement xml, final EditStrategyType defaultEditStrategyType, final ServiceRegistryWrapper serviceTracker) throws DocumentedException { Optional modulesElement = getModulesElement(xml); List moduleElements = getModulesElementList(modulesElement); @@ -148,7 +148,7 @@ public class Config { for (XmlElement moduleElement : moduleElements) { ResolvingStrategy resolvingStrategy = new ResolvingStrategy() { @Override - public ModuleElementResolved resolveElement(ModuleConfig moduleMapping, XmlElement moduleElement, ServiceRegistryWrapper serviceTracker, String instanceName, String moduleNamespace, EditStrategyType defaultStrategy) throws DocumentedException { + public ModuleElementResolved resolveElement(final ModuleConfig moduleMapping, final XmlElement moduleElement, final ServiceRegistryWrapper serviceTracker, final String instanceName, final String moduleNamespace, final EditStrategyType defaultStrategy) throws DocumentedException { return moduleMapping.fromXml(moduleElement, serviceTracker, instanceName, moduleNamespace, defaultStrategy, identityMap, enumResolver); } @@ -162,8 +162,8 @@ public class Config { /** * return a map containing namespace -> moduleName -> instanceName map. Attribute parsing is omitted. */ - public Map> fromXmlModulesMap(XmlElement xml, - EditStrategyType defaultEditStrategyType, ServiceRegistryWrapper serviceTracker) throws DocumentedException { + public Map> fromXmlModulesMap(final XmlElement xml, + final EditStrategyType defaultEditStrategyType, final ServiceRegistryWrapper serviceTracker) throws DocumentedException { Optional modulesElement = getModulesElement(xml); List moduleElements = getModulesElementList(modulesElement); @@ -172,9 +172,9 @@ public class Config { for (XmlElement moduleElement : moduleElements) { ResolvingStrategy resolvingStrategy = new ResolvingStrategy() { @Override - public ModuleElementDefinition resolveElement(ModuleConfig moduleMapping, XmlElement moduleElement, - ServiceRegistryWrapper serviceTracker, String instanceName, String moduleNamespace, - EditStrategyType defaultStrategy) { + public ModuleElementDefinition resolveElement(final ModuleConfig moduleMapping, final XmlElement moduleElement, + final ServiceRegistryWrapper serviceTracker, final String instanceName, final String moduleNamespace, + final EditStrategyType defaultStrategy) { // TODO: add check for conflicts between global and local // edit strategy String perInstanceEditStrategy = moduleElement.getAttribute(XmlMappingConstants.OPERATION_ATTR_KEY, @@ -188,12 +188,12 @@ public class Config { return retVal; } - private static Optional getModulesElement(XmlElement xml) { + private static Optional getModulesElement(final XmlElement xml) { return xml.getOnlyChildElementOptionally(XmlMappingConstants.MODULES_KEY, XmlMappingConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG); } - private List getModulesElementList(Optional modulesElement) throws DocumentedException { + private List getModulesElementList(final Optional modulesElement) throws DocumentedException { List moduleElements; if (modulesElement.isPresent()) { @@ -205,8 +205,8 @@ public class Config { return moduleElements; } - private void resolveModule(Map> retVal, ServiceRegistryWrapper serviceTracker, - XmlElement moduleElement, EditStrategyType defaultStrategy, ResolvingStrategy resolvingStrategy) throws DocumentedException { + private void resolveModule(final Map> retVal, final ServiceRegistryWrapper serviceTracker, + final XmlElement moduleElement, final EditStrategyType defaultStrategy, final ResolvingStrategy resolvingStrategy) throws DocumentedException { XmlElement typeElement = null; typeElement = moduleElement.getOnlyChildElementWithSameNamespace(XmlMappingConstants.TYPE_KEY); Entry prefixToNamespace = typeElement.findNamespaceOfTextContent(); @@ -232,7 +232,7 @@ public class Config { innerMap.put(factoryName, resolvedElement); } - public Services fromXmlServices(XmlElement xml) throws DocumentedException { + public Services fromXmlServices(final XmlElement xml) throws DocumentedException { Optional servicesElement = getServicesElement(xml); Services services; @@ -245,12 +245,12 @@ public class Config { return services; } - private static Optional getServicesElement(XmlElement xml) { + private static Optional getServicesElement(final XmlElement xml) { return xml.getOnlyChildElementOptionally(XmlMappingConstants.SERVICES_KEY, XmlMappingConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG); } - public static void checkUnrecognisedChildren(XmlElement parent) throws DocumentedException { + public static void checkUnrecognisedChildren(final XmlElement parent) throws DocumentedException { Optional servicesOpt = getServicesElement(parent); Optional modulesOpt = getModulesElement(parent); @@ -265,7 +265,7 @@ public class Config { parent.checkUnrecognisedElements(recognised); } - private String getFactoryName(String factoryNameWithPrefix, String prefixOrEmptyString) { + private String getFactoryName(final String factoryNameWithPrefix, final String prefixOrEmptyString) { checkState( factoryNameWithPrefix.startsWith(prefixOrEmptyString), String.format("Internal error: text " + "content '%s' of type node does not start with prefix '%s'", @@ -280,7 +280,7 @@ public class Config { return factoryNameWithPrefix.substring(factoryNameAfterPrefixIndex); } - private ModuleConfig getModuleMapping(String moduleNamespace, String instanceName, String factoryName) { + private ModuleConfig getModuleMapping(final String moduleNamespace, final String instanceName, final String factoryName) { Map mappingsFromNamespace = moduleConfigs.get(moduleNamespace); Preconditions.checkNotNull(mappingsFromNamespace, 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()) { diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfigElementResolved.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfigElementResolved.java index a17c96c48a..76cf9dbf2a 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfigElementResolved.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfigElementResolved.java @@ -24,20 +24,20 @@ public class InstanceConfigElementResolved { private final EditStrategyType editStrategy; private final Map configuration; - public InstanceConfigElementResolved(String currentStrategy, Map configuration, - EditStrategyType defaultStrategy) + public InstanceConfigElementResolved(final String currentStrategy, final Map configuration, + final EditStrategyType defaultStrategy) throws DocumentedException { this.editStrategy = parseStrategy(currentStrategy, defaultStrategy); this.configuration = configuration; } - public InstanceConfigElementResolved(Map configuration, EditStrategyType defaultStrategy) { + public InstanceConfigElementResolved(final Map configuration, final EditStrategyType defaultStrategy) { editStrategy = defaultStrategy; this.configuration = configuration; } - static EditStrategyType parseStrategy(String currentStrategy, EditStrategyType defaultStrategy) throws OperationNotPermittedException { + static EditStrategyType parseStrategy(final String currentStrategy, final EditStrategyType defaultStrategy) throws OperationNotPermittedException { EditStrategyType parsedStrategy = EditStrategyType.valueOf(currentStrategy); EditStrategyType.compareParsedStrategyToDefaultEnforcing(parsedStrategy,defaultStrategy); return parsedStrategy; diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleConfig.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleConfig.java index 1b0aaa2668..90108ce72d 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleConfig.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleConfig.java @@ -28,12 +28,12 @@ public class ModuleConfig { private final String moduleName; private final InstanceConfig instanceConfig; - public ModuleConfig(String moduleName, InstanceConfig mbeanMapping) { + public ModuleConfig(final String moduleName, final InstanceConfig mbeanMapping) { this.moduleName = moduleName; this.instanceConfig = mbeanMapping; } - public Element toXml(ObjectName instanceON, Document document, String namespace, final EnumResolver enumResolver) { + public Element toXml(final ObjectName instanceON, final Document document, final String namespace, final EnumResolver enumResolver) { final Optional configNs = Optional.of(XmlMappingConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG); Element root = XmlUtil.createElement(document, XmlMappingConstants.MODULE_KEY, configNs); @@ -55,8 +55,8 @@ public class ModuleConfig { return root; } - public ModuleElementResolved fromXml(XmlElement moduleElement, ServiceRegistryWrapper depTracker, String instanceName, - String moduleNamespace, EditStrategyType defaultStrategy, Map> identityMap, final EnumResolver enumResolver) throws DocumentedException { + public ModuleElementResolved fromXml(final XmlElement moduleElement, final ServiceRegistryWrapper depTracker, final String instanceName, + final String moduleNamespace, final EditStrategyType defaultStrategy, final Map> identityMap, final EnumResolver enumResolver) throws DocumentedException { InstanceConfigElementResolved ice = instanceConfig.fromXml(moduleElement, depTracker, moduleNamespace, defaultStrategy, identityMap, enumResolver); return new ModuleElementResolved(instanceName, ice); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementDefinition.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementDefinition.java index 6dae445ad5..15f2b380d3 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementDefinition.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementDefinition.java @@ -25,7 +25,7 @@ public class ModuleElementDefinition { private final EditStrategyType editStrategy; private static final Logger LOG = LoggerFactory.getLogger(ModuleElementDefinition.class); - public ModuleElementDefinition(String instanceName, String currentStrategy, EditStrategyType defaultStrategy) { + public ModuleElementDefinition(final String instanceName, final String currentStrategy, final EditStrategyType defaultStrategy) { this.instanceName = instanceName; if (currentStrategy == null || currentStrategy.isEmpty()) { this.editStrategy = defaultStrategy; @@ -33,7 +33,7 @@ public class ModuleElementDefinition { EditStrategyType _edStrategy = null; try { _edStrategy = InstanceConfigElementResolved.parseStrategy(currentStrategy, defaultStrategy); - } catch (OperationNotPermittedException e) { + } catch (final OperationNotPermittedException e) { _edStrategy = defaultStrategy; LOG.warn("Operation not permitted on current strategy {} while default strategy is {}. Element definition strategy set to default.", currentStrategy, diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementResolved.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementResolved.java index 9939bb0cd7..44418eb981 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementResolved.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ModuleElementResolved.java @@ -13,7 +13,7 @@ public class ModuleElementResolved { private final String instanceName; private final InstanceConfigElementResolved instanceConfigElementResolved; - public ModuleElementResolved(String instanceName, InstanceConfigElementResolved instanceConfigElementResolved) { + public ModuleElementResolved(final String instanceName, final InstanceConfigElementResolved instanceConfigElementResolved) { this.instanceName = instanceName; this.instanceConfigElementResolved = instanceConfigElementResolved; } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ServiceRegistryWrapper.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ServiceRegistryWrapper.java index 054c064a36..b9e5f0f5b5 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ServiceRegistryWrapper.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/ServiceRegistryWrapper.java @@ -21,11 +21,11 @@ public class ServiceRegistryWrapper { private final ServiceReferenceReadableRegistry configServiceRefRegistry; - public ServiceRegistryWrapper(ServiceReferenceReadableRegistry configServiceRefRegistry) { + public ServiceRegistryWrapper(final ServiceReferenceReadableRegistry configServiceRefRegistry) { this.configServiceRefRegistry = configServiceRefRegistry; } - public ObjectName getByServiceAndRefName(String namespace, String serviceType, String refName) { + public ObjectName getByServiceAndRefName(final String namespace, final String serviceType, final String refName) { Map>> mappedServices = getMappedServices(); Map> serviceNameToRefNameToInstance = mappedServices.get(namespace); @@ -56,7 +56,7 @@ public class ServiceRegistryWrapper { */ return ObjectNameUtil.withoutTransactionName( configServiceRefRegistry.getServiceReference(qNameOfService, refName)); - } catch (InstanceNotFoundException e) { + } catch (final InstanceNotFoundException e) { throw new IllegalArgumentException("No serviceInstance mapped to " + refName + " under service name " + serviceType + " , " + refNameToInstance.keySet(), e); diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Services.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Services.java index c2683d44ab..4ee1bcaf0b 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Services.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Services.java @@ -46,7 +46,7 @@ public final class Services { return namespaceToServiceNameToRefNameToInstance; } - private static Services resolveServices(Map>> mappedServices) { + private static Services resolveServices(final Map>> mappedServices) { Services tracker = new Services(); for (Entry>> namespaceEntry : mappedServices.entrySet()) { @@ -85,7 +85,7 @@ public final class Services { // TODO support edit strategies on services - public static Services fromXml(XmlElement xml) throws DocumentedException { + public static Services fromXml(final XmlElement xml) throws DocumentedException { Map>> retVal = Maps.newHashMap(); List services = xml.getChildElements(SERVICE_KEY); @@ -141,7 +141,7 @@ public final class Services { return resolveServices(retVal); } - public static Element toXml(ServiceRegistryWrapper serviceRegistryWrapper, Document document) { + public static Element toXml(final ServiceRegistryWrapper serviceRegistryWrapper, final Document document) { final Optional configNs = Optional.of(XmlMappingConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG); Element root = XmlUtil.createElement(document, XmlMappingConstants.SERVICES_KEY, configNs); @@ -183,7 +183,7 @@ public final class Services { public static final class ServiceInstance { public static final ServiceInstance EMPTY_SERVICE_INSTANCE = new ServiceInstance("", ""); - public ServiceInstance(String moduleName, String instanceName) { + public ServiceInstance(final String moduleName, final String instanceName) { this.moduleName = moduleName; this.instanceName = instanceName; } @@ -210,7 +210,7 @@ public final class Services { return serviceName; } - public void setServiceName(String serviceName) { + public void setServiceName(final String serviceName) { this.serviceName = serviceName; } @@ -258,7 +258,7 @@ public final class Services { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj){ return true; } @@ -286,11 +286,11 @@ public final class Services { return true; } - public ObjectName getObjectName(String transactionName) { + public ObjectName getObjectName(final String transactionName) { return ObjectNameUtil.createTransactionModuleON(transactionName, moduleName, instanceName); } - public static ServiceInstance fromObjectName(ObjectName on) { + public static ServiceInstance fromObjectName(final ObjectName on) { return new ServiceInstance(ObjectNameUtil.getFactoryName(on), ObjectNameUtil.getInstanceName(on)); } } diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/rpc/InstanceRuntimeRpc.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/rpc/InstanceRuntimeRpc.java index 175b3f0927..c513100aea 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/rpc/InstanceRuntimeRpc.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/rpc/InstanceRuntimeRpc.java @@ -34,13 +34,13 @@ public final class InstanceRuntimeRpc { private final Rpc rpc; private final EnumResolver enumResolver; - public InstanceRuntimeRpc(Rpc rpc, final EnumResolver enumResolver) { + public InstanceRuntimeRpc(final Rpc rpc, final EnumResolver enumResolver) { this.enumResolver = enumResolver; this.yangToAttrConfig = map(rpc.getParameters()); this.rpc = rpc; } - private Map map(List parameters) { + private Map map(final List parameters) { Map mapped = Maps.newHashMap(); for (JavaAttribute javaAttribute : parameters) { mapped.put(javaAttribute.getAttributeYangName(), javaAttribute); @@ -48,7 +48,7 @@ public final class InstanceRuntimeRpc { return mapped; } - private void resolveConfiguration(Map mappedConfig) { + private void resolveConfiguration(final Map mappedConfig) { // TODO make field, resolvingStrategies can be instantiated only once Map>> resolvingStrategies = new ObjectResolver(null) @@ -63,14 +63,14 @@ public final class InstanceRuntimeRpc { configDefEntry.getValue().resolveValue(attributeResolvingStrategy, configDefEntry.getKey()); configDefEntry.getValue().setJmxName( yangToAttrConfig.get(configDefEntry.getKey()).getUpperCaseCammelCase()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Unable to resolve value " + configDefEntry.getValue() + " to attribute " + configDefEntry.getKey(), e); } } } - public Map fromXml(XmlElement configRootNode) throws DocumentedException { + public Map fromXml(final XmlElement configRootNode) throws DocumentedException { Map retVal = Maps.newHashMap(); // FIXME add identity map to runtime data diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/transactions/TransactionProvider.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/transactions/TransactionProvider.java index eebc1ba001..d742238ba2 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/transactions/TransactionProvider.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/transactions/TransactionProvider.java @@ -35,7 +35,7 @@ public class TransactionProvider implements AutoCloseable { private final List allOpenedTransactions = new ArrayList<>(); private static final String NO_TRANSACTION_FOUND_FOR_SESSION = "No transaction found for session "; - public TransactionProvider(ConfigRegistryClient configRegistryClient, String sessionIdForReporting) { + public TransactionProvider(final ConfigRegistryClient configRegistryClient, final String sessionIdForReporting) { this.configRegistryClient = configRegistryClient; this.sessionIdForReporting = sessionIdForReporting; } @@ -47,7 +47,7 @@ public class TransactionProvider implements AutoCloseable { if (isStillOpenTransaction(tx)) { configRegistryClient.getConfigTransactionClient(tx).abortConfig(); } - } catch (Exception e) { + } catch (final Exception e) { LOG.debug("Ignoring exception while closing transaction {}", tx, e); } } @@ -84,7 +84,7 @@ public class TransactionProvider implements AutoCloseable { return Optional.of(readTx); } - private boolean isStillOpenTransaction(ObjectName transaction) { + private boolean isStillOpenTransaction(final ObjectName transaction) { return configRegistryClient.getOpenConfigs().contains(transaction); } @@ -144,11 +144,11 @@ public class TransactionProvider implements AutoCloseable { allOpenedTransactions.remove(candidateTx); candidateTx = null; return status; - } catch (ValidationException validationException) { + } catch (final ValidationException validationException) { // no clean up: user can reconfigure and recover this transaction LOG.warn("Transaction {} failed on {}", taON, validationException.toString()); throw validationException; - } catch (ConflictingVersionException e) { + } catch (final ConflictingVersionException e) { LOG.debug("Exception while commit of {}, aborting transaction", taON, e); // clean up abortTransaction(); @@ -178,7 +178,7 @@ public class TransactionProvider implements AutoCloseable { readTx = null; } - public synchronized void abortTestTransaction(ObjectName testTx) { + public synchronized void abortTestTransaction(final ObjectName testTx) { LOG.debug("Aborting transaction {}", testTx); ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(testTx); allOpenedTransactions.remove(testTx); @@ -193,19 +193,19 @@ public class TransactionProvider implements AutoCloseable { transactionClient.validateConfig(); } - public void validateTestTransaction(ObjectName taON) throws ValidationException { + public void validateTestTransaction(final ObjectName taON) throws ValidationException { ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON); transactionClient.validateConfig(); } - public void wipeTestTransaction(ObjectName taON) { + public void wipeTestTransaction(final ObjectName taON) { wipeInternal(taON, true); } /** * Wiping means removing all module instances keeping the transaction open + service references. */ - synchronized void wipeInternal(ObjectName taON, boolean isTest) { + synchronized void wipeInternal(final ObjectName taON, final boolean isTest) { ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON); Set lookupConfigBeans = transactionClient.lookupConfigBeans(); @@ -213,7 +213,7 @@ public class TransactionProvider implements AutoCloseable { for (ObjectName instance : lookupConfigBeans) { try { transactionClient.destroyModule(instance); - } catch (InstanceNotFoundException e) { + } catch (final InstanceNotFoundException e) { if (isTest){ LOG.debug("Unable to clean configuration in transactiom {}", taON, e); } else { -- 2.36.6