From 12fab6215a7a92b4959330ef179d38454dbb6225 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 14 Jan 2019 14:30:46 -0500 Subject: Remove guard checkstyle suppressions Renamed a number of fields and methods, in the Guard classes, to conform to camel-case format. Also updated some toString() methods to return "xxxId=" instead of "xxxID=", if the corresponding field names were also xxxId. Updated license data in one changed file. Change-Id: Idac58f8744b5523d6daed7f369026495dd357bf8 Issue-ID: POLICY-1140 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/guard/CallGuardTask.java | 6 +- .../java/org/onap/policy/guard/PolicyGuard.java | 18 ++--- .../org/onap/policy/guard/PolicyGuardRequest.java | 8 +- .../org/onap/policy/guard/PolicyGuardResponse.java | 8 +- .../onap/policy/guard/PolicyGuardXacmlHelper.java | 16 ++-- .../guard/PolicyGuardXacmlRequestAttributes.java | 66 ++++++++-------- .../java/org/onap/policy/guard/TargetLock.java | 6 +- .../org/onap/policy/guard/impl/PNFTargetLock.java | 89 ---------------------- .../org/onap/policy/guard/impl/PnfTargetLock.java | 89 ++++++++++++++++++++++ .../org/onap/policy/guard/impl/VMTargetLock.java | 85 --------------------- .../org/onap/policy/guard/impl/VNFTargetLock.java | 89 ---------------------- .../org/onap/policy/guard/impl/VmTargetLock.java | 85 +++++++++++++++++++++ .../org/onap/policy/guard/impl/VnfTargetLock.java | 89 ++++++++++++++++++++++ 13 files changed, 327 insertions(+), 327 deletions(-) delete mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java create mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java delete mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java delete mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java create mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java create mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java (limited to 'controlloop/common/guard/src/main/java') 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 fefea39ab..046b7cfd6 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -131,7 +131,7 @@ public class CallGuardTask implements Runnable { // // Make guard request // - guardDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + guardDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); logger.debug("\n********** XACML RESPONSE START ********"); logger.debug("{}", guardDecision); @@ -153,7 +153,7 @@ public class CallGuardTask implements Runnable { // if ("Indeterminate".equals(guardResponse.getResult())) { guardResponse.setOperation(recipe); - guardResponse.setRequestID(UUID.fromString(requestId)); + guardResponse.setRequestId(UUID.fromString(requestId)); } long estimatedTime = System.nanoTime() - startTime; 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 e4849cea5..7ae0e7eb2 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -23,9 +23,9 @@ package org.onap.policy.guard; import java.util.UUID; import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.drools.core.lock.PolicyResourceLockManager; -import org.onap.policy.guard.impl.PNFTargetLock; -import org.onap.policy.guard.impl.VMTargetLock; -import org.onap.policy.guard.impl.VNFTargetLock; +import org.onap.policy.guard.impl.PnfTargetLock; +import org.onap.policy.guard.impl.VmTargetLock; +import org.onap.policy.guard.impl.VnfTargetLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -97,17 +97,17 @@ public class PolicyGuard { // // 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; @@ -156,7 +156,7 @@ public class PolicyGuard { * @return the result: acquired or denied */ public static GuardResult lockTarget(TargetLock lock, int holdSec) { - String owner = makeOwner(lock.getTargetType(), lock.getRequestID()); + String owner = makeOwner(lock.getTargetType(), lock.getRequestId()); boolean result = factory.getManager().refresh(lock.getTargetInstance(), owner, holdSec); @@ -173,7 +173,7 @@ public class PolicyGuard { * @throws IllegalArgumentException if an argument is null */ public static boolean unlockTarget(TargetLock lock) { - String owner = makeOwner(lock.getTargetType(), lock.getRequestID()); + String owner = makeOwner(lock.getTargetType(), lock.getRequestId()); boolean result = factory.getManager().unlock(lock.getTargetInstance(), owner); if (result) { 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 5cb080fa5..8887e00b7 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-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -46,7 +46,7 @@ public class PolicyGuardRequest { @Override public String toString() { - return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestID=" + requestId + ", operation=" + return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestId=" + requestId + ", operation=" + operation + "]"; } @@ -66,11 +66,11 @@ public class PolicyGuardRequest { this.target = target; } - public UUID getRequestID() { + public UUID getRequestId() { return requestId; } - public void setRequestID(UUID requestId) { + public void setRequestId(UUID requestId) { this.requestId = requestId; } 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 d7ece3081..574c50b79 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-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -42,14 +42,14 @@ public class PolicyGuardResponse { @Override public String toString() { - return "PolicyGuardResponse [requestID=" + requestId + ", operation=" + operation + ", result=" + result + "]"; + return "PolicyGuardResponse [requestId=" + requestId + ", operation=" + operation + ", result=" + result + "]"; } - public UUID getRequestID() { + public UUID getRequestId() { return requestId; } - public void setRequestID(UUID requestId) { + public void setRequestId(UUID requestId) { this.requestId = requestId; } 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 35b1d2561..c2dfc908d 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -84,7 +84,7 @@ public class PolicyGuardXacmlHelper { * @param xacmlReq the XACML request * @return the response */ - public String callPDP(PolicyGuardXacmlRequestAttributes xacmlReq) { + public String callPdp(PolicyGuardXacmlRequestAttributes xacmlReq) { // // Send it to the PDP // @@ -94,11 +94,11 @@ public class PolicyGuardXacmlHelper { // Build the json request // JSONObject attributes = new JSONObject(); - attributes.put("actor", xacmlReq.getActorID()); - attributes.put("recipe", xacmlReq.getOperationID()); - attributes.put("target", xacmlReq.getTargetID()); - if (xacmlReq.getClnameID() != null) { - attributes.put("clname", xacmlReq.getClnameID()); + attributes.put("actor", xacmlReq.getActorId()); + attributes.put("recipe", xacmlReq.getOperationId()); + attributes.put("target", xacmlReq.getTargetId()); + if (xacmlReq.getClnameId() != null) { + attributes.put("clname", xacmlReq.getClnameId()); } if (xacmlReq.getVfCount() != null) { attributes.put("vfCount", xacmlReq.getVfCount()); @@ -221,7 +221,7 @@ public class PolicyGuardXacmlHelper { * @param xacmlResponse the XACML response * @return the PolicyGuardResponse */ - public static PolicyGuardResponse parseXACMLPDPResponse(com.att.research.xacml.api.Response xacmlResponse) { + public static PolicyGuardResponse parseXacmlPdpResponse(com.att.research.xacml.api.Response xacmlResponse) { if (xacmlResponse == null) { // // In case the actual XACML response was null, create an empty diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java index d7e608cb8..da03addf9 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -29,19 +29,19 @@ import com.att.research.xacml.std.annotations.XACMLSubject; public class PolicyGuardXacmlRequestAttributes { @XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:clname:clname-id") - String clnameID; + String clnameId; @XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:actor:actor-id") - String actorID; + String actorId; @XACMLAction(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:operation:operation-id") - String operationID; + String operationId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:target:target-id") - String targetID; + String targetId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:request-id") - String requestID; + String requestId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:vf-count") Integer vfCount; @@ -59,58 +59,58 @@ public class PolicyGuardXacmlRequestAttributes { public PolicyGuardXacmlRequestAttributes(String clnameId, String actorId, String operationId, String targetId, String requestId, Integer vfCount) { super(); - this.clnameID = clnameId; - this.actorID = actorId; - this.operationID = operationId; - this.targetID = targetId; - this.requestID = requestId; + this.clnameId = clnameId; + this.actorId = actorId; + this.operationId = operationId; + this.targetId = targetId; + this.requestId = requestId; this.vfCount = vfCount; } @Override public String toString() { - return "PolicyGuardXacmlRequestAttributes [actorID=" + actorID + ", operationID=" + operationID + ", targetID=" - + targetID + ", requestID=" + requestID + "]"; + return "PolicyGuardXacmlRequestAttributes [actorId=" + actorId + ", operationId=" + operationId + ", targetId=" + + targetId + ", requestId=" + requestId + "]"; } - public String getActorID() { - return actorID; + public String getActorId() { + return actorId; } - public void setActorID(String actorID) { - this.actorID = actorID; + public void setActorId(String actorId) { + this.actorId = actorId; } - public String getOperationID() { - return operationID; + public String getOperationId() { + return operationId; } - public void setOperationID(String operationID) { - this.operationID = operationID; + public void setOperationId(String operationId) { + this.operationId = operationId; } - public String getTargetID() { - return targetID; + public String getTargetId() { + return targetId; } - public void setTargetID(String targetID) { - this.targetID = targetID; + public void setTargetId(String targetId) { + this.targetId = targetId; } - public String getRequestID() { - return requestID; + public String getRequestId() { + return requestId; } - public void setRequestID(String requestID) { - this.requestID = requestID; + public void setRequestId(String requestId) { + this.requestId = requestId; } - public String getClnameID() { - return clnameID; + public String getClnameId() { + return clnameId; } - public void setClnameID(String clnameID) { - this.clnameID = clnameID; + public void setClnameId(String clnameId) { + this.clnameId = clnameId; } public Integer getVfCount() { diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java index 1e3064abd..eea46c3cc 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 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. @@ -26,12 +26,12 @@ import org.onap.policy.controlloop.policy.TargetType; public interface TargetLock { - public UUID getLockID(); + public UUID getLockId(); public TargetType getTargetType(); public String getTargetInstance(); - public UUID getRequestID(); + public UUID getRequestId(); } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java deleted file mode 100644 index 904448591..000000000 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * guard - * ================================================================================ - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.guard.impl; - -import java.io.Serializable; -import java.util.UUID; - -import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.guard.LockCallback; -import org.onap.policy.guard.TargetLock; - -public class PNFTargetLock implements TargetLock, Serializable { - - private static final long serialVersionUID = 2335897394577202732L; - - private final UUID lockId; - private final TargetType targetType; - private final String target; - private final UUID requestId; - private final transient LockCallback callback; - - /** - * Construct an instance. - * - * @param type the target type - * @param target the target - * @param requestId the request Id - * @param callback the callback - */ - public PNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { - this.lockId = UUID.randomUUID(); - this.targetType = type; - this.target = target; - this.requestId = requestId; - this.callback = callback; - } - - @Override - public UUID getLockID() { - return this.lockId; - } - - - @Override - public TargetType getTargetType() { - return targetType; - } - - @Override - public String getTargetInstance() { - return target; - } - - @Override - public UUID getRequestID() { - return this.requestId; - } - - public LockCallback getCallback() { - return this.callback; - } - - @Override - public String toString() { - return "PNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" - + requestId + "]"; - } - - - -} diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java new file mode 100644 index 000000000..c1ad34a22 --- /dev/null +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * guard + * ================================================================================ + * Copyright (C) 2017-2019 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.guard.impl; + +import java.io.Serializable; +import java.util.UUID; + +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.guard.LockCallback; +import org.onap.policy.guard.TargetLock; + +public class PnfTargetLock implements TargetLock, Serializable { + + private static final long serialVersionUID = 2335897394577202732L; + + private final UUID lockId; + private final TargetType targetType; + private final String target; + private final UUID requestId; + private final transient LockCallback callback; + + /** + * Construct an instance. + * + * @param type the target type + * @param target the target + * @param requestId the request Id + * @param callback the callback + */ + public PnfTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { + this.lockId = UUID.randomUUID(); + this.targetType = type; + this.target = target; + this.requestId = requestId; + this.callback = callback; + } + + @Override + public UUID getLockId() { + return this.lockId; + } + + + @Override + public TargetType getTargetType() { + return targetType; + } + + @Override + public String getTargetInstance() { + return target; + } + + @Override + public UUID getRequestId() { + return this.requestId; + } + + public LockCallback getCallback() { + return this.callback; + } + + @Override + public String toString() { + return "PnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + + requestId + "]"; + } + + + +} 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 deleted file mode 100644 index 6046e3a32..000000000 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * guard - * ================================================================================ - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.guard.impl; - -import java.io.Serializable; -import java.util.UUID; - -import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.guard.LockCallback; -import org.onap.policy.guard.TargetLock; - -public class VMTargetLock implements TargetLock, Serializable { - - private static final long serialVersionUID = -8795145054334409724L; - private final UUID lockId; - private final TargetType targetType; - private final String target; - private final UUID requestId; - private final transient LockCallback callback; - - /** - * Create an instance. - * - * @param targetType the target type - * @param target the target - * @param requestId the request Id - * @param callback the 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.callback = callback; - } - - @Override - public UUID getLockID() { - return this.lockId; - } - - @Override - public TargetType getTargetType() { - return targetType; - } - - @Override - public String getTargetInstance() { - return target; - } - - @Override - public UUID getRequestID() { - return this.requestId; - } - - public LockCallback getCallback() { - return this.callback; - } - - @Override - public String toString() { - return "VMTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" - + requestId + "]"; - } - -} 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 deleted file mode 100644 index 418a3ed78..000000000 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * guard - * ================================================================================ - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.guard.impl; - -import java.io.Serializable; -import java.util.UUID; - -import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.guard.LockCallback; -import org.onap.policy.guard.TargetLock; - -public class VNFTargetLock implements TargetLock, Serializable { - - private static final long serialVersionUID = 2335897394577202732L; - - private final UUID lockId; - private final TargetType targetType; - private final String target; - private final UUID requestId; - private final transient LockCallback callback; - - /** - * Create an instance. - * - * @param type the type - * @param target the target - * @param requestId the request Id - * @param callback the 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.callback = callback; - } - - @Override - public UUID getLockID() { - return this.lockId; - } - - - @Override - public TargetType getTargetType() { - return targetType; - } - - @Override - public String getTargetInstance() { - return target; - } - - @Override - public UUID getRequestID() { - return this.requestId; - } - - public LockCallback getCallback() { - return this.callback; - } - - @Override - public String toString() { - return "VNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" - + requestId + "]"; - } - - - -} 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 new file mode 100644 index 000000000..301c6ec7c --- /dev/null +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * guard + * ================================================================================ + * Copyright (C) 2017-2019 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.guard.impl; + +import java.io.Serializable; +import java.util.UUID; + +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.guard.LockCallback; +import org.onap.policy.guard.TargetLock; + +public class VmTargetLock implements TargetLock, Serializable { + + private static final long serialVersionUID = -8795145054334409724L; + private final UUID lockId; + private final TargetType targetType; + private final String target; + private final UUID requestId; + private final transient LockCallback callback; + + /** + * Create an instance. + * + * @param targetType the target type + * @param target the target + * @param requestId the request Id + * @param callback the 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.callback = callback; + } + + @Override + public UUID getLockId() { + return this.lockId; + } + + @Override + public TargetType getTargetType() { + return targetType; + } + + @Override + public String getTargetInstance() { + return target; + } + + @Override + public UUID getRequestId() { + return this.requestId; + } + + public LockCallback getCallback() { + return this.callback; + } + + @Override + public String toString() { + return "VmTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + + requestId + "]"; + } + +} 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 new file mode 100644 index 000000000..2e3fc28b1 --- /dev/null +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * guard + * ================================================================================ + * Copyright (C) 2017-2019 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.guard.impl; + +import java.io.Serializable; +import java.util.UUID; + +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.guard.LockCallback; +import org.onap.policy.guard.TargetLock; + +public class VnfTargetLock implements TargetLock, Serializable { + + private static final long serialVersionUID = 2335897394577202732L; + + private final UUID lockId; + private final TargetType targetType; + private final String target; + private final UUID requestId; + private final transient LockCallback callback; + + /** + * Create an instance. + * + * @param type the type + * @param target the target + * @param requestId the request Id + * @param callback the 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.callback = callback; + } + + @Override + public UUID getLockId() { + return this.lockId; + } + + + @Override + public TargetType getTargetType() { + return targetType; + } + + @Override + public String getTargetInstance() { + return target; + } + + @Override + public UUID getRequestId() { + return this.requestId; + } + + public LockCallback getCallback() { + return this.callback; + } + + @Override + public String toString() { + return "VnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + + requestId + "]"; + } + + + +} -- cgit 1.2.3-korg