Fix checkstyle issues to enforce it 29/62729/2
authorDavid Suarez <david.suarez.fuentes@gmail.com>
Tue, 5 Sep 2017 21:01:47 +0000 (23:01 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 6 Sep 2017 08:40:58 +0000 (08:40 +0000)
Fix checkstyle issues to enforce it.

Change-Id: I6e876b21f092b6d10e6f9ee1304ddf5a535dcb13
Signed-off-by: David Suarez <david.suarez.fuentes@gmail.com>
31 files changed:
opendaylight/config/config-api/pom.xml
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ConfigRegistry.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ConfigTransactionController.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/DependencyResolver.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/IdentityAttributeRef.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/JmxAttribute.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/LookupRegistry.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ModuleIdentifier.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/RuntimeBeanRegistratorAwareModule.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ServiceReferenceReadableRegistry.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ServiceReferenceWritableRegistry.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ValidationException.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/annotations/ServiceInterfaceAnnotation.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/CommitStatus.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/ObjectNameUtil.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/constants/ConfigRegistryConstants.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/notifications/CommitJMXNotification.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/notifications/ConfigJMXNotification.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/osgi/WaitingServiceTracker.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/runtime/RuntimeBean.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/spi/AbstractModule.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/spi/Module.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/spi/ModuleFactory.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/IdentityAttributeRefTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/JmxAttributeTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/JmxAttributeValidationExceptionTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/ModuleIdentifierTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/ValidationExceptionTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/jmx/CommitStatusTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/jmx/ConfigRegistryConstantsTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/jmx/ObjectNameUtilTest.java

index d05d5ce82dcd1b8d89c866373217b79fb240b8b8..9242ffecee9beb8f7cfa24624955e5302059af62 100644 (file)
@@ -1,12 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- vi: set et smarttab sw=4 tabstop=4: -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.mdsal</groupId>
     <artifactId>binding-parent</artifactId>
     <version>0.12.0-SNAPSHOT</version>
-    <relativePath/>
+    <relativePath />
   </parent>
 
   <groupId>org.opendaylight.controller</groupId>
            to make sure anyone dependending on this artifact inherits it -->
       <scope>compile</scope>
     </dependency>
-      <dependency>
-          <groupId>org.opendaylight.yangtools</groupId>
-          <artifactId>mockito-configuration</artifactId>
-      </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>mockito-configuration</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
index 426edc1dec9fb4f38bf9f9d2b63cbaedb9ac26b5..a3c747bafbfdf566254c69cda36196a6fbb989d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -39,8 +39,8 @@ public interface ConfigRegistry extends LookupRegistry, ServiceReferenceReadable
      *
      * @param transactionControllerON
      *            {@link ObjectName} of
-     *            {@link org.opendaylight.controller.config.api.jmx.ConfigTransactionControllerMXBean} that was
-     *            received in {@link #beginConfig()} method call.
+     *            {@link org.opendaylight.controller.config.api.jmx.ConfigTransactionControllerMXBean}
+     *            that was received in {@link #beginConfig()} method call.
      * @return CommitStatus
      * @throws ValidationException
      *             if validation fails
@@ -51,20 +51,23 @@ public interface ConfigRegistry extends LookupRegistry, ServiceReferenceReadable
             throws ConflictingVersionException, ValidationException;
 
     /**
+     * List of open configuration transactions.
+     *
      * @return list of open configuration transactions.
      */
     List<ObjectName> getOpenConfigs();
 
     /**
      * Will return true unless there was a transaction that succeeded during
-     * validation but failed in second phase of commit. In this case the server
-     * is unstable and its state is undefined.
+     * validation but failed in second phase of commit. In this case the server is
+     * unstable and its state is undefined.
      */
     boolean isHealthy();
 
     /**
+     * Get the module names available in the system.
+     *
      * @return module factory names available in the system
      */
     Set<String> getAvailableModuleNames();
-
 }
index bd9002c62487d2c5506599ec35219278527b9377..c234da7df590c0743e4be3e3b916a365bc7a59d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -21,13 +21,14 @@ public interface ConfigTransactionController extends LookupRegistry, ServiceRefe
      * Create new configuration bean.
      *
      * @param moduleName
+     *            name of the module
      * @param instanceName
+     *            name of the instance
      * @return ObjectName of newly created module
      * @throws InstanceAlreadyExistsException
      *             if given ifcName and instanceName is already registered
      */
-    ObjectName createModule(String moduleName, String instanceName)
-            throws InstanceAlreadyExistsException;
+    ObjectName createModule(String moduleName, String instanceName) throws InstanceAlreadyExistsException;
 
     /**
      * Re-creates an existing module configuration bean.
@@ -49,8 +50,7 @@ public interface ConfigTransactionController extends LookupRegistry, ServiceRefe
      * @param objectName
      *            can be either read-only module name that can be obtained using
      *            {@link ConfigRegistry#lookupConfigBean(String, String)} or
-     *            writable module name that must contain current transaction
-     *            name.
+     *            writable module name that must contain current transaction name.
      * @throws InstanceNotFoundException
      *             if module is not found
      * @throws IllegalArgumentException
@@ -72,14 +72,17 @@ public interface ConfigTransactionController extends LookupRegistry, ServiceRefe
     void validateConfig() throws ValidationException;
 
     /**
+     * Get the name of the transaction.
      *
      * @return transactionName
      */
     String getTransactionName();
 
     /**
-     * @return all known module factory names as reported by {@link org.opendaylight.controller.config.spi.ModuleFactory#getImplementationName()}
+     * Get the names of all available modules.
+     *
+     * @return all known module factory names as reported by
+     *         {@link org.opendaylight.controller.config.spi.ModuleFactory#getImplementationName()}
      */
     Set<String> getAvailableModuleNames();
-
 }
index 813e55426b203bc1a679f4daa1d221bff1a6650b..e9b63e6f051b8564a948c7efaafd632d2a9e74b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -26,72 +26,90 @@ import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 public interface DependencyResolver extends Identifiable<ModuleIdentifier> {
 
     /**
-     * To be used during validation phase to validate service interface of
-     * dependent module.
+     * To be used during validation phase to validate service interface of dependent
+     * module.
      *
-     * @param expectedServiceInterface MBean/MXBean interface which will back the proxy object.
-     * @param objectName               ObjectName of dependent module without transaction name
-     *                                 (platformON).
-     * @param jmxAttribute             for reporting
-     * @throws IllegalArgumentException when module is not found
-     * @throws IllegalStateException    if module does not export this
-     *                                  service interface.
+     * @param expectedServiceInterface
+     *            MBean/MXBean interface which will back the proxy object.
+     * @param objectName
+     *            ObjectName of dependent module without transaction name
+     *            (platformON).
+     * @param jmxAttribute
+     *            for reporting
+     * @throws IllegalArgumentException
+     *             when module is not found
+     * @throws IllegalStateException
+     *             if module does not export this service interface.
      */
-    void validateDependency(
-            Class<? extends AbstractServiceInterface> expectedServiceInterface,
-            ObjectName objectName, JmxAttribute jmxAttribute);
+    void validateDependency(Class<? extends AbstractServiceInterface> expectedServiceInterface, ObjectName objectName,
+            JmxAttribute jmxAttribute);
 
     /**
      * To be used during commit phase to wire actual dependencies.
      *
      * @return dependency instance using
-     * {@link org.opendaylight.controller.config.spi.Module#getInstance()}
-     * @throws IllegalArgumentException when module is not found
+     *         {@link org.opendaylight.controller.config.spi.Module#getInstance()}
+     * @throws IllegalArgumentException
+     *             when module is not found
      */
-    <T> T resolveInstance(Class<T> expectedType, ObjectName objectName,
-                          JmxAttribute jmxAttribute);
-
+    <T> T resolveInstance(Class<T> expectedType, ObjectName objectName, JmxAttribute jmxAttribute);
 
     /**
      * To be used during commit phase to resolve identity-ref config attributes.
      *
      * @return actual class object generated from identity
      */
-    <T extends BaseIdentity> Class<? extends T> resolveIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass);
-
+    <T extends BaseIdentity> Class<? extends T> resolveIdentity(IdentityAttributeRef identityRef,
+            Class<T> expectedBaseClass);
 
     /**
      * Validate identity-ref config attribute.
      */
-    <T extends BaseIdentity> void validateIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass, JmxAttribute jmxAttribute);
+    <T extends BaseIdentity> void validateIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass,
+            JmxAttribute jmxAttribute);
 
     /**
-     * Can be used during validation or commit phase to get attribute value of dependent module.
+     * Can be used during validation or commit phase to get attribute value of
+     * dependent module.
      *
-     * @param name      either direct ObjectName of a Module (type=Module) or service reference (type=ServiceReference) of dependent Module
-     * @param attribute String identifying attribute name in JMX. Note that attributes start with upper case. See {@link org.opendaylight.controller.config.api.JmxAttribute#getAttributeName()}
+     * @param name
+     *            either direct ObjectName of a Module (type=Module) or service
+     *            reference (type=ServiceReference) of dependent Module
+     * @param attribute
+     *            String identifying attribute name in JMX. Note that attributes
+     *            start with upper case. See
+     *            {@link org.opendaylight.controller.config.api.JmxAttribute#getAttributeName()}
      */
     Object getAttribute(ObjectName name, String attribute)
-            throws MBeanException, AttributeNotFoundException,
-            InstanceNotFoundException, ReflectionException;
-
+            throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException;
 
     /**
-     * Helper method around {@link javax.management.JMX#newMXBeanProxy(javax.management.MBeanServerConnection, javax.management.ObjectName, Class)} }.
-     * Returns MXBean proxy for dependent module. Can be used during validation or commit phase to inspect dependent module's attributes.
+     * Helper method around.
+     * {@link javax.management
+     * .JMX#newMXBeanProxy(javax.management.MBeanServerConnection, javax.management.ObjectName, Class)}}.
+     *
+     * Returns MXBean proxy for dependent module. Can be used during validation or
+     * commit phase to inspect dependent module's attributes.
      *
-     * @param objectName either direct ObjectName of a Module (type=Module) or service reference (type=ServiceReference) of dependent Module
-     * @param interfaceClass MXBean interface to be used as a proxy
-     * @param <T> type of proxy for type safe return value
+     * @param objectName
+     *            either direct ObjectName of a Module (type=Module) or service
+     *            reference (type=ServiceReference) of dependent Module
+     * @param interfaceClass
+     *            MXBean interface to be used as a proxy
+     * @param <T>
+     *            type of proxy for type safe return value
      * @return instance of MXBean proxy
      */
     <T> T newMXBeanProxy(ObjectName objectName, Class<T> interfaceClass);
 
     /**
-     * Check whether a dependency will be reused or (re)created. Useful when deciding if current module could be also reused.
+     * Check whether a dependency will be reused or (re)created. Useful when
+     * deciding if current module could be also reused.
      *
-     * @param objectName ObjectName ID of a dependency
-     * @param jmxAttribute JMXAttribute ID of a dependency
+     * @param objectName
+     *            ObjectName ID of a dependency
+     * @param jmxAttribute
+     *            JMXAttribute ID of a dependency
      * @return true if the dependency will be reused false otherwise
      */
     boolean canReuseDependency(ObjectName objectName, JmxAttribute jmxAttribute);
