Fix remaining sonar 44/69644/1
authorPamela Dragosh <pdragosh@research.att.com>
Tue, 2 Oct 2018 00:42:36 +0000 (20:42 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Tue, 2 Oct 2018 00:42:42 +0000 (20:42 -0400)
Mostly moving variables to their right spot.

Issue-ID: POLICY-1129
Change-Id: Iccc084bbb404ffd51bdd0b26b5f8c373c6142fb1
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java
controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java

index 790d434..909fa93 100644 (file)
@@ -47,6 +47,11 @@ import org.slf4j.LoggerFactory;
  */
 public interface ControlLoopMetrics {
 
+    /**
+     * Singleton manager object.
+     */
+    ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
+
     /**
      * Gets all transaction identifiers being monitored.
      *
@@ -131,11 +136,6 @@ public interface ControlLoopMetrics {
      * Refresh underlying transaction management.
      */
     void refresh();
-
-    /**
-     * Singleton manager object.
-     */
-    ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
 }
 
 
index 865a442..e4849ce 100644 (file)
@@ -30,9 +30,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PolicyGuard {
-    private PolicyGuard() {
-        // Cannot instantiate this static class
-    }
 
     private static final Logger logger = LoggerFactory.getLogger(PolicyGuard.class);
     
@@ -45,10 +42,6 @@ public class PolicyGuard {
         private A parameterA;
         private B parameterB;
 
-        public static <A, B> LockResult<A, B> createLockResult(A parameterA, B parameterB) {
-            return new LockResult<>(parameterA, parameterB);
-        }
-
         public LockResult(A parameterA, B parameterB) {
             this.parameterA = parameterA;
             this.parameterB = parameterB;
@@ -61,8 +54,16 @@ public class PolicyGuard {
         public B getB() {
             return parameterB;
         }
+        
+        public static <A, B> LockResult<A, B> createLockResult(A parameterA, B parameterB) {
+            return new LockResult<>(parameterA, parameterB);
+        }
     }
     
+    private PolicyGuard() {
+        // Cannot instantiate this static class
+    }
+
     /**
      * Get the factory.
      * 
index ec4ebf9..35b1d25 100644 (file)
@@ -54,6 +54,12 @@ public class PolicyGuardXacmlHelper {
     // Constant for the systme line separator
     private static final String SYSTEM_LS = System.lineSeparator();
 
+    private UrlEntry[] restUrls = null;
+    private int restUrlIndex = 0;
+
+    // REST timeout, initialized from 'pdpx.timeout' property
+    private int timeout = 20000;
+
     public PolicyGuardXacmlHelper() {
         init(PolicyEngine.manager.getEnvironment());
     }
@@ -72,12 +78,6 @@ public class PolicyGuardXacmlHelper {
         String environment = null;
     }
 
-    private UrlEntry[] restUrls = null;
-    private int restUrlIndex = 0;
-
-    // REST timeout, initialized from 'pdpx.timeout' property
-    private int timeout = 20000;
-
     /**
      * Call PDP.
      * 
index 66ac3e6..cad32c2 100644 (file)
@@ -32,6 +32,11 @@ public class ControlLoopGuard {
         //DO Nothing Empty Constructor
     }
     
+    public ControlLoopGuard(ControlLoopGuard clGuard) {
+        this.guard = new Guard();
+        this.guards = new LinkedList<>(clGuard.guards);
+    }
+    
     public Guard getGuard() {
         return guard;
     }
@@ -48,11 +53,6 @@ public class ControlLoopGuard {
         this.guards = guards;
     }
 
-    public ControlLoopGuard(ControlLoopGuard clGuard) {
-        this.guard = new Guard();
-        this.guards = new LinkedList<>(clGuard.guards);
-    }
-    
     @Override
     public String toString() {
         return "Guard [guard=" + guard + ", GuardPolicies=" + guards + "]";