From daee922e51e60c3cad6a3cc691214a34aad9ac7f Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 19 Apr 2018 11:28:41 -0400 Subject: Add license to policy-engine files Added license to various files. Updated XACMLPolicyScanner to work even when license comment is added to the Policy.xml file. Moved DOCTYPE before license in html files. Removed license from css files, as many are generated or come from third-party software. Removed license from other generated files. Change-Id: I9d98ca9f552a6eae17e80ef27fc7045cc4f27b8e Issue-ID: POLICY-741 Signed-off-by: Jim Hahn --- .../onap/policy/xacml/util/XACMLPolicyScanner.java | 78 +++++++++------------- .../test/resources/Action_TestActionPolicy.1.xml | 19 ++++++ .../src/test/resources/Config_SampleTest1206.1.xml | 19 ++++++ .../emptyPapGroupsDefault/xacml.properties | 20 ++++++ ....Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml | 19 ++++++ .../resources/pdps/default/xacml.pip.properties | 20 ++++++ .../resources/pdps/default/xacml.policy.properties | 20 ++++++ .../src/test/resources/pdps/xacml.properties | 20 ++++++ .../xacml3.0-ct-v.0.4/IIA001Response.xml | 19 ++++++ 9 files changed, 188 insertions(+), 46 deletions(-) (limited to 'ONAP-XACML') diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java index e24343704..0003e12c6 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java @@ -613,59 +613,45 @@ public class XACMLPolicyScanner { // Parse the policy file // Document doc = db.parse(is); - // - // Because there is no root defined in xacml, - // find the first element - // - NodeList nodes = doc.getChildNodes(); - Node node = nodes.item(0); - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element e = (Element) node; + Element e = doc.getDocumentElement(); + // + // Is it a 3.0 policy? + // + if ("urn:oasis:names:tc:xacml:3.0:core:schema:wd-17".equals(e.getNamespaceURI())) { // - // Is it a 3.0 policy? + // A policyset or policy could be the root // - if ("urn:oasis:names:tc:xacml:3.0:core:schema:wd-17".equals(e.getNamespaceURI())) { + if (e.getNodeName().endsWith("Policy")) { // - // A policyset or policy could be the root + // Now we can create the context for the policy set + // and unmarshall the policy into a class. // - if (e.getNodeName().endsWith("Policy")) { - // - // Now we can create the context for the policy set - // and unmarshall the policy into a class. - // - JAXBContext context = JAXBContext.newInstance(PolicyType.class); - Unmarshaller um = context.createUnmarshaller(); - JAXBElement root = um.unmarshal(e, PolicyType.class); - // - // Here is our policy set class - // - return root.getValue(); - } else if (e.getNodeName().endsWith("PolicySet")) { - // - // Now we can create the context for the policy set - // and unmarshall the policy into a class. - // - JAXBContext context = JAXBContext.newInstance(PolicySetType.class); - Unmarshaller um = context.createUnmarshaller(); - JAXBElement root = um.unmarshal(e, PolicySetType.class); - // - // Here is our policy set class - // - return root.getValue(); - } else { - if (logger.isDebugEnabled()) { - logger.debug("Not supported yet: " + e.getNodeName()); - } - } + JAXBContext context = JAXBContext.newInstance(PolicyType.class); + Unmarshaller um = context.createUnmarshaller(); + JAXBElement root = um.unmarshal(e, PolicyType.class); + // + // Here is our policy set class + // + return root.getValue(); + } else if (e.getNodeName().endsWith("PolicySet")) { + // + // Now we can create the context for the policy set + // and unmarshall the policy into a class. + // + JAXBContext context = JAXBContext.newInstance(PolicySetType.class); + Unmarshaller um = context.createUnmarshaller(); + JAXBElement root = um.unmarshal(e, PolicySetType.class); + // + // Here is our policy set class + // + return root.getValue(); } else { - logger.warn("unsupported namespace: " + e.getNamespaceURI()); + if (logger.isDebugEnabled()) { + logger.debug("Not supported yet: " + e.getNodeName()); + } } } else { - if (logger.isDebugEnabled()) { - logger.debug("No root element contained in policy " + - " Name: " + node.getNodeName() + " type: " + node.getNodeType() + - " Value: " + node.getNodeValue()); - } + logger.warn("unsupported namespace: " + e.getNamespaceURI()); } } catch (Exception e) { PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPolicyScanner", "Exception in readPolicy"); diff --git a/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml b/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml index a3b483f74..7f5d45cec 100644 --- a/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml +++ b/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml @@ -1,4 +1,23 @@ + TestActionPolicy@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy: diff --git a/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml b/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml index dcfd0c5eb..551616744 100644 --- a/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml +++ b/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml @@ -1,4 +1,23 @@ + SampleTest1206@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy: diff --git a/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties b/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties index be5102f2d..291324a3b 100644 --- a/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties +++ b/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties @@ -1,3 +1,23 @@ +# +#============LICENSE_START================================================== +# ONAP Policy Engine +#=========================================================================== +# 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================================================== +# + # #Fri Feb 16 11:15:29 GMT 2018 xacml.pap.groups.default= diff --git a/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml b/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml index e27f163b6..4fffaf3aa 100644 --- a/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml +++ b/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml @@ -1,4 +1,23 @@ + vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy: diff --git a/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties b/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties index 846848f28..d55f7176b 100644 --- a/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties +++ b/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties @@ -1,3 +1,23 @@ +# +#============LICENSE_START================================================== +# ONAP Policy Engine +#=========================================================================== +# 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================================================== +# + # #Tue Feb 07 10:35:08 EST 2017 AAF.description=AAFEngine to communicate with AAF to take decisions diff --git a/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties b/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties index 1dc2aabf4..9b74b3eb9 100644 --- a/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties +++ b/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties @@ -1,3 +1,23 @@ +# +#============LICENSE_START================================================== +# ONAP Policy Engine +#=========================================================================== +# 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================================================== +# + # #Tue Feb 07 10:35:08 EST 2017 com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml.name=Config_BRMS_Param_BRMSParamvFWDemoPolicy diff --git a/ONAP-XACML/src/test/resources/pdps/xacml.properties b/ONAP-XACML/src/test/resources/pdps/xacml.properties index aa1ece0a3..f0bed55ea 100644 --- a/ONAP-XACML/src/test/resources/pdps/xacml.properties +++ b/ONAP-XACML/src/test/resources/pdps/xacml.properties @@ -1,3 +1,23 @@ +# +#============LICENSE_START================================================== +# ONAP Policy Engine +#=========================================================================== +# 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================================================== +# + # #Tue Feb 07 10:37:51 EST 2017 default.description=The default group where new PDP's are put. diff --git a/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml b/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml index 8c484e0a9..680d27d1d 100644 --- a/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml +++ b/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml @@ -1,4 +1,23 @@ +