index 23d8691f54674f12cc01f51b38e45ef1e8a17b62..a578ac563fbe2c5af84fb7e6968e387357f015aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -14,48 +14,50 @@ public final class IdentityAttributeRef {
 
     public static final String QNAME_ATTR_NAME = "qNameOfIdentity";
 
-    private final String qNameOfIdentity;
+    private final String qualifiedNameOfIdentity;
 
     @ConstructorProperties(QNAME_ATTR_NAME)
-    public IdentityAttributeRef(final String qNameOfIdentity) {
-        if (qNameOfIdentity == null) {
+    public IdentityAttributeRef(final String qualifiedNameOfIdentity) {
+        if (qualifiedNameOfIdentity == null) {
             throw new NullPointerException("Parameter " + QNAME_ATTR_NAME + " is null");
         }
-        this.qNameOfIdentity = qNameOfIdentity;
+        this.qualifiedNameOfIdentity = qualifiedNameOfIdentity;
     }
 
     public String getqNameOfIdentity() {
-        return qNameOfIdentity;
+        return qualifiedNameOfIdentity;
     }
 
-    public <T extends BaseIdentity> Class<? extends T> resolveIdentity(final DependencyResolver resolver, final Class<T> baseIdentity) {
+    public <T extends BaseIdentity> Class<? extends T> resolveIdentity(final DependencyResolver resolver,
+            final Class<T> baseIdentity) {
         return resolver.resolveIdentity(this, baseIdentity);
     }
 
-    public <T extends BaseIdentity> void validateIdentity(final DependencyResolver resolver, final Class<T> baseIdentity, final JmxAttribute jmxAttribute) {
+    public <T extends BaseIdentity> void validateIdentity(final DependencyResolver resolver,
+            final Class<T> baseIdentity, final JmxAttribute jmxAttribute) {
         resolver.validateIdentity(this, baseIdentity, jmxAttribute);
     }
 
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder("IdentityAttributeRef{");
-        sb.append("qNameOfIdentity='").append(qNameOfIdentity).append('\'');
+        sb.append("qNameOfIdentity='").append(qualifiedNameOfIdentity).append('\'');
         sb.append('}');
         return sb.toString();
     }
 
     @Override
-    public boolean equals(final Object o) {
-        if (this == o) {
+    public boolean equals(final Object object) {
+        if (this == object) {
             return true;
         }
-        if (!(o instanceof IdentityAttributeRef)) {
+        if (!(object instanceof IdentityAttributeRef)) {
             return false;
         }
 
-        IdentityAttributeRef that = (IdentityAttributeRef) o;
+        IdentityAttributeRef that = (IdentityAttributeRef) object;
 
-        if (!qNameOfIdentity.equals(that.qNameOfIdentity)) {
+        if (!qualifiedNameOfIdentity.equals(that.qualifiedNameOfIdentity)) {
             return false;
         }
 
@@ -64,7 +66,6 @@ public final class IdentityAttributeRef {
 
     @Override
     public int hashCode() {
-        return qNameOfIdentity.hashCode();
+        return qualifiedNameOfIdentity.hashCode();
     }
-
 }
index 068322cc89c29b8b927a301a1c26cf19db43afe7..7b67b95d37430f92756325d745791df5687912d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -29,15 +29,15 @@ public class JmxAttribute {
     }
 
     @Override
-    public boolean equals(final Object o) {
-        if (this == o) {
+    public boolean equals(final Object object) {
+        if (this == object) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (object == null || getClass() != object.getClass()) {
             return false;
         }
 
-        JmxAttribute that = (JmxAttribute) o;
+        JmxAttribute that = (JmxAttribute) object;
 
         if (!attributeName.equals(that.attributeName)) {
             return false;
index 5d615c20845099d260cf5f2d0dddf5e6aad3d7bf..0492268338e19ed3ac2bc6462712cc30137aa65e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -24,6 +24,7 @@ public interface LookupRegistry {
      * Find modules with given module name.
      *
      * @param moduleName
+     *            name of module
      * @return objectNames
      */
     Set<ObjectName> lookupConfigBeans(String moduleName);
@@ -32,11 +33,11 @@ public interface LookupRegistry {
      * Find read modules.
      *
      * @param moduleName
-     *            exact match for searched module name, can contain '*' to match
-     *            all values.
+     *            exact match for searched module name, can contain '*' to match all
+     *            values.
      * @param instanceName
-     *            exact match for searched instance name, can contain '*' to
-     *            match all values.
+     *            exact match for searched instance name, can contain '*' to match
+     *            all values.
      * @return objectNames
      */
     Set<ObjectName> lookupConfigBeans(String moduleName, String instanceName);
@@ -45,17 +46,16 @@ public interface LookupRegistry {
      * Find read module.
      *
      * @param moduleName
-     *            exact match for searched module name, can contain '*' to match
-     *            all values.
+     *            exact match for searched module name, can contain '*' to match all
+     *            values.
      * @param instanceName
-     *            exact match for searched instance name, can contain '*' to
-     *            match all values.
+     *            exact match for searched instance name, can contain '*' to match
+     *            all values.
      * @return objectNames
      * @throws InstanceNotFoundException
      *             if search did not find exactly one instance
      */
-    ObjectName lookupConfigBean(String moduleName, String instanceName)
-            throws InstanceNotFoundException;
+    ObjectName lookupConfigBean(String moduleName, String instanceName) throws InstanceNotFoundException;
 
     /**
      * Check that object name corresponds with existing module.
@@ -65,21 +65,22 @@ public interface LookupRegistry {
      */
     void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException;
 
-
     /**
+     * Get the qNames  of all ModuleFactory instances in the system.
+     *
      * @return qNames of all ModuleFactory instances in the system
      */
     Set<String> getAvailableModuleFactoryQNames();
 
     /**
-     * Find all runtime beans
+     * Find all runtime beans.
      *
      * @return objectNames
      */
     Set<ObjectName> lookupRuntimeBeans();
 
     /**
-     * Find all runtime of specified module
+     * Find all runtime of specified module.
      *
      * @param moduleName
      *            of bean
index c7d1df895bd353901c6aeefd54d75e874fd46f69..600c9eeaec62ff71e504d52ffe2bd79f4c8d24e9 100644 (file)
@@ -11,7 +11,8 @@ import org.opendaylight.yangtools.concepts.Identifier;
 
 public class ModuleIdentifier implements Identifier {
     private static final long serialVersionUID = 1L;
-    private final String factoryName, instanceName;
+    private final String factoryName;
+    private final String instanceName;
 
     public ModuleIdentifier(final String factoryName, final String instanceName) {
         if (factoryName == null) {
@@ -33,15 +34,15 @@ public class ModuleIdentifier implements Identifier {
     }
 
     @Override
-    public boolean equals(final Object o) {
-        if (this == o) {
+    public boolean equals(final Object object) {
+        if (this == object) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (object == null || getClass() != object.getClass()) {
             return false;
         }
 
-        ModuleIdentifier that = (ModuleIdentifier) o;
+        ModuleIdentifier that = (ModuleIdentifier) object;
 
         if (!factoryName.equals(that.factoryName)) {
             return false;
index e6c92fdb6dd5c10ffed0e8e65b1243fa32912d76..2b46ac79d7eba7cbbf446dee33fbb032f32778d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -21,7 +21,7 @@ public interface RuntimeBeanRegistratorAwareModule extends Module {
      * to close registrator in their {@link java.io.Closeable#close()} method. Same
      * module will get the same registrator during reconfiguration.
      *
-     * @param rootRuntimeBeanRegistrator
+     * @param rootRuntimeBeanRegistrator root bean
      */
     void setRuntimeBeanRegistrator(
             RootRuntimeBeanRegistrator rootRuntimeBeanRegistrator);
index a364e54bff584363405b2b88337b65301a000add..f4ee78784fd93c35672aa1b2b32411ca67c7343b 100644 (file)
@@ -15,11 +15,17 @@ import javax.management.ObjectName;
 public interface ServiceReferenceReadableRegistry {
 
     /**
-     * Lookup object name by fully qualified service interface name and service reference name.
-     * @param serviceInterfaceQName service interface name
-     * @param refName service reference name supplied in
-     * {@link org.opendaylight.controller.config.api.ConfigTransactionController#saveServiceReference(String, String, javax.management.ObjectName)}
-     * @throws java.lang.IllegalArgumentException if module not found
+     * Lookup object name by fully qualified service interface name and service
+     * reference name.
+     *
+     * @param serviceInterfaceQName
+     *            service interface name
+     * @param refName
+     *            service reference name supplied in
+     *            {@link org.opendaylight.controller.config
+     *            .api .ConfigTransactionController#saveServiceReference(String, String, javax.management.ObjectName)}
+     * @throws java.lang.IllegalArgumentException
+     *             if module not found
      */
     ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName);
 
@@ -29,34 +35,50 @@ public interface ServiceReferenceReadableRegistry {
     Map<String /* serviceInterfaceQName */, Map<String/* refName */, ObjectName>> getServiceMapping();
 
     /**
-     * Get current mapping between reference names and module object names for given service interface name.
-     * @param serviceInterfaceQName service interface name
-     * @throws IllegalArgumentException if there is a mismatch between serviceInterfaceName and objectName
+     * Get current mapping between reference names and module object names for given
+     * service interface name.
+     *
+     * @param serviceInterfaceQName
+     *            service interface name
+     * @throws IllegalArgumentException
+     *             if there is a mismatch between serviceInterfaceName and
+     *             objectName
      */
     Map<String /* refName */, ObjectName> lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName);
 
     /**
      * Find all available service interface names of a module.
-     * @param objectName module object name
-     * @throws InstanceNotFoundException if search did not find exactly one instance
+     *
+     * @param objectName
+     *            module object name
+     * @throws InstanceNotFoundException
+     *             if search did not find exactly one instance
      */
     Set<String> lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException;
 
     /**
-     * @param namespace service interface namespace
-     * @param localName service interface local name
-     * @return fully qualified name needed by all other service reference mapping methods.
-     * @throws java.lang.IllegalArgumentException if namespace or localName is not found
+     * Get the name of the service interface.
+     *
+     * @param namespace
+     *            service interface namespace
+     * @param localName
+     *            service interface local name
+     * @return fully qualified name needed by all other service reference mapping
+     *         methods.
+     * @throws java.lang.IllegalArgumentException
+     *             if namespace or localName is not found
      */
     String getServiceInterfaceName(String namespace, String localName);
 
     /**
+     * Get the reference to that service.
+     *
      * @return ObjectName with type=Service that was created using
-     * {@link org.opendaylight.controller.config.api.ServiceReferenceWritableRegistry#saveServiceReference(String, String,
-     * javax.management.ObjectName)}
+     *         {@link org.opendaylight.controller
+     *         .config .api.ServiceReferenceWritableRegistry#saveServiceReference(String,
+     *          String, javax.management.ObjectName)}
      */
     ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException;
 
     void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException;
-
 }
index f7b56fe4c2240c4b7ac80a54f7c372db6205b448..77fc8dc3c785f1b4c42b60ce83ecb879041d777b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -12,16 +12,25 @@ import javax.management.ObjectName;
 
 public interface ServiceReferenceWritableRegistry extends ServiceReferenceReadableRegistry {
     /**
-     * Create or update reference name to objectName. Reference name is unique per service interface name.
-     * @return created or updated object name containing service name and reference name
-     * @throws IllegalArgumentException if there is a mismatch between serviceInterfaceName and objectName
-     * @throws InstanceNotFoundException if search did not find exactly one instance
+     * Create or update reference name to objectName. Reference name is unique per
+     * service interface name.
+     *
+     * @return created or updated object name containing service name and reference
+     *         name
+     * @throws IllegalArgumentException
+     *             if there is a mismatch between serviceInterfaceName and
+     *             objectName
+     * @throws InstanceNotFoundException
+     *             if search did not find exactly one instance
      */
-    ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException;
+    ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON)
+            throws InstanceNotFoundException;
 
     /**
      * Remove service reference.
-     * @throws IllegalArgumentException if service interface name is not advertised by any module
+     *
+     * @throws IllegalArgumentException
+     *             if service interface name is not advertised by any module
      */
     void removeServiceReference(String serviceInterfaceName, String refName) throws InstanceNotFoundException;
 
@@ -32,6 +41,7 @@ public interface ServiceReferenceWritableRegistry extends ServiceReferenceReadab
 
     /**
      * Remove all service references attached to given module.
+     *
      * @return true iif at least one reference was removed
      */
     boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException;
index 1d528e5b001c5c5335fff5abbba5c41e2b7ca87c..83e83e9b176a9bb1f44c8f87535609b480e77216 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,18 +15,22 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 /**
- * This exception is not intended to be used while implementing modules,
- * it aggregates validation exceptions and sends them back to the user.
- * Use {@link org.opendaylight.controller.config.api.JmxAttributeValidationException} for
- * validating modules instead.
+ * This exception is not intended to be used while implementing modules, it
+ * aggregates validation exceptions and sends them back to the user. Use
+ * {@link org.opendaylight.controller.config.api.JmxAttributeValidationException}
+ * for validating modules instead.
  */
 public class ValidationException extends Exception {
     private static final long serialVersionUID = -6072893219820274247L;
 
-    private final Map<String/* module name */, Map<String/* instance name */, ExceptionMessageWithStackTrace>> failedValidations;
+    private final Map<String/* module name */,
+        Map<String/* instance name */,
+        ExceptionMessageWithStackTrace>> failedValidations;
 
     public ValidationException(
-            final Map<String /* module name */, Map<String /* instance name */, ExceptionMessageWithStackTrace>> failedValidations) {
+            final Map<String /* module name */,
+            Map<String /* instance name */,
+            ExceptionMessageWithStackTrace>> failedValidations) {
         super(failedValidations.toString());
         this.failedValidations = Collections.unmodifiableMap(failedValidations);
     }
@@ -35,20 +39,17 @@ public class ValidationException extends Exception {
             final List<ValidationException> collectedExceptions) {
         Map<String, Map<String, ExceptionMessageWithStackTrace>> failedValidations = new HashMap<>();
         for (ValidationException ve : collectedExceptions) {
-            for (Entry<String, Map<String, ExceptionMessageWithStackTrace>> outerEntry : ve
-                    .getFailedValidations().entrySet()) {
-                for (Entry<String, ExceptionMessageWithStackTrace> innerEntry : outerEntry
-                        .getValue().entrySet()) {
+            for (Entry<String, Map<String, ExceptionMessageWithStackTrace>> outerEntry : ve.getFailedValidations()
+                    .entrySet()) {
+                for (Entry<String, ExceptionMessageWithStackTrace> innerEntry : outerEntry.getValue().entrySet()) {
                     String moduleName = outerEntry.getKey();
                     String instanceName = innerEntry.getKey();
                     ExceptionMessageWithStackTrace ex = innerEntry.getValue();
                     Map<String, ExceptionMessageWithStackTrace> instanceToExMap = failedValidations
                             .computeIfAbsent(moduleName, k -> new HashMap<>());
                     if (instanceToExMap.containsKey(instanceName)) {
-                        throw new IllegalArgumentException(
-                                "Cannot merge with same module name "
-                                        + moduleName + " and instance name "
-                                        + instanceName);
+                        throw new IllegalArgumentException("Cannot merge with same module name " + moduleName
+                                + " and instance name " + instanceName);
                     }
                     instanceToExMap.put(instanceName, ex);
                 }
@@ -57,23 +58,25 @@ public class ValidationException extends Exception {
         return new ValidationException(failedValidations);
     }
 
-    public static ValidationException createForSingleException(
-            final ModuleIdentifier moduleIdentifier, final Exception e) {
+    public static ValidationException createForSingleException(final ModuleIdentifier moduleIdentifier,
+            final Exception exception) {
         Map<String, Map<String, ExceptionMessageWithStackTrace>> failedValidations = new HashMap<>();
         Map<String, ExceptionMessageWithStackTrace> innerMap = new HashMap<>();
 
         failedValidations.put(moduleIdentifier.getFactoryName(), innerMap);
-        innerMap.put(moduleIdentifier.getInstanceName(),
-                new ExceptionMessageWithStackTrace(e));
+        innerMap.put(moduleIdentifier.getInstanceName(), new ExceptionMessageWithStackTrace(exception));
         return new ValidationException(failedValidations);
     }
 
-    public Map<String/* module name */, Map<String/* instance name */, ExceptionMessageWithStackTrace>> getFailedValidations() {
+    public Map<String/* module name */,
+        Map<String/* instance name */,
+        ExceptionMessageWithStackTrace>> getFailedValidations() {
         return failedValidations;
     }
 
     public static class ExceptionMessageWithStackTrace {
-        private String message, stackTrace;
+        private String message;
+        private String stackTrace;
 
         public ExceptionMessageWithStackTrace() {
         }
@@ -83,8 +86,8 @@ public class ValidationException extends Exception {
             this.stackTrace = stackTrace;
         }
 
-        public ExceptionMessageWithStackTrace(final Exception e) {
-            this(e.getMessage(), Arrays.toString(e.getStackTrace()));
+        public ExceptionMessageWithStackTrace(final Exception exception) {
+            this(exception.getMessage(), Arrays.toString(exception.getStackTrace()));
         }
 
         public String getMessage() {
@@ -107,10 +110,8 @@ public class ValidationException extends Exception {
         public int hashCode() {
             final int prime = 31;
             int result = 1;
-            result = prime * result
-                    + ((message == null) ? 0 : message.hashCode());
-            result = prime * result
-                    + ((stackTrace == null) ? 0 : stackTrace.hashCode());
+            result = prime * result + (message == null ? 0 : message.hashCode());
+            result = prime * result + (stackTrace == null ? 0 : stackTrace.hashCode());
             return result;
         }
 
@@ -147,6 +148,5 @@ public class ValidationException extends Exception {
         public String toString() {
             return message;
         }
-
     }
 }
index 23a01a7b51654a233ee36c7efed043a67342eed9..1adf6c5478aaf9b0116651b935aca03d42dcd302 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -42,17 +42,17 @@ public @interface ServiceInterfaceAnnotation {
     boolean registerToOsgi() default true;
 
     /**
-     * Get namespace of {@link #value()}
+     * Get namespace of {@link #value()}.
      */
     String namespace();
 
     /**
-     * Get revision of {@link #value()}
+     * Get revision of {@link #value()}.
      */
     String revision();
 
     /**
-     * Get local name of {@link #value()}
+     * Get local name of {@link #value()}.
      */
     String localName();
 }
index 33f811c739436a5497a5fe8d55766e102ef513bb..ed9164d151a14baafba8466bf9409e7a3f56bc3d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,42 +15,36 @@ import javax.management.ObjectName;
 
 @Immutable
 public class CommitStatus {
-    private final List<ObjectName> newInstances, reusedInstances,
-        recreatedInstances;
+    private final List<ObjectName> newInstances;
+    private final List<ObjectName> reusedInstances;
+    private final List<ObjectName> recreatedInstances;
 
     /**
-     * @param newInstances       newly created instances
-     * @param reusedInstances    reused instances
-     * @param recreatedInstances recreated instances
+     * Constructor.
+     *
+     * @param newInstances
+     *            newly created instances
+     * @param reusedInstances
+     *            reused instances
+     * @param recreatedInstances
+     *            recreated instances
      */
-    @ConstructorProperties({"newInstances", "reusedInstances",
-            "recreatedInstances"})
-    public CommitStatus(final List<ObjectName> newInstances,
-                        final List<ObjectName> reusedInstances,
-                        final List<ObjectName> recreatedInstances) {
+    @ConstructorProperties({ "newInstances", "reusedInstances", "recreatedInstances" })
+    public CommitStatus(final List<ObjectName> newInstances, final List<ObjectName> reusedInstances,
+            final List<ObjectName> recreatedInstances) {
         this.newInstances = Collections.unmodifiableList(newInstances);
         this.reusedInstances = Collections.unmodifiableList(reusedInstances);
-        this.recreatedInstances = Collections
-                .unmodifiableList(recreatedInstances);
+        this.recreatedInstances = Collections.unmodifiableList(recreatedInstances);
     }
 
-    /**
-     * @return list of objectNames representing newly created instances
-     */
     public List<ObjectName> getNewInstances() {
         return newInstances;
     }
 
-    /**
-     * @return list of objectNames representing reused instances
-     */
     public List<ObjectName> getReusedInstances() {
         return reusedInstances;
     }
 
-    /**
-     * @return list of objectNames representing recreated instances
-     */
     public List<ObjectName> getRecreatedInstances() {
         return recreatedInstances;
     }
@@ -59,14 +53,9 @@ public class CommitStatus {
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result
-                + ((newInstances == null) ? 0 : newInstances.hashCode());
-        result = prime
-                * result
-                + ((recreatedInstances == null) ? 0 : recreatedInstances
-                .hashCode());
-        result = prime * result
-                + ((reusedInstances == null) ? 0 : reusedInstances.hashCode());
+        result = prime * result + (newInstances == null ? 0 : newInstances.hashCode());
+        result = prime * result + (recreatedInstances == null ? 0 : recreatedInstances.hashCode());
+        result = prime * result + (reusedInstances == null ? 0 : reusedInstances.hashCode());
         return result;
     }
 
@@ -108,8 +97,7 @@ public class CommitStatus {
 
     @Override
     public String toString() {
-        return "CommitStatus [newInstances=" + newInstances
-                + ", reusedInstances=" + reusedInstances
+        return "CommitStatus [newInstances=" + newInstances + ", reusedInstances=" + reusedInstances
                 + ", recreatedInstances=" + recreatedInstances + "]";
     }
 
index 1165d7a3992f8bd76602600d021547097f236aad..3b7858c4771c3419f2958415a2e852865f27d851 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -27,9 +27,7 @@ import org.opendaylight.controller.config.api.jmx.constants.ConfigRegistryConsta
  * {@link #TRANSACTION_NAME_KEY} property set.
  */
 @ThreadSafe
-public class ObjectNameUtil {
-    private ObjectNameUtil() {
-    }
+public final class ObjectNameUtil {
 
     public static final String ON_DOMAIN = ConfigRegistryConstants.ON_DOMAIN;
     public static final String MODULE_FACTORY_NAME_KEY = "moduleFactoryName";
@@ -45,6 +43,9 @@ public class ObjectNameUtil {
     private static final String REPLACED_QUOTATION_MARK = "\\?";
     public static final String ON_WILDCARD = "*";
 
+    private ObjectNameUtil() {
+    }
+
     public static ObjectName createON(final String on) {
         try {
             return new ObjectName(on);
@@ -53,10 +54,6 @@ public class ObjectNameUtil {
         }
     }
 
-    public static ObjectName createONWithDomainAndType(final String type) {
-        return ConfigRegistryConstants.createONWithDomainAndType(type);
-    }
-
     public static ObjectName createON(final String name, final String key, final String value) {
         return ConfigRegistryConstants.createON(name, key, value);
     }
@@ -71,8 +68,11 @@ public class ObjectNameUtil {
 
     }
 
-    public static ObjectName createTransactionControllerON(
-            final String transactionName) {
+    public static ObjectName createONWithDomainAndType(final String type) {
+        return ConfigRegistryConstants.createONWithDomainAndType(type);
+    }
+
+    public static ObjectName createTransactionControllerON(final String transactionName) {
         Map<String, String> onParams = new HashMap<>();
         onParams.put(TRANSACTION_NAME_KEY, transactionName);
         onParams.put(TYPE_KEY, TYPE_CONFIG_TRANSACTION);
@@ -80,29 +80,29 @@ public class ObjectNameUtil {
     }
 
     public static ObjectName createTransactionModuleON(final String transactionName,
-                                                       final ModuleIdentifier moduleIdentifier) {
-        return createTransactionModuleON(transactionName,
-                moduleIdentifier.getFactoryName(),
+            final ModuleIdentifier moduleIdentifier) {
+        return createTransactionModuleON(transactionName, moduleIdentifier.getFactoryName(),
                 moduleIdentifier.getInstanceName());
     }
 
-    public static ObjectName createTransactionModuleON(final String transactionName,
-                                                       final String moduleName, final String instanceName) {
+    public static ObjectName createTransactionModuleON(final String transactionName, final String moduleName,
+            final String instanceName) {
         Map<String, String> onParams = createModuleMap(moduleName, instanceName);
         onParams.put(TRANSACTION_NAME_KEY, transactionName);
         return createON(ON_DOMAIN, onParams);
     }
 
-    public static ObjectName createTransactionModuleON(final String transactionName,
-                                                       final ObjectName on) {
-        return createTransactionModuleON(transactionName, getFactoryName(on),
-                getInstanceName(on));
+    public static ObjectName createTransactionModuleON(final String transactionName, final ObjectName on) {
+        return createTransactionModuleON(transactionName, getFactoryName(on), getInstanceName(on));
     }
 
-    public static ObjectName createReadOnlyModuleON(
-            final ModuleIdentifier moduleIdentifier) {
-        return createReadOnlyModuleON(moduleIdentifier.getFactoryName(),
-                moduleIdentifier.getInstanceName());
+    public static ObjectName createReadOnlyModuleON(final ModuleIdentifier moduleIdentifier) {
+        return createReadOnlyModuleON(moduleIdentifier.getFactoryName(), moduleIdentifier.getInstanceName());
+    }
+
+    public static ObjectName createReadOnlyModuleON(final String moduleName, final String instanceName) {
+        Map<String, String> onParams = createModuleMap(moduleName, instanceName);
+        return createON(ON_DOMAIN, onParams);
     }
 
     public static ObjectName createReadOnlyServiceON(final String serviceQName, final String refName) {
@@ -110,7 +110,8 @@ public class ObjectNameUtil {
         return createON(ON_DOMAIN, onParams);
     }
 
-    public static ObjectName createTransactionServiceON(final String transactionName, final String serviceQName, final String refName) {
+    public static ObjectName createTransactionServiceON(final String transactionName, final String serviceQName,
+            final String refName) {
         Map<String, String> onParams = createServiceON(transactionName, serviceQName, refName);
         return createON(ON_DOMAIN, onParams);
     }
@@ -121,7 +122,8 @@ public class ObjectNameUtil {
         return unquoteAndUnescape(objectName, quoted);
     }
 
-    // ObjectName supports quotation and ignores tokens like =, but fails to ignore ? sign.
+    // ObjectName supports quotation and ignores tokens like =, but fails to ignore
+    // ? sign.
     // It must be replaced with another character that hopefully does not collide
     // with actual value.
     private static String unquoteAndUnescape(final ObjectName objectName, final String quoted) {
@@ -147,14 +149,13 @@ public class ObjectNameUtil {
     }
 
     private static Map<String, String> createServiceON(final String transactionName, final String serviceQName,
-                                                       final String refName) {
+            final String refName) {
         Map<String, String> result = new HashMap<>(createServiceMap(serviceQName, refName));
         result.put(TRANSACTION_NAME_KEY, transactionName);
         return result;
     }
 
-    private static Map<String, String> createServiceMap(final String serviceQName,
-                                                        final String refName) {
+    private static Map<String, String> createServiceMap(final String serviceQName, final String refName) {
         Map<String, String> onParams = new HashMap<>();
         onParams.put(TYPE_KEY, TYPE_SERVICE_REFERENCE);
         onParams.put(SERVICE_QNAME_KEY, quoteAndEscapeValue(serviceQName));
@@ -162,15 +163,7 @@ public class ObjectNameUtil {
         return onParams;
     }
 
-
-    public static ObjectName createReadOnlyModuleON(final String moduleName,
-                                                    final String instanceName) {
-        Map<String, String> onParams = createModuleMap(moduleName, instanceName);
-        return createON(ON_DOMAIN, onParams);
-    }
-
-    private static Map<String, String> createModuleMap(final String moduleName,
-                                                       final String instanceName) {
+    private static Map<String, String> createModuleMap(final String moduleName, final String instanceName) {
         Map<String, String> onParams = new HashMap<>();
         onParams.put(TYPE_KEY, TYPE_MODULE);
         onParams.put(MODULE_FACTORY_NAME_KEY, moduleName);
@@ -198,12 +191,10 @@ public class ObjectNameUtil {
     public static ObjectName withoutTransactionName(final ObjectName inputON) {
         checkTypeOneOf(inputON, TYPE_MODULE, TYPE_SERVICE_REFERENCE);
         if (getTransactionName(inputON) == null) {
-            throw new IllegalArgumentException(
-                    "Expected ObjectName with transaction:" + inputON);
+            throw new IllegalArgumentException("Expected ObjectName with transaction:" + inputON);
         }
         if (!ON_DOMAIN.equals(inputON.getDomain())) {
-            throw new IllegalArgumentException("Expected different domain: "
-                    + inputON);
+            throw new IllegalArgumentException("Expected different domain: " + inputON);
         }
         Map<String, String> outputProperties;
         if (inputON.getKeyProperty(TYPE_KEY).equals(TYPE_MODULE)) {
@@ -231,17 +222,14 @@ public class ObjectNameUtil {
 
     }
 
-    private static void assertDoesNotContain(
-            final Map<String, String> additionalProperties, final String key) {
+    private static void assertDoesNotContain(final Map<String, String> additionalProperties, final String key) {
         if (additionalProperties.containsKey(key)) {
-            throw new IllegalArgumentException(
-                    "Map 'additionalProperties' cannot overwrite attribute "
-                            + key);
+            throw new IllegalArgumentException("Map 'additionalProperties' cannot overwrite attribute " + key);
         }
     }
 
-    public static ObjectName createRuntimeBeanName(final String moduleName,
-                                                   final String instanceName, final Map<String, String> additionalProperties) {
+    public static ObjectName createRuntimeBeanName(final String moduleName, final String instanceName,
+            final Map<String, String> additionalProperties) {
         // check that there is no overwriting of default attributes
         assertDoesNotContain(additionalProperties, MODULE_FACTORY_NAME_KEY);
         assertDoesNotContain(additionalProperties, INSTANCE_NAME_KEY);
@@ -254,11 +242,10 @@ public class ObjectNameUtil {
         return createON(ON_DOMAIN, map);
     }
 
-    private static Set<String> blacklist = new HashSet<>(Arrays.asList(
-            MODULE_FACTORY_NAME_KEY, INSTANCE_NAME_KEY, TYPE_KEY));
+    private static Set<String> blacklist = new HashSet<>(
+            Arrays.asList(MODULE_FACTORY_NAME_KEY, INSTANCE_NAME_KEY, TYPE_KEY));
 
-    public static Map<String, String> getAdditionalPropertiesOfRuntimeBeanName(
-            final ObjectName on) {
+    public static Map<String, String> getAdditionalPropertiesOfRuntimeBeanName(final ObjectName on) {
         checkType(on, TYPE_RUNTIME_BEAN);
         Map<String, String> allProperties = getAdditionalProperties(on);
         Map<String, String> result = new HashMap<>();
@@ -288,8 +275,7 @@ public class ObjectNameUtil {
 
     public static void checkType(final ObjectName objectName, final String type) {
         if (!type.equals(objectName.getKeyProperty(TYPE_KEY))) {
-            throw new IllegalArgumentException("Wrong type, expected '" + type
-                    + "', got " + objectName);
+            throw new IllegalArgumentException("Wrong type, expected '" + type + "', got " + objectName);
         }
     }
 
@@ -299,65 +285,51 @@ public class ObjectNameUtil {
                 return;
             }
         }
-        throw new IllegalArgumentException("Wrong type, expected one of " + Arrays.asList(types)
-                + ", got " + objectName);
+        throw new IllegalArgumentException(
+                "Wrong type, expected one of " + Arrays.asList(types) + ", got " + objectName);
     }
 
-    public static ObjectName createModulePattern(final String moduleName,
-                                                 final String instanceName) {
+    public static ObjectName createModulePattern(final String moduleName, final String instanceName) {
         String finalModuleName = moduleName == null ? ON_WILDCARD : moduleName;
         String finalInstanceName = instanceName == null ? ON_WILDCARD : instanceName;
 
         // do not return object names containing transaction name
-        ObjectName namePattern = ObjectNameUtil
-                .createON(ObjectNameUtil.ON_DOMAIN + ":"
-                        + ObjectNameUtil.TYPE_KEY + "="
-                        + ObjectNameUtil.TYPE_MODULE + ","
-                        + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "="
-                        + finalModuleName + "," + ""
-                        + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + finalInstanceName);
+        ObjectName namePattern = ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":" + ObjectNameUtil.TYPE_KEY + "="
+                + ObjectNameUtil.TYPE_MODULE + "," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + finalModuleName
+                + "," + "" + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + finalInstanceName);
         return namePattern;
     }
 
-    public static ObjectName createModulePattern(final String ifcName,
-                                                 final String instanceName, final String transactionName) {
+    public static ObjectName createModulePattern(final String ifcName, final String instanceName,
+            final String transactionName) {
         String finalIfcName = ifcName == null ? ON_WILDCARD : ifcName;
         String finalInstanceName = instanceName == null ? ON_WILDCARD : instanceName;
         String finalTransactionName = transactionName == null ? ON_WILDCARD : transactionName;
 
-        return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN
-                + ":type=Module," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY
-                + "=" + finalIfcName + "," + ObjectNameUtil.INSTANCE_NAME_KEY + "="
-                + finalInstanceName + "," + ObjectNameUtil.TRANSACTION_NAME_KEY
-                + "=" + finalTransactionName);
+        return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":type=Module,"
+                + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + finalIfcName + "," + ObjectNameUtil.INSTANCE_NAME_KEY
+                + "=" + finalInstanceName + "," + ObjectNameUtil.TRANSACTION_NAME_KEY + "=" + finalTransactionName);
     }
 
-    public static ObjectName createRuntimeBeanPattern(final String moduleName,
-                                                      final String instanceName) {
+    public static ObjectName createRuntimeBeanPattern(final String moduleName, final String instanceName) {
         String finalModuleName = moduleName == null ? ON_WILDCARD : moduleName;
         String finalInstanceName = instanceName == null ? ON_WILDCARD : instanceName;
 
-        return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":"
-                + ObjectNameUtil.TYPE_KEY + "="
-                + ObjectNameUtil.TYPE_RUNTIME_BEAN + ","
-                + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "=" + finalModuleName
-                + "," + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + finalInstanceName
-                + ",*");
+        return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN + ":" + ObjectNameUtil.TYPE_KEY + "="
+                + ObjectNameUtil.TYPE_RUNTIME_BEAN + "," + ObjectNameUtil.MODULE_FACTORY_NAME_KEY + "="
+                + finalModuleName + "," + ObjectNameUtil.INSTANCE_NAME_KEY + "=" + finalInstanceName + ",*");
 
     }
 
-    public static ModuleIdentifier fromON(final ObjectName objectName,
-                                          final String expectedType) {
+    public static ModuleIdentifier fromON(final ObjectName objectName, final String expectedType) {
         checkType(objectName, expectedType);
         String factoryName = getFactoryName(objectName);
         if (factoryName == null) {
-            throw new IllegalArgumentException(
-                    "ObjectName does not contain module name");
+            throw new IllegalArgumentException("ObjectName does not contain module name");
         }
         String instanceName = getInstanceName(objectName);
         if (instanceName == null) {
-            throw new IllegalArgumentException(
-                    "ObjectName does not contain instance name");
+            throw new IllegalArgumentException("ObjectName does not contain instance name");
         }
         return new ModuleIdentifier(factoryName, instanceName);
     }
index eae93e4d56b7dd7cdbf8fb39e8e3569a23f9438c..08e6d18c6433d80fc8fc98ec81e2630d6caaaa95 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -25,7 +25,8 @@ public class ConfigRegistryConstants {
 
     public static final ObjectName OBJECT_NAME = createONWithDomainAndType(TYPE_CONFIG_REGISTRY);
 
-    public static final ObjectName OBJECT_NAME_NO_NOTIFICATIONS = createONWithDomainAndType(TYPE_CONFIG_REGISTRY_NO_NOTIFICATIONS);
+    public static final ObjectName OBJECT_NAME_NO_NOTIFICATIONS = createONWithDomainAndType(
+            TYPE_CONFIG_REGISTRY_NO_NOTIFICATIONS);
 
     public static final String GET_AVAILABLE_MODULE_NAMES_ATTRIBUT_NAME = "AvailableModuleNames";
 
index ef538188914b32c21847eb81a79093725bb8bfac..2c794705636f7868746671660f8e97e3f2382dfc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,7 +15,8 @@ public class CommitJMXNotification extends ConfigJMXNotification {
     private static final String AFTER_COMMIT_MESSAGE_TEMPLATE = "Commit successful: %s";
 
     CommitJMXNotification(final NotificationBroadcasterSupport source, final String message) {
-        super(ConfigJMXNotification.NotificationType.COMMIT,  source, String.format(AFTER_COMMIT_MESSAGE_TEMPLATE, message));
+        super(ConfigJMXNotification.NotificationType.COMMIT, source,
+                String.format(AFTER_COMMIT_MESSAGE_TEMPLATE, message));
     }
 
     @Override
@@ -23,9 +24,5 @@ public class CommitJMXNotification extends ConfigJMXNotification {
         return "CommitJMXNotification{}";
     }
 
-    /**
-     *
-     */
     private static final long serialVersionUID = -8587623362011695514L;
-
 }
index 842c30aaa53c1a0d1e531b1af14b3dbb8065d77c..0d804c597349f63bc56df167c45d7ece5960a00b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,20 +15,17 @@ import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
 
 public abstract class ConfigJMXNotification extends Notification {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = 6754474563863772845L;
 
     private static long sequenceNumber = 1;
 
-    public static String TYPE_NAME = "configfNotificationProvider";
-    public static ObjectName OBJECT_NAME = ObjectNameUtil.createONWithDomainAndType(TYPE_NAME);
+    public static final String TYPE_NAME = "configfNotificationProvider";
+    public static final ObjectName OBJECT_NAME = ObjectNameUtil.createONWithDomainAndType(TYPE_NAME);
 
     private final NotificationType type;
 
-    protected ConfigJMXNotification(final NotificationType type,
-                                    final NotificationBroadcasterSupport source, final String message) {
+    protected ConfigJMXNotification(final NotificationType type, final NotificationBroadcasterSupport source,
+            final String message) {
         super(type.toString(), source, sequenceNumber++, System.nanoTime(), message);
         this.type = type;
     }
@@ -39,23 +36,22 @@ public abstract class ConfigJMXNotification extends Notification {
     }
 
     /**
-     * Sends this notification using source that created it
+     * Sends this notification using source that created it.
      */
     public void send() {
         ((NotificationBroadcasterSupport) getSource()).sendNotification(this);
     }
 
     /**
-     * Creates notification about successful commit execution.
-     *
-     * Intended for config-persister.
+     * Creates notification about successful commit execution. Intended for
+     * config-persister.
      */
-    public static CommitJMXNotification afterCommit(final NotificationBroadcasterSupport source, final String messages) {
+    public static CommitJMXNotification afterCommit(final NotificationBroadcasterSupport source,
+            final String messages) {
         return new CommitJMXNotification(source, messages);
     }
 
     enum NotificationType {
         COMMIT
     }
-
 }
index e06d7002dd9aeeee5c668e032598cf347e7deab6..839612cb18320c075a5f2d7e46725fb954ded7aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016, 2017 Brocade Communications Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -36,34 +36,39 @@ public final class WaitingServiceTracker<T> implements AutoCloseable {
     /**
      * Waits for an OSGi services.
      *
-     * @param timeoutInMillis the timeout in millis
+     * @param timeoutInMillis
+     *            the timeout in millis
      * @return the service instance
-     * @throws ServiceNotFoundException if it times out or is interrupted
+     * @throws ServiceNotFoundException
+     *             if it times out or is interrupted
      */
     @SuppressWarnings("unchecked")
     public T waitForService(final long timeoutInMillis) throws ServiceNotFoundException {
         try {
             T service = (T) tracker.waitForService(timeoutInMillis);
-            if(service == null) {
-                throw new ServiceNotFoundException(String.format("OSGi Service %s was not found after %d ms",
-                        serviceInterface, timeoutInMillis));
+            if (service == null) {
+                throw new ServiceNotFoundException(
+                        String.format("OSGi Service %s was not found after %d ms", serviceInterface, timeoutInMillis));
             }
 
             return service;
-        } catch(final InterruptedException e) {
-            throw new ServiceNotFoundException(String.format("Wait for OSGi service %s was interrrupted",
-                    serviceInterface));
+        } catch (final InterruptedException e) {
+            throw new ServiceNotFoundException(
+                    String.format("Wait for OSGi service %s was interrrupted", serviceInterface));
         }
     }
 
     /**
      * Creates an instance.
      *
-     * @param serviceInterface the service interface
-     * @param context the BundleContext
+     * @param serviceInterface
+     *            the service interface
+     * @param context
+     *            the BundleContext
      * @return new WaitingServiceTracker instance
      */
-    public static <T> WaitingServiceTracker<T> create(@Nonnull final Class<T> serviceInterface, @Nonnull final BundleContext context) {
+    public static <T> WaitingServiceTracker<T> create(@Nonnull final Class<T> serviceInterface,
+            @Nonnull final BundleContext context) {
         ServiceTracker<T, ?> tracker = new ServiceTracker<>(context, serviceInterface, null);
         tracker.open();
         return new WaitingServiceTracker<>(serviceInterface, tracker);
@@ -72,31 +77,28 @@ public final class WaitingServiceTracker<T> implements AutoCloseable {
     /**
      * Creates an instance.
      *
-     * @param serviceInterface the service interface
-     * @param context the BundleContext
-     * @param filter the OSGi service filter
+     * @param serviceInterface
+     *            the service interface
+     * @param context
+     *            the BundleContext
+     * @param filter
+     *            the OSGi service filter
      * @return new WaitingServiceTracker instance
      */
-    public static <T> WaitingServiceTracker<T> create(@Nonnull final Class<T> serviceInterface, @Nonnull final BundleContext context,
-            @Nonnull final String filter) {
+    public static <T> WaitingServiceTracker<T> create(@Nonnull final Class<T> serviceInterface,
+            @Nonnull final BundleContext context, @Nonnull final String filter) {
         String newFilter = String.format("(&(%s=%s)%s)", Constants.OBJECTCLASS, serviceInterface.getName(), filter);
         try {
             ServiceTracker<T, ?> tracker = new ServiceTracker<>(context, context.createFilter(newFilter), null);
             tracker.open();
             return new WaitingServiceTracker<>(serviceInterface, tracker);
-        } catch(final InvalidSyntaxException e) {
+        } catch (final InvalidSyntaxException e) {
             throw new IllegalArgumentException(String.format("Invalid OSGi filter %s", newFilter), e);
         }
     }
 
     @Override
     public void close() {
-        try {
-            tracker.close();
-        } catch(final RuntimeException e) {
-            // The ServiceTracker could throw IllegalStateException if the BundleContext is already closed.
-            // This is benign so ignore it.
-            LOG.debug("Error closing ServiceTracker", e);
-        }
+        tracker.close();
     }
 }
index b7ac7733c9b2afa8789c36f9959d599043a9fec3..b4a7ed16b368e94c5efc8975a36ed11f45395720 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.config.api.runtime;
 
 /**
- * Marker interface for all runtime beans
+ * Marker interface for all runtime beans.
  */
 
 public interface RuntimeBean {
index b9addee95259a57b96f6fd148e99c9e8efec700e..12287c00f5620a99b4fa3db0c89c705ce9b01fa1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -14,10 +14,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Base implementation of Module. This implementation contains base logic for Module reconfiguration with associated fields.
- * @param <M> Type of module implementation. Enables easier implementation for the <code>isSame()</code> method
+ * Base implementation of Module. This implementation contains base logic for
+ * Module reconfiguration with associated fields.
+ *
+ * @param <M>
+ *            Type of module implementation. Enables easier implementation for
+ *            the <code>isSame()</code> method
  */
-public abstract class AbstractModule<M extends AbstractModule<M>> implements org.opendaylight.controller.config.spi.Module {
+public abstract class AbstractModule<M extends AbstractModule<M>>
+        implements org.opendaylight.controller.config.spi.Module {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractModule.class);
 
@@ -32,8 +37,10 @@ public abstract class AbstractModule<M extends AbstractModule<M>> implements org
     /**
      * Called when module is configured.
      *
-     * @param identifier id of current instance.
-     * @param dependencyResolver resolver used in dependency injection and validation.
+     * @param identifier
+     *            id of current instance.
+     * @param dependencyResolver
+     *            resolver used in dependency injection and validation.
      */
     public AbstractModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
         this(identifier, dependencyResolver, null, null);
@@ -42,12 +49,19 @@ public abstract class AbstractModule<M extends AbstractModule<M>> implements org
     /**
      * Called when module is reconfigured.
      *
-     * @param identifier id of current instance.
-     * @param dependencyResolver resolver used in dependency injection and validation.
-     * @param oldModule old instance of module that is being reconfigred(replaced) by current instance. The old instance can be examined for reuse.
-     * @param oldInstance old instance wrapped by the old module. This is the resource that is actually being reused if possible or closed otherwise.
+     * @param identifier
+     *            id of current instance.
+     * @param dependencyResolver
+     *            resolver used in dependency injection and validation.
+     * @param oldModule
+     *            old instance of module that is being reconfigred(replaced) by
+     *            current instance. The old instance can be examined for reuse.
+     * @param oldInstance
+     *            old instance wrapped by the old module. This is the resource that
+     *            is actually being reused if possible or closed otherwise.
      */
-    public AbstractModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver, final M oldModule, final AutoCloseable oldInstance) {
+    public AbstractModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
+            final M oldModule, final AutoCloseable oldInstance) {
         this.identifier = identifier;
         this.dependencyResolver = dependencyResolver;
         this.oldModule = oldModule;
@@ -64,12 +78,13 @@ public abstract class AbstractModule<M extends AbstractModule<M>> implements org
     }
 
     /**
-     *
      * General algorithm for spawning/closing and reusing wrapped instances.
      *
-     * @return current instance of wrapped resource either by reusing the old one (if present) or constructing a brand new.
+     * @return current instance of wrapped resource either by reusing the old one
+     *         (if present) or constructing a brand new.
      */
     @Override
+    @SuppressWarnings("IllegalCatch")
     public final AutoCloseable getInstance() {
         if (instance == null) {
             if (oldInstance != null && canReuseInstance && canReuseInstance(oldModule)) {
@@ -79,18 +94,22 @@ public abstract class AbstractModule<M extends AbstractModule<M>> implements org
                 if (oldInstance != null) {
                     try {
                         oldInstance.close();
-                    } catch (final Exception e) {
-                        LOG.error("An error occurred while closing old instance {} for module {}", oldInstance, getIdentifier(), e);
+                    } catch (final Exception exception) {
+                        LOG.error("An error occurred while closing old instance {} for module {}", oldInstance,
+                                getIdentifier(), exception);
                     }
                 }
                 resolveDependencies();
                 instance = createInstance();
                 if (instance == null) {
-                    throw new IllegalStateException("Error in createInstance - null is not allowed as return value. Module: " + getIdentifier());
+                    throw new IllegalStateException(
+                            "Error in createInstance - null is not allowed as return value. Module: "
+                                    + getIdentifier());
                 }
             }
 
-            // Prevent serial memory leak: clear these references as we will not use them again.
+            // Prevent serial memory leak: clear these references as we will not use them
+            // again.
             oldInstance = null;
             oldModule = null;
         }
@@ -99,35 +118,45 @@ public abstract class AbstractModule<M extends AbstractModule<M>> implements org
     }
 
     /**
-     * @return Brand new instance of wrapped class in case no previous instance is present or reconfiguration is impossible.
+     * Create instance.
+     *
+     * @return Brand new instance of wrapped class in case no previous instance is
+     *         present or reconfiguration is impossible.
      */
     protected abstract AutoCloseable createInstance();
 
     @Override
     public final boolean canReuse(final Module oldModule) {
         // Just cast into a specific instance
-        // TODO unify this method with canReuseInstance (required Module interface to be generic which requires quite a lot of changes)
+        // TODO unify this method with canReuseInstance (required Module interface to be
+        // generic which requires quite a lot of changes)
         return canReuseInstance && getClass().isInstance(oldModule) ? canReuseInstance((M) oldModule) : false;
     }
 
     /**
+     * Users are welcome to override this method to provide custom logic for
+     * advanced reusability detection.
      *
-     * Users are welcome to override this method to provide custom logic for advanced reusability detection.
-     *
-     * @param oldModule old instance of a Module
-     * @return true if the old instance is reusable false if a new one should be spawned
+     * @param oldModule
+     *            old instance of a Module
+     * @return true if the old instance is reusable false if a new one should be
+     *         spawned
      */
-    protected abstract boolean canReuseInstance(final M oldModule);
+    protected abstract boolean canReuseInstance(M oldModule);
 
     /**
-     * By default the oldInstance is returned since this method is by default called only if the oldModule had the same configuration and dependencies configured.
-     * Users are welcome to override this method to provide custom logic for advanced reusability.
+     * By default the oldInstance is returned since this method is by default called
+     * only if the oldModule had the same configuration and dependencies configured.
+     * Users are welcome to override this method to provide custom logic for
+     * advanced reusability.
      *
-     * @param oldInstance old instance of a class wrapped by the module
+     * @param oldInstance
+     *            old instance of a class wrapped by the module
      * @return reused instance
      */
     protected AutoCloseable reuseInstance(final AutoCloseable oldInstance) {
-        // implement if instance reuse should be supported. Override canReuseInstance to change the criteria.
+        // implement if instance reuse should be supported. Override canReuseInstance to
+        // change the criteria.
         return oldInstance;
     }
 
index 4766ad8a47d3ce2c9ffc1a6f81ea11bf3818905a..ad4f2d36c45908e7cb3e246f662f9214ad472467 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,7 +11,6 @@ import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
-
 /**
  * Represents one service that is to be configured. These methods need to be
  * implemented in addition to the usual attribute getters/setters. Dependencies
@@ -19,7 +18,8 @@ import org.opendaylight.yangtools.concepts.Identifiable;
  * ConfigBeans.
  * <p>
  * In order to guide dependency resolution, the setter method should be
- * annotated with {@link org.opendaylight.controller.config.api.annotations.RequireInterface}.
+ * annotated with
+ * {@link org.opendaylight.controller.config.api.annotations.RequireInterface}.
  * </p>
  * <p>
  * Thread safety note: implementations of this interface are not required to be
@@ -27,44 +27,43 @@ import org.opendaylight.yangtools.concepts.Identifiable;
  * </p>
  */
 @NotThreadSafe
-public interface Module extends Identifiable<ModuleIdentifier>{
+public interface Module extends Identifiable<ModuleIdentifier> {
     /**
-     * This method will be called as first phase in two phase commit. Instance
-     * can check attributes, but is not allowed to do any kind of work that
-     * could leave any resources open. It is prohibited to call
-     * {@link #getInstance()} on dependent {@link Module} because it would
-     * destroy separation between validation and commit phase.
+     * This method will be called as first phase in two phase commit. Instance can
+     * check attributes, but is not allowed to do any kind of work that could leave
+     * any resources open. It is prohibited to call {@link #getInstance()} on
+     * dependent {@link Module} because it would destroy separation between
+     * validation and commit phase.
      *
      */
     void validate();
 
     /**
-     * Returns 'live' object that was configured using this object. It is
-     * allowed to call this method only after all ConfigBeans were validated. In
-     * this method new resources might be opened or old instance might be
-     * modified. This method must be implemented so that it returns same
-     * result for a single transaction. Since Module is created per transaction
-     * this means that it must be safe to cache result of first call.
+     * Returns 'live' object that was configured using this object. It is allowed to
+     * call this method only after all ConfigBeans were validated. In this method
+     * new resources might be opened or old instance might be modified. This method
+     * must be implemented so that it returns same result for a single transaction.
+     * Since Module is created per transaction this means that it must be safe to
+     * cache result of first call.
      *
      *
-     * @return closeable instance: After bundle update the factory might be able
-     *         to copy old configuration into new one without being able to cast
-     *         Module or the instance. Thus to clean up old instance, it will
-     *         call close().
+     * @return closeable instance: After bundle update the factory might be able to
+     *         copy old configuration into new one without being able to cast Module
+     *         or the instance. Thus to clean up old instance, it will call close().
      */
     AutoCloseable getInstance();
 
-
     /**
      * Compare current module with oldModule and if the instance/live object
      * produced by the old module can be reused in this module as well return true.
-     * Typically true should be returned if the old module had the same configuration.
+     * Typically true should be returned if the old module had the same
+     * configuration.
      *
      *
-     * @param oldModule old instance of Module
-     * @return true if the instance produced by oldModule can be reused with current instance as well.
+     * @param oldModule
+     *            old instance of Module
+     * @return true if the instance produced by oldModule can be reused with current
+     *         instance as well.
      */
     boolean canReuse(Module oldModule);
-
-
 }
index 1a8c140c63870544bb8f8df5b5c4b10968e6c5db..37dcd65d0afd47d72e678602b53fa509e28cad3f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -19,15 +19,16 @@ import org.osgi.framework.BundleContext;
  * needs to be exported into the OSGi Service Registry. Such an instance
  * provides metadata describing services which can be published from it.
  *
+ * <p>
  * Each {@link Module} can optionally be instantiated with a
- * {@link javax.management.DynamicMBean} which represents the configuration of the currently
- * running instance.
+ * {@link javax.management.DynamicMBean} which represents the configuration of
+ * the currently running instance.
  */
 public interface ModuleFactory {
 
     /**
-     * Returns the human-friendly implementation name. This value needs to be
-     * unique within all implementations of all interfaces returned by
+     * Returns the human-friendly implementation name. This value needs to be unique
+     * within all implementations of all interfaces returned by
      * getImplementedInterfaces().
      *
      * @return human-friendly implementation name
@@ -42,24 +43,25 @@ public interface ModuleFactory {
      * @param dependencyResolver
      *            This resolver will return actual config mbean based on its
      *            ObjectName.
-     * @param bundleContext Reference to OSGi bundleContext that can be used to
-     *                      acquire OSGi services, startup configuration and other
-     *                      OSGi related information.
+     * @param bundleContext
+     *            Reference to OSGi bundleContext that can be used to acquire OSGi
+     *            services, startup configuration and other OSGi related
+     *            information.
      *
      * @return newly created module
      *
      */
-    Module createModule(String instanceName,
-            DependencyResolver dependencyResolver, BundleContext bundleContext);
+    Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext);
 
     /**
      * Create a new Module instance. The returned object is expected to use the
      * dependencyResolver provided when resolving ObjectNames to actual Module
-     * instances. A reference to an abstract view of the previous configuration
-     * is also provided in the form of a {@link javax.management.DynamicMBean}. Implementations
-     * should use the MBeanInfo interface to understand the structure of the
-     * configuration information.
+     * instances. A reference to an abstract view of the previous configuration is
+     * also provided in the form of a {@link javax.management.DynamicMBean}.
+     * Implementations should use the MBeanInfo interface to understand the
+     * structure of the configuration information.
      *
+     * <p>
      * Structural information impacts hot-swap operations in that in order to
      * perform such a swap the newly loaded code needs to understand the
      * previously-running instance configuration layout and how to map it onto
@@ -70,49 +72,49 @@ public interface ModuleFactory {
      *            ObjectName.
      * @param old
      *            existing module from platform MBeanServer that is being
-     *            reconfigured. Implementations should inspect its attributes
-     *            using {@link javax.management.DynamicMBean#getAttribute(String)} and set those
-     *            attributes on newly created module. If reconfiguration of live
-     *            instances is supported, this live instance can be retreived
+     *            reconfigured. Implementations should inspect its attributes using
+     *            {@link javax.management.DynamicMBean#getAttribute(String)} and set
+     *            those attributes on newly created module. If reconfiguration of
+     *            live instances is supported, this live instance can be retreived
      *            using
      *            {@link org.opendaylight.controller.config.api.DynamicMBeanWithInstance#getInstance()}
      *            . It is possible that casting this old instance throws
-     *            {@link ClassCastException} when OSGi bundle is being updated.
-     *            In this case, implementation should revert to creating new
-     *            instance.
-     * @param bundleContext Reference to OSGi bundleContext that can be used to
-     *                      acquire OSGi services, startup configuration and other
-     *                      OSGi related information.
+     *            {@link ClassCastException} when OSGi bundle is being updated. In
+     *            this case, implementation should revert to creating new instance.
+     * @param bundleContext
+     *            Reference to OSGi bundleContext that can be used to acquire OSGi
+     *            services, startup configuration and other OSGi related
+     *            information.
      *
      * @return newly created module
      * @throws Exception
      *             if it is not possible to recover configuration from old. This
-     *             leaves server in a running state but no configuration
-     *             transaction can be created.
+     *             leaves server in a running state but no configuration transaction
+     *             can be created.
      */
-    Module createModule(String instanceName, DependencyResolver dependencyResolver,
-            DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception;
+    Module createModule(String instanceName, DependencyResolver dependencyResolver, DynamicMBeanWithInstance old,
+            BundleContext bundleContext) throws Exception;
 
-    boolean isModuleImplementingServiceInterface(
-            Class<? extends AbstractServiceInterface> serviceInterface);
+    boolean isModuleImplementingServiceInterface(Class<? extends AbstractServiceInterface> serviceInterface);
 
     Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces();
 
     /**
-     * Called when ModuleFactory is registered to config manager.
-     * Useful for populating the registry with pre-existing state. Since
-     * the method is called for each ModuleFactory separately and transaction
-     * is committed automatically, returned modules MUST be valid and commitable
-     * without any manual intervention.
+     * Called when ModuleFactory is registered to config manager. Useful for
+     * populating the registry with pre-existing state. Since the method is called
+     * for each ModuleFactory separately and transaction is committed automatically,
+     * returned modules MUST be valid and commitable without any manual
+     * intervention.
      *
-     * @param dependencyResolverFactory factory for getting dependency resolvers for each module.
-     * @param bundleContext Reference to OSGi bundleContext that can be used to
-     *                      acquire OSGi services, startup configuration and other
-     *                      OSGi related information.
+     * @param dependencyResolverFactory
+     *            factory for getting dependency resolvers for each module.
+     * @param bundleContext
+     *            Reference to OSGi bundleContext that can be used to acquire OSGi
+     *            services, startup configuration and other OSGi related
+     *            information.
      *
      * @return set of default modules. Null is not allowed.
      */
     Set<? extends Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
             BundleContext bundleContext);
-
 }
index 5533152b9a1e0e678ec3a0e6915961c95b7a9807..b3c2d7461b5a553168aa0b14337ac6ad29161834 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -55,10 +55,10 @@ public class IdentityAttributeRefTest {
     @Test
     public void testResolveIdentity() throws Exception {
         DependencyResolver res = mock(DependencyResolver.class);
-        IdentityAttributeRef a = new IdentityAttributeRef("abcd");
-        doReturn(SubIdentity.class).when(res).resolveIdentity(a, Identity.class);
-        a.resolveIdentity(res, Identity.class);
-        verify(res).resolveIdentity(a, Identity.class);
+        IdentityAttributeRef identityAttributeRef = new IdentityAttributeRef("abcd");
+        doReturn(SubIdentity.class).when(res).resolveIdentity(identityAttributeRef, Identity.class);
+        identityAttributeRef.resolveIdentity(res, Identity.class);
+        verify(res).resolveIdentity(identityAttributeRef, Identity.class);
     }
 
     @Test
index 917218277ebac8179bc3925337886b23780bf4d2..cb0bbafb3a61ec1f3a8c2cafd06eac9e21f631aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
index 4df59addc298f5142e1fc4133f2faee6a0a42551..c39710acd78abb460ac7e7cb3f477e88e914976b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -26,8 +26,9 @@ public class JmxAttributeValidationExceptionTest {
     @Test
     public void testJmxAttributeValidationExceptionElement() throws Exception {
         JmxAttribute attributeName = new JmxAttribute("attr_name");
-        JmxAttributeValidationException e = new JmxAttributeValidationException(attributeName);
-        assertThat(e.getAttributeNames(), CoreMatchers.hasItem(attributeName));
+        JmxAttributeValidationException jmxAttributeValidationException = new JmxAttributeValidationException(
+                attributeName);
+        assertThat(jmxAttributeValidationException.getAttributeNames(), CoreMatchers.hasItem(attributeName));
     }
 
     @Test
@@ -36,8 +37,9 @@ public class JmxAttributeValidationExceptionTest {
         attributeNames.add(new JmxAttribute("att1"));
         attributeNames.add(new JmxAttribute("att2"));
         attributeNames.add(new JmxAttribute("att3"));
-        JmxAttributeValidationException e = new JmxAttributeValidationException(attributeNames);
-        assertEquals(e.getAttributeNames(), attributeNames);
+        JmxAttributeValidationException jmxAttributeValidationException = new JmxAttributeValidationException(
+                attributeNames);
+        assertEquals(jmxAttributeValidationException.getAttributeNames(), attributeNames);
     }
 
     @Test
@@ -46,17 +48,17 @@ public class JmxAttributeValidationExceptionTest {
         attributeNames.add(new JmxAttribute("att1"));
         attributeNames.add(new JmxAttribute("att2"));
         attributeNames.add(new JmxAttribute("att3"));
-        JmxAttributeValidationException e = new JmxAttributeValidationException("exception str",
-                new AccessDeniedException(""), attributeNames);
-        assertEquals(e.getAttributeNames(), attributeNames);
+        JmxAttributeValidationException jmxAttributeValidationException = new JmxAttributeValidationException(
+                "exception str", new AccessDeniedException(""), attributeNames);
+        assertEquals(jmxAttributeValidationException.getAttributeNames(), attributeNames);
     }
 
     @Test
     public void testJmxAttributeValidationExceptionJmxElement() throws Exception {
         JmxAttribute attributeName = new JmxAttribute("attr_name");
-        JmxAttributeValidationException e = new JmxAttributeValidationException("exception str",
-                new AccessDeniedException(""), attributeName);
-        assertEquals(e.getAttributeNames(), Arrays.asList(attributeName));
+        JmxAttributeValidationException jmxAttributeValidationException = new JmxAttributeValidationException(
+                "exception str", new AccessDeniedException(""), attributeName);
+        assertEquals(jmxAttributeValidationException.getAttributeNames(), Arrays.asList(attributeName));
     }
 
     @Test
@@ -88,8 +90,9 @@ public class JmxAttributeValidationExceptionTest {
         JmxAttributeValidationException.checkCondition(false, "message", jmxAttribute);
     }
 
-    private void assertJmxEx(final JmxAttributeValidationException e, final String message, final JmxAttribute... attrNames) {
-        assertEquals(message, e.getMessage());
-        assertEquals(Lists.newArrayList(attrNames), e.getAttributeNames());
+    private void assertJmxEx(final JmxAttributeValidationException jmxAttributeValidationException,
+            final String message, final JmxAttribute... attrNames) {
+        assertEquals(message, jmxAttributeValidationException.getMessage());
+        assertEquals(Lists.newArrayList(attrNames), jmxAttributeValidationException.getAttributeNames());
     }
-}
\ No newline at end of file
+}
index edfcc2611324008a898d876424f4f1a394c1cc3a..2e78e69ed4b4d0a3d8bfb9f31d8706a2c14c42e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -19,12 +19,12 @@ public class ModuleIdentifierTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void testConstructor() throws Exception {
-        ModuleIdentifier m = new ModuleIdentifier(null, "instance");
+        ModuleIdentifier moduleIdentifier = new ModuleIdentifier(null, "instance");
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void testConstructor2() throws Exception {
-        ModuleIdentifier m = new ModuleIdentifier("name", null);
+        ModuleIdentifier moduleIdentifier = new ModuleIdentifier("name", null);
     }
 
     @Test
@@ -63,7 +63,7 @@ public class ModuleIdentifierTest {
 
     @Test
     public void testToString() throws Exception {
-        assertEquals( new ModuleIdentifier("factory", "instance").toString(),
+        assertEquals(new ModuleIdentifier("factory", "instance").toString(),
                 new ModuleIdentifier("factory", "instance").toString());
     }
 }
index 3f4bd858237de6fd712c9337fb1da190adb941dd..5f6db7291afaa43c73a119d38c2d2f6ce75c1d79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -26,16 +26,18 @@ public class ValidationExceptionTest {
     private final String instance2 = "instance2";
     private final ModuleIdentifier mi2 = new ModuleIdentifier("module", instance2);
     private final String message = "ex message";
-    private final Exception e = new IllegalStateException(message);
+    private final Exception exception = new IllegalStateException(message);
 
     @Test
     public void testCreateFromCollectedValidationExceptions() throws Exception {
-        ValidationException single = ValidationException.createForSingleException(mi, e);
-        ValidationException single2 = ValidationException.createForSingleException(mi2, e);
+        ValidationException single = ValidationException.createForSingleException(mi, exception);
+        ValidationException single2 = ValidationException.createForSingleException(mi2, exception);
 
-        ValidationException collected = ValidationException.createFromCollectedValidationExceptions(Lists.newArrayList(single, single2));
+        ValidationException collected = ValidationException
+                .createFromCollectedValidationExceptions(Lists.newArrayList(single, single2));
 
-        Map<String, Map<String, ValidationException.ExceptionMessageWithStackTrace>> failedMap = collected.getFailedValidations();
+        Map<String, Map<String, ValidationException.ExceptionMessageWithStackTrace>> failedMap = collected
+                .getFailedValidations();
         assertEquals(1, failedMap.size());
         assertTrue(failedMap.containsKey("module"));
 
@@ -49,8 +51,8 @@ public class ValidationExceptionTest {
 
     @Test
     public void testCreateFromCollectedValidationExceptionsWithDuplicate() throws Exception {
-        ValidationException single = ValidationException.createForSingleException(mi, e);
-        ValidationException single2 = ValidationException.createForSingleException(mi, e);
+        ValidationException single = ValidationException.createForSingleException(mi, exception);
+        ValidationException single2 = ValidationException.createForSingleException(mi, exception);
         try {
             ValidationException.createFromCollectedValidationExceptions(Lists.newArrayList(single, single2));
         } catch (final IllegalArgumentException ex) {
@@ -63,104 +65,112 @@ public class ValidationExceptionTest {
 
     @Test
     public void testGetTrace() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace();
+        ValidationException.ExceptionMessageWithStackTrace exp =
+                new ValidationException.ExceptionMessageWithStackTrace();
         exp.setTrace("trace");
         Assert.assertEquals(exp.getTrace(), "trace");
     }
 
     @Test
     public void testSetMessage() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace();
+        ValidationException.ExceptionMessageWithStackTrace exp =
+                new ValidationException.ExceptionMessageWithStackTrace();
         exp.setMessage("message");
         Assert.assertEquals(exp.getMessage(), "message");
     }
 
     @Test
     public void testHashCode() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace();
+        ValidationException.ExceptionMessageWithStackTrace exp =
+                new ValidationException.ExceptionMessageWithStackTrace();
         Assert.assertEquals(exp.hashCode(), new ValidationException.ExceptionMessageWithStackTrace().hashCode());
     }
 
     @Test
     public void testExceptionMessageWithStackTraceConstructor() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertEquals(exp, exp);
     }
 
     @Test
     public void testExceptionMessageWithStackTraceConstructor2() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertNotEquals(exp, null);
     }
 
     @Test
     public void testExceptionMessageWithStackTraceConstructor3() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertNotEquals(exp, new Exception());
     }
 
     @Test
     public void testExceptionMessageWithStackTraceConstructor4() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertEquals(exp, new ValidationException.ExceptionMessageWithStackTrace("string1", "string2"));
     }
 
     @Test
     public void testEqual() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace(null, "string2");
+                new ValidationException.ExceptionMessageWithStackTrace(
+                null, "string2");
         Assert.assertNotEquals(exp, exp2);
     }
 
     @Test
     public void testEqual2() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace("different", "string2");
+                new ValidationException.ExceptionMessageWithStackTrace(
+                "different", "string2");
         Assert.assertNotEquals(exp, exp2);
     }
 
-
     @Test
     public void testEqual3() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", null);
+                new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", null);
         Assert.assertNotEquals(exp, exp2);
     }
 
     @Test
     public void testEqual4() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "different");
+                new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "different");
         Assert.assertNotEquals(exp, exp2);
     }
 
     @Test
     public void testEqual5() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace(null, "string2");
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                null, "string2");
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+                new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertNotEquals(exp, exp2);
     }
 
     @Test
     public void testEqual6() throws Exception {
-        ValidationException.ExceptionMessageWithStackTrace exp =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", null);
+        ValidationException.ExceptionMessageWithStackTrace exp = new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", null);
         ValidationException.ExceptionMessageWithStackTrace exp2 =
-                new ValidationException.ExceptionMessageWithStackTrace("string1", "string2");
+                new ValidationException.ExceptionMessageWithStackTrace(
+                "string1", "string2");
         Assert.assertNotEquals(exp, exp2);
     }
-}
\ No newline at end of file
+}
index 299446b16ef0c381485690e9de9635a16f18f5eb..abea9c5afd5577df86706644a7ab57cd9ce3625b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -26,6 +26,7 @@ public class CommitStatusTest {
         reusedInst.add(new ObjectName("o2: key = val"));
         recreatedInst.add(new ObjectName("o3: key = k"));
     }
+
     @Test
     public void testCommitStatus() throws Exception {
         CommitStatus status = new CommitStatus(newInst, reusedInst, recreatedInst);
index e6a03135c71d31fbd4a5be1ec8034336e5a7bbb1..5fb50f700b052fe0002ff51beaff250e310c1b4f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,7 +8,6 @@
 
 package org.opendaylight.controller.config.api.jmx;
 
-
 import org.junit.Test;
 import org.opendaylight.controller.config.api.jmx.constants.ConfigRegistryConstants;
 
index 572765164c20d7c98dbd52724dac1509486d04b9..7498561eb2d6c8bc6a5ec2ca7be7deff84a090cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -45,7 +45,8 @@ public class ObjectNameUtilTest {
         assertEquals(serviceQName, ObjectNameUtil.getServiceQName(serviceReferenceON));
         assertEquals(refName, ObjectNameUtil.getReferenceName(serviceReferenceON));
         assertEquals(transaction, ObjectNameUtil.getTransactionName(serviceReferenceON));
-        assertEquals(ObjectNameUtil.createReadOnlyServiceON(serviceQName, refName), ObjectNameUtil.withoutTransactionName(serviceReferenceON));
+        assertEquals(ObjectNameUtil.createReadOnlyServiceON(serviceQName, refName),
+                ObjectNameUtil.withoutTransactionName(serviceReferenceON));
 
         serviceReferenceON = ObjectNameUtil.createReadOnlyServiceON(serviceQName, refName);
         assertFalse(serviceReferenceON.isPattern());
@@ -124,20 +125,23 @@ public class ObjectNameUtilTest {
 
     @Test
     public void testChecks() throws Exception {
-        final ObjectName on = ObjectNameUtil.createON("customDomain", ObjectNameUtil.TYPE_KEY, ObjectNameUtil.TYPE_MODULE);
+        final ObjectName on = ObjectNameUtil.createON("customDomain", ObjectNameUtil.TYPE_KEY,
+                ObjectNameUtil.TYPE_MODULE);
 
-        assertFailure(
-                () -> ObjectNameUtil.checkTypeOneOf(on, ObjectNameUtil.TYPE_RUNTIME_BEAN, ObjectNameUtil.TYPE_CONFIG_TRANSACTION), IllegalArgumentException.class);
+        assertFailure(() -> ObjectNameUtil.checkTypeOneOf(on, ObjectNameUtil.TYPE_RUNTIME_BEAN,
+                ObjectNameUtil.TYPE_CONFIG_TRANSACTION), IllegalArgumentException.class);
 
-        assertFailure(() -> ObjectNameUtil.checkType(on, ObjectNameUtil.TYPE_RUNTIME_BEAN), IllegalArgumentException.class);
+        assertFailure(() -> ObjectNameUtil.checkType(on, ObjectNameUtil.TYPE_RUNTIME_BEAN),
+                IllegalArgumentException.class);
 
         assertFailure(() -> ObjectNameUtil.checkDomain(on), IllegalArgumentException.class);
     }
 
+    @SuppressWarnings("IllegalCatch")
     private void assertFailure(final Runnable test, final Class<? extends Exception> ex) {
         try {
             test.run();
-        } catch(final Exception e) {
+        } catch (final Exception e) {
             assertTrue("Failed with wrong exception: " + Throwables.getStackTraceAsString(e),
                     e.getClass().isAssignableFrom(ex));
             return;