diff options
Diffstat (limited to 'ONAP-XACML/src/main/java/org/onap/policy/xacml/std')
11 files changed, 76 insertions, 75 deletions
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java index 3173bc16d..4399f715f 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -125,10 +125,10 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE if (Files.notExists(this.repository)) { Files.createDirectory(repository); } - if (Files.isDirectory(this.repository) == false) { + if (!Files.isDirectory(this.repository)) { throw new PAPException ("Repository is NOT a directory: " + this.repository.toAbsolutePath()); } - if (Files.isWritable(this.repository) == false) { + if (!Files.isWritable(this.repository)) { throw new PAPException ("Repository is NOT writable: " + this.repository.toAbsolutePath()); } // @@ -467,7 +467,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE this.doSave(); } else { PolicyLogger.error("Failed to add to new group, putting back into original group."); - if (((StdPDPGroup) currentGroup).removePDP(pdp) == false) { + if (!((StdPDPGroup) currentGroup).removePDP(pdp)) { PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Failed to put PDP back into original group."); } } @@ -492,8 +492,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE // the only things that the user can change are name and description currentPDP.setDescription(pdp.getDescription()); currentPDP.setName(pdp.getName()); - if (currentPDP instanceof OnapPDP && pdp instanceof OnapPDP) { - ((OnapPDP)currentPDP).setJmxPort(((OnapPDP)pdp).getJmxPort()); + if (currentPDP instanceof OnapPDP) { + ((OnapPDP)currentPDP).setJmxPort(pdp.getJmxPort()); } this.doSave(); } @@ -769,9 +769,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE // Save the configuration // this.saveConfiguration(); - } catch (IOException e) { - PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration"); - } catch (PAPException e) { + } catch (IOException|PAPException e) { PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration"); } } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java index ee6785611..dd8a92135 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -36,7 +36,7 @@ public class StdEngineFactory extends ONAPPapEngineFactory { @Override public PAPPolicyEngine newEngine() throws FactoryException, PAPException { try { - return (PAPPolicyEngine) new StdEngine(); + return new StdEngine(); } catch (IOException e) { PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "StdEngineFactory", "Failed to create engine"); return null; @@ -47,7 +47,7 @@ public class StdEngineFactory extends ONAPPapEngineFactory { public PAPPolicyEngine newEngine(Properties properties) throws FactoryException, PAPException { try { - return (PAPPolicyEngine) new StdEngine(properties); + return new StdEngine(properties); } catch (IOException e) { PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "StdEngineFactory", "Failed to create engine"); return null; diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java index c66d11b8c..a8c59e892 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java index e059ea665..8727b8185 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -210,9 +210,6 @@ public class StdPDP extends StdPDPItemSetChangeNotifier implements OnapPDP, Comp if (o == null) { return -1; } - if ( ! (o instanceof StdPDP)) { - return -1; - } if (o.name == null) { return -1; } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java index 9289c2461..bdbbf33f7 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -89,6 +89,21 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG @JsonIgnore private Integer jmxport; + public StdPDPGroup() { + // + // Methods needed for JSON deserialization + // + } + + public StdPDPGroup(OnapPDPGroup group) { + this.id = group.getId(); + this.name = group.getName(); + this.description = group.getDescription(); + this.isDefault = group.isDefaultGroup(); + this.pdps = group.getOnapPdps(); + this.policies = group.getPolicies(); + this.pipConfigs = group.getPipConfigs(); + } public StdPDPGroup(String id, Path directory) { this.id = id; @@ -333,7 +348,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG // to occur: 1) old default=false (don't want to fire) and // then 2) new default=true (yes fire - but we'll have to do that // elsewhere. - //this.firePDPGroupChanged(this); } @Override @@ -474,7 +488,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG logger.info("Copied " + num + " bytes for policy " + name); StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, isRoot, name, tempFile.toUri()); - if (tempRootPolicy.isValid() == false) { + if (!tempRootPolicy.isValid()) { try { Files.delete(tempFile); } catch(Exception ee) { @@ -544,7 +558,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG // policy is new to this group StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri()); - if (tempRootPolicy.isValid() == false) { + if (!tempRootPolicy.isValid()) { try { Files.delete(policyFile); } catch(Exception ee) { @@ -606,7 +620,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG // policy is new to this group StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri()); - if (tempRootPolicy.isValid() == false) { + if (!tempRootPolicy.isValid()) { try { Files.delete(policyFile); } catch(Exception ee) { @@ -924,23 +938,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG this.changed(); } - - public StdPDPGroup() { - // - // Methods needed for JSON deserialization - // - } - - public StdPDPGroup(OnapPDPGroup group) { - this.id = group.getId(); - this.name = group.getName(); - this.description = group.getDescription(); - this.isDefault = group.isDefaultGroup(); - this.pdps = group.getOnapPdps(); - this.policies = group.getPolicies(); - this.pipConfigs = group.getPipConfigs(); - } - public boolean isDefault() { return isDefault; } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java index ae4649e11..dd9bf0a2c 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -71,18 +71,30 @@ public class StdPDPGroupStatus implements PDPGroupStatus { public StdPDPGroupStatus(PDPGroupStatus stat) { this.status = stat.getStatus(); - this.failedPDPs.clear(); this.failedPDPs.addAll(stat.getFailedPDPs()); - this.failedPIPConfigs.clear(); this.failedPIPConfigs.addAll(stat.getFailedPipConfigs()); - this.failedPolicies.clear(); this.failedPolicies.addAll(stat.getFailedPolicies()); - this.inSynchPDPs.clear(); this.inSynchPDPs.addAll(stat.getInSynchPDPs()); - this.lastUpdateFailedPDPs.clear(); this.lastUpdateFailedPDPs.addAll(stat.getLastUpdateFailedPDPs()); - this.loadedPIPConfigs.clear(); this.loadedPIPConfigs.addAll(stat.getLoadedPipConfigs()); - this.loadedPolicies.clear(); this.loadedPolicies.addAll(stat.getLoadedPolicies()); - this.loadErrors.clear(); this.loadErrors.addAll(stat.getLoadErrors()); - this.loadWarnings.clear(); this.loadWarnings.addAll(stat.getLoadWarnings()); - this.outOfSynchPDPs.clear(); this.outOfSynchPDPs.addAll(stat.getOutOfSynchPDPs()); - this.unknownPDPs.clear(); this.unknownPDPs.addAll(stat.getUpdatingPDPs()); - this.updatingPDPs.clear(); this.updatingPDPs.addAll(stat.getUpdatingPDPs()); + this.failedPDPs.clear(); + this.failedPDPs.addAll(stat.getFailedPDPs()); + this.failedPIPConfigs.clear(); + this.failedPIPConfigs.addAll(stat.getFailedPipConfigs()); + this.failedPolicies.clear(); + this.failedPolicies.addAll(stat.getFailedPolicies()); + this.inSynchPDPs.clear(); + this.inSynchPDPs.addAll(stat.getInSynchPDPs()); + this.lastUpdateFailedPDPs.clear(); + this.lastUpdateFailedPDPs.addAll(stat.getLastUpdateFailedPDPs()); + this.loadedPIPConfigs.clear(); + this.loadedPIPConfigs.addAll(stat.getLoadedPipConfigs()); + this.loadedPolicies.clear(); + this.loadedPolicies.addAll(stat.getLoadedPolicies()); + this.loadErrors.clear(); + this.loadErrors.addAll(stat.getLoadErrors()); + this.loadWarnings.clear(); + this.loadWarnings.addAll(stat.getLoadWarnings()); + this.outOfSynchPDPs.clear(); + this.outOfSynchPDPs.addAll(stat.getOutOfSynchPDPs()); + this.unknownPDPs.clear(); + this.unknownPDPs.addAll(stat.getUpdatingPDPs()); + this.updatingPDPs.clear(); + this.updatingPDPs.addAll(stat.getUpdatingPDPs()); } public Set<PDPPIPConfig> getLoadedPIPConfigs() { @@ -286,16 +298,16 @@ public class StdPDPGroupStatus implements PDPGroupStatus { @Override @JsonIgnore public boolean isGroupOk() { - if (this.policiesOK() == false) { + if (!this.policiesOK()) { return false; } - if (this.pipConfigOK() == false) { + if (!this.pipConfigOK()) { return false; } - if (this.pdpsOK() == false) { + if (!this.pdpsOK()) { return false; } - if (this.loadErrors.isEmpty() == false) { + if (!this.loadErrors.isEmpty()) { return false; } return this.status == Status.OK; diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java index 0c832b30e..9a65d50b2 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java index 79e41f831..03170bdb7 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -64,7 +64,12 @@ public class StdPDPPolicy implements PDPPolicy, Serializable { private URI location = null; - + public StdPDPPolicy() { + // + // Methods needed for JSON Deserialization + // + } + public StdPDPPolicy(String id, boolean isRoot) { this.id = id; this.isRoot = isRoot; @@ -173,7 +178,7 @@ public class StdPDPPolicy implements PDPPolicy, Serializable { } if (this.policyId != null) { ArrayList<String> foo = Lists.newArrayList(Splitter.on(':').split(this.policyId)); - if (foo.isEmpty() == false) { + if (!foo.isEmpty()) { return foo.get(foo.size() - 1); } } @@ -337,14 +342,6 @@ public class StdPDPPolicy implements PDPPolicy, Serializable { return versionString; } - - - public StdPDPPolicy() { - // - // Methods needed for JSON Deserialization - // - } - public void setPolicyId(String policyId) { this.policyId = policyId; } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java index 6e1f2d62b..e42d54446 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java index 7c75e58d8..355a6f644 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. @@ -80,6 +80,10 @@ public class OperationHistoryEngine extends StdConfigurableEngine{ XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("target"), XACML.ID_DATATYPE_STRING); + + public OperationHistoryEngine() { + super(); + } private void addIntegerAttribute(StdMutablePIPResponse stdPIPResponse, Identifier category, Identifier attributeId, int value, PIPRequest pipRequest) { AttributeValue<BigInteger> attributeValue = null; @@ -93,10 +97,6 @@ public class OperationHistoryEngine extends StdConfigurableEngine{ } } - public OperationHistoryEngine() { - super(); - } - @Override public Collection<PIPRequest> attributesRequired() { return new ArrayList<>(); diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java index de46d01f1..de35e0eb8 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * 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. |