summaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-21 20:08:11 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-24 15:30:14 -0400
commita24a985d328b97f50a41d3448d235866af625ca9 (patch)
tree06c95950000fc2b512ec1e4da5aded2c5bc84e78 /controlloop/common/guard/src/main
parent3c52de0725c942fe1f2fdeb05c8960645bc66f01 (diff)
Fix checkstyle declarations
I fixed what I thought would be tolerable for this release. Same issue as policy/common I had to defined the checkstyle in each repo where the suppressions were needed. Issue-ID: POLICY-1135 Change-Id: I8f30bee7e9cddc692ddad3cf88acedb2e6b4781b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/guard/src/main')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java11
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java34
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java32
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java12
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java6
8 files changed, 49 insertions, 64 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
index 146f42170..59a1816b7 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
@@ -20,6 +20,8 @@
package org.onap.policy.guard;
+import com.att.research.xacml.api.DataTypeException;
+import com.att.research.xacml.std.annotations.RequestParser;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@@ -27,8 +29,6 @@ import java.util.function.Supplier;
import org.drools.core.WorkingMemory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.research.xacml.api.DataTypeException;
-import com.att.research.xacml.std.annotations.RequestParser;
public class CallGuardTask implements Runnable {
@@ -36,14 +36,14 @@ public class CallGuardTask implements Runnable {
/**
* Actor/recipe pairs whose guard requests need a VF Module count. Each element is of
- * the form "<actor>:<recipe>".
+ * the form "&lt;actor&gt;:&lt;recipe&gt;".
*/
private static final Set<String> NEEDS_VF_COUNT = new HashSet<>();
/**
* Actor/recipe pairs whose guard requests need the VF Module count to be incremented
* (i.e., because a module is being added). Each element is of the form
- * "<actor>:<recipe>".
+ * "&lt;actor&gt;:&lt;recipe&gt;".
*/
private static final Set<String> INCR_VF_COUNT = new HashSet<>();
@@ -69,7 +69,8 @@ public class CallGuardTask implements Runnable {
/**
* Guard url is grabbed from PolicyEngine.manager properties
*/
- public CallGuardTask(WorkingMemory wm, String cl, String act, String rec, String tar, String reqId, Supplier<Integer> vfcnt) {
+ public CallGuardTask(WorkingMemory wm, String cl, String act,
+ String rec, String tar, String reqId, Supplier<Integer> vfcnt) {
workingMemory = wm;
clname = cl;
actor = act;
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
index 40b26c847..36bb36f5c 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
@@ -39,14 +39,12 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Properties;
import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.NoResultException;
-import javax.persistence.NonUniqueResultException;
import javax.persistence.Persistence;
import javax.persistence.Query;
@@ -66,26 +64,12 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
private static final String XML_SCHEMA_STRING = "http://www.w3.org/2001/XMLSchema#string";
- private static final String XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT =
- "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
- private static final String XACML_ACTOR_ACTOR_ID = "urn:oasis:names:tc:xacml:1.0:actor:actor-id";
- private static final String XACML_ATTRIBUTE_CATEGORY_ACTION =
- "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
- private static final String XACML_OPERATION_OPERATION_ID = "urn:oasis:names:tc:xacml:1.0:operation:operation-id";
private static final String XACML_ATTRIBUTE_CATEGORY_RESOURCE =
"urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
private static final String XACML_TARGET_TARGET_ID = "urn:oasis:names:tc:xacml:1.0:target:target-id";
private static final String XACML_TEST_SQL_RESOURCE_OPERATIONS_STATUS =
"com:att:research:xacml:test:sql:resource:operations:status";
- private static final PIPRequest PIP_REQUEST_ACTOR =
- new StdPIPRequest(new IdentifierImpl(XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT),
- new IdentifierImpl(XACML_ACTOR_ACTOR_ID), new IdentifierImpl(XML_SCHEMA_STRING));
-
- private static final PIPRequest PIP_REQUEST_RECIPE =
- new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_ACTION),
- new IdentifierImpl(XACML_OPERATION_OPERATION_ID), new IdentifierImpl(XML_SCHEMA_STRING));
-
private static final PIPRequest PIP_REQUEST_TARGET =
new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_RESOURCE),
new IdentifierImpl(XACML_TARGET_TARGET_ID), new IdentifierImpl(XML_SCHEMA_STRING));
@@ -121,7 +105,7 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
} else if (!issuer.contains(this.getIssuer())) {
// Notice, we are checking here for the base issuer prefix.
logger.debug("Requested issuer '{}' does not match {}", issuer, getIssuer());
- logger.debug("Status PIP - Issuer {} does not match with: ", issuer, this.getIssuer());
+ logger.debug("Status PIP - Issuer {} does not match with: {}", issuer, this.getIssuer());
return StdPIPResponse.PIP_RESPONSE_EMPTY;
}
@@ -282,13 +266,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
// Run the query
//
String ret = null;
- try{
+ try {
ret = ((String)nq.getSingleResult());
- } catch(NoResultException ex) {
+ } catch (NoResultException ex) {
logger.debug("NoResultException for getSingleResult()");
ret = "NO_MATCHING_ENTRY";
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception", ex);
}
if (ret != null) {
logger.debug("SQL query result: {}", ret);
@@ -298,13 +282,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
//
try {
em.close();
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception ", ex);
}
try {
emf.close();
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception ", ex);
}
return ret;
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
index a7b4f73f2..865a442b9 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
@@ -85,28 +85,28 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @return the TargetLock
* @throws IllegalArgumentException if an argument is null
*/
public static TargetLock createTargetLock(TargetType targetType, String targetInstance,
- UUID requestID, LockCallback callback) {
+ UUID requestId, LockCallback callback) {
switch (targetType) {
case PNF:
//
// Create the Lock object
//
- return new PNFTargetLock(targetType, targetInstance, requestID, callback);
+ return new PNFTargetLock(targetType, targetInstance, requestId, callback);
case VM:
//
// Create the Lock object
//
- return new VMTargetLock(targetType, targetInstance, requestID, callback);
+ return new VMTargetLock(targetType, targetInstance, requestId, callback);
case VNF:
//
// Create the Lock object
//
- return new VNFTargetLock(targetType, targetInstance, requestID, callback);
+ return new VNFTargetLock(targetType, targetInstance, requestId, callback);
default:
logger.error("invalid target type {} for lock on {}", targetType, targetInstance);
return null;
@@ -118,21 +118,21 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @param callback the LockCallback
* @param holdSec maximum number of seconds to hold the lock
* @return the LockResult
* @throws IllegalArgumentException if an argument is null
*/
public static LockResult<GuardResult, TargetLock> lockTarget(TargetType targetType, String targetInstance,
- UUID requestID, LockCallback callback, int holdSec) {
- String owner = makeOwner(targetType, requestID);
+ UUID requestId, LockCallback callback, int holdSec) {
+ String owner = makeOwner(targetType, requestId);
boolean result = factory.getManager().lock(targetInstance, owner, holdSec);
if (!result) {
return LockResult.createLockResult(GuardResult.LOCK_DENIED, null);
}
- TargetLock lock = createTargetLock(targetType, targetInstance, requestID, callback);
+ TargetLock lock = createTargetLock(targetType, targetInstance, requestId, callback);
if (lock == null) {
//
// Bad lock type: unlock and return exception result
@@ -188,12 +188,12 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @return <code>true</code> if the target is locked, <code>false</code> otherwise
* @throws IllegalArgumentException if an argument is null
*/
- public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestID) {
- String owner = makeOwner(targetType, requestID);
+ public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestId) {
+ String owner = makeOwner(targetType, requestId);
return factory.getManager().isLockedBy(targetInstance, owner);
}
@@ -204,16 +204,16 @@ public class PolicyGuard {
* @return the "owner" of a resource
* @throws IllegalArgumentException if either argument is null
*/
- private static String makeOwner(TargetType targetType, UUID requestID) {
+ private static String makeOwner(TargetType targetType, UUID requestId) {
if (targetType == null) {
- throw new IllegalArgumentException("null targetType for lock request id " + requestID);
+ throw new IllegalArgumentException("null targetType for lock request id " + requestId);
}
- if (requestID == null) {
+ if (requestId == null) {
throw new IllegalArgumentException("null requestID for lock type " + targetType);
}
- return targetType + ":" + requestID;
+ return targetType + ":" + requestId;
}
/**
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
index bca31d904..5cb080fa5 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,14 +33,14 @@ public class PolicyGuardRequest {
*
* @param actor the actor
* @param target the target
- * @param requestID the request Id
+ * @param requestId the request Id
* @param operation the operation
*/
- public PolicyGuardRequest(String actor, String target, UUID requestID, String operation) {
+ public PolicyGuardRequest(String actor, String target, UUID requestId, String operation) {
super();
this.actor = actor;
this.target = target;
- this.requestId = requestID;
+ this.requestId = requestId;
this.operation = operation;
}
@@ -70,8 +70,8 @@ public class PolicyGuardRequest {
return requestId;
}
- public void setRequestID(UUID requestID) {
- this.requestId = requestID;
+ public void setRequestID(UUID requestId) {
+ this.requestId = requestId;
}
public String getOperation() {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
index e9ff435f8..d7ece3081 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,8 +49,8 @@ public class PolicyGuardResponse {
return requestId;
}
- public void setRequestID(UUID requestID) {
- this.requestId = requestID;
+ public void setRequestID(UUID requestId) {
+ this.requestId = requestId;
}
public String getResult() {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index 53ba6075e..ec4ebf9cd 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -115,7 +115,7 @@ public class PolicyGuardXacmlHelper {
UrlEntry urlEntry = restUrls[restUrlIndex];
String jsonRequestString = jsonReq.toString();
netLogger.info("[OUT|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, jsonRequestString);
- response = callRESTfulPDP(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl,
+ response = callRestfulPdp(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl,
urlEntry.authorization, urlEntry.clientAuth, urlEntry.environment);
netLogger.info("[IN|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, response);
} catch (Exception e) {
@@ -134,7 +134,7 @@ public class PolicyGuardXacmlHelper {
* @param environment the Environment
* @return response from guard which contains "Permit" or "Deny"
*/
- private String callRESTfulPDP(InputStream is, URL restURL, String authorization, String clientauth,
+ private String callRestfulPdp(InputStream is, URL restUrl, String authorization, String clientauth,
String environment) {
HttpURLConnection connection = null;
@@ -142,7 +142,7 @@ public class PolicyGuardXacmlHelper {
//
// Open up the connection
//
- connection = (HttpURLConnection) restURL.openConnection();
+ connection = (HttpURLConnection) restUrl.openConnection();
connection.setRequestProperty("Content-Type", "application/json");
//
// Setup our method and headers
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
index dc81712cd..6046e3a32 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
@@ -41,14 +41,14 @@ public class VMTargetLock implements TargetLock, Serializable {
*
* @param targetType the target type
* @param target the target
- * @param requestID the request Id
+ * @param requestId the request Id
* @param callback the callback
*/
- public VMTargetLock(TargetType targetType, String target, UUID requestID, LockCallback callback) {
+ public VMTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) {
this.lockId = UUID.randomUUID();
this.targetType = targetType;
this.target = target;
- this.requestId = requestID;
+ this.requestId = requestId;
this.callback = callback;
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
index 307c11acf..418a3ed78 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
@@ -42,14 +42,14 @@ public class VNFTargetLock implements TargetLock, Serializable {
*
* @param type the type
* @param target the target
- * @param requestID the request Id
+ * @param requestId the request Id
* @param callback the callback
*/
- public VNFTargetLock(TargetType type, String target, UUID requestID, LockCallback callback) {
+ public VNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) {
this.lockId = UUID.randomUUID();
this.targetType = type;
this.target = target;
- this.requestId = requestID;
+ this.requestId = requestId;
this.callback = callback;
}