diff options
Diffstat (limited to 'POLICY-SDK-APP/src/main')
5 files changed, 87 insertions, 82 deletions
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. |