aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishnajinka <kris.jinka@samsung.com>2018-07-23 14:14:39 +0900
committerKrishnakumar Jinka <kris.jinka@samsung.com>2018-07-23 13:34:05 +0000
commit8cf5ed300190ab386d95758e6d4be6c38e67123d (patch)
treecfab1054b351211909af2f469e452862395c93d0
parenteff265962c081edb751d5d2ed99dc443cb97f3fb (diff)
Add modified copyright notice
For the files which are modified add modified copyright notices as per comments from earlier review Issue-ID: POLICY-1002 Change-Id: I873b3ccc986d5f3d138ddb9e9b3c2307a0b127a6 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java1
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java1
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java1
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java641
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java1
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java1
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java489
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java165
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java1
12 files changed, 658 insertions, 646 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java
index 6c80f9c04..614ba85df 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
index eed73f629..6c66898e3 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
index f7f8a335c..abb425131 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java
index 4c837bb18..1be27ae71 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/Policy.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,326 +52,326 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
public abstract class Policy {
-
- private static final Logger LOGGER = FlexLogger.getLogger(Policy.class);
-
-
- /**
- * Common Fields
- */
- public static final String GET_INT_TYPE = "Integer";
- public static final String GET_STRING_TYPE = "String";
-
- public static final String ONAPID = "ONAPName";
- public static final String CONFIGID = "ConfigName";
- public static final String CLOSEDLOOPID = "ServiceType";
-
- public static final String CONFIG_POLICY = "Config";
- public static final String ACTION_POLICY = "Action";
- public static final String DECISION_POLICY = "Decision";
-
- protected String policyName = null;
-
- protected boolean isValidForm = true;
-
- private Path finalPolicyPath = null;
-
- private boolean preparedToSave = false;
-
- private boolean policyExists = false;
-
- public Path getFinalPolicyPath() {
- return finalPolicyPath;
- }
-
- public void setFinalPolicyPath(Path finalPolicyPath) {
- this.finalPolicyPath = finalPolicyPath;
- }
-
- // Constants Used in XML Creation
- public static final String CATEGORY_RECIPIENT_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject";
- public static final String CATEGORY_RESOURCE = "urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
- public static final String CATEGORY_ACTION = "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
- public static final String CATEGORY_ACCESS_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
- public static final String ACTION_ID = "urn:oasis:names:tc:xacml:1.0:action:action-id";
- public static final String SUBJECT_ID = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
- public static final String RESOURCE_ID = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
- public static final String FUNTION_INTEGER_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only";
- public static final String FUNCTION_STRING_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only";
- public static final String FUNCTION_BOOLEAN_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only";
- public static final String FUNCTION_STRING_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-equal";
- public static final String FUNCTION_STRING_REGEX_MATCH = "org.onap.function.regex-match";
- public static final String FUNCTION_STRING_REGEXP_MATCH = "urn:oasis:names:tc:xacml:1.0:function:string-regexp-match";
- public static final String FUNCTION_STRING_EQUAL_IGNORE = "urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case";
- public static final String INTEGER_DATATYPE = "http://www.w3.org/2001/XMLSchema#integer";
- public static final String BOOLEAN_DATATYPE = "http://www.w3.org/2001/XMLSchema#boolean";
- public static final String STRING_DATATYPE = "http://www.w3.org/2001/XMLSchema#string";
- public static final String URI_DATATYPE = "http://www.w3.org/2001/XMLSchema#anyURI";
- public static final String RULE_VARIABLE = "var:";
- public static final String EMPTY_STRING = "";
-
- protected static String CONFIG_HOME = null;
- protected static String ACTION_HOME = null;
- protected static String CONFIG_URL = null;
-
- protected Map<String, String> performer = new HashMap<>();
-
- private static String actionHome = null;
- private static String configHome = null;
-
- public PolicyRestAdapter policyAdapter = null;
- String ruleID = "";
-
- public Policy() {
- CONFIG_HOME = getConfigHome();
- ACTION_HOME = getActionHome();
- CONFIG_URL = "$URL";
- performer.put("PDP", "PDPAction");
- performer.put("PEP", "PEPAction");
- }
-
- //Each policy type seems to either use policyData or data field policy adapter when
- //getting the xml to save the policy. Instead of keep this hardcoded in the save method,
- //this method makes it usable outside.
- /**
- * Return the data field of the PolicyAdapter that will be used when saving this policy
- * with the savePolicies method.
- * @return Either the PolicyAdapter.getData() or PolicyAdapter.getPolicyData()
- */
- public abstract Object getCorrectPolicyDataObject();
- public abstract Map<String, String> savePolicies() throws PAPException;
-
- //This is the method for preparing the policy for saving. We have broken it out
- //separately because the fully configured policy is used for multiple things
- public abstract boolean prepareToSave() throws PAPException;
-
-
- // create match for onap and config name
- protected MatchType createMatch(String key, String value) {
- MatchType match = new MatchType();
-
- AttributeValueType attributeValue = new AttributeValueType();
- attributeValue.setDataType(STRING_DATATYPE);
- attributeValue.getContent().add(value);
- match.setAttributeValue(attributeValue);
- AttributeDesignatorType attributeDesignator = new AttributeDesignatorType();
- URI uri = null;
- try {
- uri = new URI(key);
- } catch (URISyntaxException e) {
- LOGGER.error("Exception Occured"+e);
- }
- attributeDesignator.setCategory(CATEGORY_ACCESS_SUBJECT);
- attributeDesignator.setDataType(STRING_DATATYPE);
- attributeDesignator.setAttributeId(new IdentifierImpl(uri).stringValue());
- match.setAttributeDesignator(attributeDesignator);
- match.setMatchId(FUNCTION_STRING_REGEX_MATCH);
- return match;
- }
-
- // Creating the match for dynamically added components.
- protected MatchType createDynamicMatch(String key, String value) {
- MatchType dynamicMatch = new MatchType();
- AttributeValueType dynamicAttributeValue = new AttributeValueType();
- String dataType = null;
- dataType = STRING_DATATYPE;
- dynamicAttributeValue.setDataType(dataType);
- dynamicAttributeValue.getContent().add(value);
- dynamicMatch.setAttributeValue(dynamicAttributeValue);
-
- AttributeDesignatorType dynamicAttributeDesignator = new AttributeDesignatorType();
-
- URI dynamicURI = null;
- try {
- dynamicURI = new URI(key);
- } catch (URISyntaxException e) {
- LOGGER.error("Exception Occured"+e);// log msg
- }
- dynamicAttributeDesignator.setCategory(CATEGORY_RESOURCE);
- dynamicAttributeDesignator.setDataType(dataType);
- dynamicAttributeDesignator.setAttributeId(new IdentifierImpl(dynamicURI).stringValue());
- dynamicMatch.setAttributeDesignator(dynamicAttributeDesignator);
- dynamicMatch.setMatchId(FUNCTION_STRING_REGEX_MATCH);
-
- return dynamicMatch;
- }
-
- // the Policy Name as Unique One throws error
- @SuppressWarnings("static-access")
- protected Path getNextFilename(Path parent, String policyType, String polcyFileName, Integer version) {
- policyType = FilenameUtils.removeExtension(policyType);
- polcyFileName = FilenameUtils.removeExtension(polcyFileName);
- Path newFile = null;
- String policyDir = EMPTY_STRING;
- String absolutePath = parent.toString();
- if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
- policyDir = absolutePath.substring(absolutePath.lastIndexOf('\\') + 1, absolutePath.length());
- if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
- policyDir = absolutePath.substring(absolutePath.lastIndexOf('/') + 1, absolutePath.length());
- }
- }
-
- String fileName = "default";
- if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
- fileName = policyType + "_" + String.format(polcyFileName) + "." + version + ".xml";
- }
-
- newFile = Paths.get(parent.toString(), fileName);
- if (newFile.toFile().exists()) {
- return newFile;
- }
- return null;
- }
-
- protected Path getNextLoopFilename(Path parentPath, String policyType, String policyConfigType, String policyFileName, Integer version) {
- policyType = FilenameUtils.removeExtension(policyType);
- policyConfigType = FilenameUtils.removeExtension(policyConfigType);
- policyFileName = FilenameUtils.removeExtension(policyFileName);
- Path newFile = null;
- String policyDir = EMPTY_STRING;
- String absolutePath = parentPath.toString();
- if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
- policyDir = absolutePath.substring(absolutePath.lastIndexOf('\\') + 1, absolutePath.length());
- if (policyDir.equals(EMPTY_STRING)) {
- policyDir = absolutePath.substring(absolutePath.lastIndexOf('/') + 1, absolutePath.length());
- }
- }
-
- String fileName = "default";
- if (!policyDir.equals(EMPTY_STRING)) {
- if("ClosedLoop_PM".equals(policyConfigType)){
- fileName = policyType + "_" + "PM" + "_" +java.lang.String.format(policyFileName) + "." +version +".xml";
- }else if("ClosedLoop_Fault".equals(policyConfigType)){
- fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) + "." + version + ".xml";
- }else if("Micro Service".equals(policyConfigType)){
- fileName = policyType + "_" + "MS" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
- }else if("Optimization".equals(policyConfigType)) {
- fileName = policyType + "_" + "OOF" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
- }
- }
-
- newFile = Paths.get(parentPath.toString(), fileName);
-
- if (newFile.toFile().exists()) {
- return newFile;
- }
- return null;
- }
-
-
- //create policy once all the validations are completed
- protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
- Map<String, String> success = new HashMap<>();
- //
- // Is the root a PolicySet or Policy?
- //
-
- if (policyData instanceof PolicyType) {
- //
- // Write it out
- //
- //Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
- //and this transaction is intercepted up stream.
-
- try(InputStream inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData)) {
- PolicyDef policyDef = DOMPolicyDef.load(inputStream);
- if (policyDef == null) {
- success.put("validation", "PolicyDef Validation Failed");
- }else{
- success.put("success", "success");
- }
- } catch (Exception e) {
- LOGGER.error("PolicyDef Validation failed"+e);
- success.put("error", "Validation Failed");
- }
- } else {
- PolicyLogger.error("Unknown data type sent back.");
- return success;
- }
- return success;
- }
-
- public static String getConfigHome(){
- try {
- loadWebapps();
- } catch (Exception e) {
- LOGGER.debug(e);
- return null;
- }
- return configHome;
- }
-
- public static String getActionHome(){
- try {
- loadWebapps();
- } catch (Exception e) {
- LOGGER.debug(e);
- return null;
- }
- return actionHome;
- }
-
- private static void loadWebapps() throws PAPException{
- if(actionHome == null || configHome == null){
- Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
- //Sanity Check
- if (webappsPath == null) {
- PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
- throw new PAPException("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
- }
- Path webappsPathConfig;
- Path webappsPathAction;
- if(webappsPath.toString().contains("\\")){
- webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
- webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
- }else{
- webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
- webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
- }
- if(!webappsPathConfig.toFile().exists()){
- try {
- Files.createDirectories(webappsPathConfig);
- } catch (IOException e) {
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
- }
- }
- if(!webappsPathAction.toFile().exists()){
- try {
- Files.createDirectories(webappsPathAction);
- } catch (IOException e) {
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
- }
- }
- actionHome = webappsPathAction.toString();
- configHome = webappsPathConfig.toString();
- }
- }
-
- public boolean validateConfigForm() {
- return true;
- }
-
- /**
- * @return the preparedToSave
- */
- public boolean isPreparedToSave() {
- return preparedToSave;
- }
-
- /**
- * @param preparedToSave the preparedToSave to set
- */
- protected void setPreparedToSave(boolean preparedToSave) {
- this.preparedToSave = preparedToSave;
- }
-
- public boolean isPolicyExists() {
- return policyExists;
- }
-
- public void setPolicyExists(boolean policyExists) {
- this.policyExists = policyExists;
- }
+
+ private static final Logger LOGGER = FlexLogger.getLogger(Policy.class);
+
+
+ /**
+ * Common Fields
+ */
+ public static final String GET_INT_TYPE = "Integer";
+ public static final String GET_STRING_TYPE = "String";
+
+ public static final String ONAPID = "ONAPName";
+ public static final String CONFIGID = "ConfigName";
+ public static final String CLOSEDLOOPID = "ServiceType";
+
+ public static final String CONFIG_POLICY = "Config";
+ public static final String ACTION_POLICY = "Action";
+ public static final String DECISION_POLICY = "Decision";
+
+ protected String policyName = null;
+
+ protected boolean isValidForm = true;
+
+ private Path finalPolicyPath = null;
+
+ private boolean preparedToSave = false;
+
+ private boolean policyExists = false;
+
+ public Path getFinalPolicyPath() {
+ return finalPolicyPath;
+ }
+
+ public void setFinalPolicyPath(Path finalPolicyPath) {
+ this.finalPolicyPath = finalPolicyPath;
+ }
+
+ // Constants Used in XML Creation
+ public static final String CATEGORY_RECIPIENT_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject";
+ public static final String CATEGORY_RESOURCE = "urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
+ public static final String CATEGORY_ACTION = "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
+ public static final String CATEGORY_ACCESS_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
+ public static final String ACTION_ID = "urn:oasis:names:tc:xacml:1.0:action:action-id";
+ public static final String SUBJECT_ID = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
+ public static final String RESOURCE_ID = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
+ public static final String FUNTION_INTEGER_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only";
+ public static final String FUNCTION_STRING_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only";
+ public static final String FUNCTION_BOOLEAN_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only";
+ public static final String FUNCTION_STRING_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-equal";
+ public static final String FUNCTION_STRING_REGEX_MATCH = "org.onap.function.regex-match";
+ public static final String FUNCTION_STRING_REGEXP_MATCH = "urn:oasis:names:tc:xacml:1.0:function:string-regexp-match";
+ public static final String FUNCTION_STRING_EQUAL_IGNORE = "urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case";
+ public static final String INTEGER_DATATYPE = "http://www.w3.org/2001/XMLSchema#integer";
+ public static final String BOOLEAN_DATATYPE = "http://www.w3.org/2001/XMLSchema#boolean";
+ public static final String STRING_DATATYPE = "http://www.w3.org/2001/XMLSchema#string";
+ public static final String URI_DATATYPE = "http://www.w3.org/2001/XMLSchema#anyURI";
+ public static final String RULE_VARIABLE = "var:";
+ public static final String EMPTY_STRING = "";
+
+ protected static String CONFIG_HOME = null;
+ protected static String ACTION_HOME = null;
+ protected static String CONFIG_URL = null;
+
+ protected Map<String, String> performer = new HashMap<>();
+
+ private static String actionHome = null;
+ private static String configHome = null;
+
+ public PolicyRestAdapter policyAdapter = null;
+ String ruleID = "";
+
+ public Policy() {
+ CONFIG_HOME = getConfigHome();
+ ACTION_HOME = getActionHome();
+ CONFIG_URL = "$URL";
+ performer.put("PDP", "PDPAction");
+ performer.put("PEP", "PEPAction");
+ }
+
+ //Each policy type seems to either use policyData or data field policy adapter when
+ //getting the xml to save the policy. Instead of keep this hardcoded in the save method,
+ //this method makes it usable outside.
+ /**
+ * Return the data field of the PolicyAdapter that will be used when saving this policy
+ * with the savePolicies method.
+ * @return Either the PolicyAdapter.getData() or PolicyAdapter.getPolicyData()
+ */
+ public abstract Object getCorrectPolicyDataObject();
+ public abstract Map<String, String> savePolicies() throws PAPException;
+
+ //This is the method for preparing the policy for saving. We have broken it out
+ //separately because the fully configured policy is used for multiple things
+ public abstract boolean prepareToSave() throws PAPException;
+
+
+ // create match for onap and config name
+ protected MatchType createMatch(String key, String value) {
+ MatchType match = new MatchType();
+
+ AttributeValueType attributeValue = new AttributeValueType();
+ attributeValue.setDataType(STRING_DATATYPE);
+ attributeValue.getContent().add(value);
+ match.setAttributeValue(attributeValue);
+ AttributeDesignatorType attributeDesignator = new AttributeDesignatorType();
+ URI uri = null;
+ try {
+ uri = new URI(key);
+ } catch (URISyntaxException e) {
+ LOGGER.error("Exception Occured"+e);
+ }
+ attributeDesignator.setCategory(CATEGORY_ACCESS_SUBJECT);
+ attributeDesignator.setDataType(STRING_DATATYPE);
+ attributeDesignator.setAttributeId(new IdentifierImpl(uri).stringValue());
+ match.setAttributeDesignator(attributeDesignator);
+ match.setMatchId(FUNCTION_STRING_REGEX_MATCH);
+ return match;
+ }
+
+ // Creating the match for dynamically added components.
+ protected MatchType createDynamicMatch(String key, String value) {
+ MatchType dynamicMatch = new MatchType();
+ AttributeValueType dynamicAttributeValue = new AttributeValueType();
+ String dataType = null;
+ dataType = STRING_DATATYPE;
+ dynamicAttributeValue.setDataType(dataType);
+ dynamicAttributeValue.getContent().add(value);
+ dynamicMatch.setAttributeValue(dynamicAttributeValue);
+
+ AttributeDesignatorType dynamicAttributeDesignator = new AttributeDesignatorType();
+
+ URI dynamicURI = null;
+ try {
+ dynamicURI = new URI(key);
+ } catch (URISyntaxException e) {
+ LOGGER.error("Exception Occured"+e);// log msg
+ }
+ dynamicAttributeDesignator.setCategory(CATEGORY_RESOURCE);
+ dynamicAttributeDesignator.setDataType(dataType);
+ dynamicAttributeDesignator.setAttributeId(new IdentifierImpl(dynamicURI).stringValue());
+ dynamicMatch.setAttributeDesignator(dynamicAttributeDesignator);
+ dynamicMatch.setMatchId(FUNCTION_STRING_REGEX_MATCH);
+
+ return dynamicMatch;
+ }
+
+ // the Policy Name as Unique One throws error
+ @SuppressWarnings("static-access")
+ protected Path getNextFilename(Path parent, String policyType, String polcyFileName, Integer version) {
+ policyType = FilenameUtils.removeExtension(policyType);
+ polcyFileName = FilenameUtils.removeExtension(polcyFileName);
+ Path newFile = null;
+ String policyDir = EMPTY_STRING;
+ String absolutePath = parent.toString();
+ if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
+ policyDir = absolutePath.substring(absolutePath.lastIndexOf('\\') + 1, absolutePath.length());
+ if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
+ policyDir = absolutePath.substring(absolutePath.lastIndexOf('/') + 1, absolutePath.length());
+ }
+ }
+
+ String fileName = "default";
+ if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
+ fileName = policyType + "_" + String.format(polcyFileName) + "." + version + ".xml";
+ }
+
+ newFile = Paths.get(parent.toString(), fileName);
+ if (newFile.toFile().exists()) {
+ return newFile;
+ }
+ return null;
+ }
+
+ protected Path getNextLoopFilename(Path parentPath, String policyType, String policyConfigType, String policyFileName, Integer version) {
+ policyType = FilenameUtils.removeExtension(policyType);
+ policyConfigType = FilenameUtils.removeExtension(policyConfigType);
+ policyFileName = FilenameUtils.removeExtension(policyFileName);
+ Path newFile = null;
+ String policyDir = EMPTY_STRING;
+ String absolutePath = parentPath.toString();
+ if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
+ policyDir = absolutePath.substring(absolutePath.lastIndexOf('\\') + 1, absolutePath.length());
+ if (policyDir.equals(EMPTY_STRING)) {
+ policyDir = absolutePath.substring(absolutePath.lastIndexOf('/') + 1, absolutePath.length());
+ }
+ }
+
+ String fileName = "default";
+ if (!policyDir.equals(EMPTY_STRING)) {
+ if("ClosedLoop_PM".equals(policyConfigType)){
+ fileName = policyType + "_" + "PM" + "_" +java.lang.String.format(policyFileName) + "." +version +".xml";
+ }else if("ClosedLoop_Fault".equals(policyConfigType)){
+ fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) + "." + version + ".xml";
+ }else if("Micro Service".equals(policyConfigType)){
+ fileName = policyType + "_" + "MS" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
+ }else if("Optimization".equals(policyConfigType)) {
+ fileName = policyType + "_" + "OOF" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
+ }
+ }
+
+ newFile = Paths.get(parentPath.toString(), fileName);
+
+ if (newFile.toFile().exists()) {
+ return newFile;
+ }
+ return null;
+ }
+
+
+ //create policy once all the validations are completed
+ protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
+ Map<String, String> success = new HashMap<>();
+ //
+ // Is the root a PolicySet or Policy?
+ //
+
+ if (policyData instanceof PolicyType) {
+ //
+ // Write it out
+ //
+ //Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
+ //and this transaction is intercepted up stream.
+
+ try(InputStream inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData)) {
+ PolicyDef policyDef = DOMPolicyDef.load(inputStream);
+ if (policyDef == null) {
+ success.put("validation", "PolicyDef Validation Failed");
+ }else{
+ success.put("success", "success");
+ }
+ } catch (Exception e) {
+ LOGGER.error("PolicyDef Validation failed"+e);
+ success.put("error", "Validation Failed");
+ }
+ } else {
+ PolicyLogger.error("Unknown data type sent back.");
+ return success;
+ }
+ return success;
+ }
+
+ public static String getConfigHome(){
+ try {
+ loadWebapps();
+ } catch (Exception e) {
+ LOGGER.debug(e);
+ return null;
+ }
+ return configHome;
+ }
+
+ public static String getActionHome(){
+ try {
+ loadWebapps();
+ } catch (Exception e) {
+ LOGGER.debug(e);
+ return null;
+ }
+ return actionHome;
+ }
+
+ private static void loadWebapps() throws PAPException{
+ if(actionHome == null || configHome == null){
+ Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
+ //Sanity Check
+ if (webappsPath == null) {
+ PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ throw new PAPException("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ }
+ Path webappsPathConfig;
+ Path webappsPathAction;
+ if(webappsPath.toString().contains("\\")){
+ webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
+ webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
+ }else{
+ webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
+ webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
+ }
+ if(!webappsPathConfig.toFile().exists()){
+ try {
+ Files.createDirectories(webappsPathConfig);
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
+ }
+ }
+ if(!webappsPathAction.toFile().exists()){
+ try {
+ Files.createDirectories(webappsPathAction);
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
+ }
+ }
+ actionHome = webappsPathAction.toString();
+ configHome = webappsPathConfig.toString();
+ }
+ }
+
+ public boolean validateConfigForm() {
+ return true;
+ }
+
+ /**
+ * @return the preparedToSave
+ */
+ public boolean isPreparedToSave() {
+ return preparedToSave;
+ }
+
+ /**
+ * @param preparedToSave the preparedToSave to set
+ */
+ protected void setPreparedToSave(boolean preparedToSave) {
+ this.preparedToSave = preparedToSave;
+ }
+
+ public boolean isPolicyExists() {
+ return policyExists;
+ }
+
+ public void setPolicyExists(boolean policyExists) {
+ this.policyExists = policyExists;
+ }
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
index dc1287b6c..6b980b98d 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
index 5d831f6dc..936e497f4 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
@@ -3,6 +3,7 @@
* ONAP-PDP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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/util/XACMLPolicyWriter.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
index ecbd3faa8..928165909 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
@@ -3,6 +3,7 @@
* ONAP-XACML
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,266 +62,266 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
*/
public class XACMLPolicyWriter {
- /**
- * Helper static class that does the work to write a policy set to a file on disk.
- *
- *
- */
- public static Path writePolicyFile(Path filename, PolicySetType policySet) {
- JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet);
- try {
- JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(policySetElement, filename.toFile());
+ /**
+ * Helper static class that does the work to write a policy set to a file on disk.
+ *
+ *
+ */
+ public static Path writePolicyFile(Path filename, PolicySetType policySet) {
+ JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet);
+ try {
+ JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(policySetElement, filename.toFile());
- if (Files.exists(filename)) {
- return filename;
- } else {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "File does not exist after marshalling.");
- return null;
- }
+ if (Files.exists(filename)) {
+ return filename;
+ } else {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "File does not exist after marshalling.");
+ return null;
+ }
- } catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- return null;
- }
- }
+ } catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ return null;
+ }
+ }
- /**
- * Helper static class that does the work to write a policy set to an output stream.
- *
- *
- */
- public static void writePolicyFile(OutputStream os, PolicySetType policySet) {
- JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet);
- try {
- JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(policySetElement, os);
- } catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- }
- }
+ /**
+ * Helper static class that does the work to write a policy set to an output stream.
+ *
+ *
+ */
+ public static void writePolicyFile(OutputStream os, PolicySetType policySet) {
+ JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet);
+ try {
+ JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(policySetElement, os);
+ } catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ }
+ }
- /**
- * Helper static class that does the work to write a policy to a file on disk.
- *
- *
- */
- public static Path writePolicyFile(Path filename, PolicyType policy) {
- JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy);
- try {
- JAXBContext context = JAXBContext.newInstance(PolicyType.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(policyElement, filename.toFile());
+ /**
+ * Helper static class that does the work to write a policy to a file on disk.
+ *
+ *
+ */
+ public static Path writePolicyFile(Path filename, PolicyType policy) {
+ JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy);
+ try {
+ JAXBContext context = JAXBContext.newInstance(PolicyType.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(policyElement, filename.toFile());
- if (Files.exists(filename)) {
- return filename;
- } else {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "File does not exist after marshalling.");
- return null;
- }
+ if (Files.exists(filename)) {
+ return filename;
+ } else {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "File does not exist after marshalling.");
+ return null;
+ }
- } catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- return null;
- }
- }
+ } catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ return null;
+ }
+ }
- /**
- * Helper static class that does the work to write a policy to a file on disk.
- *
- *
- */
- public static InputStream getXmlAsInputStream(PolicyType policy) {
- JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy);
- try {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- JAXBContext context = JAXBContext.newInstance(PolicyType.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(policyElement, byteArrayOutputStream);
- return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
- } catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- throw new IllegalArgumentException("XACMLPolicyWriter writePolicyFile failed", e);
- }
- }
- /**
- * Helper static class that does the work to write a policy set to an output stream.
- *
- *
- */
- public static void writePolicyFile(OutputStream os, PolicyType policy) {
- JAXBElement<PolicyType> policySetElement = new ObjectFactory().createPolicy(policy);
- try {
- JAXBContext context = JAXBContext.newInstance(PolicyType.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(policySetElement, os);
- } catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- }
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public static String changeFileNameInXmlWhenRenamePolicy(Path filename) {
+ /**
+ * Helper static class that does the work to write a policy to a file on disk.
+ *
+ *
+ */
+ public static InputStream getXmlAsInputStream(PolicyType policy) {
+ JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy);
+ try {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ JAXBContext context = JAXBContext.newInstance(PolicyType.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(policyElement, byteArrayOutputStream);
+ return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+ } catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ throw new IllegalArgumentException("XACMLPolicyWriter writePolicyFile failed", e);
+ }
+ }
+ /**
+ * Helper static class that does the work to write a policy set to an output stream.
+ *
+ *
+ */
+ public static void writePolicyFile(OutputStream os, PolicyType policy) {
+ JAXBElement<PolicyType> policySetElement = new ObjectFactory().createPolicy(policy);
+ try {
+ JAXBContext context = JAXBContext.newInstance(PolicyType.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(policySetElement, os);
+ } catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ }
+ }
- String extension = "";
- String domain = null;
- String repository = "repository";
- if(filename.toString().contains("Config_")){
- domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Config_"));
- }else if(filename.toString().contains("Action_")){
- domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Action_"));
- }else if(filename.toString().contains("Decision_")){
- domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Decision_"));
- }
- if(domain.contains(File.separator)){
- domain = domain.replace(File.separator, ".");
- }
- try {
- JAXBContext context = JAXBContext.newInstance(PolicyType.class);
- Unmarshaller m = context.createUnmarshaller();
- JAXBElement<PolicyType> policyElement = (JAXBElement<PolicyType>) m.unmarshal(filename.toFile());
- PolicyType policyType = policyElement.getValue();
- if (policyType != null) {
- TargetType targetType = policyType.getTarget();
- List<AnyOfType> anyOfTypes = targetType.getAnyOf();
- for( Iterator anyOfIte = anyOfTypes.iterator(); anyOfIte.hasNext(); ){
- AnyOfType anyOfType = (AnyOfType) anyOfIte.next();
- List<AllOfType> allOf = anyOfType.getAllOf();
- for( Iterator allOfIte = allOf.iterator(); allOfIte.hasNext(); ){
- AllOfType allOfType = (AllOfType) allOfIte.next();
- List<MatchType> match = allOfType.getMatch();
- for( Iterator matchIte = match.iterator(); matchIte.hasNext();) {
- MatchType matchType = (MatchType) matchIte.next();
- if("PolicyName".equals(matchType.getAttributeDesignator().getAttributeId())){
- AttributeValueType attributeValueType = matchType.getAttributeValue();
- List<Object> contents = attributeValueType.getContent();
- if (contents != null && !contents.isEmpty()) {
- String tmp = filename.getFileName()+"";
- String newName = tmp.substring(0, tmp.lastIndexOf("."));
- attributeValueType.getContent().clear();
- attributeValueType.getContent().add(domain + newName + "." + "xml");
- }
- }
- }
- }
- }
- if(filename.toString().contains("Config_") || filename.toString().contains("Action_")){
- List<Object> objects = policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition();
- if (objects != null && !objects.isEmpty()) {
- for (Iterator ite = objects.iterator(); ite.hasNext();) {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public static String changeFileNameInXmlWhenRenamePolicy(Path filename) {
- RuleType ruleType = (RuleType ) ite.next();
- AdviceExpressionsType adviceExpressionsType = ruleType.getAdviceExpressions();
- if (adviceExpressionsType != null) {
- List<AdviceExpressionType> adviceExpressionTypes = adviceExpressionsType.getAdviceExpression();
- if (adviceExpressionTypes != null && !adviceExpressionTypes.isEmpty()) {
- for (Iterator iterator = adviceExpressionTypes
- .iterator(); iterator.hasNext();) {
- AdviceExpressionType adviceExpressionType = (AdviceExpressionType) iterator
- .next();
- if (adviceExpressionType.getAdviceId() != null && !"".equals(adviceExpressionType.getAdviceId()) && ("configID".equals(adviceExpressionType.getAdviceId())
- || "faultID".equals(adviceExpressionType.getAdviceId()) || "PMID".equals(adviceExpressionType.getAdviceId())||"firewallConfigID".equals(adviceExpressionType.getAdviceId()) || "OptimizationID".equals(adviceExpressionType.getAdviceId())
- || "MSID".equals(adviceExpressionType.getAdviceId())) || "GocID".equals(adviceExpressionType.getAdviceId())||"GocHPID".equals(adviceExpressionType.getAdviceId())||"BRMSRAWID".equals(adviceExpressionType.getAdviceId())
- || "BRMSPARAMID".equals(adviceExpressionType.getAdviceId())|| "HPSuppID".equals(adviceExpressionType.getAdviceId()) || "HPFlapID".equals(adviceExpressionType.getAdviceId()) || "HPOverID".equals(adviceExpressionType.getAdviceId()))
- {
- List<AttributeAssignmentExpressionType> attributeAssignmentExpressionTypes = adviceExpressionType.getAttributeAssignmentExpression();
- if (attributeAssignmentExpressionTypes != null && !attributeAssignmentExpressionTypes.isEmpty()) {
- for (Iterator iterator2 = attributeAssignmentExpressionTypes
- .iterator(); iterator2.hasNext();) {
- AttributeAssignmentExpressionType attributeAssignmentExpressionType = (AttributeAssignmentExpressionType) iterator2
- .next();
- if ("URLID".equals(attributeAssignmentExpressionType.getAttributeId())) {
- JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
- AttributeValueType attributeValueType1 = attributeValueType.getValue();
- String configUrl = "$URL";
- String urlVal = (String) attributeValueType1.getContent().get(0);
- String origExtension = urlVal.substring(urlVal.lastIndexOf('.')+1).trim();
- extension = origExtension;
- attributeValueType1.getContent().clear();
- String txtFileName = filename.getFileName().toString();
- txtFileName = txtFileName.substring(0, txtFileName.lastIndexOf(".")+1) + origExtension;
- txtFileName = configUrl+ File.separator + "Config" + File.separator + domain + txtFileName;
- attributeValueType1.getContent().add(txtFileName);
- } else if ("PolicyName".equals(attributeAssignmentExpressionType.getAttributeId())) {
- JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
- AttributeValueType attributeValueType1 = attributeValueType.getValue();
- List<Object> contents = attributeValueType1.getContent();
- if (contents != null && !contents.isEmpty()) {
- String tmp = filename.getFileName()+"";
- String newName = tmp.substring(0, tmp.lastIndexOf("."));
- attributeValueType1.getContent().clear();
- attributeValueType1.getContent().add(domain + newName + "." + "xml");
- }
+ String extension = "";
+ String domain = null;
+ String repository = "repository";
+ if(filename.toString().contains("Config_")){
+ domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Config_"));
+ }else if(filename.toString().contains("Action_")){
+ domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Action_"));
+ }else if(filename.toString().contains("Decision_")){
+ domain = filename.toString().substring(filename.toString().indexOf(repository) + (repository.length()+1), filename.toString().indexOf("Decision_"));
+ }
+ if(domain.contains(File.separator)){
+ domain = domain.replace(File.separator, ".");
+ }
+ try {
+ JAXBContext context = JAXBContext.newInstance(PolicyType.class);
+ Unmarshaller m = context.createUnmarshaller();
+ JAXBElement<PolicyType> policyElement = (JAXBElement<PolicyType>) m.unmarshal(filename.toFile());
+ PolicyType policyType = policyElement.getValue();
+ if (policyType != null) {
+ TargetType targetType = policyType.getTarget();
+ List<AnyOfType> anyOfTypes = targetType.getAnyOf();
+ for( Iterator anyOfIte = anyOfTypes.iterator(); anyOfIte.hasNext(); ){
+ AnyOfType anyOfType = (AnyOfType) anyOfIte.next();
+ List<AllOfType> allOf = anyOfType.getAllOf();
+ for( Iterator allOfIte = allOf.iterator(); allOfIte.hasNext(); ){
+ AllOfType allOfType = (AllOfType) allOfIte.next();
+ List<MatchType> match = allOfType.getMatch();
+ for( Iterator matchIte = match.iterator(); matchIte.hasNext();) {
+ MatchType matchType = (MatchType) matchIte.next();
+ if("PolicyName".equals(matchType.getAttributeDesignator().getAttributeId())){
+ AttributeValueType attributeValueType = matchType.getAttributeValue();
+ List<Object> contents = attributeValueType.getContent();
+ if (contents != null && !contents.isEmpty()) {
+ String tmp = filename.getFileName()+"";
+ String newName = tmp.substring(0, tmp.lastIndexOf("."));
+ attributeValueType.getContent().clear();
+ attributeValueType.getContent().add(domain + newName + "." + "xml");
+ }
+ }
+ }
+ }
+ }
+ if(filename.toString().contains("Config_") || filename.toString().contains("Action_")){
+ List<Object> objects = policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition();
+ if (objects != null && !objects.isEmpty()) {
+ for (Iterator ite = objects.iterator(); ite.hasNext();) {
- }
+ RuleType ruleType = (RuleType ) ite.next();
+ AdviceExpressionsType adviceExpressionsType = ruleType.getAdviceExpressions();
+ if (adviceExpressionsType != null) {
+ List<AdviceExpressionType> adviceExpressionTypes = adviceExpressionsType.getAdviceExpression();
+ if (adviceExpressionTypes != null && !adviceExpressionTypes.isEmpty()) {
+ for (Iterator iterator = adviceExpressionTypes
+ .iterator(); iterator.hasNext();) {
+ AdviceExpressionType adviceExpressionType = (AdviceExpressionType) iterator
+ .next();
+ if (adviceExpressionType.getAdviceId() != null && !"".equals(adviceExpressionType.getAdviceId()) && ("configID".equals(adviceExpressionType.getAdviceId())
+ || "faultID".equals(adviceExpressionType.getAdviceId()) || "PMID".equals(adviceExpressionType.getAdviceId())||"firewallConfigID".equals(adviceExpressionType.getAdviceId()) || "OptimizationID".equals(adviceExpressionType.getAdviceId())
+ || "MSID".equals(adviceExpressionType.getAdviceId())) || "GocID".equals(adviceExpressionType.getAdviceId())||"GocHPID".equals(adviceExpressionType.getAdviceId())||"BRMSRAWID".equals(adviceExpressionType.getAdviceId())
+ || "BRMSPARAMID".equals(adviceExpressionType.getAdviceId())|| "HPSuppID".equals(adviceExpressionType.getAdviceId()) || "HPFlapID".equals(adviceExpressionType.getAdviceId()) || "HPOverID".equals(adviceExpressionType.getAdviceId()))
+ {
+ List<AttributeAssignmentExpressionType> attributeAssignmentExpressionTypes = adviceExpressionType.getAttributeAssignmentExpression();
+ if (attributeAssignmentExpressionTypes != null && !attributeAssignmentExpressionTypes.isEmpty()) {
+ for (Iterator iterator2 = attributeAssignmentExpressionTypes
+ .iterator(); iterator2.hasNext();) {
+ AttributeAssignmentExpressionType attributeAssignmentExpressionType = (AttributeAssignmentExpressionType) iterator2
+ .next();
+ if ("URLID".equals(attributeAssignmentExpressionType.getAttributeId())) {
+ JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
+ AttributeValueType attributeValueType1 = attributeValueType.getValue();
+ String configUrl = "$URL";
+ String urlVal = (String) attributeValueType1.getContent().get(0);
+ String origExtension = urlVal.substring(urlVal.lastIndexOf('.')+1).trim();
+ extension = origExtension;
+ attributeValueType1.getContent().clear();
+ String txtFileName = filename.getFileName().toString();
+ txtFileName = txtFileName.substring(0, txtFileName.lastIndexOf(".")+1) + origExtension;
+ txtFileName = configUrl+ File.separator + "Config" + File.separator + domain + txtFileName;
+ attributeValueType1.getContent().add(txtFileName);
+ } else if ("PolicyName".equals(attributeAssignmentExpressionType.getAttributeId())) {
+ JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
+ AttributeValueType attributeValueType1 = attributeValueType.getValue();
+ List<Object> contents = attributeValueType1.getContent();
+ if (contents != null && !contents.isEmpty()) {
+ String tmp = filename.getFileName()+"";
+ String newName = tmp.substring(0, tmp.lastIndexOf("."));
+ attributeValueType1.getContent().clear();
+ attributeValueType1.getContent().add(domain + newName + "." + "xml");
+ }
- }
- }
- }
- }
- }
- }
- }
- if (objects != null && !objects.isEmpty()) {
- for (Iterator ite1 = objects.iterator(); ite1.hasNext();) {
+ }
- RuleType ruleType1 = (RuleType ) ite1.next();
- ObligationExpressionsType obligationExpressionsType = ruleType1.getObligationExpressions();
- if (obligationExpressionsType != null) {
- List<ObligationExpressionType> obligationExpressionType = obligationExpressionsType.getObligationExpression();
- if (obligationExpressionType != null && !obligationExpressionType.isEmpty()) {
- for (Iterator iterator = obligationExpressionType
- .iterator(); iterator.hasNext();) {
- ObligationExpressionType obligationExpressionTypes = (ObligationExpressionType) iterator
- .next();
- if (obligationExpressionTypes.getObligationId() != null && !"".equals(obligationExpressionTypes.getObligationId())) {
- List<AttributeAssignmentExpressionType> attributeAssignmentExpressionTypes = obligationExpressionTypes.getAttributeAssignmentExpression();
- if (attributeAssignmentExpressionTypes != null && !attributeAssignmentExpressionTypes.isEmpty()) {
- for (Iterator iterator2 = attributeAssignmentExpressionTypes
- .iterator(); iterator2.hasNext();) {
- AttributeAssignmentExpressionType attributeAssignmentExpressionType = (AttributeAssignmentExpressionType) iterator2
- .next();
- if ("body".equals(attributeAssignmentExpressionType.getAttributeId())) {
- JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
- AttributeValueType attributeValueType1 = attributeValueType.getValue();
- String configUrl = "$URL";
- String urlVal = (String) attributeValueType1.getContent().get(0);
- String origExtension = urlVal.substring(urlVal.lastIndexOf('.')+1).trim();
- extension = "json";
- attributeValueType1.getContent().clear();
- String txtFileName = filename.getFileName().toString();
- txtFileName = txtFileName.substring(0, txtFileName.lastIndexOf(".")+1) + origExtension;
- txtFileName = configUrl+ File.separator + "Action" + File.separator + domain + txtFileName;
- attributeValueType1.getContent().add(txtFileName);
- }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (objects != null && !objects.isEmpty()) {
+ for (Iterator ite1 = objects.iterator(); ite1.hasNext();) {
- }
- }
+ RuleType ruleType1 = (RuleType ) ite1.next();
+ ObligationExpressionsType obligationExpressionsType = ruleType1.getObligationExpressions();
+ if (obligationExpressionsType != null) {
+ List<ObligationExpressionType> obligationExpressionType = obligationExpressionsType.getObligationExpression();
+ if (obligationExpressionType != null && !obligationExpressionType.isEmpty()) {
+ for (Iterator iterator = obligationExpressionType
+ .iterator(); iterator.hasNext();) {
+ ObligationExpressionType obligationExpressionTypes = (ObligationExpressionType) iterator
+ .next();
+ if (obligationExpressionTypes.getObligationId() != null && !"".equals(obligationExpressionTypes.getObligationId())) {
+ List<AttributeAssignmentExpressionType> attributeAssignmentExpressionTypes = obligationExpressionTypes.getAttributeAssignmentExpression();
+ if (attributeAssignmentExpressionTypes != null && !attributeAssignmentExpressionTypes.isEmpty()) {
+ for (Iterator iterator2 = attributeAssignmentExpressionTypes
+ .iterator(); iterator2.hasNext();) {
+ AttributeAssignmentExpressionType attributeAssignmentExpressionType = (AttributeAssignmentExpressionType) iterator2
+ .next();
+ if ("body".equals(attributeAssignmentExpressionType.getAttributeId())) {
+ JAXBElement<AttributeValueType> attributeValueType = (JAXBElement<AttributeValueType>) attributeAssignmentExpressionType.getExpression();
+ AttributeValueType attributeValueType1 = attributeValueType.getValue();
+ String configUrl = "$URL";
+ String urlVal = (String) attributeValueType1.getContent().get(0);
+ String origExtension = urlVal.substring(urlVal.lastIndexOf('.')+1).trim();
+ extension = "json";
+ attributeValueType1.getContent().clear();
+ String txtFileName = filename.getFileName().toString();
+ txtFileName = txtFileName.substring(0, txtFileName.lastIndexOf(".")+1) + origExtension;
+ txtFileName = configUrl+ File.separator + "Action" + File.separator + domain + txtFileName;
+ attributeValueType1.getContent().add(txtFileName);
+ }
- }
+ }
+ }
- }
- }
- }
- }
- }
- }
- }
- writePolicyFile(filename, policyType);
- }
- }catch (JAXBException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
- }
+ }
- return extension;
- }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ writePolicyFile(filename, policyType);
+ }
+ }catch (JAXBException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
+ }
+
+ return extension;
+ }
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
index be84690fa..8349fab82 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
index f29c8f8a1..8a3d27890 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,94 +40,94 @@ import com.att.research.xacml.util.XACMLProperties;
public class PolicyAdapter {
- private static final Logger LOGGER = FlexLogger.getLogger(PolicyAdapter.class);
+ private static final Logger LOGGER = FlexLogger.getLogger(PolicyAdapter.class);
- public void configure(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- if(extendedOptions(policyAdapter, entity)){
- return;
- }
- String policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf('_'));
- String configPolicyName = getConfigPolicyName(policyAdapter);
- policyAdapter.setPolicyType(policyNameValue);
+ public void configure(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ if(extendedOptions(policyAdapter, entity)){
+ return;
+ }
+ String policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf('_'));
+ String configPolicyName = getConfigPolicyName(policyAdapter);
+ policyAdapter.setPolicyType(policyNameValue);
- if (configPolicyName != null) {
- policyAdapter.setConfigPolicyType(configPolicyName);
- }
+ if (configPolicyName != null) {
+ policyAdapter.setConfigPolicyType(configPolicyName);
+ }
- if("Action".equalsIgnoreCase(policyAdapter.getPolicyType())){
- new ActionPolicyController().prePopulateActionPolicyData(policyAdapter, entity);
- }
- if("Decision".equalsIgnoreCase(policyAdapter.getPolicyType())){
- new DecisionPolicyController().prePopulateDecisionPolicyData(policyAdapter, entity);
- }
- if("Config".equalsIgnoreCase(policyAdapter.getPolicyType())){
- prePopulatePolicyData(policyAdapter, entity);
- }
- }
+ if("Action".equalsIgnoreCase(policyAdapter.getPolicyType())){
+ new ActionPolicyController().prePopulateActionPolicyData(policyAdapter, entity);
+ }
+ if("Decision".equalsIgnoreCase(policyAdapter.getPolicyType())){
+ new DecisionPolicyController().prePopulateDecisionPolicyData(policyAdapter, entity);
+ }
+ if("Config".equalsIgnoreCase(policyAdapter.getPolicyType())){
+ prePopulatePolicyData(policyAdapter, entity);
+ }
+ }
- private String getConfigPolicyName(PolicyRestAdapter policyAdapter) {
- String configPolicyName = null ;
- if(policyAdapter.getPolicyName().startsWith("Config_PM")){
- configPolicyName = "ClosedLoop_PM";
- }else if(policyAdapter.getPolicyName().startsWith("Config_Fault")){
- configPolicyName = "ClosedLoop_Fault";
- }else if(policyAdapter.getPolicyName().startsWith("Config_FW")){
- configPolicyName = "Firewall Config";
- }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Raw")){
- configPolicyName = "BRMS_Raw";
- }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Param")){
- configPolicyName = "BRMS_Param";
- }else if(policyAdapter.getPolicyName().startsWith("Config_MS")){
- configPolicyName = "Micro Service";
- }else if(policyAdapter.getPolicyName().startsWith("Config_OOF")){
- configPolicyName = "Optimization";
- }else if(policyAdapter.getPolicyName().startsWith("Action") || policyAdapter.getPolicyName().startsWith("Decision") ){
- // No configPolicyName is applicable
- }else{
- configPolicyName = "Base";
- }
- return configPolicyName;
- }
+ private String getConfigPolicyName(PolicyRestAdapter policyAdapter) {
+ String configPolicyName = null ;
+ if(policyAdapter.getPolicyName().startsWith("Config_PM")){
+ configPolicyName = "ClosedLoop_PM";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_Fault")){
+ configPolicyName = "ClosedLoop_Fault";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_FW")){
+ configPolicyName = "Firewall Config";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Raw")){
+ configPolicyName = "BRMS_Raw";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Param")){
+ configPolicyName = "BRMS_Param";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_MS")){
+ configPolicyName = "Micro Service";
+ }else if(policyAdapter.getPolicyName().startsWith("Config_OOF")){
+ configPolicyName = "Optimization";
+ }else if(policyAdapter.getPolicyName().startsWith("Action") || policyAdapter.getPolicyName().startsWith("Decision") ){
+ // No configPolicyName is applicable
+ }else{
+ configPolicyName = "Base";
+ }
+ return configPolicyName;
+ }
- private void prePopulatePolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- if("Base".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreatePolicyController().prePopulateBaseConfigPolicyData(policyAdapter, entity);
- }
- else if("BRMS_Raw".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateBRMSRawController().prePopulateBRMSRawPolicyData(policyAdapter, entity);
- }
- else if("BRMS_Param".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateBRMSParamController().prePopulateBRMSParamPolicyData(policyAdapter, entity);
- }
- else if("ClosedLoop_Fault".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateClosedLoopFaultController().prePopulateClosedLoopFaultPolicyData(policyAdapter, entity);
- }
- else if("ClosedLoop_PM".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateClosedLoopPMController().prePopulateClosedLoopPMPolicyData(policyAdapter, entity);
- }
- else if("Micro Service".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateDcaeMicroServiceController().prePopulateDCAEMSPolicyData(policyAdapter, entity);
- }
- else if("Optimization".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateOptimizationController().prePopulatePolicyData(policyAdapter, entity);
- }
- else if("Firewall Config".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
- new CreateFirewallController().prePopulateFWPolicyData(policyAdapter, entity);
- }
- }
+ private void prePopulatePolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ if("Base".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreatePolicyController().prePopulateBaseConfigPolicyData(policyAdapter, entity);
+ }
+ else if("BRMS_Raw".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateBRMSRawController().prePopulateBRMSRawPolicyData(policyAdapter, entity);
+ }
+ else if("BRMS_Param".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateBRMSParamController().prePopulateBRMSParamPolicyData(policyAdapter, entity);
+ }
+ else if("ClosedLoop_Fault".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateClosedLoopFaultController().prePopulateClosedLoopFaultPolicyData(policyAdapter, entity);
+ }
+ else if("ClosedLoop_PM".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateClosedLoopPMController().prePopulateClosedLoopPMPolicyData(policyAdapter, entity);
+ }
+ else if("Micro Service".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateDcaeMicroServiceController().prePopulateDCAEMSPolicyData(policyAdapter, entity);
+ }
+ else if("Optimization".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateOptimizationController().prePopulatePolicyData(policyAdapter, entity);
+ }
+ else if("Firewall Config".equalsIgnoreCase(policyAdapter.getConfigPolicyType())){
+ new CreateFirewallController().prePopulateFWPolicyData(policyAdapter, entity);
+ }
+ }
- private boolean extendedOptions(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- return false;
- }
+ private boolean extendedOptions(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ return false;
+ }
- public static PolicyAdapter getInstance() {
- try {
- Class<?> policyAdapter = Class.forName(XACMLProperties.getProperty("policyAdapter.impl.className", PolicyAdapter.class.getName()));
- return (PolicyAdapter) policyAdapter.newInstance();
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException e) {
- LOGGER.error("Exception Occured"+e);
- }
- return null;
- }
+ public static PolicyAdapter getInstance() {
+ try {
+ Class<?> policyAdapter = Class.forName(XACMLProperties.getProperty("policyAdapter.impl.className", PolicyAdapter.class.getName()));
+ return (PolicyAdapter) policyAdapter.newInstance();
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException e) {
+ LOGGER.error("Exception Occured"+e);
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
index e99f5ccc3..d94274242 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
index 0ece5cab4..b908c75d9 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
index 0c87ad3a4..c09944c2f 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.