X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fapi%2FPolicyEngine.java;h=4e2c092c1f02ffd1bf0d7ca4f5e4a14f9cd4697a;hb=4ca818fdfb9b807562166800a086b413593d6894;hp=0b46c57cfb6d1c4e4a381fd47cb9166ba6d3bf8d;hpb=91d04c64771832a0b8815ffbe1f0f9920320d94d;p=policy%2Fengine.git
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
index 0b46c57cf..4e2c092c1 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
@@ -33,7 +33,7 @@ import org.openecomp.policy.std.StdPolicyEngine;
/**
* PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine
*
- * @version 1.0
+ * @version 2.0
*/
public class PolicyEngine{
private String propertyFilePath = null;
@@ -41,18 +41,68 @@ public class PolicyEngine{
private NotificationScheme scheme = null;
private NotificationHandler handler = null;
+ /**
+ * PolicyEngine Constructor with String
format of propertiesFilePathname
+ *
+ * @param propertiesFilePathname the String
format of the propertiesFilePathname
+ * @throws PolicyEngineException PolicyEngine Exception
+ */
+ public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
+ this.propertyFilePath = propertiesFilePathname ;
+ this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, (String)null);
+ }
+
+ /**
+ * PolicyEngine Constructor with String
format of propertiesFilePathname
+ *
+ * @param propertiesFilePathname the String
format of the propertiesFilePathname
+ * @param clientKey depicts String format of Password/ Client_Key.
+ * @throws PolicyEngineException PolicyEngine Exception
+ */
+ public PolicyEngine(String propertiesFilePathname, String clientKey) throws PolicyEngineException {
+ this.propertyFilePath = propertiesFilePathname ;
+ this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, clientKey);
+ }
+
+ /**
+ * PolicyEngine Constructor with String
format of PropertiesFilePathname and NotificationScheme
+ *
+ * @param propertiesFilePathname the String
format of the propertiesFilePathname
+ * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
+ * @throws PolicyEngineException PolicyEngine Exception
+ */
+ public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme) throws PolicyEngineException{
+ this.propertyFilePath = propertiesFilePathname;
+ this.scheme = scheme;
+ this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme);
+ }
+
+ /**
+ * PolicyEngine Constructor with String
format of PropertiesFilePathname, NotificationScheme
and NotificationHandler
+ *
+ * @param propertiesFilePathname the String
format of the propertiesFilePathname
+ * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
+ * @param handler the NotificationHandler
of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
+ * @throws PolicyEngineException PolicyEngine Exception
+ */
+ public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme, NotificationHandler handler) throws PolicyEngineException {
+ this.propertyFilePath = propertiesFilePathname ;
+ this.scheme = scheme;
+ this.handler = handler;
+ this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler);
+ }
+
/**
* Gets the configuration from the PolicyDecisionPoint(PDP) for the String
which represents the Policy File Name
*
* @param policyName the String
format of the PolicyFile Name whose configuration is required.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
- * @deprecated use {@link #getConfigByPolicyName(String policyName, UUID requestID)} Instead.
+ * @throws PolicyConfigException PolicyConfig Exception
+ * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfigByPolicyName(String policyName) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.policyName(policyName,(UUID)null);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(policyName, null, null, null, null));
}
/**
@@ -62,13 +112,12 @@ public class PolicyEngine{
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
- * @deprecated use {@link #getConfigByPolicyName(String policyName, UUID requestID)} Instead.
+ * @throws PolicyConfigException PolicyConfig Exception
+ * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.policyName(policyName,requestID);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(policyName, null, null, null, requestID));
}
/**
@@ -76,13 +125,12 @@ public class PolicyEngine{
*
* @param eCOMPComponentName the String
format of the eCOMPComponentName whose configuration is required.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,(UUID)null);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, null));
}
/**
@@ -92,13 +140,12 @@ public class PolicyEngine{
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName, UUID requestID) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,requestID);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, requestID));
}
/**
@@ -109,13 +156,12 @@ public class PolicyEngine{
* @param eCOMPComponentName the String
format of the eCOMPComponentName whose configuration is required.
* @param configName the String
format of the configurationName whose configuration is required.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName, String configName) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,configName,(UUID)null);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, null));
}
/**
@@ -128,13 +174,12 @@ public class PolicyEngine{
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName, String configName, UUID requestID) throws PolicyConfigException {
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,configName,requestID);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, requestID));
}
/**
@@ -146,13 +191,12 @@ public class PolicyEngine{
* @param configName the String
format of the configurationName whose configuration is required.
* @param configAttributes the Map
of String,String
format of the configuration attributes which are required.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName, String configName, Map configAttributes) throws PolicyConfigException{
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,configName,configAttributes,(UUID)null);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, null));
}
/**
@@ -166,13 +210,12 @@ public class PolicyEngine{
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
* @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
*/
@Deprecated
public Collection getConfig(String eCOMPComponentName, String configName, Map configAttributes, UUID requestID) throws PolicyConfigException{
- Collection policyConfig = stdPolicyEngine.config(eCOMPComponentName,configName,configAttributes,requestID);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, requestID));
}
/**
@@ -181,11 +224,10 @@ public class PolicyEngine{
*
* @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the Config policy request parameters.
* @return Collection
of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
*/
public Collection getConfig(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
- Collection policyConfig = stdPolicyEngine.config(configRequestParameters);
- return policyConfig;
+ return stdPolicyEngine.getConfig(configRequestParameters);
}
/**
@@ -194,11 +236,10 @@ public class PolicyEngine{
*
* @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the List Policy request parameters.
* @return Collection
of String
which returns the list of policies.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
*/
public Collection listConfig(ConfigRequestParameters listPolicyRequestParameters) throws PolicyConfigException{
- Collection policyList = stdPolicyEngine.listConfig(listPolicyRequestParameters);
- return policyList;
+ return stdPolicyEngine.listConfig(listPolicyRequestParameters);
}
@@ -207,13 +248,12 @@ public class PolicyEngine{
*
* @param eventAttributes the Map
of String,String
format of the eventAttributes that must contain the event ID and values.
* @return Collection
of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
- * @throws PolicyEventException
+ * @throws PolicyEventException PolicyEvent Exception
* @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
*/
@Deprecated
public Collection sendEvent(Map eventAttributes) throws PolicyEventException {
- Collection policyResponse = stdPolicyEngine.event(eventAttributes, (UUID) null);
- return policyResponse;
+ return stdPolicyEngine.sendEvent(eventAttributes, (UUID) null);
}
/**
@@ -223,13 +263,12 @@ public class PolicyEngine{
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
* @return Collection
of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
- * @throws PolicyEventException
+ * @throws PolicyEventException PolicyEvent Exception
* @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
*/
@Deprecated
public Collection sendEvent(Map eventAttributes, UUID requestID) throws PolicyEventException {
- Collection policyResponse = stdPolicyEngine.event(eventAttributes, requestID);
- return policyResponse;
+ return stdPolicyEngine.sendEvent(eventAttributes, requestID);
}
/**
@@ -237,11 +276,10 @@ public class PolicyEngine{
*
* @param eventRequestParameters {@link org.openecomp.policy.api.EventRequestParameters} which represents the Event Request Parameters.
* @return Collection
of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
- * @throws PolicyEventException
+ * @throws PolicyEventException PolicyEvent Exception
*/
public Collection sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
- Collection policyResponse = stdPolicyEngine.event(eventRequestParameters);
- return policyResponse;
+ return stdPolicyEngine.sendEvent(eventRequestParameters);
}
/**
@@ -250,13 +288,12 @@ public class PolicyEngine{
* @param eCOMPComponentName the String
format of the eCOMPComponentName whose Decision is required.
* @param decisionAttributes the Map
of String,String
format of the decisionAttributes that must contain the ID and values.
* @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision.
- * @throws PolicyDecisionException
+ * @throws PolicyDecisionException PolicyDecision Exception
* @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
*/
@Deprecated
public DecisionResponse getDecision(String eCOMPComponentName, Map decisionAttributes) throws PolicyDecisionException {
- DecisionResponse policyDecision = stdPolicyEngine.decide(eCOMPComponentName, decisionAttributes, null);
- return policyDecision;
+ return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, null);
}
/**
@@ -267,13 +304,12 @@ public class PolicyEngine{
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
* @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision.
- * @throws PolicyDecisionException
+ * @throws PolicyDecisionException PolicyDecision Exception
* @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
*/
@Deprecated
public DecisionResponse getDecision(String eCOMPComponentName, Map decisionAttributes, UUID requestID) throws PolicyDecisionException {
- DecisionResponse policyDecision = stdPolicyEngine.decide(eCOMPComponentName, decisionAttributes, requestID);
- return policyDecision;
+ return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, requestID);
}
/**
@@ -281,48 +317,22 @@ public class PolicyEngine{
*
* @param decisionRequestParameters {@link org.openecomp.policy.api.DecisionRequestParameters} which represents the Decision Request Parameters.
* @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision.
- * @throws PolicyDecisionException
+ * @throws PolicyDecisionException PolicyDecision Exception
*/
public DecisionResponse getDecision(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException {
- DecisionResponse policyDecision = stdPolicyEngine.decide(decisionRequestParameters);
- return policyDecision;
+ return stdPolicyEngine.getDecision(decisionRequestParameters);
}
/**
- * setNotification
allows changes to the Notification Scheme and Notification Handler
+ * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
*
- * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- * @param handler the NotificationHandler
of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
- */
- public void setNotification(NotificationScheme scheme, NotificationHandler handler) {
- this.scheme = scheme;
- this.handler = handler;
- stdPolicyEngine.notification(this.scheme,this.handler);
- }
-
- /**
- * clearNotification
shutsDown the Notification Service if the Auto Scehme Notification service is running.
- */
- public void clearNotification(){
- stdPolicyEngine.stopNotification();
- }
-
- /**
- * setNotification
allows changes to the Notification Scheme
- *
- * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- */
- public void setScheme(NotificationScheme scheme){
- this.scheme = scheme;
- stdPolicyEngine.setScheme(this.scheme);
- }
- /**
- * Gets the PDPNotification
if there is one exists. This is used for Polling Patterns.
+ * @param parameters {@link org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
+ * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
+ * @throws PolicyException PolicyException related to the operation
*
- * @return PDPNotification
of {@link org.openecomp.policy.api.PDPNotification} which has the Notification.
- */
- public PDPNotification getNotification() {
- return stdPolicyEngine.getNotification();
+ * */
+ public MetricsResponse getMetrics(MetricsRequestParameters parameters) throws PolicyException {
+ return stdPolicyEngine.getMetrics(parameters);
}
/**
@@ -337,21 +347,21 @@ public class PolicyEngine{
* @param policyScope the String
value of the sub scope directory where the policy will be created and stored
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
- * @throws Exception
+ * @param riskLevel the String
value of risk Level.
+ * @param riskType the String
value of risk Type.
+ * @param guard the String
value of guard.
+ * @param ttlDate the String
value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return String
format of response
* @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String createConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
Map configAttributes, String configType, String body, String policyScope, UUID requestID,
- String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
-
- String response = stdPolicyEngine.createConfigPolicy(policyName, policyDescription, ecompName, configName,
- configAttributes, configType, body, policyScope, requestID,
- riskLevel, riskType, guard, ttlDate);
-
- return response;
-
+ String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
+ return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName,
+ configAttributes, configType, body, policyScope, requestID,
+ riskLevel, riskType, guard, ttlDate, false);
}
/**
@@ -366,20 +376,20 @@ public class PolicyEngine{
* @param policyScope the String
value of the sub scope directory where the policy will be created and stored
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
- * @throws Exception
+ * @param riskLevel the String
value of risk Level.
+ * @param riskType the String
value of risk Type.
+ * @param guard the String
value of guard.
+ * @param ttlDate the String
value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return String
format of response
* @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String updateConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
Map configAttributes, String configType, String body, String policyScope, UUID requestID,
- String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
-
- String response = stdPolicyEngine.updateConfigPolicy(policyName, policyDescription, ecompName, configName,
- configAttributes, configType, body, policyScope, requestID,riskLevel, riskType, guard, ttlDate);
-
- return response;
-
+ String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
+ return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName,
+ configAttributes, configType, body, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
}
/**
@@ -389,19 +399,19 @@ public class PolicyEngine{
* @param policyScope the String
value of the sub scope directory where the policy will be created and stored
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
- * @throws Exception
+ * @param riskLevel the String
value of risk Level.
+ * @param riskType the String
value of risk Type.
+ * @param guard the String
value of guard.
+ * @param ttlDate the String
value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return String
format of response.
* @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
- String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
-
- String response = stdPolicyEngine.createConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel,
- riskType, guard, ttlDate);
-
- return response;
-
+ String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
+ return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel,
+ riskType, guard, ttlDate, false);
}
/**
@@ -411,30 +421,52 @@ public class PolicyEngine{
* @param policyScope the String
value of the sub scope directory where the policy will be created and stored
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* A different request ID should be passed for each request.
- * @throws Exception
+ * @param riskLevel the String
value of risk Level.
+ * @param riskType the String
value of risk Type.
+ * @param guard the String
value of guard.
+ * @param ttlDate the String
value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return String
format of response.
* @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
- String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
-
- String response = stdPolicyEngine.updateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, ttlDate);
-
- return response;
-
+ String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
+ return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
+ }
+
+ /**
+ * Retrieves Dictionary Items for a specified dictionary
+ *
+ * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item.
+ * @return {@link org.openecomp.policy.api.DictionaryResponse} which consists of the response related to create dictionary item Request.
+ * @throws PolicyException PolicyException related to the operation
+ *
+ * */
+ public DictionaryResponse getDictionaryItem(DictionaryParameters parameters) throws PolicyException {
+ return stdPolicyEngine.getDictionaryItem(parameters);
}
/**
* Creates a Dictionary Item based on given Dictionary Parameters
*
- * @param policyParameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item.
+ * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item.
* @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create dictionary item Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.createDictionaryItem(parameters);
- return response;
+ public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws PolicyException {
+ return stdPolicyEngine.createDictionaryItem(parameters);
+ }
+
+ /**
+ * Updates a Dictionary Item based on given Dictionary Parameters
+ *
+ * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to update a Dictionary Item.
+ * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to update dictionary item Request.
+ * @throws PolicyException PolicyException related to the operation.
+ */
+ public PolicyChangeResponse updateDictionaryItem(DictionaryParameters parameters) throws PolicyException {
+ return stdPolicyEngine.updateDictionaryItem(parameters);
}
/**
@@ -442,11 +474,10 @@ public class PolicyEngine{
*
* @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to create a Policy.
* @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.createPolicy(policyParameters);
- return response;
+ public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws PolicyException {
+ return stdPolicyEngine.createPolicy(policyParameters);
}
/**
@@ -454,11 +485,10 @@ public class PolicyEngine{
*
* @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to update a Policy.
* @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.updatePolicy(policyParameters);
- return response;
+ public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws PolicyException {
+ return stdPolicyEngine.updatePolicy(policyParameters);
}
/**
@@ -470,15 +500,12 @@ public class PolicyEngine{
* @param pdpGroup the String
format of the PDP Group name to which the policy needs to be pushed to.
* @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
* @return String
format of the response related to the push Policy Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
* @deprecated use {@link #pushPolicy(PushPolicyParameters)} instead.
*/
@Deprecated
- public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws Exception {
-
- String response = stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
-
- return response;
+ public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws PolicyException {
+ return stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
}
/**
@@ -486,11 +513,10 @@ public class PolicyEngine{
*
* @param pushPolicyParameters {@link org.openecomp.policy.api.PushPolicyParameters} which represents the Push Policy parameters required to push a policy.
* @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the push Policy Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.pushPolicy(pushPolicyParameters);
- return response;
+ public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws PolicyException {
+ return stdPolicyEngine.pushPolicy(pushPolicyParameters);
}
/**
@@ -498,78 +524,79 @@ public class PolicyEngine{
*
* @param deletePolicyParameters {@link org.openecomp.policy.api.DeletePolicyParameters} which represents the Delete Policy parameters to delete a policy.
* @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the Delete Policy Request.
- * @throws Exception
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.deletePolicy(deletePolicyParameters);
- return response;
+ public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws PolicyException {
+ return stdPolicyEngine.deletePolicy(deletePolicyParameters);
}
/**
- * PolicyEngine Constructor with String
format of propertiesFilePathname
+ * Creates a new Policy Service based on given Service Parameters.
*
- * @param propertiesFilePathname the String
format of the propertiesFilePathname
- * @throws PolicyEngineException
+ * @param importParameters {@link org.openecomp.policy.api.ImportParameters} which represents the Service Parameters required to create a Policy Service.
+ * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create import Service.
+ * @throws PolicyException PolicyException related to the operation.
*/
- public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
- this.propertyFilePath = propertiesFilePathname ;
- this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath);
+ public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws PolicyException {
+ return stdPolicyEngine.policyEngineImport(importParameters);
}
/**
- * PolicyEngine Constructor with String
format of PropertiesFilePathname, NotificationScheme
and NotificationHandler
- *
- * @param propertiesFilePathname the String
format of the propertiesFilePathname
- * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- * @param handler the NotificationHandler
of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
- * @throws PolicyEngineException
+ * setNotification
allows changes to the Notification Scheme and Notification Handler
+ *
+ * @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
+ * @param handler the NotificationHandler
of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
*/
- public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme, NotificationHandler handler) throws PolicyEngineException {
- this.propertyFilePath = propertiesFilePathname ;
+ public void setNotification(NotificationScheme scheme, NotificationHandler handler) {
this.scheme = scheme;
this.handler = handler;
- this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler);
+ stdPolicyEngine.notification(this.scheme,this.handler);
}
/**
- * Creates a new Policy Service based on given Service Parameters.
- *
- * @param importParameters {@link org.openecomp.policy.api.ImportParameters} which represents the Service Parameters required to create a Policy Service.
- * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create import Service.
- * @throws Exception
+ * clearNotification
shutsDown the Notification Service if the Auto Scehme Notification service is running.
*/
- public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws Exception {
- PolicyChangeResponse response = stdPolicyEngine.policyEngineImport(importParameters);
- return response;
+ public void clearNotification(){
+ stdPolicyEngine.stopNotification();
}
/**
- * PolicyEngine Constructor with String
format of PropertiesFilePathname and NotificationScheme
+ * setNotification
allows changes to the Notification Scheme
*
- * @param propertiesFilePathname the String
format of the propertiesFilePathname
* @param scheme the NotificationScheme
of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- * @throws PolicyEngineException
*/
- public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme) throws PolicyEngineException{
- this.propertyFilePath = propertiesFilePathname;
+ public void setScheme(NotificationScheme scheme){
this.scheme = scheme;
- this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme);
+ stdPolicyEngine.setScheme(this.scheme);
}
+
/**
- * PolicyEngine Constructor with no parameters.
- *//*
- public PolicyEngine(){
-
+ * Gets the PDPNotification
if there is one exists. This is used for Polling Patterns.
+ *
+ * @return PDPNotification
of {@link org.openecomp.policy.api.PDPNotification} which has the Notification.
+ */
+ public PDPNotification getNotification() {
+ return stdPolicyEngine.getNotification();
}
- public void createFirewallPolicy(String filterName, String termName, String preIPSource, String preIPDest,
- String sourcePort, String destPort, String Port, String protocol, String direction, String action ) throws PolicyDecisionException {
- stdPolicyEngine.createFirewallPolicy(filterName, termName, preIPSource, preIPDest, sourcePort, destPort, Port,
- protocol, direction, action);
+
+ /**
+ * setClientKey allows the client to use their own implementation logic for Password Protection
+ * and will be used to set the clear text password, this will be used while making Requests.
+ *
+ * @param clientKey depicts String format of Password/ Client_Key.
+ */
+ public void setClientKey(String clientKey){
+ stdPolicyEngine.setClientKey(clientKey);
}
- public void updateFirewallPolicy(String filterName, String termName, String preIPSource, String preIPDest,
- String sourcePort, String destPort, String Port, String protocol, String direction, String action ) throws PolicyDecisionException {
- stdPolicyEngine.updateFirewallPolicy(filterName, termName, preIPSource, preIPDest, sourcePort, destPort, Port,
- protocol, direction, action);
- }*/
-}
+ // Internal Setter Method to help build configRequestParameters.
+ private ConfigRequestParameters setConfigRequestParameters(String policyName, String eCOMPComponentName, String configName, Map configAttributes, UUID requestID){
+ ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
+ configRequestParameters.setPolicyName(policyName);
+ configRequestParameters.setEcompName(eCOMPComponentName);
+ configRequestParameters.setConfigName(configName);
+ configRequestParameters.setConfigAttributes(configAttributes);
+ configRequestParameters.setRequestID(requestID);
+ return configRequestParameters;
+ }
+}
\ No newline at end of file