aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/openecomp/policy/api
diff options
context:
space:
mode:
authorITSERVICES\rb7147 <rb7147@att.com>2017-04-25 11:46:00 -0400
committerITSERVICES\rb7147 <rb7147@att.com>2017-05-03 09:58:17 -0400
commite0addf5b588a1244f9679becd90999dfcb4c3a94 (patch)
tree1212772d6366730266ff0e093c874b07aa716c29 /PolicyEngineAPI/src/main/java/org/openecomp/policy/api
parent39fb0f30472777e4b60d6a7ac8aa4eb9773961ff (diff)
Policy 1707 commit to LF
Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/openecomp/policy/api')
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java12
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java12
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java13
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java11
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryResponse.java41
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java29
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java23
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsRequestParameters.java21
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsResponse.java45
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java11
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java11
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java20
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java11
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java397
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyException.java29
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java55
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java12
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java11
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java12
19 files changed, 555 insertions, 221 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java
index 2a887919b..44cf441ca 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Attribute Types that is used as a part of
* {@link org.openecomp.policy.api.PolicyParameters}.
@@ -63,4 +65,14 @@ public enum AttributeType {
public String toString() {
return this.name;
}
+
+ @JsonCreator
+ public static AttributeType create (String value) {
+ for(AttributeType type: values()){
+ if(type.toString().equalsIgnoreCase(value)){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java
index 3440c99aa..4ef348c7d 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Policy Delete Condition that is used as a part of
* {@link org.openecomp.policy.api.DeletePolicyParameters}.
@@ -50,4 +52,14 @@ public enum DeletePolicyCondition {
public String toString(){
return this.name;
}
+
+ @JsonCreator
+ public static DeletePolicyCondition create (String value) {
+ for(DeletePolicyCondition type: values()){
+ if(type.toString().equals(value) || type.equals(DeletePolicyCondition.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java
index 3999c5e22..3121297e1 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java
@@ -31,6 +31,7 @@ import java.util.UUID;
public class DeletePolicyParameters {
private String policyName;
+ private String policyType;
private String policyComponent;
private DeletePolicyCondition deleteCondition;
private String pdpGroup;
@@ -56,6 +57,18 @@ public class DeletePolicyParameters {
return policyComponent;
}
/**
+ * @return the policyType
+ */
+ public String getPolicyType() {
+ return policyType;
+ }
+ /**
+ * @param policyType the policyType to set
+ */
+ public void setPolicyType(String policyType) {
+ this.policyType = policyType;
+ }
+ /**
* @param policyComponent the policyComponent to set
*/
public void setPolicyComponent(String policyComponent) {
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java
index 1506effd7..cf70caf07 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java
@@ -20,14 +20,13 @@
package org.openecomp.policy.api;
-import java.util.Map;
import java.util.UUID;
public class DictionaryParameters {
private DictionaryType dictionaryType;
private String dictionary;
- private Map<AttributeType, Map<String,String>> dictionaryFields;
+ private String dictionaryJson;
private UUID requestID;
@@ -58,14 +57,14 @@ public class DictionaryParameters {
/**
* @return the dictionaryFields
*/
- public Map<AttributeType, Map<String,String>> getDictionaryFields() {
- return dictionaryFields;
+ public String getDictionaryJson() {
+ return dictionaryJson;
}
/**
* @param dictionaryFields the dictionaryFields to set
*/
- public void setDictionaryFields(Map<AttributeType, Map<String,String>> dictionaryFields) {
- this.dictionaryFields = dictionaryFields;
+ public void setDictionaryJson(String dictionaryJson) {
+ this.dictionaryJson = dictionaryJson;
}
/**
* @return the requestID
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryResponse.java
new file mode 100644
index 000000000..dd7379871
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryResponse.java
@@ -0,0 +1,41 @@
+package org.openecomp.policy.api;
+
+import java.util.Map;
+
+import javax.json.JsonObject;
+
+public interface DictionaryResponse {
+
+ /**
+ * Gets the <code>String</code> of the DictionaryItemsMessage from <code>DictionaryResponse</code>.
+ *
+ * @return the <code>String</code> which consists of DictionaryItemsMessage from <code>DictionaryResponse</code>
+ */
+ public String getResponseMessage();
+
+ /**
+ * Response code of type <code>Integer</code> which corresponds to the HTTP Response code explaining the response from Policy Engine.
+ *
+ * @return the responseCode in <code>Integer</code> format corresponding to the HTTP response code from Policy Engine.
+ */
+ public int getResponseCode();
+
+
+ /**
+ * Gets the <code>JsonObject</code> of all the Dictionary data retrieved
+ *
+ * @return the <code>JsonObject</code> which consists of Dictionary data which has been retrieved.
+ */
+ public JsonObject getDictionaryJson();
+
+
+ /**
+ * Gets the Key and Value pairs for each Dictionary item retrieved which can be used in the getDictionaryItems call.
+ *
+ * @return <code>Map</code> of <code>String, String</code> which consists of the Key and Value pairs for each Dictionary item retrieved.
+ */
+ public Map<String,String> getDictionaryData();
+
+
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java
index 0935f64b9..b50f398a9 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java
@@ -20,19 +20,25 @@
package org.openecomp.policy.api;
-public enum DictionaryType {
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+public enum DictionaryType{
/**
* Indicates Common Dictionaries.
*/
Common("Common"),
/**
+ * Indicates Action Policy Dictionaries
+ */
+ Action("Action"),
+ /**
* Indicates ClosedLoop Policy Dictionaries.
*/
ClosedLoop("ClosedLoop"),
/**
* Indicates Firewall Config Policy Dictionaries.
*/
- Firewall("FW"),
+ Firewall("Firewall"),
/**
* Indicates Decision Policy Dictionaries.
*/
@@ -44,7 +50,7 @@ public enum DictionaryType {
/**
* Indicates DCAE Micro Service Policy Dictionaries.
*/
- MicroService("MS"),
+ MicroService("MicroService"),
/**
* Indicates Descriptive Scope Dictionaries
*/
@@ -53,6 +59,14 @@ public enum DictionaryType {
* Indicates Policy Scope Dictionaries
*/
PolicyScope("PolicyScope"),
+ /**
+ * Indicates Enforcer Dictionaries
+ */
+ Enforcer("Enforcer"),
+ /**
+ * Indicates SafePolicy Dictionaries
+ */
+ SafePolicy("SafePolicy"),
;
private String name;
@@ -69,5 +83,14 @@ public enum DictionaryType {
return this.name;
}
+ @JsonCreator
+ public static DictionaryType create (String value) {
+ for(DictionaryType type: values()){
+ if(type.toString().equals(value) || type.equals(DictionaryType.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java
index 299f29a93..882379397 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java
@@ -20,7 +20,6 @@
package org.openecomp.policy.api;
-import java.util.List;
import java.util.UUID;
@@ -35,12 +34,12 @@ public class ImportParameters {
private String description;
private UUID requestID;
private String filePath;
- private String importBody;
private String version;
private IMPORT_TYPE importType;
public enum IMPORT_TYPE {
- MICROSERVICE
+ MICROSERVICE,
+ BRMSPARAM
}
/**
@@ -118,24 +117,6 @@ public class ImportParameters {
public void setRequestID(UUID requestID) {
this.requestID = requestID;
}
-
- /**
- * Gets the importBody of the new policy import.
- *
- * @return importBody the <code>String</code> format of the Policy Import Body
- */
- public String getImportBody() {
- return importBody;
- }
-
- /**
- * Sets the importBody of the Policy Import Body.
- *
- * @param importBody the <code>String</code> format of the Policy Import Body
- */
- public void setImportBody(String importBody) {
- this.importBody = importBody;
- }
/**
* Gets the List of File Paths of the new import.
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsRequestParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsRequestParameters.java
new file mode 100644
index 000000000..4c10f391f
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsRequestParameters.java
@@ -0,0 +1,21 @@
+package org.openecomp.policy.api;
+
+import java.util.UUID;
+
+public class MetricsRequestParameters {
+ private UUID requestID;
+
+ /**
+ * @return the requestID
+ */
+ public UUID getRequestID() {
+ return requestID;
+ }
+ /**
+ * @param requestID the requestID to set
+ */
+ public void setRequestID(UUID requestID) {
+ this.requestID = requestID;
+ }
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsResponse.java
new file mode 100644
index 000000000..d96a6dc9c
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/MetricsResponse.java
@@ -0,0 +1,45 @@
+package org.openecomp.policy.api;
+
+public interface MetricsResponse {
+
+ /**
+ * Gets the <code>String</code> of the metrics message from <code>MetricsResponse</code>.
+ *
+ * @return the <code>String</code> which consists of the metrics message from <code>MetricsResponse</code>
+ */
+ public String getResponseMessage();
+
+ /**
+ * Gets the response code of type <code>Integer</code> which corresponds to the HTTP Response code explaining the response from Policy Engine.
+ *
+ * @return the responseCode in <code>Integer</code> format corresponding to the HTTP response code from Policy Engine.
+ */
+ public int getResponseCode();
+
+
+ /**
+ * Gets the <code>Integer</code> value of the count of policies that reside on the PAP.
+ *
+ * @return the <code>Integer</code> which consists of count of policies that reside on the PAP.
+ */
+ public int getPapMetrics();
+
+
+ /**
+ * Gets the <code>Integer</code> value of the count of policies that reside on the PDP.
+ *
+ * @return the <code>Integer</code> which consists of count of policies that reside on the PDP.
+ */
+ public int getPdpMetrics();
+
+
+ /**
+ * Gets the <code>Integer</code> value of the total count of policies.
+ *
+ * @return the <code>Integer</code> which consists of the total count of policies.
+ */
+ public int getMetricsTotal();
+
+
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java
index caf3c11f1..8b87f408b 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Policy Types that is used as a part of
* {@link org.openecomp.policy.api.PolicyParameters}.
@@ -53,4 +55,13 @@ public enum PolicyClass {
public String toString() {
return this.name;
}
+ @JsonCreator
+ public static PolicyClass create (String value) {
+ for(PolicyClass type: values()){
+ if(type.toString().equals(value) || type.equals(PolicyClass.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java
index 9f45b652b..95d890de8 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of PolicyConfigStatus that can be returned as a part of
* {@link org.openecomp.policy.api.PolicyConfig}.
@@ -65,4 +67,13 @@ public enum PolicyConfigStatus {
public String toString(){
return this.name;
}
+ @JsonCreator
+ public static PolicyConfigStatus create (String value) {
+ for(PolicyConfigStatus type: values()){
+ if(type.toString().equals(value) || type.equals(PolicyConfigStatus.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java
index 111c85623..7b3ca2f23 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java
@@ -20,13 +20,15 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Policy Config Types that is used as a part of
* {@link org.openecomp.policy.api.PolicyParameters}.
*
* @version 0.1
*/
-public enum PolicyConfigType {
+public enum PolicyConfigType{
/**
* Indicates Base Config Policy.
*/
@@ -59,8 +61,8 @@ public enum PolicyConfigType {
private String name;
- private PolicyConfigType(String typeName){
- this.name = typeName;
+ private PolicyConfigType(String name){
+ this.name = name;
}
/**
@@ -68,6 +70,16 @@ public enum PolicyConfigType {
* @return the <code>String</code> of the Type for this <code>PolicyClass</code>
*/
public String toString() {
- return this.name;
+ return name;
}
+
+ @JsonCreator
+ public static PolicyConfigType create (String value) {
+ for(PolicyConfigType type: values()){
+ if(type.toString().equals(value) || type.equals(PolicyConfigType.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java
index 18d066905..a6b4bd2b4 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of PolicyDecision that can be returned as a part of
* {@link org.openecomp.policy.api.DecisionResponse} getDecision().
@@ -54,4 +56,13 @@ public enum PolicyDecision {
public String toString(){
return this.name;
}
+ @JsonCreator
+ public static PolicyDecision create (String value) {
+ for(PolicyDecision type: values()){
+ if(type.toString().equals(value) || type.equals(PolicyDecision.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
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..4fad508f6 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;
@@ -42,17 +42,67 @@ public class PolicyEngine{
private NotificationHandler handler = null;
/**
+ * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
+ *
+ * @param propertiesFilePathname the <code>String</code> 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 <code>String</code> format of propertiesFilePathname
+ *
+ * @param propertiesFilePathname the <code>String</code> 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 <code>String</code> format of PropertiesFilePathname and <code>NotificationScheme</code>
+ *
+ * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
+ * @param scheme the <code>NotificationScheme</code> 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 <code>String</code> format of PropertiesFilePathname, <code>NotificationScheme</code> and <code>NotificationHandler</code>
+ *
+ * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
+ * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
+ * @param handler the <code>NotificationHandler</code> 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 <code>String</code> which represents the Policy File Name
*
* @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required.
* @return <code>Collection</code> 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<PolicyConfig> getConfigByPolicyName(String policyName) throws PolicyConfigException {
- Collection<PolicyConfig> 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 <code>Collection</code> 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<PolicyConfig> getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
- Collection<PolicyConfig> 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 <code>String</code> format of the eCOMPComponentName whose configuration is required.
* @return <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName) throws PolicyConfigException {
- Collection<PolicyConfig> policyConfig = stdPolicyEngine.config(eCOMPComponentName,(UUID)null);
- return policyConfig;
+ return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, null));
}
/**
@@ -92,13 +140,12 @@ public class PolicyEngine{
* @return <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName, UUID requestID) throws PolicyConfigException {
- Collection<PolicyConfig> 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 <code>String</code> format of the eCOMPComponentName whose configuration is required.
* @param configName the <code>String</code> format of the configurationName whose configuration is required.
* @return <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName, String configName) throws PolicyConfigException {
- Collection<PolicyConfig> 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 <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName, String configName, UUID requestID) throws PolicyConfigException {
- Collection<PolicyConfig> 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 <code>String</code> format of the configurationName whose configuration is required.
* @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
* @return <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes) throws PolicyConfigException{
- Collection<PolicyConfig> 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 <code>Collection</code> 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<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes, UUID requestID) throws PolicyConfigException{
- Collection<PolicyConfig> 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 <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
*/
public Collection<PolicyConfig> getConfig(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
- Collection<PolicyConfig> 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 <code>Collection</code> of <code>String</code> which returns the list of policies.
- * @throws PolicyConfigException
+ * @throws PolicyConfigException PolicyConfig Exception
*/
public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters) throws PolicyConfigException{
- Collection<String> policyList = stdPolicyEngine.listConfig(listPolicyRequestParameters);
- return policyList;
+ return stdPolicyEngine.listConfig(listPolicyRequestParameters);
}
@@ -207,13 +248,12 @@ public class PolicyEngine{
*
* @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
* @return <code>Collection</code> 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<PolicyResponse> sendEvent(Map<String, String> eventAttributes) throws PolicyEventException {
- Collection<PolicyResponse> 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 <code>Collection</code> 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<PolicyResponse> sendEvent(Map<String, String> eventAttributes, UUID requestID) throws PolicyEventException {
- Collection<PolicyResponse> 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 <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
- * @throws PolicyEventException
+ * @throws PolicyEventException PolicyEvent Exception
*/
public Collection<PolicyResponse> sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
- Collection<PolicyResponse> policyResponse = stdPolicyEngine.event(eventRequestParameters);
- return policyResponse;
+ return stdPolicyEngine.sendEvent(eventRequestParameters);
}
/**
@@ -250,13 +288,12 @@ public class PolicyEngine{
* @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
* @param decisionAttributes the <code>Map</code> of <code>String,String</code> 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<String,String> 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<String,String> 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);
}
/**
- * <code>setNotification</code> 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 <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- * @param handler the <code>NotificationHandler</code> 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);
- }
-
- /**
- * <code>clearNotification</code> shutsDown the Notification Service if the Auto Scehme Notification service is running.
- */
- public void clearNotification(){
- stdPolicyEngine.stopNotification();
- }
-
- /**
- * <code>setNotification</code> allows changes to the Notification Scheme
- *
- * @param scheme the <code>NotificationScheme</code> 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 <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns.
+ * @param parameters {@link com.att.labs.ecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
+ * @return {@link com.att.labs.ecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
+ * @throws PolicyException PolicyException related to the operation
*
- * @return <code>PDPNotification</code> 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 <code>String</code> 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 <code>String</code> value of risk Level.
+ * @param riskType the <code>String</code> value of risk Type.
+ * @param guard the <code>String</code> value of guard.
+ * @param ttlDate the <code>String</code> value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return <code>String</code> format of response
* @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String createConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
Map<String, String> 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 <code>String</code> 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 <code>String</code> value of risk Level.
+ * @param riskType the <code>String</code> value of risk Type.
+ * @param guard the <code>String</code> value of guard.
+ * @param ttlDate the <code>String</code> value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return <code>String</code> format of response
* @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
*/
@Deprecated
public String updateConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
Map<String, String> 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 <code>String</code> 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 <code>String</code> value of risk Level.
+ * @param riskType the <code>String</code> value of risk Type.
+ * @param guard the <code>String</code> value of guard.
+ * @param ttlDate the <code>String</code> value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return <code>String</code> 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 <code>String</code> 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 <code>String</code> value of risk Level.
+ * @param riskType the <code>String</code> value of risk Type.
+ * @param guard the <code>String</code> value of guard.
+ * @param ttlDate the <code>String</code> value of time to live Date.
+ * @throws PolicyException PolicyException related to the operation.
* @return <code>String</code> 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 <code>String</code> 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 <code>String</code> 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 <code>String</code> format of propertiesFilePathname
+ * Creates a new Policy Service based on given Service Parameters.
*
- * @param propertiesFilePathname the <code>String</code> 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 <code>String</code> format of PropertiesFilePathname, <code>NotificationScheme</code> and <code>NotificationHandler</code>
- *
- * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
- * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
- * @param handler the <code>NotificationHandler</code> of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
- * @throws PolicyEngineException
+ * <code>setNotification</code> allows changes to the Notification Scheme and Notification Handler
+ *
+ * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
+ * @param handler the <code>NotificationHandler</code> 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
+ * <code>clearNotification</code> 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 <code>String</code> format of PropertiesFilePathname and <code>NotificationScheme</code>
+ * <code>setNotification</code> allows changes to the Notification Scheme
*
- * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
* @param scheme the <code>NotificationScheme</code> 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 <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns.
+ *
+ * @return <code>PDPNotification</code> 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<String, String> 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
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyException.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyException.java
new file mode 100644
index 000000000..f4a99fd32
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyException.java
@@ -0,0 +1,29 @@
+package org.openecomp.policy.api;
+
+/**
+ * PolicyException extends <code>Exception</code> to implement exceptions thrown by {@link org.openecomp.policy.api.PolicyEngine}
+ *
+ * @version 0.1
+ */
+public class PolicyException extends Exception {
+ private static final long serialVersionUID = -5006203722296799708L;
+
+ public PolicyException() {
+ }
+
+ public PolicyException(String message) {
+ super(message);
+ }
+
+ public PolicyException(Throwable cause){
+ super(cause);
+ }
+
+ public PolicyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PolicyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java
index 32cd75b5f..489408863 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java
@@ -20,6 +20,7 @@
package org.openecomp.policy.api;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -50,6 +51,8 @@ public class PolicyParameters {
private List<String> dynamicRuleAlgorithmField2;
private String priority;
private RuleProvider ruleProvider;
+ private String controllerName;
+ private ArrayList<String> dependencyNames;
private Date TTLDate;
private boolean guard = false;
private String riskLevel = "5";
@@ -203,7 +206,9 @@ public class PolicyParameters {
* @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
*/
public void setPolicyConfigType(PolicyConfigType policyConfigType) {
- setPolicyClass(PolicyClass.Config);
+ if(policyConfigType!=null){
+ setPolicyClass(PolicyClass.Config);
+ }
this.policyConfigType = policyConfigType;
}
@@ -444,7 +449,7 @@ public class PolicyParameters {
/**
* Sets the riskType field of the Policy Parameters.
*
- * @param guard the <code>String</code> format of the riskType value
+ * @param riskType the <code>String</code> format of the riskType value
*/
public void setRiskType(String riskType){
this.riskType = riskType;
@@ -494,4 +499,50 @@ public class PolicyParameters {
public Date getTtlDate(){
return TTLDate;
}
+
+ /**
+ * Gets the Controller Name for your policy.
+ *
+ * @return String format of the controller Name.
+ */
+ public String getControllerName() {
+ return controllerName;
+ }
+
+ /**
+ * Sets Controller Name for your policy.
+ *
+ * @param controllerName to identify the controller information for your policy.
+ */
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+
+ /**
+ * Gets Dependency Names for your policy.
+ *
+ * @return ArrayList of String(s) format of dependency names.
+ */
+ public ArrayList<String> getDependencyNames() {
+ return dependencyNames;
+ }
+
+ /**
+ * Sets Dependency that your policy is dependent on.
+ *
+ * @param dependencyNames ArrayList of String(s).
+ */
+ public void setDependencyNames(ArrayList<String> dependencyNames) {
+ this.dependencyNames = dependencyNames;
+ }
+
+ public String toString() {
+ return "PolicyParameters [ policyName=" + policyName + ", policyDescription=" + policyDescription + ", ecompName="+ ecompName
+ + ", configName=" + configName + ", attributes=" + attributes + ", configBody=" + configBody
+ + ",dynamicRuleAlgorithmLabels=" + dynamicRuleAlgorithmLabels + ",dynamicRuleAlgorithmFunctions=" + dynamicRuleAlgorithmFunctions
+ + ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2=" + dynamicRuleAlgorithmField2
+ + ", actionPerformer=" + actionPerformer + ", actionAttribute=" + actionAttribute + ", priority=" + priority
+ + ", ruleProvider= " + ruleProvider + ", riskLevel= " + riskLevel + ", riskType= " + riskType
+ + "]";
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java
index a9c329621..84fac733d 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of PolicyResponseStatus that can be returned as a part of
* {@link org.openecomp.policy.api.PolicyResponse}.
@@ -70,4 +72,14 @@ public enum PolicyResponseStatus {
public String toString(){
return this.name;
}
+
+ @JsonCreator
+ public static PolicyResponseStatus create (String value) {
+ for(PolicyResponseStatus type: values()){
+ if(type.toString().equals(value) || type.equals(PolicyResponseStatus.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java
index b86f9521f..a0566e039 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Policy Return Types that can be returned as part of a
* {@link org.openecomp.policy.api.PolicyConfig}.
@@ -58,4 +60,13 @@ public enum PolicyType {
public String toString() {
return this.name;
}
+ @JsonCreator
+ public static PolicyType create (String value) {
+ for(PolicyType type: values()){
+ if(type.toString().equalsIgnoreCase(value)){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java
index 8e9218124..e263d5dfa 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java
@@ -20,6 +20,8 @@
package org.openecomp.policy.api;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
/**
* Enumeration of the Attribute Types that is used as a part of
* {@link org.openecomp.policy.api.PolicyParameters}.
@@ -50,4 +52,14 @@ public enum RuleProvider {
public String toString() {
return this.name;
}
+
+ @JsonCreator
+ public static RuleProvider create (String value) {
+ for(RuleProvider type: values()){
+ if(type.toString().equals(value) || type.equals(RuleProvider.valueOf(value))){
+ return type;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
}