Removed useless parentheses 41/14241/3
authorrama-huawei <rama.subba.reddy.s@huawei.com>
Thu, 21 Sep 2017 12:50:13 +0000 (18:20 +0530)
committerRama SubbaReddy <rama.subba.reddy.s@huawei.com>
Thu, 21 Sep 2017 12:54:28 +0000 (12:54 +0000)
Added diamond symbol on RHS

Issue-ID: POLICY-239
Change-Id: I24c138703047308c2e28fef2180a0bb64400c1c9
Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java
feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java
feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java

index 2dc2e26..3b7410f 100644 (file)
@@ -87,62 +87,62 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor
        if (resourceName == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'resource.name'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'resource.name'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'resource.name'");
          }
        if (hostPort == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'hostPort'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'hostPort'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'hostPort'");
          }
        if (fpMonitorInterval == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'fp_monitor_interval'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'fp_monitor_interval'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'fp_monitor_interval'");
          }     
        if (failedCounterThreshold == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'failed_counter_threshold'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'failed_counter_threshold'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'failed_counter_threshold'");
          }     
        if (testTransInterval == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'test_trans_interval'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'test_trans_interval'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'test_trans_interval'");
          }     
        if (writeFpcInterval == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'write_fpc_interval'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'write_fpc_interval'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'write_fpc_interval'");
          }     
        if (siteName == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'site_name'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'site_name'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'site_name'");
          }     
        if (nodeType == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'node_type'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'node_type'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'node_type'");
          }     
        if (dependencyGroups == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'dependency_groups'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'dependency_groups'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'dependency_groups'");
          }     
        if (javaxPersistenceJdbcDriver == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'");
          }             
        if (javaxPersistenceJdbcUrl == null)
          {
@@ -153,14 +153,14 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor
        if (javaxPersistenceJdbcUser == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'");
          }                     
        if (javaxPersistenceJdbcPassword == null)
          {
                logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.password for xacml DB'");
-               throw(new Exception
-                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.password'  for xacml DB'"));
+               throw new Exception
+                         ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.password'  for xacml DB'");
          }             
 
        // Now that we've validated the properties, create Drools Integrity Monitor
@@ -300,7 +300,7 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor
         */
        public String getName()
        {
-         return(name);
+         return name;
        }
 
        /**
@@ -308,7 +308,7 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor
         */
        public String getResponse()
        {
-         return(response);
+         return response;
        }
 
        /**
index 84cb7e3..7eed736 100644 (file)
@@ -53,7 +53,7 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
    */
   static DroolsPDPIntegrityMonitor.AuditBase getInstance()
   {
-       return(instance);
+       return instance;
   }
 
   /**
@@ -123,8 +123,8 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
        String repositoryPassword =
          StateManagementProperties.getProperty("repository.audit.password");
        boolean upload =
-         (repositoryId != null && repositoryUrl != null
-          && repositoryUsername != null && repositoryPassword != null);
+          repositoryId != null && repositoryUrl != null
+          && repositoryUsername != null && repositoryPassword != null;
 
        // used to incrementally construct response as problems occur
        // (empty = no problems)
@@ -410,8 +410,8 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
                         "curl",
                         "--request", "DELETE",
                         "--user", repositoryUsername + ":" + repositoryPassword,
-                        (repositoryUrl + "/" + groupId.replace('.', '/') + "/" +
-                         artifactId + "/" + version))
+                        repositoryUrl + "/" + groupId.replace('.', '/') + "/" +
+                         artifactId + "/" + version)
                        != 0)
                  {
                        logger.error
@@ -437,13 +437,15 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
          (dir,
           new SimpleFileVisitor<Path>()
           {
+                @Override
                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
                   {
                         // logger.info("RepositoryAudit: Delete " + file);
                         file.toFile().delete();
-                        return(FileVisitResult.CONTINUE);
+                        return FileVisitResult.CONTINUE;
                   }
 
+                @Override
                 public FileVisitResult postVisitDirectory(Path file, IOException e)
                   throws IOException
                   {
@@ -451,11 +453,11 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
                           {
                                 // logger.info("RepositoryAudit: Delete " + file);
                                 file.toFile().delete();
-                                return(FileVisitResult.CONTINUE);
+                                return FileVisitResult.CONTINUE;
                           }
                         else
                           {
-                                throw(e);
+                                throw e;
                           }
                   }
           });
@@ -492,12 +494,12 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
        if (process.waitFor(timeoutInSeconds, TimeUnit.SECONDS))
          {
                // process terminated before the timeout
-               return(process.exitValue());
+               return process.exitValue();
          }
        
        // process timed out -- kill it, and return -1
        process.destroyForcibly();
-       return(-1);
+       return -1;
   }
 
   /* ============================================================ */
@@ -538,21 +540,22 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase
          String[] segments = artifact.split("/");
          if (segments.length != 4 && segments.length != 3)
                {
-                 throw(new IllegalArgumentException("groupId/artifactId/version/type"));
+                 throw new IllegalArgumentException("groupId/artifactId/version/type");
                }
          groupId = segments[0];
          artifactId = segments[1];
          version = segments[2];
-         type = (segments.length == 4 ? segments[3] : "jar");
+         type = segments.length == 4 ? segments[3] : "jar";
        }
 
        /**
         * @return the artifact id in the form:
         *              "<groupId>/<artifactId>/<version>/<type>"
         */
+       @Override
        public String toString()
        {
-         return(groupId + "/" + artifactId + "/" + version + "/" + type);
+         return groupId + "/" + artifactId + "/" + version + "/" + type;
        }
   }
 }
index c8e17ea..f90f748 100644 (file)
@@ -38,6 +38,9 @@ public class StateManagementProperties {
        public static final String DB_PWD = "javax.persistence.jdbc.password";
        
        private static Properties properties = null;
+
+       private StateManagementProperties(){
+       }
        /*
         * Initialize the parameter values from the feature-state-management.properties file values
         * 
index 34c8589..d0b625d 100644 (file)
@@ -190,13 +190,13 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
         * Policy Controller Name Index
         */
        protected HashMap<String,PolicyController> policyControllers =
-                       new HashMap<String,PolicyController>();
+                       new HashMap<>();
        
        /**
         * Group/Artifact Ids Index
         */
        protected HashMap<String,PolicyController> coordinates2Controller = 
-                       new HashMap<String,PolicyController>();
+                       new HashMap<>();
        
        /**
         * produces key for indexing controller names
@@ -479,7 +479,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
        @Override
        public List<PolicyController> inventory() {
                 List<PolicyController> controllers = 
-                                new ArrayList<PolicyController>(this.policyControllers.values());
+                                new ArrayList<>(this.policyControllers.values());
                 return controllers;
        }
        
@@ -488,7 +488,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
         */
        @Override 
        public List<String> getFeatures() {
-               List<String> features = new ArrayList<String>();
+               List<String> features = new ArrayList<>();
                for (PolicyControllerFeatureAPI feature : PolicyControllerFeatureAPI.providers.getList()) {
                        features.add(feature.getName());
                }