diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java
new file mode 100644
index 0000000..2a88791
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/AttributeType.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of the Attribute Types that is used as a part of
+ * {@link org.openecomp.policy.api.PolicyParameters}.
+ * 
+ * @version 0.1
+ */
+public enum AttributeType {
+	/**
+	 * Indicates Attributes required to Match the Policy. 
+	 */
+	MATCHING("matching"),
+	/**
+	 * Indicates Attributes required to create DRL based Rules. 
+	 */
+	RULE("rule"),
+	/**
+	 * Indicates Attributes required to create MicroService policy. 
+	 */
+	MICROSERVICE("microService"),
+	/**
+	 * Indicates Attributes required to create settings for Decision Policy.
+	 */
+	SETTINGS("settings"),
+	/**
+	 * Indicates Attributes required to create dictionary fields for creating Dictionary Items
+	 */
+	DICTIONARY("dictionary")
+	;
+	
+	
+	private String name;
+	
+	private AttributeType(String typeName){
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>AttributeType</code>
+	 * @return the <code>String</code> of the Type for this <code>AttributeType</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ConfigRequestParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ConfigRequestParameters.java
new file mode 100644
index 0000000..1830679
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ConfigRequestParameters.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <code>ConfigRequestParameters</code> defines the Config Policy Request Parameters
+ *  which retrieve(s) the policy from PDP if the request parameters match with any Config Policy.  
+ * 
+ * @version 0.1
+ */
+public class ConfigRequestParameters {
+	private String policyName;
+	private String eCOMPComponentName;
+	private String configName;
+	private Map<String,String> configAttributes;
+	private UUID requestID;
+	private Boolean unique = false;
+	
+	/**
+	 * Sets the PolicyName of the Config policy which needs to be retrieved. 
+	 * 
+	 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required.
+	 */
+	public void setPolicyName(String policyName){
+		this.policyName = policyName;
+	}
+	
+	/**
+	 * Sets the ECOMP Component Name of the Config policy which needs to be retrieved. 
+	 * 
+	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
+	 */
+	public void setEcompName(String eCOMPComponentName){
+		this.eCOMPComponentName = eCOMPComponentName;
+	}
+	
+	/**
+	 * Sets the Config Name of the Config policy which needs to be retrieved.  
+	 * 
+	 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
+	 */
+	public void setConfigName(String configName){
+		this.configName = configName;
+	}
+	
+	/**
+	 * Sets the ConfigAttributes of the Config policy which needs to be retrieved. 
+	 * 
+	 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
+	 */
+	public void setConfigAttributes(Map<String, String> configAttributes){
+		this.configAttributes = configAttributes;
+	}
+	
+	/**
+	 * Sets the Request ID of the ECOMP request. 
+	 * 
+	 * @param requestID unique <code>UUID</code> requestID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public void setRequestID(UUID requestID){
+		this.requestID = requestID;
+	}
+	
+	/**
+	 * Gets the policyName of the Request Parameters.
+	 * 
+	 * @return <code>String</code> format of the policyName.
+	 */
+	public String getPolicyName(){
+		return policyName;
+	}
+	
+	/**
+	 * Gets the ECOMP Component Name of the Request Parameters. 
+	 * 
+	 * @return <code>String</code> format of the ECOMP Component Name. 
+	 */
+	public String getEcompName(){
+		return eCOMPComponentName;
+	}
+	
+	/**
+	 * Gets the Config name of the Request Parameters. 
+	 * 
+	 * @return <code>String</code> format of the Config Name.  
+	 */
+	public String getConfigName(){
+		return configName;
+	}
+	
+	/**
+	 *  Gets the Config Attributes of the Request Parameters. 
+	 *  
+	 * @return <code>Map</code> of <code>String</code>,<code>String</code> format of the config Attributes. 
+	 */
+	public Map<String,String> getConfigAttributes(){
+		return configAttributes;
+	}
+	
+	/**
+	 *  Gets the Request ID of the Request Paramters.
+	 *  
+	 * @return <code>UUID</code> format of requestID. 
+	 */
+	public UUID getRequestID(){
+		return requestID;
+	}
+	
+	/**
+	 * Makes the results Unique, priority based. If set to True. Default Value is set to False. 
+	 * 
+	 * @param unique flag which is either true or false. 
+	 */
+	public void makeUnique(Boolean unique){
+		this.unique = unique;
+	}
+	
+	/**
+	 * Gets the Unique flag value from the Config Request Parameters. 
+	 * 
+	 * @return unique flag which is either true or false. 
+	 */
+	public Boolean getUnique(){
+		return this.unique;
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionRequestParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionRequestParameters.java
new file mode 100644
index 0000000..dc485f7
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionRequestParameters.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <code>DecisionRequestParameters</code> defines the Decision Policy Request Parameters
+ *  which retrieve(s) the response from PDP if the request parameters match with any Decision Policy.
+ * 
+ * @version 0.1
+ */
+public class DecisionRequestParameters {
+	private String eCOMPComponentName;
+	private Map<String,String> decisionAttributes;
+	private UUID requestID;
+	
+	/**
+	 * Constructor with no Parameters
+	 */
+	public DecisionRequestParameters(){
+	}
+	
+	/**
+	 * Constructor with Parameters
+	 * 
+	 * @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 contain the ID and values.
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public DecisionRequestParameters(String eCOMPComponentName, Map<String,String> decisionAttributes, UUID requestID){
+		this.eCOMPComponentName = eCOMPComponentName;
+		this.decisionAttributes = decisionAttributes;
+		this.requestID = requestID;
+	}
+	
+	/**
+	 * Gets the ECOMPComponentName of the Decision Request Parameters. 
+	 * 
+	 * @return ECOMPComponentName the <code>String</code> format of the eCOMPComponentName of the Decision Request Parameters.
+	 */
+	public String getECOMPComponentName() {
+		return eCOMPComponentName;
+	}
+	/**
+	 * Sets the ECOMPComponentName of the Decision Request parameters.  
+	 * 
+	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
+	 */
+	public void setECOMPComponentName(String eCOMPComponentName) {
+		this.eCOMPComponentName = eCOMPComponentName;
+	}
+	/**
+	 * Gets the Decision Attributes from Decision Request Parameters. 
+	 * 
+	 * @return decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that contain the ID and values.
+	 */
+	public Map<String,String> getDecisionAttributes() {
+		return decisionAttributes;
+	}
+	/**
+	 * Sets the Decision Attributes which contain ID and values for obtaining Decision from PDP. 
+	 * 
+	 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
+	 */
+	public void setDecisionAttributes(Map<String,String> decisionAttributes) {
+		this.decisionAttributes = decisionAttributes;
+	}
+	/**
+	 * Gets the request ID of Decision Request Parameters. 
+	 * 
+	 * @return the requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	/**
+	 * Sets the ReqestID of Decision Request Parameters which will be passed around ECOMP requests.
+	 * 
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public void setRequestID(UUID requestID) {
+		this.requestID = requestID;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionResponse.java
new file mode 100644
index 0000000..caa9fda
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DecisionResponse.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Defines the Object that represents the Policy Decision Response elements.
+ * DecisionResponse communicates the decision and details  
+ * 
+ * @version 0.1
+ */
+public interface DecisionResponse {
+	/**
+	 * Gets the Decision of the Policy, Either a Permit or Deny. 
+	 * 
+	 * @return {@link org.openecomp.policy.api.PolicyDecision} Enumeration. 
+	 */
+	public PolicyDecision getDecision();
+	
+	/**
+	 * Gets the details of the result. Would be required in case of Deny. 
+	 * 
+	 * @return <code>String</code> format of the details of Deny cause. 
+	 */
+	public String getDetails();
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java
new file mode 100644
index 0000000..3440c99
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyCondition.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of the Policy Delete Condition that is used as a part of
+ * {@link org.openecomp.policy.api.DeletePolicyParameters}.
+ * 
+ * @version 0.1
+ */
+public enum DeletePolicyCondition {
+	
+	/**
+	 * Indicates a condition to only delete the current version of the policy. 
+	 */
+	ONE("Current Version"),
+	
+	/**
+	 * Indicates a condition to delete all versions of the policy.
+	 */
+	ALL("All Versions");
+	private String name;
+
+	private DeletePolicyCondition(String name){
+		this.name = name;
+	}
+
+	/**
+	 * Returns the <code>String</code> format of delete condition for this Policy
+	 * @return the <code>String</code> of the delete condition for this Policy
+	 */
+	public String toString(){
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java
new file mode 100644
index 0000000..3999c5e
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DeletePolicyParameters.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.UUID;
+
+/**
+ * <code>PushPolicyParameters</code> defines the Policy Parameters
+ *  which are required to Push a Policy to PDPGroup. 
+ * 
+ * @version 0.1
+ */
+public class DeletePolicyParameters {
+	
+	private String policyName;
+	private String policyComponent;
+	private DeletePolicyCondition deleteCondition;
+	private String pdpGroup;
+	private UUID requestID;
+
+	
+	/**
+	 * @return the policyName
+	 */
+	public String getPolicyName() {
+		return policyName;
+	}
+	/**
+	 * @param policyName the policyName to set
+	 */
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+	/**
+	 * @return the policyComponent
+	 */
+	public String getPolicyComponent() {
+		return policyComponent;
+	}
+	/**
+	 * @param policyComponent the policyComponent to set
+	 */
+	public void setPolicyComponent(String policyComponent) {
+		this.policyComponent = policyComponent;
+	}
+	/**
+	 * @return the deleteCondition
+	 */
+	public DeletePolicyCondition getDeleteCondition() {
+		return deleteCondition;
+	}
+	/**
+	 * @param deleteCondition the deleteCondition to set
+	 */
+	public void setDeleteCondition(DeletePolicyCondition deleteCondition) {
+		this.deleteCondition = deleteCondition;
+	}
+	/**
+	 * @return the requestID
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	/**
+	 * @param requestID the requestID to set
+	 */
+	public void setRequestID(UUID requestID) {
+		this.requestID = requestID;
+	}
+	/**
+	 * @return the pdpGroup
+	 */
+	public String getPdpGroup() {
+		return pdpGroup;
+	}
+	/**
+	 * @param pdpGroup the pdpGroup to set
+	 */
+	public void setPdpGroup(String pdpGroup) {
+		this.pdpGroup = pdpGroup;
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java
new file mode 100644
index 0000000..1506eff
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryParameters.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+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 UUID requestID;
+	
+	
+	/**
+	 * @return the dictionaryType
+	 */
+	public DictionaryType getDictionaryType() {
+		return dictionaryType;
+	}
+	/**
+	 * @param dictionaryType the dictionaryType to set
+	 */
+	public void setDictionaryType(DictionaryType dictionaryType) {
+		this.dictionaryType = dictionaryType;
+	}
+	/**
+	 * @return the dictionary
+	 */
+	public String getDictionary() {
+		return dictionary;
+	}
+	/**
+	 * @param dictionary the dictionary to set
+	 */
+	public void setDictionary(String dictionary) {
+		this.dictionary = dictionary;
+	}
+	/**
+	 * @return the dictionaryFields
+	 */
+	public Map<AttributeType, Map<String,String>> getDictionaryFields() {
+		return dictionaryFields;
+	}
+	/**
+	 * @param dictionaryFields the dictionaryFields to set
+	 */
+	public void setDictionaryFields(Map<AttributeType, Map<String,String>> dictionaryFields) {
+		this.dictionaryFields = dictionaryFields;
+	}
+	/**
+	 * @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/DictionaryType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java
new file mode 100644
index 0000000..0935f64
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/DictionaryType.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+public enum DictionaryType {
+	/**
+	 * Indicates Common Dictionaries. 
+	 */
+	Common("Common"),
+	/**
+	 * Indicates ClosedLoop Policy Dictionaries. 
+	 */
+	ClosedLoop("ClosedLoop"),
+	/**
+	 * Indicates Firewall Config Policy Dictionaries. 
+	 */
+	Firewall("FW"),
+	/**
+	 * Indicates Decision Policy Dictionaries. 
+	 */
+	Decision("Decision"),
+	/**
+	 * Indicates BRMS Policy Dictionaries. 
+	 */
+	BRMS("BRMS"),
+	/**
+	 * Indicates DCAE Micro Service Policy Dictionaries. 
+	 */
+	MicroService("MS"),
+	/**
+	 * Indicates Descriptive Scope Dictionaries
+	 */
+	DescriptiveScope("DescriptiveScope"),
+	/**
+	 * Indicates Policy Scope Dictionaries
+	 */
+	PolicyScope("PolicyScope"),
+	;
+	
+	private String name;
+	
+	private DictionaryType(String typeName){
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>PolicyClass</code>
+	 * @return the <code>String</code> of the Type for this <code>PolicyClass</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+	
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/EventRequestParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/EventRequestParameters.java
new file mode 100644
index 0000000..155d9c6
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/EventRequestParameters.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <code>EventRequestParameters</code> defines the Event Policy Request Parameters
+ *  which retrieve(s) the response from PDP if the request parameters match with any Action Policy.  
+ * 
+ * @version 0.1
+ */
+public class EventRequestParameters {
+	private Map<String,String> eventAttributes;
+	private UUID requestID;
+	
+	/**
+	 * Constructor with no Parameters
+	 */
+	public EventRequestParameters(){
+	}
+	
+	/**
+	 * Constructor with Parameters
+	 * 
+	 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that contains the event ID and values.
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public EventRequestParameters(Map<String,String> eventAttributes, UUID requestID){
+		this.eventAttributes = eventAttributes;
+		this.requestID = requestID;
+	}
+	
+	/**
+	 * Gets the eventAttributes of Event Request Parameters. 
+	 * 
+	 * @return eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that contains the event ID and values.
+	 */
+	public Map<String,String> getEventAttributes() {
+		return eventAttributes;
+	}
+	
+	/**
+	 * Sets the eventAttributes that contain the eventID and values to the Event Request Parameters. 
+	 * 
+	 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
+	 */
+	public void setEventAttributes(Map<String,String> eventAttributes) {
+		this.eventAttributes = eventAttributes;
+	}
+	
+	/**
+	 * Gets the ReqestID of Event Request Parameters which will be passed around ECOMP requests. 
+	 * 
+	 * @return requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	
+	/**
+	 * Sets the ReqestID of Event Request Parameters which will be passed around ECOMP requests.
+	 * 
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public void setRequestID(UUID requestID) {
+		this.requestID = requestID;
+	}
+	
+} 
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java
new file mode 100644
index 0000000..299f29a
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/ImportParameters.java
@@ -0,0 +1,194 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.List;
+import java.util.UUID;
+
+
+/**
+ * <code>ImportParameters</code> defines the Policy Engine Import Parameters
+ *  which are required to import a new Policy Service or Value. 
+ * 
+ * @version 0.1
+ */
+public class ImportParameters {
+	private String serviceName;
+	private String description;
+	private UUID requestID;
+	private String filePath;
+	private String importBody;
+	private String version;
+	private IMPORT_TYPE importType;
+	
+	public enum IMPORT_TYPE {
+	    MICROSERVICE
+	}
+
+	/**
+	 * Sets Import Policy Parameters.
+	 * 
+	 * @param serviceName the <code>String</code> format of the Service Name
+	 * @param description the <code>String</code> format of the i Description
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 * @param filePath the <code>List</code> format of the file paths for the service files
+	 * @param importType the {@link IMPORT_TYPE} format of the Policy Service List
+	 * @param version the <code>String</code> format of the Policy Import Version
+	 * A different request ID should be passed for each request.
+	 */
+	public void setImportParameters(String serviceName, String description, UUID requestID, String filePath, IMPORT_TYPE importType, String version){
+		
+		this.setServiceName(serviceName);
+		this.setDescription(description);
+		this.setRequestID(requestID);
+		this.setFilePath(filePath);
+		this.setServiceType(importType);	
+		this.setVersion(version);
+		
+	}
+
+	/**
+	 * Gets the Policy Service of the Policy Service Import Parameters. 
+	 * 
+	 * @return serviceName the <code>String</code> format of the Policy Service Name
+	 */
+	public String getServiceName() {
+		return serviceName;
+	}
+
+	/**
+	 * Sets the serviceName of the Policy Service Parameters.
+	 * 
+	 * @param serviceName the <code>String</code> format of the Policy Service Name
+	 */
+	public void setServiceName(String serviceName) {
+		this.serviceName = serviceName;
+	}
+
+	/**
+	 * Gets the Policy Import Description. 
+	 * 
+	 * @return description the <code>String</code> format of the Policy Import Description
+	 */
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Sets the Description of the new Policy Import Description. 
+	 * 
+	 * @param description the <code>String</code> format of the Policy Import Description
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	
+	/**
+	 * Gets the requestID of the Policy Parameters. 
+	 * 
+	 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	
+	/**
+	 * Sets the requestID of the Policy Parameters. 
+	 * 
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	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. 
+	 * 
+	 * @return filePath the <code>List</code> format of the Policy Import  File
+	 */
+	public String getFilePath() {
+		return filePath;
+	}
+
+	/**
+	 * Sets the policy Import File List of the new Policy Import. 
+	 * 
+	 * @param filePath the <code>List</code> format of the Policy Import  File
+	 */
+	public void setFilePath(String filePath) {
+		this.filePath = filePath;
+	}
+	
+	/** 
+	 * Gets the Service Type of the new policy import. 
+	 * 
+	 * @return ImportType {@link IMPORT_TYPE} format of the Policy Service List
+	 */
+	public IMPORT_TYPE getServiceType() {
+		return importType;
+	}
+	
+	/**
+	 * Sets the policy Service Type of the new Policy Service. 
+	 * 
+	 * @param enumImportType the <code>enumServiceType</code> format of the Policy Service List
+	 */
+	public void setServiceType(IMPORT_TYPE enumImportType) {
+		this.importType = enumImportType;
+	}
+	
+	/**
+	 * 
+	 * Gets the Import Version of the new policy import. 
+	 * 
+	 * @return version the <code>String</code> format of the Policy Import Version
+	 */
+	public String getVersion() {
+		return version;
+	}
+
+	/**
+	 * Sets the policy Import Version  of the new Policy Import. 
+	 * 
+	 * @param version the <code>String</code> format of the Policy Import Version
+	 */
+	public void setVersion(String version) {
+		this.version = version;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/NotificationScheme.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/NotificationScheme.java
new file mode 100644
index 0000000..2e88d9c
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/NotificationScheme.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of <code>NotificationScheme</code> describes the Notification Scheme that will be used by the PolicyEngine.
+ * 
+ * @version 0.1 
+ */
+public enum NotificationScheme {
+	/**
+	 * Notifications for policyUpdates on policy Configs already retrieved 
+	 */
+	AUTO_NOTIFICATIONS("auto_notifications"),
+	/**
+	 * Subscribing to all notifications from the PDP 
+	 */
+	AUTO_ALL_NOTIFICATIONS("auto_all_notifications"),
+	/**
+	 * Client can poll for updates that receive policyUpdates on policy Configs that have already been retrieved
+	 */
+	MANUAL_NOTIFICATIONS("manual_notifications"),
+	/**
+	 * Client can poll for updates that receive all notifications from the PDP 
+	 */
+	MANUAL_ALL_NOTIFICATIONS("manual_all_notifications")
+	;
+	
+	private String name;
+	private NotificationScheme(String name){
+		this.name = name;
+	}
+	
+	/**
+	 * Returns the <code>String</code> name for this <code>NotificationScheme</code>
+	 * 
+	 * @return the <code>String</code> name for this <code>NotificationScheme</code>
+	 */
+	@Override
+	public String toString(){
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyChangeResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyChangeResponse.java
new file mode 100644
index 0000000..98bfdc2
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyChangeResponse.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * <code>PolicyChangeResponse</code> defines the Policy Response
+ *  which is Contains responseCode corresponding to HTTP response Codes with response Message. 
+ * 
+ * @version 0.1
+ */
+public interface PolicyChangeResponse {
+	
+	/**
+	 * Policy Change Response Message in <code>String</code> format from the Policy Engine. 
+	 * 
+	 * @return the responseMessage in <code>String</code> format related to Response from Policy Engine. 
+	 */
+	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();
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java
new file mode 100644
index 0000000..caf3c11
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyClass.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of the Policy Types that is used as a part of
+ * {@link org.openecomp.policy.api.PolicyParameters}.
+ * 
+ * @version 0.1
+ */
+public enum PolicyClass {
+	/**
+	 * Indicates Config based Policy. 
+	 */
+	Config("Config"),
+	/**
+	 * Indicates Action based Policy. 
+	 */
+	Action("Action"),
+	/**
+	 * Indicates Decision based Policy. 
+	 */
+	Decision("Decision")
+	;
+	private String name;
+	
+	private PolicyClass(String typeName){
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>PolicyClass</code>
+	 * @return the <code>String</code> of the Type for this <code>PolicyClass</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfig.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfig.java
new file mode 100644
index 0000000..5cb7d81
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfig.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.json.JsonObject;
+
+import org.w3c.dom.Document;
+/**
+ * Defines the objects that represent PolicyEngine config elements. PolicyConfig communicates the PolicyConfigStatus,
+ * PolicyConfigMessage, PolicyType, Properties, JsonObject, String and Document. 
+ * 
+ * @version 0.7
+ */
+
+public interface PolicyConfig {
+	/**
+	 * Gets the {@link org.openecomp.policy.api.PolicyType} associated with <code>PolicyConfig</code> 
+	 * 
+	 * @return the <code>PolicyType</code> associated with this <code>PolicyConfig</code> 
+	 */
+	public PolicyType getType();
+	
+	/**
+	 * Gives the <code>Properties</code> response associated with the <code>PolicyConfig</code> 
+	 * 
+	 * @return the <code>Properties</code> associated with this <code>PolicyConfig</code>
+	 */
+	public Properties toProperties();
+	
+	/**
+	 * Gives the <code>JsonObject</code> response associated with the <code>PolicyConfig</code> 
+	 * 
+	 * @return the <code>JsonObject</code> result associated with <code>PolicyConfig</code> 
+	 */
+	public JsonObject toJSON();
+	
+	/**
+	 * Gives the XML <code>Document</code> result associated with <code>PolicyConfig</code> 
+	 * 
+	 * @return the <code>Document</code> result associated with <code>PolicyConfig</code> 
+	 */
+	public Document toXML();
+	
+	/**
+	 * Gives the Other <code>String</code> response associated with <code>PolicyConfig</code>
+	 * 
+	 * @return the <code>String</code> result associated with <code>PolicyConfig</code>
+	 */
+	public String toOther();
+	
+	/**
+	 * Gets the {@link org.openecomp.policy.api.PolicyConfigStatus} associated with this <code>PolicyConfig</code>.
+	 * 
+	 * @return the <code>PolicyConfigStatus</code> associated with this <code>PolicyConfig</code>
+	 */
+	public PolicyConfigStatus getPolicyConfigStatus();
+	
+	/**
+	 * Gets the <code>String</code> of the PolicyConfigMessage from <code>PolicyConfig</code>.
+	 * 
+	 * @return the <code>String</code> which consists of PolicyConfigMessage from <code>PolicyConfig</code>
+	 */
+	public String getPolicyConfigMessage();
+	
+	/**
+	 * Gets the <code>String</code> of the PolicyName retrieved.
+	 * 
+	 * @return the <code>String</code> which consists of Policy Name which has been retrieved.  
+	 */
+	public String getPolicyName();
+	
+	
+	/**
+	 * Gets the <code>String</code> of the PolicyVersion retrieved.
+	 * 
+	 * @return the <code>String</code> which consists of the Policy Version number which has been retrieved.
+	 */
+	public String getPolicyVersion();
+	
+	/**
+	 * Gets the Matching Conditions of the policy retrieved which can be used in the getConfig call.
+	 * 
+	 * @return <code>Map</code> of <code>String, String</code> which consists of the Matching conditions of the Policy retrieved. 
+	 */
+	public Map<String,String> getMatchingConditions();
+	
+	/**
+	 * Gets the Response Attributes of the policy retrieved. Which can hold additional information about the policy retrieved.  
+	 * 
+	 * @return <code>Map</code> of <code>String, String</code> which consists of the Response Attributes of the Policy retrieved. 
+	 */
+	public Map<String,String> getResponseAttributes();
+ 	
+	/**
+	 * Returns the <code>String</code> version of the <code>PolicyConfig</code> object.
+	 * 
+	 *  @return <code>String</code> of the <code>PolicyConfig</code> Object.  
+	 */
+	@Override
+	public String toString();
+	
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigException.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigException.java
new file mode 100644
index 0000000..ad6948e
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigException.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * PolicyConfigException extends <code>Exception</code> to implement exceptions thrown by {@link org.openecomp.policy.api.PolicyEngine}
+ * 
+ * @version 0.1
+ */
+public class PolicyConfigException extends Exception{
+	private static final long serialVersionUID = -188355220060684215L;
+	
+	public PolicyConfigException() {
+	}
+	
+	public PolicyConfigException(String message) {
+		super(message);
+	}
+	
+	public PolicyConfigException(Throwable cause){
+		super(cause);
+	}
+	
+	public PolicyConfigException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	public PolicyConfigException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java
new file mode 100644
index 0000000..9f45b65
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigStatus.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of PolicyConfigStatus that can be returned as a part of 
+ * {@link org.openecomp.policy.api.PolicyConfig}.
+ * 
+ * @version 0.1
+ */
+public enum PolicyConfigStatus {	
+	/**
+	 * Indicates that the Configuration has been successfully retrieved. 
+	 */
+	CONFIG_RETRIEVED("retrieved"),
+	/**
+	 * Indicates that there is no Configuration Retrieved from PolicyConfig.
+	 */
+	CONFIG_NOT_FOUND("not_found"),
+	;
+	
+	private String name;
+	private PolicyConfigStatus(String name){
+		this.name = name;
+	}
+	
+	/**
+	 * Get the <code>PolicyConfigStatus</code> based on <code>String</code> representation of <code>PolicyConfig</code>
+	 * 
+	 * @param configStatus the <code>String</code> Configuration Status
+	 * @return the <code>PolicyConfigResponse</code> with the name matching <code>CONFIG_RETRIEVED</code> or <code>CONFIG_NOT_FOUND</code>
+	 * if no match is found
+	 */
+	public static PolicyConfigStatus getStatus(String configStatus) {
+		if(configStatus.equalsIgnoreCase("retrieved")) {
+			return CONFIG_RETRIEVED;
+		}else {
+			return CONFIG_NOT_FOUND;
+		}
+	}
+	
+	/**
+	 * Returns the <code>String</code> name for this <code>PolicyConfigStatus</code>
+	 * 
+	 * @return the <code>String</code> name for this <code>PolicyConfigStatus</code>
+	 */
+	public String toString(){
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java
new file mode 100644
index 0000000..111c856
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * 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 {
+	/**
+	 * Indicates Base Config Policy. 
+	 */
+	Base("Base"),
+	/**
+	 * Indicates ClosedLoop Fault Policy. 
+	 */
+	ClosedLoop_Fault("Fault"),
+	/**
+	 * Indicates ClosedLoop Performance Metrics Policy. 
+	 */
+	ClosedLoop_PM("PM"),
+	/**
+	 * Indicates Firewall Config Policy. 
+	 */
+	Firewall("FW"),
+	/**
+	 * Indicates BRMS based raw DRL Rule Policy. 
+	 */
+	BRMS_RAW("BRMS_Raw"),
+	/**
+	 * Indicates BRMS based Param DRL policy. 
+	 */
+	BRMS_PARAM("BRMS_Param"),
+	/**
+	 * Indicates DCAE Micro Service based Policy. 
+	 */
+	MicroService("MS")
+	;
+	
+	private String name;
+	
+	private PolicyConfigType(String typeName){
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>PolicyClass</code>
+	 * @return the <code>String</code> of the Type for this <code>PolicyClass</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java
new file mode 100644
index 0000000..18d0669
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecision.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of PolicyDecision that can be returned as a part of 
+ * {@link org.openecomp.policy.api.DecisionResponse} getDecision().
+ * 
+ * @version 0.1
+ */
+public enum PolicyDecision {
+	/**
+	 * Indicates that the Decision is to Permit. 
+	 */
+	PERMIT("permit"),
+	/**
+	 * Indicates that the Decision is to Deny. 
+	 */
+	DENY("deny"),
+	/**
+	 * Indicates that the Decision process has some issues. 
+	 */
+	ERROR("error")
+	;
+	
+	private String name;
+	private PolicyDecision(String name){
+		this.name = name;
+	}
+	
+	/**
+	 * Returns the <code>String</code> name for this <code>PolicyDecision</code>
+	 * 
+	 * @return the <code>String</code> name for this <code>PolicyDecision</code>
+	 */
+	public String toString(){
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecisionException.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecisionException.java
new file mode 100644
index 0000000..7f08fcb
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyDecisionException.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * PolicyDecisionException extends <code>Exception</code> to implement exceptions thrown by {@link org.openecomp.policy.api.PolicyEngine}
+ * 
+ * @version 0.1
+ */
+public class PolicyDecisionException extends Exception {
+
+	private static final long serialVersionUID = -2080072039363261175L;
+	
+	public PolicyDecisionException() {
+	}
+	
+	public PolicyDecisionException(String message) {
+		super(message);
+	}
+	
+	public PolicyDecisionException(Throwable cause){
+		super(cause);
+	}
+	
+	public PolicyDecisionException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	public PolicyDecisionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
new file mode 100644
index 0000000..0b46c57
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
@@ -0,0 +1,575 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.json.JsonObject;
+
+import org.openecomp.policy.api.NotificationHandler;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.std.StdPolicyEngine;
+
+/**
+ * PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine 
+ * 
+ * @version 1.0
+ */
+public class PolicyEngine{
+	private String propertyFilePath = null;
+	private StdPolicyEngine stdPolicyEngine;
+	private NotificationScheme scheme = null;
+	private NotificationHandler handler = null;
+	
+	/**
+	 * 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.
+	 */
+	@Deprecated
+	public Collection<PolicyConfig> getConfigByPolicyName(String policyName) throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = stdPolicyEngine.policyName(policyName,(UUID)null);
+		return policyConfig;	
+	}
+	
+	/**
+	 * 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. 
+	 * @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.
+	 */
+	@Deprecated
+	public Collection<PolicyConfig> getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = stdPolicyEngine.policyName(policyName,requestID);
+		return policyConfig;	
+	}
+	
+	/**
+	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
+	 * 
+	 * @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 
+	 * @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;
+	}
+	
+	/**
+	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
+	 * 
+	 * @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.
+	 * @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 
+	 * @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;
+	}
+	
+	/**
+	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
+	 * which represents the configName and returns the configuration if different Configurations exist for the
+	 * particular eCOMPComponentName.  
+	 * 
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
+	 * which represents the configName and returns the configuration if different Configurations exist for the
+	 * particular eCOMPComponentName.  
+	 * 
+	 * @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.
+	 * @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 #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;
+	}
+	
+	/**
+	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
+	 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
+	 * configuration related to the configAttributes mentioned.
+	 * 
+	 * @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.
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
+	 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
+	 * configuration related to the configAttributes mentioned.
+	 * 
+	 * @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.
+	 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
+	 * @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 #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;
+	}
+	
+	/**
+	 * Requests the configuration of the <code>ConfigRequestParameters</code> which represents the Config policy request parameters 
+	 * and returns the specific configuration related to the matching parameters. 
+	 * 
+	 * @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
+	 */
+	public Collection<PolicyConfig> getConfig(ConfigRequestParameters configRequestParameters)  throws PolicyConfigException{
+		Collection<PolicyConfig> policyConfig = stdPolicyEngine.config(configRequestParameters);
+		return policyConfig;
+	}
+	
+	/**
+	 * Requests the list of policies based on the <code>ConfigRequestParameters</code> which represents the policy request parameters 
+	 * and returns the list of policies filtered by the parameters. 
+	 * 
+	 * @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
+	 */
+	public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters)  throws PolicyConfigException{
+		Collection<String> policyList = stdPolicyEngine.listConfig(listPolicyRequestParameters);
+		return policyList;
+	}
+	
+	
+	/**
+	 * Sends the Events specified to the PEP and returns back the PolicyResponse. 
+	 * 
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Sends the Events specified to the PEP and returns back the PolicyResponse. 
+	 * 
+	 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Sends the Events specified to the PEP and returns back the PolicyResponse.
+	 * 
+	 * @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
+	 */
+	public Collection<PolicyResponse> sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
+		Collection<PolicyResponse> policyResponse = stdPolicyEngine.event(eventRequestParameters);
+		return policyResponse;
+	}
+	
+	/**
+	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
+	 * 
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
+	 * 
+	 * @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.
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
+	 * 
+	 * @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
+	 */
+	public DecisionResponse getDecision(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException {
+		DecisionResponse policyDecision = stdPolicyEngine.decide(decisionRequestParameters);
+		return policyDecision;
+	}
+	
+	/**
+	 * <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 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. 
+	 * 
+	 * @return <code>PDPNotification</code> of {@link org.openecomp.policy.api.PDPNotification} which has the Notification. 
+	 */
+	public PDPNotification getNotification() {
+		return stdPolicyEngine.getNotification();
+	}
+	
+	/**
+	 * Creates a Config Policy based on given arguments
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param policyDescription the <code>String</code> format of the Policy Description
+	 * @param ecompName the <code>String</code> format of the ECOMP Name
+	 * @param configName the <code>String</code> format of the Config Name
+	 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
+	 * @param configType the <code>String</code> format of the Config Type
+	 * @param body the <code>String</code> format of the Policy Body
+	 * @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 
+	 * @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;
+		
+	}
+	
+	/**
+	 * Creates a Config Policy based on given arguments
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param policyDescription the <code>String</code> format of the Policy Description
+	 * @param ecompName the <code>String</code> format of the ECOMP Name
+	 * @param configName the <code>String</code> format of the Config Name
+	 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
+	 * @param configType the <code>String</code> format of the Config Type
+	 * @param body the <code>String</code> format of the Policy Body
+	 * @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 
+	 * @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;
+		
+	}
+	
+	/**
+	 * Creates a Config Firewall Policy based on given arguments
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
+	 * @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 
+	 * @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;
+		
+	}
+	
+	/**
+	 * Updates a Config Firewall Policy based on given arguments
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
+	 * @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 
+	 * @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;
+		
+	}
+	
+	/**
+	 * 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. 
+	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create dictionary item Request. 
+	 * @throws Exception
+	 */
+	public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.createDictionaryItem(parameters);
+		return response;
+	}
+	
+	/**
+	 * Creates a Policy based on given Policy Parameters. 
+	 * 
+	 * @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
+	 */
+	public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.createPolicy(policyParameters);
+		return response;
+	}
+	
+	/**
+	 * Update Policy based on given Policy Parameters. 
+	 * 
+	 * @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
+	 */
+	public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.updatePolicy(policyParameters);
+		return response;
+	}
+	
+	/**
+	 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
+	 * 
+	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy is located
+	 * @param policyName the <code>String</code> format of the Policy Name being pushed. 
+	 * @param policyType the <code>String</code> format of the Policy Type which is being pushed.  
+	 * @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
+	 * @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;
+	}
+	
+	/**
+	 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
+	 * 
+	 * @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
+	 */
+	public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.pushPolicy(pushPolicyParameters);
+		return response;
+	}
+	
+	/**
+	 * Deletes the specified policy from the PAP or PDP.
+	 * 
+	 * @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
+	 */
+	public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.deletePolicy(deletePolicyParameters);
+		return response;
+	}
+	
+	/**
+	 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
+	 * 
+	 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname 
+	 * @throws PolicyEngineException 
+	 */
+	public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
+		this.propertyFilePath = propertiesFilePathname ; 
+		this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath);
+	}
+	
+	/**
+	 * 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 
+	 */
+	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);
+	}
+	
+	/**
+	 * 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
+	 */
+	public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws Exception {
+		PolicyChangeResponse response = stdPolicyEngine.policyEngineImport(importParameters);
+		return response;
+	}
+	
+	/**
+	 * 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 
+	 */
+	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 no parameters.
+	 *//*
+	public PolicyEngine(){
+		
+	}
+	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);
+	}
+	
+	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);
+	}*/
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngineException.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngineException.java
new file mode 100644
index 0000000..e80513a
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngineException.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * PolicyEngineException extends <code>Exception</code> to implement exceptions thrown by {@link org.openecomp.policy.api.PolicyEngine}
+ * 
+ * @version 0.1
+ */
+public class PolicyEngineException extends Exception{
+	private static final long serialVersionUID = 4945973094200118969L;
+
+	public PolicyEngineException() {
+	}
+	
+	public PolicyEngineException(String message) {
+		super(message);
+	}
+	
+	public PolicyEngineException(Throwable cause){
+		super(cause);
+	}
+	
+	public PolicyEngineException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	public PolicyEngineException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEventException.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEventException.java
new file mode 100644
index 0000000..8e4c819
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEventException.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * PolicyEventException extends <code>Exception</code> to implement exceptions thrown by {@link org.openecomp.policy.api.PolicyEngine}
+ * 
+ * @version 0.1
+ */
+public class PolicyEventException extends Exception {
+	private static final long serialVersionUID = -1477625011320634608L;
+	
+	public PolicyEventException() {
+	}
+	
+	public PolicyEventException(String message) {
+		super(message);
+	}
+	
+	public PolicyEventException(Throwable cause){
+		super(cause);
+	}
+	
+	public PolicyEventException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	public PolicyEventException(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
new file mode 100644
index 0000000..32cd75b
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java
@@ -0,0 +1,497 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <code>PolicyParameters</code> defines the Policy Parameters
+ *  which are required to Create/Update a Policy. 
+ * 
+ * @version 0.1
+ */
+public class PolicyParameters {
+	private PolicyClass policyClass;
+	private PolicyConfigType policyConfigType;
+	private String policyName;
+	private String policyDescription;
+	private String ecompName;
+	private String configName;
+	private Map<AttributeType, Map<String,String>> attributes;
+	private String configBody;
+	private PolicyType configBodyType;
+	private String actionPerformer;
+	private String actionAttribute;
+	private UUID requestID;
+	private List<String> dynamicRuleAlgorithmLabels;
+	private List<String> dynamicRuleAlgorithmFunctions;
+	private List<String> dynamicRuleAlgorithmField1;
+	private List<String> dynamicRuleAlgorithmField2;
+	private String priority;
+	private RuleProvider ruleProvider;
+	private Date TTLDate;
+	private boolean guard = false;
+	private String riskLevel = "5";
+	private String riskType = "defualt";
+	
+	/**
+	 * Sets Config Policy Parameters.
+	 * 
+	 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param policyDescription the <code>String</code> format of the Policy Description
+	 * @param ecompName the <code>String</code> format of the ECOMP Name
+	 * @param configName the <code>String</code> format of the Config Name
+	 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
+	 * @param configBodyType the {@link org.openecomp.policy.api.PolicyType} Enum format of the config Body Type. 
+	 * @param configBody the <code>String</code> format of the Policy Body
+	 * @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.
+	 */
+	public void setConfigPolicyParameters(PolicyConfigType policyConfigType, String policyName, String policyDescription, String ecompName, String configName, 
+			Map<AttributeType, Map<String, String>> attributes, PolicyType configBodyType, String configBody, UUID requestID){
+		this.setPolicyConfigType(policyConfigType);
+		this.setPolicyName(policyName);
+		this.setPolicyDescription(policyDescription);
+		this.setEcompName(ecompName);
+		this.setConfigName(configName);
+		this.setAttributes(attributes);
+		this.setConfigBody(configBody);
+		this.setConfigBodyType(configBodyType);
+		this.setRequestID(requestID);
+	}
+	
+	/**
+	 * Sets config Firewall Policy Parameters.
+	 * 
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param firewallJson the <code>String</code> representation of the Firewall Rules List
+	 * @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.
+	 */
+	public void setConfigFirewallPolicyParameters(String policyName, String firewallJson, UUID requestID){
+		this.setPolicyConfigType(PolicyConfigType.Firewall);
+		this.setPolicyName(policyName);
+		this.setConfigBody(firewallJson);
+		this.setConfigBodyType(PolicyType.JSON);
+		this.setRequestID(requestID);
+	}
+
+	/**
+	 * Gets the PolicyName of the Policy Parameters. 
+	 * 
+	 * @return policyName the <code>String</code> format of the Policy Name
+	 */
+	public String getPolicyName() {
+		return policyName;
+	}
+
+	/**
+	 * Sets the policyName of the Policy Parameters.
+	 * 
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 */
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+
+	/**
+	 * Gets the policy Description. 
+	 * 
+	 * @return the <code>String</code> format of the Policy Description
+	 */
+	public String getPolicyDescription() {
+		return policyDescription;
+	}
+
+	/**
+	 * Sets the policy Description of the Policy Description. 
+	 * 
+	 * @param policyDescription the <code>String</code> format of the Policy Description
+	 */
+	public void setPolicyDescription(String policyDescription) {
+		this.policyDescription = policyDescription;
+	}
+
+	/**
+	 * Gets the ECOMP Name value of the Policy Paramters. 
+	 * 
+	 * @return <code>String</code> format of the ECOMP Name
+	 */
+	public String getEcompName() {
+		return ecompName;
+	}
+
+	/**
+	 * Sets the ECOMP Name field of the Policy Parameters. 
+	 * 
+	 * @param ecompName the <code>String</code> format of the ECOMP Name
+	 */
+	public void setEcompName(String ecompName) {
+		this.ecompName = ecompName;
+	}
+
+	/**
+	 * Gets the Config Name value of the Policy Parameters. 
+	 * 
+	 * @return <code>String</code> format of the Config Name
+	 */
+	public String getConfigName() {
+		return configName;
+	}
+
+	/**
+	 * Sets the Config Name field of the Policy Parameters. 
+	 * 
+	 * @param configName the <code>String</code> format of the Config Name
+	 */
+	public void setConfigName(String configName) {
+		this.configName = configName;
+	}
+
+	/**
+	 * Gets the Attributes of the policy Parameters. 
+	 * 
+	 * @return <code>List</code> the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
+	 */
+	public Map<AttributeType, Map<String, String>> getAttributes() {
+		return attributes;
+	}
+
+	/**
+	 * Sets the Attributes of the Policy Parameters. 
+	 * 
+	 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
+	 */
+	public void setAttributes(Map<AttributeType, Map<String, String>> attributes) {
+		this.attributes = attributes;
+	}
+
+	/**
+	 * Gets the Policy Config Type value the Policy parameters. 
+	 * 
+	 * @return {@link org.openecomp.policy.api.PolicyConfigType} Enum of the Config Type
+	 */
+	public PolicyConfigType getPolicyConfigType() {
+		return policyConfigType;
+	}
+
+	/**
+	 * Sets the Policy Config Type field of the policy Parameters. 
+	 * 
+	 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
+	 */
+	public void setPolicyConfigType(PolicyConfigType policyConfigType) {
+		setPolicyClass(PolicyClass.Config);
+		this.policyConfigType = policyConfigType;
+	}
+
+	/**
+	 * Gets the configBody value of the Policy Parameters. 
+	 * 
+	 * @return the <code>String</code> format of the Policy Body
+	 */
+	public String getConfigBody() {
+		return configBody;
+	}
+
+	/**
+	 * Sets the configBody field of the Policy Parameters. 
+	 * 
+	 * @param configBody the <code>String</code> format of the Policy Body
+	 */
+	public void setConfigBody(String configBody) {
+		this.configBody = configBody;
+	}
+
+	/**
+	 * Gets the config Body Type value of the Policy Parameters.  
+	 * 
+	 * @return the <code>PolicyType</code> representation of the configBodyType
+	 */
+	public PolicyType getConfigBodyType() {
+		return configBodyType;
+	}
+
+	/**
+	 * Sets the configBodyType field of the Policy Parameters. 
+	 * 
+	 * @param configBodyType the <code>PolicyType</code> representation of the config BodyType
+	 */
+	public void setConfigBodyType(PolicyType configBodyType) {
+		this.configBodyType = configBodyType;
+	}
+	
+	/**
+	 * Gets the requestID of the Policy Parameters. 
+	 * 
+	 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	
+	/**
+	 * Sets the requestID of the Policy Parameters. 
+	 * 
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public void setRequestID(UUID requestID) {
+		this.requestID = requestID;
+	}
+
+	/**
+	 * Gets the Policy Class of the Policy Parameters. 
+	 * 
+	 * @return {@link org.openecomp.policy.api.PolicyClass} of the Policy Parameters. 
+	 */
+	public PolicyClass getPolicyClass() {
+		return policyClass;
+	}
+
+	/**
+	 * Sets the Policy Class of the Policy Parameters. 
+	 * 
+	 * @param policyClass the Enum {@link org.openecomp.policy.api.PolicyClass} to set Policy Class Type of Policy parameters. 
+	 */
+	public void setPolicyClass(PolicyClass policyClass) {
+		this.policyClass = policyClass;
+	}
+	
+	/**
+	 * Gets the Action Performer value of the Policy Parameters for Action Policies. 
+	 *
+	 * @return the <code>String</code> value of the Action Performer for Action Policies
+	 */
+	public String getActionPerformer() {
+		return actionPerformer;
+	}
+	
+	/**
+	 * Sets the Action Performer value of the Policy Parameters for Action Policies.
+	 * 
+	 * @param actionPerformer the <code>String</code> format of the Action Performer
+	 */
+	public void setActionPerformer(String actionPerformer) {
+		this.actionPerformer = actionPerformer;
+	}
+
+	/**
+	 * Gets the Action Attribute value of the Policy Parameters for Action Policies. 
+	 *
+	 * @return the <code>String</code> value of the Action Attribute for Action Policies
+	 */
+	public String getActionAttribute() {
+		return actionAttribute;
+	}
+
+	/**
+	 * Sets the Action Attribute value of the Policy Parameters for Action Policies.
+	 * 
+	 * @param actionAttribute the <code>String</code> format of the Action Attribute
+	 */
+	public void setActionAttribute(String actionAttribute) {
+		this.actionAttribute = actionAttribute;
+	}
+	
+	/**
+	 * Gets the Dynamic Rule Algorithm Label of the policy Parameters. Used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @return <code>List</code> the Dynamic Rule Algorithm Label that must contain the Labels in order
+	 */
+	public List<String> getDynamicRuleAlgorithmLabels() {
+		return dynamicRuleAlgorithmLabels;
+	}
+
+	/**
+	 * Sets the Dynamic Rule Algorithm Labels used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @param dynamicRuleAlgorithmLabels the <code>List</code> dynamicRuleAlgoritmLabels in order
+	 */
+	public void setDynamicRuleAlgorithmLabels(
+			List<String> dynamicRuleAlgorithmLabels) {
+		this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
+	}
+
+	/**
+	 * Gets the Dynamic Rule Algorithm Function of the policy Parameters. Used in conjunction with the Label, Field1,
+	 * FunctionDef, and Field2 to complete the complex and simple Rule Algorithms 
+	 * 
+	 * @return <code>List</code> the Dynamic Rule Algorithm Functions that must contain the values in order
+	 */
+	public List<String> getDynamicRuleAlgorithmFunctions() {
+		return dynamicRuleAlgorithmFunctions;
+	}
+
+	/**
+	 * Sets the Dynamic Rule Algorithm Functions used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @param dynamicRuleAlgorithmFunctions the <code>List</code> dynamicRuleAlgorithmFunctions in order
+	 */
+	public void setDynamicRuleAlgorithmFunctions(List<String> dynamicRuleAlgorithmFunctions) {
+		this.dynamicRuleAlgorithmFunctions = dynamicRuleAlgorithmFunctions;
+	}
+
+	/**
+	 * Gets the Dynamic Rule Algorithm Field1 of the policy Parameters. Used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @return <code>List</code> the Dynamic Rule Algorithm Field1 that must contain the Field1 values in order
+	 */
+	public List<String> getDynamicRuleAlgorithmField1() {
+		return dynamicRuleAlgorithmField1;
+	}
+
+	/**
+	 * Sets the Dynamic Rule Algorithm Field1 used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @param dynamicRuleAlgorithmField1 the <code>List</code> dynamicRuleAlgorithmField1 in order
+	 */
+	public void setDynamicRuleAlgorithmField1(
+			List<String> dynamicRuleAlgorithmField1) {
+		this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
+	}
+
+	/**
+	 * Gets the Dynamic Rule Algorithm Field2 of the policy Parameters. Used in conjunction with the Label, Field1,
+	 * Operator, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @return <code>List</code> the Dynamic Rule Algorithm Field2 that must contain the Field2 values in order
+	 */
+	public List<String> getDynamicRuleAlgorithmField2() {
+		return dynamicRuleAlgorithmField2;
+	}
+
+	/**
+	 * Sets the Dynamic Rule Algorithm Field2 used in conjunction with the Label, Field1,
+	 * Function, and Field2 to complete the complex and simple Rule Algorithms
+	 * 
+	 * @param dynamicRuleAlgorithmField2 the <code>List</code> dynamicRuleAlgorithmField2 in order
+	 */
+	public void setDynamicRuleAlgorithmField2(
+			List<String> dynamicRuleAlgorithmField2) {
+		this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
+	}
+	
+	/**
+	 * Gets the Priority of the Policy Parameters. 
+	 * 
+	 * @return priority the <code>String</code> format of the Micro Services priority
+	 */
+	public String getPriority() {
+		return priority;
+	}
+	
+	/**
+	 * Sets the Priority of the Policy Parameters.
+	 * 
+	 * @param priority the <code>String</code> format of the Micro Services priority
+	 */
+	public void setPriority(String priority) {
+		this.priority = priority;
+	}
+
+	public RuleProvider getRuleProvider() {
+		return ruleProvider;
+	}
+
+	public void setRuleProvider(RuleProvider ruleProvider) {
+		this.ruleProvider = ruleProvider;
+	}	
+	/**
+	 * Sets the Guard field of the Policy Parameters. 
+	 * 
+	 * @param guard the <code>Boolean</code> format of the guard value
+	 */
+	public void setGuard(boolean guard){
+		this.guard = guard;
+	}
+	
+	/**
+	 * Gets the  guard value of the Policy Parameters for Action Policies. 
+	 *
+	 * @return the <code>boolean</code> value of the Guard for Config Policies
+	 */
+	public boolean getGuard(){
+		return guard;
+	}
+	
+	/**
+	 * Sets the riskType field of the Policy Parameters. 
+	 * 
+	 * @param guard the <code>String</code> format of the riskType value
+	 */
+	public void setRiskType(String riskType){
+		this.riskType = riskType;
+	}
+	
+	/**
+	 * Gets the riskType value of the Policy Parameters for Config Policies. 
+	 *
+	 * @return the <code>String</code> value of the riskType for Config Policies
+	 */
+	public String getRiskType(){
+		return riskType;
+	}
+	
+	/**
+	 * Sets the riskLevel field of the Policy Parameters. 
+	 * 
+	 * @param riskLevel the <code>String</code> format of the riskType value
+	 */
+	public void setRiskLevel(String riskLevel){
+		this.riskLevel = riskLevel;
+	}
+	
+	/**
+	 * Gets the riskLevel value of the Policy Parameters for Config Policies. 
+	 *
+	 * @return the <code>String</code> value of the riskLevel for Config Policies
+	 */
+	public String getRiskLevel(){
+		return riskLevel;
+	}
+	
+	/**
+	 * Sets the TTLDate field of the Policy Parameters. 
+	 * 
+	 * @param TTLDate the <code>Date</code> format of the TTLDate value
+	 */
+	public void setTtlDate(Date TTLDate){
+		this.TTLDate = TTLDate;
+	}
+	
+	/**
+	 * Gets the TTLDate value of the Policy Parameters for Config Policies. 
+	 *
+	 * @return the <code>Date</code> value of the TTLDate for Config Policies
+	 */
+	public Date getTtlDate(){
+		return TTLDate;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponse.java
new file mode 100644
index 0000000..316f7dd
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponse.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.api;
+
+import java.util.Map;
+
+/**
+ * Defines the objects that represent PolicyEngine Response elements. PolicyResponse communicates the PolicyResponseStatus,
+ * PolicyResponseMessage, ActionAdvised, ActionTaken and RequestAttributes. 
+ * 
+ * @version 0.3
+ */
+public interface PolicyResponse {
+	/**
+	 * Gets the {@link org.openecomp.policy.api.PolicyResponseStatus} associated with this <code>PolicyResponse</code>.
+	 * 
+	 * @return the <code>PolicyResponseStatus</code> associated with this <code>PolicyResponse</code>
+	 */
+	public PolicyResponseStatus getPolicyResponseStatus();
+	
+	/**
+	 * Gets the <code>Map</code> of <code>String,String</code> which consists of ActionAdvised in this <code>PolicyResponse</code>.
+	 * If there is no ActionAdvised this method must return an empty <code>Map</code>.
+	 * 
+	 * @return the <code>Map</code> of <code>String,String</code> which consists of AdviceAttributes in <code>PolicyResponse</code>
+	 */
+	public Map<String,String> getActionAdvised();
+	
+	/**
+	 * Gets the <code>Map</code> of <code>String,String</code> which consists of ActionTaken in this <code>PolicyResponse</code>.
+	 * If there are no ActionTaken this method must return an empty <code>Map</code>.
+	 * 
+	 * @return the <code>Map</code> of <code>String,String</code> which consists of ActionTaken in <code>PolicyResponse</code>
+	 */
+	public Map<String,String> getActionTaken();
+	
+	/**
+	 * Gets the <code>Map</code> of <code>String,String</code> which consists of RequestAttributes in this <code>PolicyResponse</code>.
+	 * 
+	 * @return the <code>Map</code> of <code>String,String</code> which consists of RequestAttributes from <code>PolicyResponse</code>
+	 */
+	public Map<String,String> getRequestAttributes();
+	
+	/**
+	 * Gets the <code>String</code> of the PolicyResponseMessage from <code>PolicyResponse</code>
+	 * 
+	 * @return the <code>String</code> which consists of PolicyResponseMessage from <code>PolicyResponse</code>
+	 */
+	public String getPolicyResponseMessage();
+	
+	/**
+	 * Returns the <code>String</code> version of the <code>PolicyResponse</code> object.
+	 * 
+	 *  @return <code>String</code> of the <code>PolicyResponse</code> Object.  
+	 */
+	@Override
+	public String toString(); 
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java
new file mode 100644
index 0000000..a9c3296
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyResponseStatus.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of PolicyResponseStatus that can be returned as a part of
+ * {@link org.openecomp.policy.api.PolicyResponse}.
+ * 
+ * @version 0.2
+ */
+public enum PolicyResponseStatus {	
+	/**
+	 * Indicates there is no action required.
+	 */
+	NO_ACTION_REQUIRED("no_action"),
+	/** 
+	 * Indicates that an action has been advised.
+	 */
+	ACTION_ADVISED("action_advised"),
+	/**
+	 * Indicates that an action has been taken.
+	 */
+	ACTION_TAKEN("action_taken")
+	;
+	
+	private String name;
+	private PolicyResponseStatus(String name){
+		this.name = name;
+	}
+	
+	/**
+	 * Get the <code>PolicyResponseStatus</code> based on <code>String</code> representation of <code>PolicyResponse</code>
+	 * 
+	 * @param responseStatus the <code>String</code> Response Status
+	 * @return the <code>PolicyResponseStatus</code> with the name matching <code>ACTION_ADVISED</code> or <code>ACTION_TAKEN</code> or <code>NO_ACTION_REQUIRED</code>
+	 */
+	public static PolicyResponseStatus getStatus(String responseStatus) {
+		if(responseStatus.equalsIgnoreCase("action_advised")) {
+			return ACTION_ADVISED;
+		}else if(responseStatus.equalsIgnoreCase("action_taken")) {
+			return ACTION_TAKEN;
+		}else {
+			return NO_ACTION_REQUIRED;
+		}
+	}
+	
+	/**
+	 * Returns the <code>String</code> name for this <code>PolicyResponseStatus</code>
+	 * 
+	 * @return the <code>String</code> name for this <code>PolicyResponseStatus</code>
+	 */
+	public String toString(){
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java
new file mode 100644
index 0000000..b86f952
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyType.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of the Policy Return Types that can be returned as part of a
+ * {@link org.openecomp.policy.api.PolicyConfig}.
+ * 
+ * @version 0.2
+ */
+public enum PolicyType {
+	/**
+	 * Indicates the response is Properties type
+	 */
+	PROPERTIES("Properties"),
+	/**
+	 * Indicates the response is JSON type
+	 */
+	JSON("json"),
+	/**
+	 * Indicates the response is XML type
+	 */
+	XML("xml"),
+	/**
+	 * Indicates the response is Other type
+	 */
+	OTHER("other")
+	;
+	
+	private String name; 
+	
+	private PolicyType(String typeName) {
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>PolicyType</code>
+	 * @return the <code>String</code> of the Type for this <code>PolicyType</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PushPolicyParameters.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PushPolicyParameters.java
new file mode 100644
index 0000000..8a82206
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PushPolicyParameters.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+import java.util.UUID;
+
+/**
+ * <code>PushPolicyParameters</code> defines the Policy Parameters
+ *  which are required to Push a Policy to PDPGroup. 
+ * 
+ * @version 0.1
+ */
+public class PushPolicyParameters {
+	private String policyName;
+	private String policyType;
+	private String pdpGroup;
+	private UUID requestID;
+	
+	/**
+	 * Constructor with no Parameters.
+	 */
+	public PushPolicyParameters(){
+	}
+	
+	/**
+	 * Constructor with Parameters.
+	 * 
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 * @param policyType the <code>String</code> format of the Policy Type
+	 * @param pdpGroup the <code>String</code> format of the PDPGroup
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public PushPolicyParameters(String policyName, String policyType, String pdpGroup, UUID requestID){
+		this.policyName = policyName;
+		this.policyType = policyType;
+		this.pdpGroup = pdpGroup;
+		this.requestID = requestID;
+	}
+	
+	/**
+	 * Gets the PolicyName of the Push Policy Parameters. 
+	 * 
+	 * @return policyName the <code>String</code> format of the Policy Name
+	 */
+	public String getPolicyName() {
+		return policyName;
+	}
+	
+	/**
+	 * Sets the policyName of the Push Policy Parameters.
+	 * 
+	 * @param policyName the <code>String</code> format of the Policy Name
+	 */
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+	
+	/**
+	 * Gets the PolicyType of the Push Policy Parameters. 
+	 * 
+	 * @return policyType the <code>String</code> format of the Policy Type
+	 */
+	public String getPolicyType() {
+		return policyType;
+	}
+	
+	/**
+	 * Sets the policyType of the Push Policy Parameters.
+	 * 
+	 * @param policyType the <code>String</code> format of the Policy Type
+	 */
+	public void setPolicyType(String policyType) {
+		this.policyType = policyType;
+	}
+	
+	/**
+	 * Gets the PDPGroup of the Push Policy Parameters. 
+	 * 
+	 * @return pdpGroup the <code>String</code> format of the PDPGroup
+	 */
+	public String getPdpGroup() {
+		return pdpGroup;
+	}
+	
+	/**
+	 * Sets the PDPGroup of the Push Policy Parameters.
+	 * 
+	 * @param pdpGroup the <code>String</code> format of the PDPGroup
+	 */
+	public void setPdpGroup(String pdpGroup) {
+		this.pdpGroup = pdpGroup;
+	}
+	
+	/**
+	 * Gets the requestID of the Push Policy Parameters. 
+	 * 
+	 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public UUID getRequestID() {
+		return requestID;
+	}
+	
+	/**
+	 * Sets the requestID of the Push Policy Parameters. 
+	 * 
+	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
+	 */
+	public void setRequestID(UUID requestID) {
+		this.requestID = requestID;
+	}
+	
+	
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java
new file mode 100644
index 0000000..8e92181
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/RuleProvider.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.api;
+
+/**
+ * Enumeration of the Attribute Types that is used as a part of
+ * {@link org.openecomp.policy.api.PolicyParameters}.
+ * 
+ * @version 0.1
+ */
+public enum RuleProvider {
+	/**
+	 * Indicates User will be defining the Rule information. 
+	 */
+	CUSTOM("Custom"),
+	/**
+	 * Indicates AAF will be providing the Rule information. 
+	 */
+	AAF("AAF")
+	;
+	
+	private String name;
+	
+	private RuleProvider(String typeName){
+		this.name = typeName;
+	}
+	
+	/**
+	 * Returns the <code>String</code> format of Type for this <code>AttributeType</code>
+	 * @return the <code>String</code> of the Type for this <code>AttributeType</code>
+	 */
+	public String toString() {
+		return this.name;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/package-info.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/package-info.java
new file mode 100644
index 0000000..982dbb4
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/package-info.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.api;
+
+/**
+ * org.openecomp.policy.api contains the API for the PolicyEngine ProtoType
+ *
+ * @version 0.9
+ * 
+ * Changes:
+ * Addition of Notifications methods to the Client API. 
+ * Combining Multiple results. and Minor changes to retrieve all policies.
+ * Retrieve config policy using policyFile Name and the matching conditions of the policy in the results.
+ * Addition of Decision policy call  
+ * 
+ *
+ */
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientEnd.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientEnd.java
new file mode 100644
index 0000000..3f4fe0c
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientEnd.java
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.websocket.ClientEndpoint;
+import javax.websocket.DeploymentException;
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+
+//import org.apache.log4j.Logger;
+import org.glassfish.tyrus.client.ClientManager;
+import org.openecomp.policy.api.NotificationHandler;
+import org.openecomp.policy.api.NotificationScheme;
+import org.openecomp.policy.api.NotificationType;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.std.NotificationStore;
+import org.openecomp.policy.std.StdPDPNotification;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import org.openecomp.policy.common.logging.flexlogger.*; 
+
+@ClientEndpoint
+public class AutoClientEnd {
+	private static StdPDPNotification notification = null;
+	private static StdPDPNotification oldNotification = null;
+	private static ClientManager client = null;
+	private static NotificationScheme scheme = null;
+	private static NotificationHandler handler = null;
+	private static String url = null;
+	private static Session session = null;
+	private static boolean status = false; 
+	private static boolean stop = false;
+	private static boolean message = false;
+	private static boolean error = false;
+	private static Logger logger = FlexLogger.getLogger(AutoClientEnd.class.getName());
+	
+	public static void setAuto(NotificationScheme scheme,
+			NotificationHandler handler) {
+		AutoClientEnd.scheme = scheme;
+		AutoClientEnd.handler = handler;
+	}
+
+	public static void setScheme(NotificationScheme scheme) {
+		AutoClientEnd.scheme = scheme;
+	}
+	
+	public static boolean getStatus(){
+		return AutoClientEnd.status;
+	}
+
+	public static String getURL() {
+		return AutoClientEnd.url;
+	}
+
+	public static void start(String url) {
+		AutoClientEnd.url = url;
+		// Stop and Start needs to be done.
+		if (scheme != null && handler!=null) {
+			if (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS) || scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
+				if (AutoClientEnd.client == null) {
+					client = ClientManager.createClient();
+					if(url.contains("https")){
+						url = url.replaceAll("https", "wss");
+					}else {
+						url = url.replaceAll("http", "ws");
+					}
+					try {
+						logger.info("Starting Auto Notification with the PDP server : " + url);
+						client.connectToServer(AutoClientEnd.class, new URI(url	+ "notifications"));
+						status = true;
+						if(error){
+							// The URL's will be in Sync according to design Spec. 
+							ManualClientEnd.start(AutoClientEnd.url);
+							StdPDPNotification notification = NotificationStore.getDeltaNotification((StdPDPNotification)ManualClientEnd.result(NotificationScheme.MANUAL_ALL_NOTIFICATIONS));
+							if(notification.getNotificationType()!=null){
+								if(oldNotification!=notification){
+									oldNotification= notification;
+									AutoClientEnd.notification = notification;
+									callHandler();
+								}
+							}
+							error = false;
+						}
+						//
+					} catch (DeploymentException | IOException | URISyntaxException e) {
+						logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+						client = null;
+						status = false;
+						changeURL();
+					}
+				}
+			}
+		}
+	}
+	
+	private static void changeURL(){
+		// Change the PDP if it is not Up. 
+		StdPolicyEngine.rotateList();
+		start(StdPolicyEngine.getPDPURL());
+	}
+
+	public static void stop() {
+		if (client != null) {
+			client.shutdown();
+			if(session!=null){
+				try {
+					stop = true;
+					logger.info("\n Closing Auto Notification WebSocket Connection.. ");
+					session.close();
+					session = null;
+				} catch (IOException e) {
+					//
+				}
+			}
+			client = null;
+			status = false;
+			stop = false;
+		}
+	}
+
+	private static void callHandler() {
+		if (handler != null && scheme != null) {
+			if (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS)) {
+				boolean removed = false, updated = false;
+				if (notification.getRemovedPolicies() != null && !notification.getRemovedPolicies().isEmpty()) {
+					removed = true;
+				}
+				if (notification.getLoadedPolicies() != null && !notification.getLoadedPolicies().isEmpty()) {
+					updated = true;
+				}
+				if (removed && updated) {
+					notification.setNotificationType(NotificationType.BOTH);
+				} else if (removed) {
+					notification.setNotificationType(NotificationType.REMOVE);
+				} else if (updated) {
+					notification.setNotificationType(NotificationType.UPDATE);
+				}
+				try{
+					handler.notificationReceived(notification);
+				}catch (Exception e){
+					logger.error("Error in Clients Handler Object : " + e.getMessage());
+				}
+			} else if (scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
+				PDPNotification newNotification = MatchStore.checkMatch(notification);
+				if (newNotification.getNotificationType() != null) {
+					handler.notificationReceived(newNotification);
+				}
+			}
+		}
+	}
+
+	// WebSockets Code..
+	@OnOpen
+	public void onOpen(Session session) throws IOException {
+		// session.getBasicRemote().sendText("Connected to Client with Session: "
+		// + session.getId());
+		logger.debug("Auto Notification Session Started... " + session.getId());
+		if(AutoClientEnd.session == null){
+			AutoClientEnd.session = session;
+		}
+	}
+
+	@OnError
+	public void onError(Session session, Throwable e) {
+		// trying to Restart by self.
+		logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Session Error.. "+ session.getId() + "\n Error is : " + e );
+		// e.printStackTrace();
+		stop();
+		if (url != null) {
+			client = null;
+			status = false;
+			error= true;
+			start(url);
+		}
+	}
+
+	@OnClose
+	public void onClose(Session session) {
+		logger.info("Session ended with "+ session.getId());
+		if(!stop && !message){
+			// This Block of code is executed if there is any Network Failure or if the Notification is Down. 
+			logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Disconnected from Notification Server");
+			client = null;
+			status = false;
+			AutoClientEnd.session=null;
+			// Try to connect Back to available PDP.
+			error = true;
+			start(url);
+		}
+		AutoClientEnd.message=false;
+	}
+
+	@OnMessage
+	public void onMessage(String message, Session session) throws JsonParseException, JsonMappingException, IOException {
+		AutoClientEnd.message = true;
+		logger.debug("Auto Notification Recieved Message " + message + " Session info is : " + session.getId());
+		try {
+			notification = NotificationUnMarshal.notificationJSON(message);
+		} catch (Exception e) {
+			logger.error("PE500 " + e);
+		}
+		if(AutoClientEnd.session == session){
+			try{
+				NotificationStore.recordNotification(notification);
+			}catch(Exception e){
+				logger.error(e);
+			}
+			if(oldNotification!=notification){
+				oldNotification= notification;
+				callHandler();
+			}
+		}else{
+			session.close();
+		}
+		AutoClientEnd.message = false;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
new file mode 100644
index 0000000..87bb501
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.List;
+import java.util.UUID;
+
+import org.openecomp.policy.api.NotificationHandler;
+import org.openecomp.policy.api.NotificationScheme;
+import org.openecomp.policy.api.NotificationType;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.std.StdPDPNotification;
+
+import com.att.nsa.cambria.client.CambriaClientFactory;
+import com.att.nsa.cambria.client.CambriaConsumer;
+import org.openecomp.policy.common.logging.flexlogger.*; 
+/**
+ * Create a UEB Consumer to receive policy update notification.
+ * 
+ * 
+ *
+ */
+public class AutoClientUEB implements Runnable  {
+	private static StdPDPNotification notification = null;
+	private static NotificationScheme scheme = null;
+	private static NotificationHandler handler = null;
+	private static String url = null;
+	private static boolean status = false; 
+	private static Logger logger = FlexLogger.getLogger(AutoClientUEB.class.getName());
+	private static String notficatioinType = null;
+	private static CambriaConsumer CConsumer = null;
+//	private volatile boolean stop = false;
+	private static List<String> uebURLList = null; 
+	public volatile boolean isRunning = false;
+    
+
+	public AutoClientUEB(String url, List<String> uebURLList) {
+	       AutoClientUEB.url = url;
+	       AutoClientUEB.uebURLList = uebURLList;
+	}
+
+	public void setAuto(NotificationScheme scheme,
+			NotificationHandler handler) {
+		AutoClientUEB.scheme = scheme;
+		AutoClientUEB.handler = handler;
+	}
+
+	public static void setScheme(NotificationScheme scheme) {
+		AutoClientUEB.scheme = scheme;
+	}
+	
+	public static boolean getStatus(){
+		return AutoClientUEB.status;
+	}
+
+	public static String getURL() {
+		return AutoClientUEB.url;
+	}
+	
+	public static String getNotficationType(){
+		return AutoClientUEB.notficatioinType;
+	}
+
+	public synchronized boolean isRunning() {
+		return this.isRunning;
+	}
+	
+	public synchronized void terminate() {
+		this.isRunning = false;
+	}
+	@SuppressWarnings("deprecation")
+	@Override
+	public void run() {
+		synchronized(this) {
+			this.isRunning = true;
+		}
+		String group =  UUID.randomUUID ().toString ();
+		String id = "0";
+		String topic = null;
+		// Stop and Start needs to be done.
+		if (scheme != null && handler!=null) {
+			if (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS) || scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
+				//Check if the Notification Type is UEB t				if (notficationType.equals("ueb")){
+				URL aURL;
+				try {
+					aURL = new URL(AutoClientUEB.url);
+					topic = aURL.getHost() + aURL.getPort();
+				} catch (MalformedURLException e) {
+					topic = AutoClientUEB.url.replace("[:/]", "");
+				}
+					
+				//TODO  create a loop to listen for messages from UEB cluster
+				try {
+					CConsumer = CambriaClientFactory.createConsumer ( null, uebURLList, topic, group, id, 15*1000, 1000 );
+				} catch (MalformedURLException e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				} catch (GeneralSecurityException e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+				while (this.isRunning() )
+				{
+					try {
+						for ( String msg : CConsumer.fetch () )
+						{		
+							logger.debug("Auto Notification Recieved Message " + msg + " from UEB cluster : " + uebURLList.toString());
+							notification = NotificationUnMarshal.notificationJSON(msg);
+							callHandler();
+						}
+					} catch (Exception e) {
+						// TODO Auto-generated catch block
+						logger.debug("Error in processing UEB message");
+					}
+
+				}
+				logger.debug("Stopping UEB Consuer loop will not logger fetch messages from the cluser");
+			}
+		}
+	}
+
+	private static void callHandler() {
+		if (handler != null && scheme != null) {
+			if (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS)) {
+				boolean removed = false, updated = false;
+				if (notification.getRemovedPolicies() != null && !notification.getRemovedPolicies().isEmpty()) {
+					removed = true;
+				}
+				if (notification.getLoadedPolicies() != null && !notification.getLoadedPolicies().isEmpty()) {
+					updated = true;
+				}
+				if (removed && updated) {
+					notification.setNotificationType(NotificationType.BOTH);
+				} else if (removed) {
+					notification.setNotificationType(NotificationType.REMOVE);
+				} else if (updated) {
+					notification.setNotificationType(NotificationType.UPDATE);
+				}
+				handler.notificationReceived(notification);
+			} else if (scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
+				PDPNotification newNotification = MatchStore.checkMatch(notification);
+				if (newNotification.getNotificationType() != null) {
+					handler.notificationReceived(newNotification);
+				}
+			}
+		}
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEnd.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEnd.java
new file mode 100644
index 0000000..c006b05
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEnd.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.CountDownLatch;
+
+import javax.websocket.ClientEndpoint;
+import javax.websocket.DeploymentException;
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+
+//import org.apache.log4j.Logger;
+import org.glassfish.tyrus.client.ClientManager;
+import org.openecomp.policy.api.NotificationScheme;
+import org.openecomp.policy.api.NotificationType;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.std.StdPDPNotification;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.*; 
+
+@ClientEndpoint
+public class ManualClientEnd {
+	private static CountDownLatch latch;
+	private static StdPDPNotification notification = null;
+	private static String resultJson = null;
+	private static Logger logger = FlexLogger.getLogger(ManualClientEnd.class.getName());
+	
+	public static void start(String url) {
+		latch = new CountDownLatch(1);
+		ClientManager client = ClientManager.createClient();
+		if(url.contains("https")){
+			url = url.replaceAll("https", "wss");
+		}else {
+			url = url.replaceAll("http", "ws");
+		}
+		try {
+			client.connectToServer(ManualClientEnd.class, new URI(url+"notifications"));
+			latch.await();
+		} catch (DeploymentException | URISyntaxException | InterruptedException e) {
+			logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+		} catch (IOException e) {
+			logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+		}
+	}
+
+	public static PDPNotification result(NotificationScheme scheme) {
+		if (resultJson == null || notification == null) {
+			logger.debug("No Result" );
+			return null;
+		} else {
+			if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
+				boolean removed = false, updated = false; 
+				if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
+					removed = true;
+				}
+				if(notification.getLoadedPolicies()!=null && !notification.getLoadedPolicies().isEmpty()){
+					updated = true;
+				}
+				if(removed && updated) {
+					notification.setNotificationType(NotificationType.BOTH);
+				}else if(removed){
+					notification.setNotificationType(NotificationType.REMOVE);
+				}else if(updated){
+					notification.setNotificationType(NotificationType.UPDATE);
+				}
+				return notification;
+			}else if(scheme.equals(NotificationScheme.MANUAL_NOTIFICATIONS)) {
+				return MatchStore.checkMatch(notification);
+			}else {
+				return null;
+			}
+		}
+	}
+	
+	// WebSockets Code.. 
+	@OnOpen
+	public void onOpen(Session session) throws IOException {
+		logger.info("Session Started with : " + session.getId());
+		session.getBasicRemote().sendText("Manual");
+	}
+	
+	@OnError
+	public void onError(Session session, Throwable e) {
+		logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in: "+ session.getId());
+		latch.countDown();
+	}
+	
+	@OnClose
+	public void onClose(Session session) {
+		logger.info("Session ended with "+ session.getId());
+		latch.countDown();
+	}
+	
+	@OnMessage
+	public void onMessage(String message, Session session){
+		logger.debug(" Manual Notification Recieved Message : " + message +" Session info is : "+ session.getId());
+		resultJson = message;
+		try {
+			notification = NotificationUnMarshal.notificationJSON(message);
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			latch.countDown();
+		}
+		try {
+			session.close();
+		} catch (IOException e) {
+			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			latch.countDown();
+		} // For Manual Client..
+		latch.countDown();
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
new file mode 100644
index 0000000..b1962bc
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+//import org.apache.log4j.Logger;
+import org.json.JSONObject;
+import org.openecomp.policy.api.NotificationScheme;
+import org.openecomp.policy.api.NotificationType;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.std.StdPDPNotification;
+
+import com.att.nsa.cambria.client.CambriaClientFactory;
+import com.att.nsa.cambria.client.CambriaConsumer;
+import com.att.nsa.cambria.client.CambriaPublisher;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import org.openecomp.policy.common.logging.flexlogger.*; 
+
+
+public class ManualClientEndUEB {
+	private static StdPDPNotification notification = null;
+	private static String resultJson = null;
+	private static Logger logger = FlexLogger.getLogger(ManualClientEndUEB.class.getName());
+	private static CambriaConsumer CConsumer = null;
+	private static List<String> uebURLList = null; 
+	private static boolean messageNotReceived = false;
+	private static String url = null;
+	private static String uniquID = null;
+	private static String topic = null;
+	
+
+	public static PDPNotification result(NotificationScheme scheme) {
+		if (resultJson == null || notification == null) {
+			logger.debug("No Result" );
+			return null;
+		} else {
+			if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
+				boolean removed = false, updated = false; 
+				if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
+					removed = true;
+				}
+				if(notification.getLoadedPolicies()!=null && !notification.getLoadedPolicies().isEmpty()){
+					updated = true;
+				}
+				if(removed && updated) {
+					notification.setNotificationType(NotificationType.BOTH);
+				}else if(removed){
+					notification.setNotificationType(NotificationType.REMOVE);
+				}else if(updated){
+					notification.setNotificationType(NotificationType.UPDATE);
+				}
+				return notification;
+			}else if(scheme.equals(NotificationScheme.MANUAL_NOTIFICATIONS)) {
+				return MatchStore.checkMatch(notification);
+			}else {
+				return null;
+			}
+		}
+	}
+
+	private static void publishMessage(String pubTopic, String uniqueID , List<String> uebURLList) {
+		
+		String UEBlist = uebURLList.toString();
+		UEBlist = UEBlist.substring(1,UEBlist.length()-1);
+        CambriaPublisher pub = null;
+		try {
+			pub = CambriaClientFactory.createSimplePublisher(null, UEBlist, pubTopic);
+		} catch (MalformedURLException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (GeneralSecurityException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+        final JSONObject msg1 = new JSONObject (); 
+
+        msg1.put ( "JSON", "UEB Update Ruest UID=" + uniqueID);  
+
+        try {
+			pub.send ( "MyPartitionKey", msg1.toString () );
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+        pub.close (); 
+		
+	}
+
+	public static void createTopic (String url, String uniquID, List<String> uebURLList){
+		URL aURL;
+		try {
+			aURL = new URL(url);
+			topic = aURL.getHost() + aURL.getPort();
+		} catch (MalformedURLException e) {
+			topic = url.replace("[:/]", "");
+		}
+
+		publishMessage(topic+ uniquID , uniquID, uebURLList);
+		
+	}
+	public static void start(String url, List<String> uebURLList,
+			String uniqueID) {
+		ManualClientEndUEB.uebURLList  = uebURLList;
+		ManualClientEndUEB.url = url;
+		ManualClientEndUEB.uniquID = uniqueID;
+		URL aURL;
+		try {
+			aURL = new URL(url);
+			ManualClientEndUEB.topic = aURL.getHost() + aURL.getPort();
+		} catch (MalformedURLException e) {
+			ManualClientEndUEB.topic = url.replace("[:/]", "");
+		}
+		String id = "0";
+		try {
+			CConsumer = CambriaClientFactory.createConsumer ( null, uebURLList, topic + uniquID, "clientGroup", id, 15*1000, 1000 );
+		} catch (MalformedURLException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (GeneralSecurityException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}		
+		int count = 1;
+		while (count < 4) {
+				publishMessage(topic + "UpdateRequest", uniquID, uebURLList);
+				try {
+					for ( String msg : CConsumer.fetch () )
+					{	
+						
+						logger.debug("Manual Notification Recieved Message " + msg + " from UEB cluster : " + uebURLList.toString());
+						resultJson = msg;
+						if (!msg.contains("UEB Update")){
+//							System.out.println("Manual Notification Recieved Message " + msg + " from UEB cluster : " + uebURLList.toString());
+							notification = NotificationUnMarshal.notificationJSON(msg);
+							count = 4;
+						}
+					}
+				}catch (Exception e) {
+					
+				} 
+				count++;
+			}		
+	}
+	
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
new file mode 100644
index 0000000..2c06b9a
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
@@ -0,0 +1,246 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.openecomp.policy.api.LoadedPolicy;
+import org.openecomp.policy.api.NotificationType;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.api.RemovedPolicy;
+import org.openecomp.policy.std.StdLoadedPolicy;
+import org.openecomp.policy.std.StdPDPNotification;
+import org.openecomp.policy.std.StdRemovedPolicy;
+
+import org.openecomp.policy.common.logging.flexlogger.*; 
+
+public class MatchStore {
+	private static HashSet<Matches> matchStore = new HashSet<Matches>();
+	private static Logger logger = FlexLogger.getLogger(MatchStore.class.getName());
+	
+	public static HashSet<Matches> getMatchStore() {
+		return matchStore;
+	}
+
+	public static void storeMatch(Matches newMatch){
+		// Initialization..
+		if(newMatch!=null){
+			if(matchStore.isEmpty()){
+				matchStore.add(newMatch);
+			}else{
+				// Check if it is a new Match
+				Boolean match = false;
+				for(Matches oldMatch: matchStore){
+					// Compare ECOMPName
+					if(oldMatch.getEcompName().equals(newMatch.getEcompName())){
+						// Compare ConfigName if it exists. 
+						if(newMatch.getConfigName()!=null && oldMatch.getConfigName()!=null){
+							if(oldMatch.getConfigName().equals(newMatch.getConfigName())){
+								// Compare the Config Attributes if they exist.
+								if(newMatch.getConfigAttributes()!= null && oldMatch.getConfigAttributes()!=null) {
+									//Simple thing would be comparing their size. 
+									if(newMatch.getConfigAttributes().size()==oldMatch.getConfigAttributes().size()){
+										// Now need to compare each of them..
+										int count= 0;
+										for(String oldkey: oldMatch.getConfigAttributes().keySet()){
+											boolean check = false;
+											for(String newKey: newMatch.getConfigAttributes().keySet()){
+												if(oldkey.equals(newKey)){
+													if(oldMatch.getConfigAttributes().get(oldkey).equals(newMatch.getConfigAttributes().get(newKey))){
+														check = true;
+													}
+												}
+											}
+											if(check){
+												count++;
+											}else{
+												break;
+											}
+										}
+										if(count==oldMatch.getConfigAttributes().size()){
+											match = true;
+											break;
+										}
+									}
+								}else if(newMatch.getConfigAttributes()== null && oldMatch.getConfigAttributes()==null){
+									match = true;
+									break;
+								}
+							}
+						}else if(newMatch.getConfigName()==null && oldMatch.getConfigName()==null){
+							match = true;
+							break;
+						}	
+					}
+					
+				}
+				// IF not a match then add it to the MatchStore
+				if(match==false){
+					matchStore.add(newMatch);
+				}
+			}
+		}
+	}
+	
+	//TODO Logic changes for Requested Policies notifications.. 
+	public static PDPNotification checkMatch(PDPNotification oldNotification) {
+		boolean removed = false, updated = false;
+		if(oldNotification==null){
+			return null;
+		}
+		StdPDPNotification newNotification = new StdPDPNotification();
+		if(matchStore.isEmpty()) {
+			logger.debug("No Success Config Calls made yet.. ");
+			System.out.println("No success Config calls made yet. ");
+			return null;
+		} 
+		if(oldNotification.getRemovedPolicies()!=null && !oldNotification.getRemovedPolicies().isEmpty()){
+			// send all removed policies to client.
+			Collection<StdRemovedPolicy> removedPolicies = new HashSet<StdRemovedPolicy>();
+			StdRemovedPolicy newRemovedPolicy;
+			for(RemovedPolicy removedPolicy: oldNotification.getRemovedPolicies()){
+				newRemovedPolicy = new StdRemovedPolicy();
+				newRemovedPolicy.setPolicyName(removedPolicy.getPolicyName());
+				newRemovedPolicy.setVersionNo(removedPolicy.getVersionNo());
+				removedPolicies.add(newRemovedPolicy);
+			}
+			newNotification.setRemovedPolicies(removedPolicies);
+			removed = true;
+		}
+		if(oldNotification.getLoadedPolicies()!=null && !oldNotification.getLoadedPolicies().isEmpty()){
+			Collection<StdLoadedPolicy> updatedPolicies = new HashSet<StdLoadedPolicy>();
+			StdLoadedPolicy newUpdatedPolicy;
+			for(LoadedPolicy updatedPolicy: oldNotification.getLoadedPolicies()){
+				// if it is config policies check their matches..
+				if(updatedPolicy.getMatches()!=null && !updatedPolicy.getMatches().isEmpty()){
+					boolean matched = false;
+					for(Matches match : matchStore){
+						matched = false;
+						// Again Better way would be comparing sizes first.
+						// Matches are different need to check if has configAttributes
+						if(match.getConfigAttributes()!=null && !match.getConfigAttributes().isEmpty()){
+							// adding ecomp and config to config-attributes. 
+							int compValues = match.getConfigAttributes().size() + 2;
+							if(updatedPolicy.getMatches().size()== compValues){
+								// Comparing both the values.. 
+								boolean matchAttributes = false;
+								for(String newKey: updatedPolicy.getMatches().keySet()){
+									if(newKey.equals("ECOMPName")){
+										if(updatedPolicy.getMatches().get(newKey).equals(match.getEcompName())){
+											matchAttributes = true;
+										}else {
+											matchAttributes = false;
+											break;
+										}
+									}else if(newKey.equals("ConfigName")) {
+										if(updatedPolicy.getMatches().get(newKey).equals(match.getConfigName())){
+											matchAttributes = true;
+										}else{
+											matchAttributes = false;
+											break;
+										}
+									}else {
+										if(match.getConfigAttributes().containsKey(newKey)){
+											if(updatedPolicy.getMatches().get(newKey).equals(match.getConfigAttributes().get(newKey))){
+												matchAttributes = true;
+											}else{
+												matchAttributes = false;
+												break;
+											}
+										}else{
+											matchAttributes = false;
+											break;
+										}
+									}
+								}
+								if(matchAttributes){
+									// Match..
+									matched = true;
+								}else{
+									break;
+								}
+							}else {
+								break;
+							}
+						}else if(match.getConfigName()!=null){
+							// If there are no config Attributes then check if it has Config Name
+							if(updatedPolicy.getMatches().size()== 2){
+								if(updatedPolicy.getMatches().get("ECOMPName").equals(match.getEcompName())){
+									if(updatedPolicy.getMatches().get("ConfigName").equals(match.getConfigName())){
+										// Match..
+										matched = true;
+									}else{
+										break;
+									}
+								}else {
+									break;
+								}
+							}else{
+								break;
+							}
+						}else {
+							// If non exist then assuming the ECOMP Name to be there. 
+							if(updatedPolicy.getMatches().size()== 1){
+								if(updatedPolicy.getMatches().get("ECOMPName").equals(match.getEcompName())){
+									// Match.. 
+									matched = true;
+								}else {
+									break;
+								}
+							}else{
+								break;
+							}
+						}
+						// Add logic to add the policy. 
+						if(matched){
+							newUpdatedPolicy = new StdLoadedPolicy();
+							newUpdatedPolicy.setPolicyName(updatedPolicy.getPolicyName());
+							newUpdatedPolicy.setVersionNo(updatedPolicy.getVersionNo());
+							newUpdatedPolicy.setMatches(updatedPolicy.getMatches());
+							updatedPolicies.add(newUpdatedPolicy);
+							updated = true;
+						}
+					}
+					
+				}else {
+					//send all non config notifications to client.
+					newUpdatedPolicy = new StdLoadedPolicy();
+					newUpdatedPolicy.setPolicyName(updatedPolicy.getPolicyName());
+					newUpdatedPolicy.setVersionNo(updatedPolicy.getVersionNo());
+					updatedPolicies.add(newUpdatedPolicy);
+					updated = true;
+				}
+			}
+			newNotification.setLoadedPolicies(updatedPolicies);
+		}
+		// Need to set the type of Update.. 
+		if(removed && updated) {
+			newNotification.setNotificationType(NotificationType.BOTH);
+		}else if(removed){
+			newNotification.setNotificationType(NotificationType.REMOVE);
+		}else if(updated){
+			newNotification.setNotificationType(NotificationType.UPDATE);
+		}
+		return newNotification;
+	}
+	
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/Matches.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/Matches.java
new file mode 100644
index 0000000..8e6a8ee
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/Matches.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.util.Map;
+
+public class Matches {
+	private String ecompName = null;
+	private String configName = null;
+	private Map<String,String> configAttributes = null;
+	public String getEcompName() {
+		return ecompName;
+	}
+	public void setEcompName(String ecompName) {
+		this.ecompName = ecompName;
+	}
+	public String getConfigName() {
+		return configName;
+	}
+	public void setConfigName(String configName) {
+		this.configName = configName;
+	}
+	public Map<String,String> getConfigAttributes() {
+		return configAttributes;
+	}
+	public void setConfigAttributes(Map<String,String> configAttributes) {
+		this.configAttributes = configAttributes;
+	}
+	
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
new file mode 100644
index 0000000..a09391b
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.openecomp.policy.api.LoadedPolicy;
+import org.openecomp.policy.api.RemovedPolicy;
+import org.openecomp.policy.api.UpdateType;
+import org.openecomp.policy.std.StdLoadedPolicy;
+import org.openecomp.policy.std.StdPDPNotification;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class NotificationUnMarshal {
+	private static StdPDPNotification notification;
+	
+	public static StdPDPNotification notificationJSON(String json) throws Exception{
+		ObjectMapper mapper = new ObjectMapper();
+		notification = mapper.readValue(json, StdPDPNotification.class);
+		if(notification!=null){
+			if(notification.getLoadedPolicies()!=null){
+				Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<StdLoadedPolicy>();
+				for(LoadedPolicy loadedPolicy: notification.getLoadedPolicies()){
+					StdLoadedPolicy stdLoadedPolicy = (StdLoadedPolicy) loadedPolicy;
+					if(notification.getRemovedPolicies()!=null){
+						Boolean updated = false;
+						for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
+							String regex = ".(\\d)*.xml";
+							if(removedPolicy.getPolicyName().replaceAll(regex, "").equals(stdLoadedPolicy.getPolicyName().replaceAll(regex, ""))){
+								updated  = true;
+								break;
+							}
+						}
+						if(updated){
+							stdLoadedPolicy.setUpdateType(UpdateType.UPDATE);
+						}else{
+							stdLoadedPolicy.setUpdateType(UpdateType.NEW);
+						}
+					}else{
+						stdLoadedPolicy.setUpdateType(UpdateType.NEW);
+					}
+					stdLoadedPolicies.add(stdLoadedPolicy);
+				}
+				notification.setLoadedPolicies(stdLoadedPolicies);
+			}
+		}
+		return notification;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdDecisionResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdDecisionResponse.java
new file mode 100644
index 0000000..1f4cf65
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdDecisionResponse.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.std;
+
+import org.openecomp.policy.api.DecisionResponse;
+import org.openecomp.policy.api.PolicyDecision;
+
+/**
+ * Decision Response Implementation Class. 
+ * 
+ * @version 0.1
+ */
+public class StdDecisionResponse implements DecisionResponse {
+
+	private PolicyDecision decision = PolicyDecision.DENY;
+	private String details;
+	
+	@Override
+	public PolicyDecision getDecision() {
+		return decision;
+	}
+
+	@Override
+	public String getDetails() {
+		return details;
+	}
+	
+	public void setDecision(PolicyDecision decision){
+		this.decision = decision;
+	}
+	
+	public void setDetails(String details) {
+		this.details = details;
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyChangeResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyChangeResponse.java
new file mode 100644
index 0000000..2fec860
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyChangeResponse.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+
+import org.openecomp.policy.api.PolicyChangeResponse;
+
+public class StdPolicyChangeResponse implements PolicyChangeResponse{
+	private String responseMessage = null;
+	private int responseCode;
+	
+	@Override
+	public String getResponseMessage() {
+		return responseMessage;
+	}
+
+	@Override
+	public int getResponseCode() {
+		return responseCode;
+	}
+	
+	public void setResponseMessage(String responseMessage){
+		this.responseMessage = responseMessage;
+	}
+	
+	public void setResponseCode(int responseCode){
+		this.responseCode = responseCode;
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyConfig.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyConfig.java
new file mode 100644
index 0000000..ec205da
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyConfig.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.std;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.json.JsonObject;
+
+import org.openecomp.policy.api.PolicyConfig;
+import org.openecomp.policy.api.PolicyConfigStatus;
+import org.openecomp.policy.api.PolicyType;
+import org.w3c.dom.Document;
+
+/**
+ * PolicyConfig Implementation. 
+ * 
+ * @version 0.3
+ *
+ */
+
+public class StdPolicyConfig implements PolicyConfig{
+	private PolicyType policyType;
+	private Properties properties;
+	private JsonObject jsonObject;
+	private Document document;
+	private String other;
+	private PolicyConfigStatus policyConfigStatus;
+	private String configStatus;
+	private String policyName;
+	private String policyVersion;
+	private Map<String,String> matchingConditions; 
+	private Map<String,String> responseAttributes;
+	
+	@Override
+	public PolicyType getType() {
+		return policyType;
+	}
+
+	@Override
+	public Properties toProperties() {
+		return properties;
+	}
+
+	@Override
+	public JsonObject toJSON() {
+		return jsonObject;
+	}
+
+	@Override
+	public Document toXML() {
+		return document;
+	}
+	
+	@Override
+	public String toOther() {
+		return other;
+	}
+
+	@Override
+	public PolicyConfigStatus getPolicyConfigStatus() {
+		return policyConfigStatus;
+	}
+
+	@Override
+	public String getPolicyConfigMessage() {
+		return configStatus;
+	}
+	
+	@Override
+	public String getPolicyName() {
+		if(policyName!=null && policyName.contains(".xml")){
+			return (policyName.substring(0, policyName.substring(0, policyName.lastIndexOf(".")).lastIndexOf(".")));
+		}
+		return policyName;
+	}
+	
+	@Override
+	public String getPolicyVersion() {
+		return policyVersion;
+	}
+	
+	@Override
+	public Map<String,String> getMatchingConditions(){
+		return matchingConditions;
+	}
+	
+	@Override
+	public Map<String,String> getResponseAttributes(){
+		return responseAttributes;
+	}
+	
+	public void setPolicyType(PolicyType policyType) {
+		this.policyType = policyType;
+	}
+	
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+	
+	public void setPolicyVersion(String policyVersion) {
+		this.policyVersion = policyVersion;
+	}
+	
+	public void setProperties(Properties properties) {
+		this.properties = properties;
+	}
+
+	public void setJsonObject(JsonObject jsonObject) {
+		this.jsonObject = jsonObject;
+	}
+	
+	public void setDocument(Document document) {
+		this.document = document;
+	}
+	
+	public void setOther(String other) {
+		this.other = other;
+	}
+	
+	public void setConfigStatus(String configStatus) {
+		this.configStatus = configStatus;
+	}
+	
+	public void setPolicyConfigStatus(PolicyConfigStatus policyConfigStatus) {
+		this.policyConfigStatus = policyConfigStatus;
+	}
+	
+	public void setConfigStatus(String configStatus, PolicyConfigStatus policyConfigStatus) {
+		this.configStatus = configStatus;
+		this.policyConfigStatus = policyConfigStatus;
+	}
+	
+	public void setMatchingConditions(Map<String,String> matchingConditions){
+		this.matchingConditions = matchingConditions;
+	}
+	
+	public void setResponseAttributes(Map<String,String> responseAttributes){
+		this.responseAttributes = responseAttributes;
+	}
+	
+	@Override
+	public String toString() {
+		return "PolicyConfig [ policyConfigStatus=" + policyConfigStatus + ", policyConfigMessage=" + configStatus + ", policyName=" + policyName + 
+				""
+				+ "]";
+	}
+
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
new file mode 100644
index 0000000..11e4e4f
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
@@ -0,0 +1,4227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.std;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonReader;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.entity.ContentType;
+//import org.apache.log4j.Logger;
+import org.json.JSONObject;
+import org.openecomp.policy.api.AttributeType;
+import org.openecomp.policy.api.ConfigRequestParameters;
+import org.openecomp.policy.api.DecisionRequestParameters;
+import org.openecomp.policy.api.DecisionResponse;
+import org.openecomp.policy.api.DeletePolicyParameters;
+import org.openecomp.policy.api.DictionaryParameters;
+import org.openecomp.policy.api.EventRequestParameters;
+import org.openecomp.policy.api.ImportParameters;
+import org.openecomp.policy.api.NotificationHandler;
+import org.openecomp.policy.api.NotificationScheme;
+import org.openecomp.policy.api.PDPNotification;
+import org.openecomp.policy.api.PolicyChangeResponse;
+import org.openecomp.policy.api.PolicyClass;
+import org.openecomp.policy.api.PolicyConfig;
+import org.openecomp.policy.api.PolicyConfigException;
+import org.openecomp.policy.api.PolicyConfigStatus;
+import org.openecomp.policy.api.PolicyConfigType;
+import org.openecomp.policy.api.PolicyDecision;
+import org.openecomp.policy.api.PolicyDecisionException;
+import org.openecomp.policy.api.PolicyEngineException;
+import org.openecomp.policy.api.PolicyEventException;
+import org.openecomp.policy.api.PolicyParameters;
+import org.openecomp.policy.api.PolicyResponse;
+import org.openecomp.policy.api.PolicyResponseStatus;
+import org.openecomp.policy.api.PolicyType;
+import org.openecomp.policy.api.PushPolicyParameters;
+import org.openecomp.policy.api.RuleProvider;
+//import org.openecomp.policy.utils.AAFPolicyClient;
+//import org.openecomp.policy.utils.AAFPolicyException;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+import com.att.research.xacml.api.Advice;
+import com.att.research.xacml.api.AttributeAssignment;
+import com.att.research.xacml.api.Decision;
+import com.att.research.xacml.api.Obligation;
+import com.att.research.xacml.api.Request;
+import com.att.research.xacml.api.Response;
+import com.att.research.xacml.api.Result;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.xacml.std.pap.StdPAPPolicy;
+import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.std.json.JSONRequest;
+import com.att.research.xacml.std.json.JSONResponse;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.CharMatcher;
+
+
+
+/**
+ * PolicyEngine Implementation class
+ * 
+ * @version 1.0
+ */
+public class StdPolicyEngine {
+	// Change the default Priority value here. 
+	private static final int defaultPriority = 9999;
+	
+	private String propertyFilePath = null;
+	private static List<String> pdps = null;
+	private static List<String> paps = null;
+	private static String environment= null; 
+	private static String userName = null;
+	private static String pass = null; 
+	private static List<String> encoding = null;
+	private static List<String> encodingPAP = null;
+	private List<String> pdp_default = null;
+	private List<String> pap_default = null;
+	private List<String> type_default = null;
+	private List<String> notificationType = new ArrayList<String>();
+	private List<String> uebURLList = new ArrayList<String>();
+	private NotificationScheme scheme = null;
+	private NotificationHandler handler = null;
+	private Matches match = null;
+	private Boolean decide = false;
+	private AutoClientUEB UEBClientThread = null;
+	private Thread registerUEBThread = null;
+	private boolean UEBThread = false;
+	private String policyId = null;	
+	private String description = null;	
+	private String pushVersion = null;
+	private boolean isValid = false;
+	private int responseCode = 0;
+	private boolean unique = false;
+	private boolean junit = false;
+	//private AAFPolicyClient aafClient = null;
+	// Backward code. 
+	private String pyPDPClientFile = null;
+	
+	final private static String uniqueID = UUID.randomUUID ().toString ();
+	
+	private static Logger logger = FlexLogger.getLogger(StdPolicyConfig.class.getName());
+	
+	/*
+	 * Taking the Property file even if it null.
+	 */
+	public StdPolicyEngine(String propertyFilePath)
+			throws PolicyEngineException {
+		setProperty(propertyFilePath);
+	}
+
+	/*
+	 * Taking the Notification Constructor.
+	 */
+	public StdPolicyEngine(String propertyFilePath, NotificationScheme scheme,
+			NotificationHandler handler) throws PolicyEngineException {
+		setProperty(propertyFilePath);
+		this.scheme = scheme;
+		this.handler = handler;
+		if (!notificationType.get(0).equals("ueb")){
+			AutoClientEnd.setAuto(scheme, handler);
+		}
+		notification(scheme, handler);
+	}
+
+	/*
+	 * Taking the Notification Constructor.
+	 */
+	public StdPolicyEngine(String propertyFilePath, NotificationScheme scheme)
+			throws PolicyEngineException {
+		setProperty(propertyFilePath);
+		this.scheme = scheme;
+		setScheme(scheme);
+	}
+
+	// This Call will be used by PyPDP Requests
+	public StdPolicyEngine(List<String> configURL, List<String> configPapURL, List<String> encodingPAP, List<String> encoding, NotificationScheme scheme, NotificationHandler handler, String environment, String clientProperties, Boolean isTest) {
+		StdPolicyEngine.pdps = configURL;
+		StdPolicyEngine.paps = configPapURL;
+		StdPolicyEngine.encoding = encoding;
+		StdPolicyEngine.encodingPAP = encodingPAP;
+		StdPolicyEngine.environment = environment;
+		Properties props = new Properties();
+		props.setProperty("ENVIRONMENT", environment);
+		//Not Supported for 1610 Open Source
+		/*try {
+			aafClient = AAFPolicyClient.getInstance(props);
+		} catch (AAFPolicyException e) {
+			logger.error(XACMLErrorConstants.ERROR_UNKNOWN + e.getMessage());
+		}*/
+		pyPDPClientFile = clientProperties;
+		// Default Notification Type for PyPDPServers. 
+		notificationType.add("websocket");
+		if(!isTest){
+			notification(scheme, handler);
+		}
+	}
+
+	/*
+	 * sendEvent API Implementation
+	 */
+	public Collection<PolicyResponse> event(Map<String, String> eventAttributes, UUID requestID)
+			throws PolicyEventException {
+		Collection<PolicyResponse> policyResponse = null;
+		policyResponse = event(eventAttributes, requestID, userName, pass);
+		return policyResponse;
+	}
+	
+	/*
+	 * sendEvent API Implementation for eventRequestParameters 
+	 */
+	public Collection<PolicyResponse> event(EventRequestParameters eventRequestParameters) throws PolicyEventException{
+		Collection<PolicyResponse> response = event(eventRequestParameters.getEventAttributes(), eventRequestParameters.getRequestID());
+		return response;
+	}
+
+	/*
+	 * getConfig API Implementation
+	 */
+	public Collection<PolicyConfig> config(String eCOMPComponentName,
+			String configName, Map<String, String> configAttributes, UUID requestID)
+			throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = null;
+		policyConfig = config(eCOMPComponentName, configName, configAttributes, requestID, userName, pass);
+		return policyConfig;
+	}
+
+	/*
+	 * getConfig API Implementation
+	 */
+	public Collection<PolicyConfig> config(String eCOMPComponentName,
+			String configName, UUID requestID) throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = null;
+		policyConfig = config(eCOMPComponentName, configName,null, requestID, userName, pass);
+		return policyConfig;
+	}
+
+	/*
+	 * getConfig API Implementation
+	 */
+	public Collection<PolicyConfig> config(String eCOMPComponentName, UUID requestID)
+			throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = null;
+		policyConfig = config(eCOMPComponentName, requestID, userName, pass);
+		return policyConfig;
+	}
+
+	/*
+	 * getConfig using the PolicyFileName Implementation
+	 */
+	public Collection<PolicyConfig> policyName(String policyName, UUID requestID)
+			throws PolicyConfigException {
+		Collection<PolicyConfig> policyConfig = null;
+		policyConfig = configPolicyName(policyName, requestID, userName, pass);
+		return policyConfig;
+	}
+	
+	/*
+	 * getConfig using configRequestParameters Implementation 
+	 */
+	public Collection<PolicyConfig> config(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
+		Collection<PolicyConfig> response = null;
+		response = configRequest(configRequestParameters, userName, pass);
+		return response;
+	}
+	
+	/*
+	 * listPolicies using configRequestParameters Implementation
+	 */
+	public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters) throws PolicyConfigException{
+		Collection<String> policyList = new ArrayList<String>();
+		policyList = listConfigRequest(listPolicyRequestParameters, userName, pass);
+		return policyList;
+	}
+
+	/*
+	 * getDecision using the decision Attributes.
+	 */
+	public DecisionResponse decide(String eCOMPComponentName,
+			Map<String, String> decisionAttributes, UUID requestID)
+			throws PolicyDecisionException {
+		DecisionResponse policyDecision = policyDecide(eCOMPComponentName,
+				decisionAttributes, requestID, userName, pass);
+		return policyDecision;
+	}
+	
+	/*
+	 * getDecision Using decisionRequestParameters.  
+	 */
+	public DecisionResponse decide(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException{
+		DecisionResponse decision = decide(decisionRequestParameters.getECOMPComponentName(), decisionRequestParameters.getDecisionAttributes(), decisionRequestParameters.getRequestID());
+		return decision;
+	}
+	
+	/*
+	 * PushPolicy using pushPolicyParameters. 
+	 */
+	public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws Exception{
+		return pushPolicy(pushPolicyParameters, userName, pass);
+	}
+	
+	public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters, String userID, String passcode) throws Exception{
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		String resource= "pushPolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseMessage(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseCode(401);
+			return response;
+		}
+		String plainName = null;
+		String scope = null;
+		try{
+			if(pushPolicyParameters.getPolicyName()!=null){
+				plainName = pushPolicyParameters.getPolicyName().substring(pushPolicyParameters.getPolicyName().lastIndexOf(".")+1, pushPolicyParameters.getPolicyName().length());
+				scope = pushPolicyParameters.getPolicyName().substring(0, pushPolicyParameters.getPolicyName().lastIndexOf("."));
+				logger.info("Name is "+ plainName +"   scope is "+ scope);
+			}
+		}catch(Exception e){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+		}
+
+		// check incoming requestID, if null then generate one here so the same id can be used for the multiple transactions for the same Push Policy request  (i.e. POST, PUT)
+		UUID requestID = pushPolicyParameters.getRequestID();
+		if (requestID == null) {
+			requestID = UUID.randomUUID();
+			logger.info("Request ID was not provided from input, so sending generated ID: " + requestID.toString());
+		} else {	
+			logger.info("Request ID was provided from input: " + requestID.toString());
+		}
+		// now use the local requestID field derived above to pass to the rest of the Push Policy process (below)
+		// response.setResponseMessage(pushPolicy(scope, plainName, pushPolicyParameters.getPolicyType(), pushPolicyParameters.getPdpGroup(), pushPolicyParameters.getRequestID()));
+		response.setResponseMessage(pushPolicy(scope, plainName, pushPolicyParameters.getPolicyType(), pushPolicyParameters.getPdpGroup(), requestID));
+		response.setResponseCode(responseCode);
+		return response;
+	}
+	
+	/*
+	 * Delete a Policy using deletePolicyParameters
+	 */
+	public PolicyChangeResponse deletePolicy(DeletePolicyParameters parameters) throws Exception {
+		return deletePolicy(parameters, userName, pass);
+	}
+	
+	public PolicyChangeResponse deletePolicy(DeletePolicyParameters parameters, String userID,String passcode) throws Exception {
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		String resource= "deletePolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseMessage(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseCode(401);
+			return response;
+		}
+		if (parameters.getPolicyComponent()!=null) {
+			if (parameters.getPolicyComponent().equalsIgnoreCase("PAP")) {
+				response.setResponseMessage(deletePolicyFromPAP(parameters));
+			} else if (parameters.getPolicyComponent().equalsIgnoreCase("PDP")) {
+				response.setResponseMessage(deletePolicyFromPDP(parameters));
+			} else {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy Component does not exist.");
+				response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy Component does not exist. Please enter either PAP or PDP to delete the policy from a specified Policy Component.");
+			}
+		} else {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Component given.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Component given.");
+		}
+
+		response.setResponseCode(responseCode);
+		return response;
+	}
+	
+	/*
+	 * createDictionaryItem using dictionaryParameters.
+	 */
+	public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws Exception{
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		
+		if(parameters.getDictionaryType()!=null || parameters.getDictionaryType().equals("")){
+			if(parameters.getDictionary()!=null || parameters.getDictionary().equals("")){
+				if(parameters.getDictionaryFields()!=null){
+					logger.info("Parameters are good... start create dictionary item API...");
+					
+					Map<String,String> dictionaryFields = parameters.getDictionaryFields().get(AttributeType.DICTIONARY);
+					
+					StdPAPPolicy newDictionaryItem = new StdPAPPolicy(parameters.getDictionaryType().toString(), parameters.getDictionary(), dictionaryFields);
+
+					String result = (String) callPAP(newDictionaryItem, new String[] {"operation=createDictionary", "apiflag=dictionaryApi"}, parameters.getRequestID(), "dictionaryItem");
+					
+					response.setResponseCode(responseCode);
+					response.setResponseMessage(result);
+
+				}else{
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary Fields given.");
+					response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary Fields given.");
+				}
+			}else{
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary given.");
+				response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary given.");
+			}
+		}else{
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary Type given.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Dictionary Type given.");
+		}
+		try{
+			
+		}catch(Exception e){
+
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * createPolicy Using policyParameters. 
+	 */
+	public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws Exception{
+		return createPolicy(policyParameters, userName, pass);
+	}
+	
+	public PolicyChangeResponse createPolicy(PolicyParameters policyParameters, String userID, String passcode) throws Exception{
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		String resource= "createPolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseMessage(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseCode(401);
+			return response;
+		}
+		String plainName = null;
+		String scope = null;
+		String date = "NA";
+		if (policyParameters.getTtlDate()!=null){
+			date = ConvertDate(policyParameters.getTtlDate());
+		}
+		try{
+			if(policyParameters.getPolicyName()!=null){
+				plainName = policyParameters.getPolicyName().substring(policyParameters.getPolicyName().lastIndexOf(".")+1, policyParameters.getPolicyName().length());
+				scope = policyParameters.getPolicyName().substring(0, policyParameters.getPolicyName().lastIndexOf("."));
+				logger.info("Name is "+ plainName +"   scope is "+ scope);
+			}
+		}catch(Exception e){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+		}
+		if(policyParameters.getPolicyConfigType()!=null){
+			// This is Config Class Policy. 
+			// Firewall
+			if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.Firewall)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						json = stringToJsonObject(policyParameters.getConfigBody());
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						throw new Exception(message);
+					}
+					response.setResponseMessage(createConfigFirewallPolicy(plainName, json, scope, policyParameters.getRequestID(), userID, passcode,
+							policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body given.";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			//Base
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.Base)){
+				if(policyParameters.getConfigBody()!=null) {
+					if(policyParameters.getConfigBodyType()!=null){
+						response.setResponseMessage(createConfigPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getConfigName(),
+								policyParameters.getAttributes().get(AttributeType.MATCHING), policyParameters.getConfigBodyType().toString(), policyParameters.getConfigBody(), scope, policyParameters.getRequestID(), userID, passcode,
+								policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+					} else {
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body Type given.";
+						logger.error(message);
+						response.setResponseMessage(message);
+					}
+				} else {
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body given.";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			//BRMS Raw
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.BRMS_RAW)){
+				if(policyParameters.getConfigBody()!=null){
+					
+					/*public String createUpdateBRMSRawPolicy(String policyName, String policyDescription, Map<String,String> dyanamicFieldConfigAttributes,
+					 * String brmsRawBody, String policyScope, Boolean isEdit, UUID requestID)*/
+					response.setResponseMessage(createUpdateBRMSRawPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							policyParameters.getConfigBody(),scope, false, 
+							policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), 
+							date));
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					throw new Exception(message);
+				}
+			}
+			//BRMS Param
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.BRMS_PARAM)){
+				if(policyParameters.getConfigBody()!=null){
+			
+					response.setResponseMessage(createUpdateBRMSParamPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							policyParameters.getConfigBody(),scope, false, 
+							policyParameters.getRequestID(),policyParameters.getAttributes(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+							String.valueOf(policyParameters.getGuard()), date));
+				}else{
+					response.setResponseMessage(createUpdateBRMSParamPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							null,scope, false, 
+							policyParameters.getRequestID(),policyParameters.getAttributes(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+							String.valueOf(policyParameters.getGuard()), date));
+				}
+			}
+			// Micro Services Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.MicroService)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						json = stringToJsonObject(policyParameters.getConfigBody());
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						throw new Exception(message);
+					}
+					//call Micro Services Create API here
+					response.setResponseMessage(createUpdateMicroServicesPolicy(plainName, json, policyParameters.getEcompName(),
+													scope, false, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+													String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Micro Service or Attributes Config Body Present";
+					logger.error(message);
+					throw new Exception(message);
+				}
+			}
+			// ClosedLoop_Fault Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.ClosedLoop_Fault)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						if(validateNONASCIICharactersAndAllowSpaces(policyParameters.getConfigBody())){
+							json = stringToJsonObject(policyParameters.getConfigBody());
+						} else {
+							String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "The ClosedLoop JSON Contains Non ASCII Characters.";
+							logger.error(message);
+							response.setResponseCode(400);
+							response.setResponseMessage(message);
+							return response;
+						}
+						
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						response.setResponseCode(400);
+						response.setResponseMessage(message);
+						return response;
+						
+					}
+					//call ClosedLoop_Fault Create API here
+					response.setResponseMessage(createUpdateClosedLoopPolicy(plainName, json, policyParameters.getPolicyDescription(),
+													scope, false, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+													String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					response.setResponseMessage(message);
+					response.setResponseCode(400);
+					return response;
+				}
+			}
+			// ClosedLoop_PM Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.ClosedLoop_PM)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						if(validateNONASCIICharactersAndAllowSpaces(policyParameters.getConfigBody())){
+							json = stringToJsonObject(policyParameters.getConfigBody());
+						} else {
+							String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "The ClosedLoop PM JSON Contains Non ASCII Characters.";
+							logger.error(message);
+							response.setResponseMessage(message);
+							response.setResponseCode(400);
+							return response;
+							
+						}
+						
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						response.setResponseMessage(message);
+						response.setResponseCode(400);
+						return response;
+						
+					}
+					//call ClosedLoop_Fault Create API here
+					response.setResponseMessage(createUpdateClosedLoopPmPolicy(plainName, json, policyParameters.getPolicyDescription(),
+													scope, false, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+													String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					response.setResponseMessage(message);
+					response.setResponseCode(400);
+					return response;
+					
+				}
+			}
+			
+		} else if (policyParameters.getPolicyClass()!=null){ 
+			if(policyParameters.getPolicyClass().equals(PolicyClass.Action)){
+				// call Action Create API here. 
+				response.setResponseMessage(createUpdateActionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getAttributes().get(AttributeType.MATCHING), 
+						policyParameters.getDynamicRuleAlgorithmLabels(), policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+						policyParameters.getActionPerformer(), policyParameters.getActionAttribute(), scope, false, policyParameters.getRequestID()));
+			}else if(policyParameters.getPolicyClass().equals(PolicyClass.Decision)){
+				// Call Decision Create API here. 
+				if (policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) {
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							policyParameters.getAttributes().get(AttributeType.MATCHING), policyParameters.getAttributes().get(AttributeType.SETTINGS), policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, false, policyParameters.getRequestID()));
+				}else if(policyParameters.getAttributes()!=null && !policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							null, policyParameters.getAttributes().get(AttributeType.SETTINGS), policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, false, policyParameters.getRequestID()));
+				}else if(policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							policyParameters.getAttributes().get(AttributeType.MATCHING), null, policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, false, policyParameters.getRequestID()));
+				}else{
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							null, null, policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, false, policyParameters.getRequestID()));
+				}
+			}
+		} else {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Class found.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Class found.");
+		}
+		response.setResponseCode(responseCode);
+		return response;
+	}
+	
+	/*
+	 * updatePolicy using policyParameters. 
+	 */
+	public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws Exception{
+		return updatePolicy(policyParameters, userName, pass);
+	}
+	
+	public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters,String userID, String passcode) throws Exception{
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		String resource= "updatePolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseMessage(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseCode(401);
+			return response;
+		}
+		String plainName = null;
+		String scope = null;
+		String date = "NA";
+		if (policyParameters.getTtlDate()!=null){
+			date = ConvertDate(policyParameters.getTtlDate());
+		}
+		try{
+			if(policyParameters.getPolicyName()!=null){
+				plainName = policyParameters.getPolicyName().substring(policyParameters.getPolicyName().lastIndexOf(".")+1, policyParameters.getPolicyName().length());
+				scope = policyParameters.getPolicyName().substring(0, policyParameters.getPolicyName().lastIndexOf("."));
+				logger.info("Name is "+ plainName +"   scope is "+ scope);
+			}
+		}catch(Exception e){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+		}
+		if(policyParameters.getPolicyConfigType()!=null){
+			// This is Config Class Policy.
+			//Firewall
+			if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.Firewall)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						json = stringToJsonObject(policyParameters.getConfigBody());
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						throw new Exception(message);
+					}
+					response.setResponseMessage(updateConfigFirewallPolicy(plainName, json, scope, policyParameters.getRequestID(), userID, passcode,policyParameters.getRiskLevel(), 
+							policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body given.";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			//Base Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.Base)){
+				if(policyParameters.getConfigBody()!=null) {
+					if(policyParameters.getConfigBodyType()!=null){
+						response.setResponseMessage(updateConfigPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getConfigName(),
+								policyParameters.getAttributes().get(AttributeType.MATCHING), policyParameters.getConfigBodyType().toString(), policyParameters.getConfigBody(), scope, 
+								policyParameters.getRequestID(), userID, passcode, policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+					} else {
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body Type given.";
+						logger.error(message);
+						response.setResponseMessage(message);
+					}
+				} else {
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body given.";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			//BRMS Raw
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.BRMS_RAW)){
+				if(policyParameters.getConfigBody()!=null){
+					/*public String createUpdateBRMSRawPolicy(String policyName, String policyDescription, Map<String,String> dyanamicFieldConfigAttributes,
+					 * String brmsRawBody, String policyScope, Boolean isEdit, UUID requestID)*/
+					response.setResponseMessage(createUpdateBRMSRawPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							policyParameters.getConfigBody(),scope, true, 
+							policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					throw new Exception(message);
+				}
+			}
+			//BRMS Param
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.BRMS_PARAM)){
+				if(policyParameters.getConfigBody()!=null){
+					
+				/*	public String createUpdateBRMSParamPolicy(String policyName, String policyDescription, Map<AttributeType, Map<String, String>>  dyanamicFieldConfigAttributes,
+							String brmsRawBody, String policyScope, Boolean isEdit, 
+							UUID requestID,Map<String,String> drlRuleAndUIParams)*/
+					response.setResponseMessage(createUpdateBRMSParamPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							policyParameters.getConfigBody(),scope, true, 
+							policyParameters.getRequestID(),policyParameters.getAttributes(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+				}else{
+					response.setResponseMessage(createUpdateBRMSParamPolicy(plainName, policyParameters.getPolicyDescription(),policyParameters.getAttributes(),
+							null,scope, true, 
+							policyParameters.getRequestID(),policyParameters.getAttributes(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+				}
+			}
+			// Micro Services Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.MicroService)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						json = stringToJsonObject(policyParameters.getConfigBody());
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						throw new Exception(message);
+					}
+					//call Micro Services Create API here
+					response.setResponseMessage(createUpdateMicroServicesPolicy(plainName, json, policyParameters.getEcompName(),
+							scope, true, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Micro Service or Attributes Config Body Present";
+					logger.error(message);
+					throw new Exception(message);
+				}
+			}
+			// ClosedLoop_Fault Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.ClosedLoop_Fault)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						if(validateNONASCIICharactersAndAllowSpaces(policyParameters.getConfigBody())){
+							json = stringToJsonObject(policyParameters.getConfigBody());
+						} else {
+							String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "The ClosedLoop JSON Contains Non ASCII Characters.";
+							logger.error(message);
+							response.setResponseMessage(message);
+							return response;
+						}
+						
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						response.setResponseMessage(message);
+						return response;
+					}
+					//call ClosedLoop_Fault Create API here
+					response.setResponseMessage(createUpdateClosedLoopPolicy(plainName, json, policyParameters.getPolicyDescription(),
+													scope, true, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			// ClosedLoop_PM Policy
+			else if(policyParameters.getPolicyConfigType().equals(PolicyConfigType.ClosedLoop_PM)){
+				if(policyParameters.getConfigBody()!=null){
+					JsonObject json = null;
+					try{
+						if(validateNONASCIICharactersAndAllowSpaces(policyParameters.getConfigBody())){
+							json = stringToJsonObject(policyParameters.getConfigBody());
+						} else {
+							String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "The ClosedLoop PM JSON Contains Non ASCII Characters.";
+							logger.error(message);
+							response.setResponseMessage(message);
+							return response;
+						}
+						
+					}catch(Exception e){
+						String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + policyParameters.getConfigBody();
+						logger.error(message);
+						response.setResponseMessage(message);
+						return response;
+					}
+					//call ClosedLoop_Fault Create API here
+					response.setResponseMessage(createUpdateClosedLoopPmPolicy(plainName, json, policyParameters.getPolicyDescription(),
+													scope, true, policyParameters.getRequestID(),policyParameters.getRiskLevel(), policyParameters.getRiskType(), 
+													String.valueOf(policyParameters.getGuard()), date));
+					
+				}else{
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " No Config Body Present";
+					logger.error(message);
+					response.setResponseMessage(message);
+				}
+			}
+			
+		}else{
+			
+			if(policyParameters.getPolicyClass().equals(PolicyClass.Action)){
+				// call Action Update API here. 
+				response.setResponseMessage(createUpdateActionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getAttributes().get(AttributeType.MATCHING), 
+						policyParameters.getDynamicRuleAlgorithmLabels(), policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+						policyParameters.getActionPerformer(), policyParameters.getActionAttribute(), scope, true, policyParameters.getRequestID()));
+			
+			}else if(policyParameters.getPolicyClass().equals(PolicyClass.Decision)){
+				// Call Decision Create API here. 
+				if (policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) {
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							policyParameters.getAttributes().get(AttributeType.MATCHING), policyParameters.getAttributes().get(AttributeType.SETTINGS), policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, true, policyParameters.getRequestID()));
+				}else if(policyParameters.getAttributes()!=null && !policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							null, policyParameters.getAttributes().get(AttributeType.SETTINGS), policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, true, policyParameters.getRequestID()));
+				}else if(policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							policyParameters.getAttributes().get(AttributeType.MATCHING), null, policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, true, policyParameters.getRequestID()));
+				}else{
+					response.setResponseMessage(createUpdateDecisionPolicy(plainName, policyParameters.getPolicyDescription(), policyParameters.getEcompName(), policyParameters.getRuleProvider(),
+							null, null, policyParameters.getDynamicRuleAlgorithmLabels(), 
+							policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField2(), 
+							scope, true, policyParameters.getRequestID()));
+				}
+			}
+		}
+		response.setResponseCode(responseCode);
+		return response;
+	}
+	
+	public DecisionResponse policyDecide(String eCOMPComponentName,
+			Map<String, String> decisionAttributes, UUID requestID, String userID, String passcode)
+			throws PolicyDecisionException {
+		String resource= "getDecision";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyDecisionException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		DecisionResponse policyDecision;
+		if (eCOMPComponentName == null || eCOMPComponentName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given : " + eCOMPComponentName);
+			throw new PolicyDecisionException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given.");
+		}
+		if (decisionAttributes != null && !decisionAttributes.isEmpty()) {
+			JsonArrayBuilder resourceArray = Json.createArrayBuilder();
+			for (String key : decisionAttributes.keySet()) {
+				if (key.isEmpty()) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an Empty Key");
+					throw new PolicyDecisionException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an empty Key");
+				}
+				JsonObjectBuilder resourceBuilder = Json.createObjectBuilder();
+				if (decisionAttributes.get(key).matches("[0-9]+")) {
+					int val = Integer.parseInt(decisionAttributes.get(key));
+					resourceBuilder.add("Value", val);
+				} else {
+					resourceBuilder.add("Value", decisionAttributes.get(key));
+				}
+				resourceBuilder.add("AttributeId", key);
+				resourceArray.add(resourceBuilder);
+			}
+			JsonObject model = Json
+					.createObjectBuilder()
+					.add("Request",
+							Json.createObjectBuilder()
+									.add("AccessSubject",
+											Json.createObjectBuilder()
+													.add("Attribute",
+															Json.createObjectBuilder()
+																	.add("Value",
+																			eCOMPComponentName)
+																	.add("AttributeId",
+																			"ECOMPName")))
+									.add("Resource",
+											Json.createObjectBuilder().add(
+													"Attribute", resourceArray))
+									.add("Action",
+											Json.createObjectBuilder()
+													.add("Attribute",
+															Json.createObjectBuilder()
+																	.add("Value",
+																			"DECIDE")
+																	.add("AttributeId",
+																			"urn:oasis:names:tc:xacml:1.0:action:action-id"))))
+					.build();
+			try {
+				decide = true;
+				policyDecision = decisionResult(generateRequest(model
+						.toString(), requestID));
+			} catch (Exception e) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+				decide = false;
+				throw new PolicyDecisionException(e);
+			}
+		} else {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Decision Attributes Given. ");
+			throw new PolicyDecisionException(XACMLErrorConstants.ERROR_DATA_ISSUE +"No DecisionAttributes Given.");
+		}
+		decide = false;
+		return policyDecision;
+	}
+
+	public Collection<PolicyConfig> configPolicyName(String policyName, UUID requestID, String userID, String passcode)
+			throws PolicyConfigException {
+		String resource= "getConfigByPolicyName";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		if (policyName == null || policyName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Policy FileName specified!! : " + policyName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE+"No Policy FileName specified!!");
+		}
+		if(policyName!= null && !policyName.trim().equals("") && !policyName.endsWith("xml")){
+			policyName = policyName + ".[\\d].*";
+		}
+		JsonObject model = Json
+				.createObjectBuilder()
+				.add("Request",
+						Json.createObjectBuilder()
+								.add("AccessSubject",
+										Json.createObjectBuilder().add(
+												"Attribute",
+												Json.createObjectBuilder()
+														.add("Value",
+																policyName)
+														.add("AttributeId",
+																"PolicyName")))
+								.add("Action",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"ACCESS")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+								.add("Resource",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"Config")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:resource:resource-id"))))
+				.build();
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), requestID));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+		return policyConfig;
+	}
+
+	public Collection<PolicyConfig> config(String eCOMPComponentName, UUID requestID, String userID, String passcode)
+			throws PolicyConfigException {
+		String resource= "getConfig";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		if (eCOMPComponentName == null || eCOMPComponentName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given : " + eCOMPComponentName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given.");
+		}
+		JsonObject model = Json
+				.createObjectBuilder()
+				.add("Request",
+						Json.createObjectBuilder()
+								.add("AccessSubject",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		eCOMPComponentName)
+																.add("AttributeId",
+																		"ECOMPName")))
+								.add("Action",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"ACCESS")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+								.add("Resource",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"Config")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:resource:resource-id"))))
+				.build();
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), requestID));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+		return policyConfig;
+	}
+
+	public Collection<PolicyConfig> config(String eCOMPComponentName,
+			String configName, UUID requestID, String userID, String passcode) throws PolicyConfigException {
+		String resource= "getConfig";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		if (eCOMPComponentName == null || eCOMPComponentName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given : " + eCOMPComponentName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given.");
+		}
+		if (configName == null || configName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given : " + configName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +"No configName given.");
+		}
+		JsonObject model = Json
+				.createObjectBuilder()
+				.add("Request",
+						Json.createObjectBuilder()
+								.add("AccessSubject",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createArrayBuilder()
+																.add(Json
+																		.createObjectBuilder()
+																		.add("Value",
+																				eCOMPComponentName)
+																		.add("AttributeId",
+																				"ECOMPName"))
+																.add(Json
+																		.createObjectBuilder()
+																		.add("Value",
+																				configName)
+																		.add("AttributeId",
+																				"ConfigName"))))
+								.add("Action",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"ACCESS")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+								.add("Resource",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"Config")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:resource:resource-id"))))
+				.build();
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), requestID));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+
+		return policyConfig;
+	}
+
+	public Collection<PolicyConfig> config(String eCOMPComponentName,
+			String configName, Map<String, String> configAttributes, UUID requestID, String userID, String passcode)
+			throws PolicyConfigException {
+		String resource= "getConfig";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		if (eCOMPComponentName == null || eCOMPComponentName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given : " + eCOMPComponentName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given.");
+		}
+		if (configName == null || configName.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given : " + configName);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +"No configName given.");
+		}
+		if (configAttributes != null && !configAttributes.isEmpty()) {
+			if(!configAttributes.containsKey("RiskType")){
+				configAttributes.put("RiskType", ".*");
+			}
+			if(!configAttributes.containsKey("RiskLevel")){
+				configAttributes.put("RiskLevel", ".*");
+			}
+			if(!configAttributes.containsKey("guard")){
+				configAttributes.put("guard", ".*");
+			}
+			if(!configAttributes.containsKey("TTLDate")){
+				configAttributes.put("TTLDate", ".*");
+			}
+		}else{
+			// ConfigAttributes is Null. So add basic values. 
+			configAttributes = new HashMap<String,String>();
+			configAttributes.put("RiskType", ".*");
+			configAttributes.put("RiskLevel", ".*");
+			configAttributes.put("guard", ".*");
+			configAttributes.put("TTLDate", ".*");
+		}
+		JsonArrayBuilder resourceArray = Json.createArrayBuilder();
+		for (String key : configAttributes.keySet()) {
+			if (key.isEmpty()) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an empty Key");
+				throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +"Cannot have an empty Key");
+			}
+			JsonObjectBuilder resourceBuilder = Json.createObjectBuilder();
+			/*if (configAttributes.get(key).matches("[0-9]+")) {
+				int val = Integer.parseInt(configAttributes.get(key));
+				resourceBuilder.add("Value", val);
+			} else {*/
+			resourceBuilder.add("Value", configAttributes.get(key));
+			resourceBuilder.add("AttributeId", key);
+			resourceArray.add(resourceBuilder);
+		}
+		JsonObject model = Json
+			.createObjectBuilder()
+			.add("Request",
+					Json.createObjectBuilder()						
+							.add("AccessSubject",
+									Json.createObjectBuilder()
+												.add("Attribute",
+													Json.createArrayBuilder()
+															.add(Json
+																	.createObjectBuilder()
+																	.add("Value",
+																			eCOMPComponentName)
+																	.add("AttributeId",
+																			"ECOMPName"))
+															.add(Json
+																	.createObjectBuilder()
+																	.add("Value",
+																			configName)
+																	.add("AttributeId",
+																			"ConfigName"))))
+							.add("Action",
+									Json.createObjectBuilder()
+												.add("Attribute",
+													Json.createObjectBuilder()
+															.add("Value",
+																		"ACCESS")
+															.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+							.add("Resource",
+									Json.createObjectBuilder()
+												.add("Attribute",
+														resourceArray
+																.add(Json.createObjectBuilder()
+																		.add("Value",
+																				"Config")
+																		.add("AttributeId",
+																				"urn:oasis:names:tc:xacml:1.0:resource:resource-id")))))
+				.build();
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), requestID));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+		return policyConfig;
+	}
+	
+	public Collection<PolicyConfig> configRequest(ConfigRequestParameters configRequestParameters, String userID, String passcode) throws PolicyConfigException{
+		String resource= "getConfig";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		unique = false;
+		if(configRequestParameters==null){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No config Request Parameters given ");
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No config Request Parameters given.");
+		}
+		if(configRequestParameters.getEcompName() == null && configRequestParameters.getPolicyName() == null){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot proceed without eCOMPComponentName or PolicyName");
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName or PolicyName given.");
+		}
+		String policyName = configRequestParameters.getPolicyName();
+		if(policyName!= null && !policyName.trim().equals("") && !policyName.endsWith("xml")){
+			policyName = policyName + ".[\\d].*";
+		}
+		JsonArrayBuilder subjectArray = Json.createArrayBuilder();
+		JsonArrayBuilder resourceArray = Json.createArrayBuilder();
+		if(configRequestParameters.getPolicyName()!=null){
+			JsonObjectBuilder subjectBuilder = Json.createObjectBuilder();
+			subjectBuilder.add("Value", policyName);
+			subjectBuilder.add("AttributeId", "PolicyName");
+			subjectArray.add(subjectBuilder);
+		}else{
+			logger.info("PolicyName values are not given. ");
+		}
+		if(configRequestParameters.getEcompName()!=null){
+			JsonObjectBuilder subjectBuilder = Json.createObjectBuilder();
+			subjectBuilder.add("Value", configRequestParameters.getEcompName());
+			subjectBuilder.add("AttributeId", "ECOMPName");
+			subjectArray.add(subjectBuilder);
+			if(configRequestParameters.getConfigName()!=null){
+				subjectBuilder = Json.createObjectBuilder();
+				subjectBuilder.add("Value", configRequestParameters.getConfigName());
+				subjectBuilder.add("AttributeId", "ConfigName");
+				subjectArray.add(subjectBuilder);
+				Map<String,String> configAttributes = configRequestParameters.getConfigAttributes();
+				if (configAttributes != null && !configAttributes.isEmpty()) {
+					if(!configAttributes.containsKey("RiskType")){
+						configAttributes.put("RiskType", ".*");
+					}
+					if(!configAttributes.containsKey("RiskLevel")){
+						configAttributes.put("RiskLevel", ".*");
+					}
+					if(!configAttributes.containsKey("guard")){
+						configAttributes.put("guard", ".*");
+					}
+					if(!configAttributes.containsKey("TTLDate")){
+						configAttributes.put("TTLDate", ".*");
+					}
+				}else{
+					// ConfigAttributes is Null. So add basic values. 
+					configAttributes = new HashMap<String,String>();
+					configAttributes.put("RiskType", ".*");
+					configAttributes.put("RiskLevel", ".*");
+					configAttributes.put("guard", ".*");
+					configAttributes.put("TTLDate", ".*");
+				}
+				for (String key : configAttributes.keySet()) {
+					if (key.isEmpty()) {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an empty Key");
+						throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +"Cannot have an empty Key");
+					}
+					JsonObjectBuilder resourceBuilder = Json.createObjectBuilder();
+					/*if (configAttributes.get(key).matches("[0-9]+")) {
+						int val = Integer.parseInt(configAttributes.get(key));
+						resourceBuilder.add("Value", val);
+					} else {*/
+					resourceBuilder.add("Value", configAttributes.get(key));
+					resourceBuilder.add("AttributeId", key);
+					resourceArray.add(resourceBuilder);
+				}
+			}else{
+				logger.info("Config Name is not given. ");
+			}
+		}else{
+			logger.info("Ecomp Name is not given. ");
+		}
+		JsonObject model = Json
+				.createObjectBuilder()
+				.add("Request",
+						Json.createObjectBuilder()
+								.add("AccessSubject",
+										Json.createObjectBuilder()
+												.add("Attribute",subjectArray))
+								.add("Action",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"ACCESS")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+								.add("Resource",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														resourceArray
+																.add(Json
+																		.createObjectBuilder()
+																		.add("Value",
+																				"Config")
+																		.add("AttributeId",
+																				"urn:oasis:names:tc:xacml:1.0:resource:resource-id")))))
+				.build();
+		logger.debug("Generated JSON Request is: " + model.toString());
+		if(configRequestParameters.getUnique()){
+			logger.info("Requested for Unique Result only. ");
+			unique = true;
+		}
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), configRequestParameters.getRequestID()));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+		return policyConfig;
+	}
+	
+	public Collection<String> listConfigRequest(ConfigRequestParameters listRequestParameters, String userID, String passcode) throws PolicyConfigException{
+		String resource= "listConfig";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyConfig> policyConfig = null;
+		Collection<String> policyList = new ArrayList<String>();
+		
+		unique = false;
+		if(listRequestParameters==null){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Request Parameters given ");
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Request Parameters given.");
+		}
+		
+		if (junit){
+			policyList.add("Policy Name: listConfigTest");
+			return policyList;
+		}
+
+		String policyName = listRequestParameters.getPolicyName();
+		if(policyName!= null && !policyName.trim().equals("") && !policyName.endsWith("xml")){
+			policyName = policyName + ".[\\d].*";
+		}
+		JsonArrayBuilder subjectArray = Json.createArrayBuilder();
+		JsonArrayBuilder resourceArray = Json.createArrayBuilder();
+		if(listRequestParameters.getPolicyName()!=null){
+			JsonObjectBuilder subjectBuilder = Json.createObjectBuilder();
+			subjectBuilder.add("Value", policyName);
+			subjectBuilder.add("AttributeId", "PolicyName");
+			subjectArray.add(subjectBuilder);
+		}else{
+			logger.info("PolicyName values are not given. ");
+		}
+		if(listRequestParameters.getEcompName()!=null){
+			JsonObjectBuilder subjectBuilder = Json.createObjectBuilder();
+			subjectBuilder.add("Value", listRequestParameters.getEcompName());
+			subjectBuilder.add("AttributeId", "ECOMPName");
+			subjectArray.add(subjectBuilder);
+			if(listRequestParameters.getConfigName()!=null){
+				subjectBuilder = Json.createObjectBuilder();
+				subjectBuilder.add("Value", listRequestParameters.getConfigName());
+				subjectBuilder.add("AttributeId", "ConfigName");
+				subjectArray.add(subjectBuilder);
+				Map<String,String> configAttributes = listRequestParameters.getConfigAttributes();
+				if (configAttributes != null && !configAttributes.isEmpty()) {
+					if(!configAttributes.containsKey("RiskType")){
+						configAttributes.put("RiskType", ".*");
+					}
+					if(!configAttributes.containsKey("RiskLevel")){
+						configAttributes.put("RiskLevel", ".*");
+					}
+					if(!configAttributes.containsKey("guard")){
+						configAttributes.put("guard", ".*");
+					}
+					if(!configAttributes.containsKey("TTLDate")){
+						configAttributes.put("TTLDate", ".*");
+					}
+				}else{
+					// ConfigAttributes is Null. So add basic values. 
+					configAttributes = new HashMap<String,String>();
+					configAttributes.put("RiskType", ".*");
+					configAttributes.put("RiskLevel", ".*");
+					configAttributes.put("guard", ".*");
+					configAttributes.put("TTLDate", ".*");
+				}
+				for (String key : configAttributes.keySet()) {
+					if (key.isEmpty()) {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an empty Key");
+						throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +"Cannot have an empty Key");
+					}
+					JsonObjectBuilder resourceBuilder = Json.createObjectBuilder();
+					/*if (configAttributes.get(key).matches("[0-9]+")) {
+						int val = Integer.parseInt(configAttributes.get(key));
+						resourceBuilder.add("Value", val);
+					} else {*/
+					resourceBuilder.add("Value", configAttributes.get(key));
+					resourceBuilder.add("AttributeId", key);
+					resourceArray.add(resourceBuilder);
+				}
+			}else{
+				logger.info("Config Name is not given. ");
+			}
+		}else{
+			logger.info("Ecomp Name is not given. ");
+		}
+		JsonObject model = Json
+				.createObjectBuilder()
+				.add("Request",
+						Json.createObjectBuilder()
+								.add("AccessSubject",
+										Json.createObjectBuilder()
+												.add("Attribute",subjectArray))
+								.add("Action",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														Json.createObjectBuilder()
+																.add("Value",
+																		"ACCESS")
+																.add("AttributeId",
+																		"urn:oasis:names:tc:xacml:1.0:action:action-id")))
+								.add("Resource",
+										Json.createObjectBuilder()
+												.add("Attribute",
+														resourceArray
+																.add(Json
+																		.createObjectBuilder()
+																		.add("Value",
+																				"Config")
+																		.add("AttributeId",
+																				"urn:oasis:names:tc:xacml:1.0:resource:resource-id")))))
+				.build();
+		logger.debug("Generated JSON Request is: " + model.toString());
+		if(listRequestParameters.getUnique()){
+			logger.info("Requested for Unique Result only. ");
+			unique = true;
+		}
+		try {
+			policyConfig = configResult(generateRequest(model.toString(), listRequestParameters.getRequestID()));
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new PolicyConfigException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+		}
+		for(PolicyConfig policy : policyConfig){
+			if(policy.getPolicyConfigMessage()!=null && policy.getPolicyConfigMessage().contains("PE300")){
+				policyList.add(policy.getPolicyConfigMessage());
+			} else {
+				policyList.add("Policy Name: " + policy.getPolicyName());
+			}
+		}
+		return policyList;
+	}
+	
+
+
+	public Collection<PolicyResponse> event(Map<String, String> eventAttributes, UUID requestID, String userID, String passcode)
+			throws PolicyEventException {
+		String resource= "sendEvent";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			throw new PolicyEventException(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		Collection<PolicyResponse> policyResponse = null;
+		if (eventAttributes != null && !eventAttributes.isEmpty()) {
+			JsonArrayBuilder resourceArray = Json.createArrayBuilder();
+			for (String key : eventAttributes.keySet()) {
+				if (key.isEmpty()) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot have an Empty Key");
+					throw new PolicyEventException(XACMLErrorConstants.ERROR_DATA_ISSUE +"Cannot have an empty Key");
+				}
+				JsonObjectBuilder resourceBuilder = Json.createObjectBuilder();
+				if (eventAttributes.get(key).matches("[0-9]+")) {
+					int val = Integer.parseInt(eventAttributes.get(key));
+					resourceBuilder.add("Value", val);
+				} else {
+					resourceBuilder.add("Value", eventAttributes.get(key));
+				}
+				resourceBuilder.add("AttributeId", key);
+				resourceArray.add(resourceBuilder);
+			}
+			JsonObject model = Json
+					.createObjectBuilder()
+					.add("Request",
+							Json.createObjectBuilder().add(
+									"Resource",
+									Json.createObjectBuilder().add("Attribute",
+											resourceArray))).build();
+			// Removed Part can be Useful in Future.
+			/*
+			 * .add("AccessSubject",Json.createObjectBuilder() .add("Attribute",
+			 * subjectArray)) .add("Action", Json.createObjectBuilder()
+			 * .add("Attribute", actionArray))
+			 */
+			// System.out.println(model.toString());
+			try {
+				// StdPolicyResponse stdPolicyResponse =
+				// generateRequest(model.toString());
+				// stdPolicyResponse.setRequestAttributes(eventAttributes);
+				policyResponse = eventResult(generateRequest(model.toString(), requestID),
+						eventAttributes);
+			} catch (Exception e) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+				throw new PolicyEventException(XACMLErrorConstants.ERROR_DATA_ISSUE +e);
+			}
+		} else {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No event Attributes Given. ");
+			throw new PolicyEventException(XACMLErrorConstants.ERROR_DATA_ISSUE +"No EventAttributes Given.");
+		}
+		return policyResponse;
+	}
+
+	private Collection<StdStatus> generateRequest(String Json, UUID requestID) throws Exception {
+		Collection<StdStatus> results = null;
+		
+		Response response = null;
+		// Create Request. We need XACML API here.
+		try {
+			Request request = JSONRequest.load(Json);
+			String jRequest = JSONRequest.toString(request);
+				
+			// Call the PDP
+			logger.debug("--- Generating Request: ---\n" + jRequest );
+			response = callPDP(new ByteArrayInputStream(jRequest.getBytes()), requestID);
+
+		} catch (Exception e) {
+			logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + e);
+			StdStatus stdStatus = new StdStatus();
+			results = new HashSet<StdStatus>();
+			stdStatus.setStatus("Unable to Call PDP. Error with the URL",
+					PolicyResponseStatus.NO_ACTION_REQUIRED,
+					PolicyConfigStatus.CONFIG_NOT_FOUND);
+			results.add(stdStatus);
+			throw new Exception(e);
+		}
+
+		if(this.UEBThread){
+			this.UEBThread = registerUEBThread.isAlive();
+		}
+		if (response != null) {
+			results = checkResponse(response);
+			// TODO Starting Auto Client Here.
+			if (notificationType.get(0).equals("ueb") && !this.UEBThread){
+				this.UEBClientThread = new AutoClientUEB(pdps.get(0), uebURLList); 
+				this.registerUEBThread = new Thread(this.UEBClientThread);
+				this.registerUEBThread.start();
+				this.UEBThread = true;
+				
+			}else {
+				if(AutoClientEnd.getURL()==null){
+					AutoClientEnd.start(pdps.get(0));
+				}else if(AutoClientEnd.getURL()!=pdps.get(0)){
+					AutoClientEnd.stop();
+					AutoClientEnd.start(pdps.get(0));
+				}
+			}
+		} else {
+			logger.debug("No Response Received from PDP");
+			StdStatus stdStatus = new StdStatus();
+			results = new HashSet<StdStatus>();
+			stdStatus.setStatus("No Response Received",
+					PolicyResponseStatus.NO_ACTION_REQUIRED,
+					PolicyConfigStatus.CONFIG_NOT_FOUND);
+			results.add(stdStatus);
+		}
+
+		return results;
+	}
+	
+	private Response callPDP(ByteArrayInputStream input, UUID requestID) throws Exception {
+		Response response = null;
+		HttpURLConnection connection = null;
+		responseCode = 0;
+		// Checking for the available PDPs is done during the first Request and
+		// the List is going to have the connected PDP as first element.
+		// This makes it Real-Time to change the list depending on their
+		// availability.
+		if (pdps == null || pdps.isEmpty()) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDPs List is Empty.");
+			throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PDPs List is empty.");
+		} else {
+			int pdpsCount = 0;
+			boolean connected = false;
+			while (pdpsCount < pdps.size()) {
+				input.reset();
+				try {
+					String urlValue = pdps.get(0);
+					URL url = new URL(urlValue);
+					logger.debug("--- Sending Request to PDP : "+ url.toString() + " ---");
+					connection = (HttpURLConnection) url.openConnection();
+					// Setting Content-Type
+					connection.setRequestProperty("Content-Type","application/json");
+					// Adding Authorization
+					connection.setRequestProperty("Authorization", "Basic "	+ encoding.get(0));
+					// Adding Environment. 
+					connection.setRequestProperty("Environment", environment);
+					// Adding RequestID
+					if (requestID == null) {
+						requestID = UUID.randomUUID();
+						logger.info("No request ID provided, sending generated ID: " + requestID.toString());
+					} else {
+						logger.info("Using provided request ID: " + requestID.toString());
+					}
+					connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
+					// Setting up connection method and headers.
+					connection.setRequestMethod("POST");
+					connection.setUseCaches(false);
+					connection.setInstanceFollowRedirects(false);
+					connection.setDoOutput(true);
+					connection.setDoInput(true);
+					OutputStream os = connection.getOutputStream();
+					IOUtils.copy(input, os);
+					
+					
+					connection.connect();
+					responseCode = connection.getResponseCode();
+					// If Connected to a PDP Then break from the loop and
+					// continue with the Request.
+					if (connection.getResponseCode() == 200 || junit) {
+						connected = true;
+						break;
+					} else {
+						logger.debug(XACMLErrorConstants.ERROR_PERMISSIONS+ "PDP Response Code : "	+ connection.getResponseCode());
+						Collections.rotate(pdps, -1);
+						Collections.rotate(encoding, -1);
+					}
+				} catch (Exception e) {
+					// This means that the PDP is not working and needs to
+					// Re-Order our List and Connect to the next one.
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PDP connection Error : " + e);
+					Collections.rotate(pdps, -1);
+					Collections.rotate(encoding, -1);
+				}
+				pdpsCount++;
+			}
+			if (connected) {
+				// Read the Response
+				// System.out.println("connected to PDP : " + pdps.get(0));
+				logger.debug("connected to PDP : " + pdps.get(0));
+				logger.debug("--- Response:  ---");
+				Map<String,List<String>> headers = connection.getHeaderFields();
+				for(String key : headers.keySet()){
+					logger.debug("Header : " + key + "   Value: " + headers.get(key));
+				}
+				try {
+					if (connection.getResponseCode() == 200 || junit) {
+						// Read the Response
+						ContentType contentType = null;
+						try {
+							contentType = ContentType.parse(connection
+									.getContentType());
+							if (contentType.getMimeType().equalsIgnoreCase(
+									ContentType.APPLICATION_JSON.getMimeType())) {
+								if(junit){
+									response = JSONResponse.load(getJsonResponseString());
+								} else {
+									response = JSONResponse.load(connection.getInputStream());
+								}
+								logger.debug(response + "\n---");
+							} else {
+								logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Unknown Content-Type: "
+										+ contentType);
+								throw new Exception(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Unknown Content-Type: "
+										+ contentType);
+							}
+						} catch (Exception e) {
+							String message = XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Parsing Content-Type: "
+									+ connection.getContentType() + ", error="
+									+ e;
+							logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + e);
+							throw new Exception(message, e);
+						}
+					} else {
+						throw new Exception(XACMLErrorConstants.ERROR_PERMISSIONS+ "ERROR response code of the URL " + pdps.get(0) + " is "
+								+ connection.getResponseCode());
+					}
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+					throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"Error in Connecting to the  PDP ", e);
+				}
+				return response;
+			} else {
+				if(junit){
+					response = JSONResponse.load(getJsonResponseString());
+					return response;
+				}
+				throw new Exception(XACMLErrorConstants.ERROR_PERMISSIONS+ "Unable to get valid Response from  PDP(s) " + pdps);
+			}
+		}
+	}
+	
+	private Collection<StdStatus> checkResponse(Response response)
+			throws Exception {
+
+		String pdpConfigURL = null;
+
+		Collection<StdStatus> combinedResult = new HashSet<StdStatus>();
+		int priority = defaultPriority;
+		Map<Integer, StdStatus> uniqueResult = new HashMap<Integer, StdStatus>();
+		for (Result result : response.getResults()) {
+			if (!result.getDecision().equals(Decision.PERMIT)) {
+				logger.debug("Decision not a Permit. "	+ result.getDecision().toString());
+				StdStatus stdStatus = new StdStatus();
+				if (decide) {
+					stdStatus.setDecision(PolicyDecision.DENY);
+					for(Advice advice: result.getAssociatedAdvice()){
+						for(AttributeAssignment attribute: advice.getAttributeAssignments()){
+							stdStatus.setDetails(attribute.getAttributeValue().getValue().toString());
+							break;
+						}
+					}
+					combinedResult.add(stdStatus);
+					return combinedResult;
+				}
+				stdStatus.setStatus(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Params passed: Decision not a Permit.",PolicyResponseStatus.NO_ACTION_REQUIRED,PolicyConfigStatus.CONFIG_NOT_FOUND);
+				combinedResult.add(stdStatus);
+				return combinedResult;
+			} else {
+				if (decide) {
+					// check for Decision for decision based calls.
+					StdStatus stdStatus = new StdStatus();
+					stdStatus.setDecision(PolicyDecision.PERMIT);
+					stdStatus.setDetails("Decision Permit. OK!");
+					combinedResult.add(stdStatus);
+					return combinedResult;
+				}
+				if (!result.getAssociatedAdvice().isEmpty()) {
+					// @ TODO Add advice actions
+					// Configurations should be in advice. + Also PDP took
+					// actions could be here.
+					for (Advice advice : result.getAssociatedAdvice()) {
+						int config = 0, uri = 0;
+						String configURL = null;
+						String policyName = null;
+						String policyVersion = null;
+						Map<String, String> matchingConditions = new HashMap<String, String>();
+						match = new Matches();
+						Map<String, String> configAttributes = new HashMap<String, String>();
+						Map<String, String> responseAttributes = new HashMap<String,String>();
+						Map<String, String> actionTaken = new HashMap<String, String>();
+						StdStatus stdStatus = new StdStatus();
+						Map<String, String> adviseAttributes = new HashMap<String, String>();
+						for (AttributeAssignment attribute : advice.getAttributeAssignments()) {
+							adviseAttributes.put(attribute.getAttributeId().stringValue(), attribute.getAttributeValue().getValue().toString());
+							if (attribute.getAttributeValue().getValue().toString().equalsIgnoreCase("CONFIGURATION")) {
+								config++;
+							} else if (attribute.getDataTypeId().stringValue().endsWith("anyURI")) {
+								uri++;
+								if (uri == 1) {
+									configURL = attribute.getAttributeValue().getValue().toString();
+									String currentUsedPDP = pdps.get(0);
+									int pos = (pdps.get(0)).lastIndexOf("/");
+									String configURLPath = currentUsedPDP.substring(0, pos);
+									int pos1 = configURLPath.lastIndexOf("/");
+									String pdpConfigURLPath = configURLPath.substring(0, pos1 + 1);
+									pdpConfigURL = configURL.replace("$URL", pdpConfigURLPath);
+								} else {
+									if (!(attribute.getIssuer().equalsIgnoreCase("PDP"))) {
+										throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error having multiple URI in the Policy");
+									}
+								}
+							} else if (attribute.getAttributeId().stringValue()
+									.equalsIgnoreCase("PolicyName")) {
+								policyName = attribute.getAttributeValue()
+										.getValue().toString();
+							} else if (attribute.getAttributeId().stringValue()
+									.equalsIgnoreCase("VersionNumber")) {
+								policyVersion = attribute.getAttributeValue()
+										.getValue().toString();
+							} else if (attribute.getAttributeId().stringValue().equalsIgnoreCase("Priority")){
+								try{
+									priority = Integer.parseInt(attribute.getAttributeValue().getValue().toString());
+								} catch(Exception e){
+									logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+ "Unable to Parse Integer for Priority. Setting to default value");
+									priority = defaultPriority;
+								}
+							} else if (attribute.getAttributeId().stringValue()
+									.startsWith("matching")) {
+								matchingConditions.put(attribute
+										.getAttributeId().stringValue()
+										.replaceFirst("(matching).", ""),
+										attribute.getAttributeValue()
+												.getValue().toString());
+								if (attribute.getAttributeId().stringValue()
+										.replaceFirst("(matching).", "")
+										.equals("ECOMPName")) {
+									match.setEcompName(attribute
+											.getAttributeValue().getValue()
+											.toString());
+								} else if (attribute.getAttributeId()
+										.stringValue()
+										.replaceFirst("(matching).", "")
+										.equals("ConfigName")) {
+									match.setConfigName(attribute
+											.getAttributeValue().getValue()
+											.toString());
+								} else {
+									configAttributes.put(attribute
+											.getAttributeId().stringValue()
+											.replaceFirst("(matching).", ""),
+											attribute.getAttributeValue()
+													.getValue().toString());
+								}
+							} else if (attribute.getAttributeId().stringValue().startsWith("key:")) {
+								responseAttributes.put(attribute
+										.getAttributeId().stringValue()
+										.replaceFirst("(key).", ""),
+										attribute.getAttributeValue()
+												.getValue().toString());
+							}
+						}
+						if (!configAttributes.isEmpty()) {
+							match.setConfigAttributes(configAttributes);
+						}
+						if ((config == 1) && (uri == 1)) {
+							// If there is a configuration.
+							try {
+								logger.debug("Configuration Call to : "
+										+ configURL);
+								stdStatus = ConfigCall(pdpConfigURL);
+							} catch (Exception e) {
+								logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+ e);
+								stdStatus
+										.setStatus(
+												"Error in Calling the Configuration URL "
+														+ e,
+												PolicyResponseStatus.NO_ACTION_REQUIRED,
+												PolicyConfigStatus.CONFIG_NOT_FOUND);
+							}
+							stdStatus.setPolicyName(policyName);
+							stdStatus.setPolicyVersion(policyVersion);
+							stdStatus.setMatchingConditions(matchingConditions);
+							stdStatus.setResposneAttributes(responseAttributes);
+							if(!unique){
+								combinedResult.add(stdStatus);
+							}else{
+								if(!uniqueResult.isEmpty()){
+									if(uniqueResult.containsKey(priority)){
+										// Not any more unique, check the matching conditions size
+										int oldSize = uniqueResult.get(priority).getMatchingConditions().size();
+										int newSize = matchingConditions.size();
+										if(oldSize < newSize){
+											uniqueResult.put(priority, stdStatus);
+										}else if(oldSize == newSize){
+											stdStatus = new StdStatus();
+											stdStatus.setStatus("Two/more Policies have Same Priority and matching conditions, Please correct your policies.", PolicyResponseStatus.NO_ACTION_REQUIRED,
+													PolicyConfigStatus.CONFIG_NOT_FOUND);
+											combinedResult.add(stdStatus);
+											unique = false;
+											return combinedResult;
+										}
+									}else{
+										uniqueResult.put(priority, stdStatus);
+									}
+								}else{
+									uniqueResult.put(priority, stdStatus);
+								}
+							}
+						} else {
+							// Else it is Action Taken.
+							logger.info("Action Taken by PDP. ");
+							actionTaken.putAll(adviseAttributes);
+							stdStatus.setActionTaken(actionTaken);
+							stdStatus.setPolicyResponseStatus(
+									"Action Taken by the PDP",
+									PolicyResponseStatus.ACTION_TAKEN);
+							combinedResult.add(stdStatus);
+						}
+					}
+				}
+				if (!result.getObligations().isEmpty()) {
+					// @ TODO add Obligation actions
+					// Action advised should be in obligations.
+					for (Obligation obligation : result.getObligations()) {
+						Map<String, String> actionAdvised = new HashMap<String, String>();
+						StdStatus stdStatus = new StdStatus();
+						for (AttributeAssignment attribute : obligation
+								.getAttributeAssignments()) {
+							actionAdvised.put(attribute.getAttributeId()
+									.stringValue(), attribute
+									.getAttributeValue().getValue().toString());
+						}
+						stdStatus.setActionAdvised(actionAdvised);
+						stdStatus.setPolicyResponseStatus(
+								"Action has been Advised ",
+								PolicyResponseStatus.ACTION_ADVISED);
+						combinedResult.add(stdStatus);
+					}
+				}
+			}
+		}
+		if(unique){
+			// Select Unique policy. 
+			int minNum = defaultPriority;
+			for(int num: uniqueResult.keySet()){
+				if(num < minNum){
+					minNum = num;
+				}
+			}
+			combinedResult.add(uniqueResult.get(minNum));
+			// Turn off Unique
+			unique = false;
+		}
+		
+		return combinedResult;
+	}
+
+	private StdStatus ConfigCall(String stringURL) throws Exception {
+		StdStatus stdStatus = new StdStatus();
+		try {
+			URL configURL = new URL(stringURL);
+			URLConnection connection = null;
+			try {
+				connection = configURL.openConnection();
+				if (stringURL.endsWith("json")) {
+					stdStatus.setPolicyType(PolicyType.JSON);
+					JsonReader jsonReader = Json.createReader(connection
+							.getInputStream());
+					stdStatus.setJsonObject(jsonReader.readObject());
+					jsonReader.close();
+					logger.info("config Retrieved ");
+					stdStatus.setStatus("Config Retrieved from: " + configURL,
+							PolicyResponseStatus.NO_ACTION_REQUIRED,
+							PolicyConfigStatus.CONFIG_RETRIEVED);
+					try {
+						MatchStore.storeMatch(match);
+					} catch (Exception e) {
+						logger.info("StoreMatch failed for Ecomp:"
+								+ match.getEcompName() + " Config: "
+								+ match.getConfigName());
+					}
+					return stdStatus;
+				} else if (stringURL.endsWith("xml")) {
+					stdStatus.setPolicyType(PolicyType.XML);
+					DocumentBuilderFactory dbf = DocumentBuilderFactory
+							.newInstance();
+					DocumentBuilder db = null;
+					try {
+						db = dbf.newDocumentBuilder();
+						Document config = db.parse(connection.getInputStream());
+						stdStatus.setDocument(config);
+					} catch (ParserConfigurationException e) {
+						logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + e);
+						throw new Exception(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Unable to create Document Object",
+								e);
+					} catch (SAXException e) {
+						logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID+ e);
+						throw new Exception(XACMLErrorConstants.ERROR_SCHEMA_INVALID+ "Unable to parse the XML config", e);
+					}
+					logger.info("config Retrieved ");
+					stdStatus.setStatus("Config Retrieved from: " + configURL,
+							PolicyResponseStatus.NO_ACTION_REQUIRED,
+							PolicyConfigStatus.CONFIG_RETRIEVED);
+					try {
+						MatchStore.storeMatch(match);
+					} catch (Exception e) {
+						logger.info("StoreMatch failed for Ecomp:"
+								+ match.getEcompName() + " Config: "
+								+ match.getConfigName());
+					}
+					return stdStatus;
+				} else if (stringURL.endsWith("properties")) {
+					stdStatus.setPolicyType(PolicyType.PROPERTIES);
+					Properties configProp = new Properties();
+					configProp.load(connection.getInputStream());
+					stdStatus.setProperties(configProp);
+					logger.info("config Retrieved ");
+					stdStatus.setStatus("Config Retrieved from: " + configURL,
+							PolicyResponseStatus.NO_ACTION_REQUIRED,
+							PolicyConfigStatus.CONFIG_RETRIEVED);
+					try {
+						MatchStore.storeMatch(match);
+					} catch (Exception e) {
+						logger.info("StoreMatch failed for Ecomp:"
+								+ match.getEcompName() + " Config: "
+								+ match.getConfigName());
+					}
+					return stdStatus;
+				} else if (stringURL.endsWith("txt")) {
+					stdStatus.setPolicyType(PolicyType.OTHER);
+					InputStream in = connection.getInputStream();
+					String other = IOUtils.toString(in);
+					IOUtils.closeQuietly(in);
+					stdStatus.setOther(other);
+					logger.info("config Retrieved ");
+					stdStatus.setStatus("Config Retrieved from: " + configURL,
+							PolicyResponseStatus.NO_ACTION_REQUIRED,
+							PolicyConfigStatus.CONFIG_RETRIEVED);
+					try {
+						MatchStore.storeMatch(match);
+					} catch (Exception e) {
+						logger.info("StoreMatch failed for Ecomp:"
+								+ match.getEcompName() + " Config: "
+								+ match.getConfigName());
+					}
+					return stdStatus;
+				} else {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Config Not Found");
+					stdStatus
+							.setPolicyConfigStatus(PolicyConfigStatus.CONFIG_NOT_FOUND);
+					stdStatus
+							.setConfigStatus("Illegal form of Configuration Type Found.");
+					return stdStatus;
+				}
+			} catch (IOException e) {
+				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+				throw new Exception(XACMLErrorConstants.ERROR_PROCESS_FLOW +
+						"Cannot open a connection to the configURL", e);
+			}
+		} catch (MalformedURLException e) {
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+			throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error in ConfigURL", e);
+		}
+	}
+
+	private void setProperty(String propertyFilePath)
+			throws PolicyEngineException {
+		this.propertyFilePath = propertyFilePath;
+		if (this.propertyFilePath == null) {
+			// This is only for testing purpose. Or We will add a default PDP
+			// address here.
+			// url_default = "http://localhost:8080/pdp/";
+			// The General Error Message is Below.
+			throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error NO PropertyFile Path provided");
+		} else {
+			// Adding logic for remote Properties file.
+			Properties prop = new Properties();
+			if (propertyFilePath.startsWith("http")) {
+				URL configURL;
+				try {
+					configURL = new URL(propertyFilePath);
+					URLConnection connection = null;
+					connection = configURL.openConnection();
+					prop.load(connection.getInputStream());
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+					throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Maformed property URL "+ e.getMessage());
+				}
+			} else {
+				Path file = Paths.get(propertyFilePath);
+				if (Files.notExists(file)) {
+					throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "File doesn't exist in the specified Path "	+ file.toString());
+				} 
+				if (file.toString().endsWith(".properties")) {
+					InputStream in;
+					prop = new Properties();
+					try {
+						in = new FileInputStream(file.toFile());
+						prop.load(in);
+					} catch (IOException e) {
+						logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+						throw new PolicyEngineException(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Cannot Load the Properties file", e);
+					}
+				} else {
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Not a .properties file " + propertyFilePath);
+					throw new PolicyEngineException(XACMLErrorConstants.ERROR_SYSTEM_ERROR  + "Not a .properties file");
+				}
+			}
+			// UEB Settings
+			String check_type = prop.getProperty("NOTIFICATION_TYPE");
+			String serverList = prop.getProperty("NOTIFICATION_UEB_SERVERS");
+			if(check_type==null) {
+				notificationType.add("websocket");
+				logger.info("Properties file doesn't have the NOTIFICATION_TYPE parameter system will use defualt websockets");	
+			}else{
+				if(check_type.contains(",")) {
+					type_default = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_TYPE").split(",")));
+					notificationType = type_default; 
+				} else {
+						notificationType = new ArrayList<String>();
+						notificationType.add(check_type);
+				}
+			}
+			if(serverList==null) {
+				notificationType.clear();
+				notificationType.add("websocket");
+				logger.info("Properties file doesn't have the NOTIFICATION_UEB_SERVERS parameter system will use defualt websockets");	
+			}else{
+				if(serverList.contains(",")) {
+					uebURLList = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_UEB_SERVERS").split(","))); 
+				} else {
+					uebURLList = new ArrayList<String>();
+					uebURLList.add(serverList);
+				}
+			}
+			// Client ID Authorization Settings. 
+			String clientID = prop.getProperty("CLIENT_ID");
+			String clientKey = prop.getProperty("CLIENT_KEY");
+			userName = clientID;
+			pass = clientKey;
+			pyPDPClientFile = prop.getProperty("CLIENT_FILE");
+			environment = prop.getProperty("ENVIRONMENT", "DEVL");
+			/*try {
+				aafClient = AAFPolicyClient.getInstance(prop);
+			} catch (AAFPolicyException e) {
+				logger.error(XACMLErrorConstants.ERROR_UNKNOWN + e.getMessage());
+				throw new PolicyEngineException(XACMLErrorConstants.ERROR_UNKNOWN + e);
+			}*/
+			// Initializing the values.
+			pdps = new ArrayList<String>();
+			paps = new ArrayList<String>(); 
+			encoding = new ArrayList<String>();
+			encodingPAP = new ArrayList<String>();
+			// Check the Keys for PDP_URLs
+			Collection<Object> unsorted = prop.keySet();
+			@SuppressWarnings({ "rawtypes", "unchecked" })
+			List<String> sorted = new ArrayList(unsorted);
+			Collections.sort(sorted);
+			for (String propKey : sorted) {
+				if (propKey.startsWith("PDP_URL")) {
+					String check_val = prop.getProperty(propKey);
+					if (check_val == null) {
+						throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Properties file doesn't have the PDP_URL parameter");
+					}
+					if (check_val.contains(";")) {
+						pdp_default = new ArrayList<String>(Arrays.asList(check_val.split("\\s*;\\s*")));
+						int pdpCount = 0;
+						while (pdpCount < pdp_default.size()) {
+							String pdpVal = pdp_default.get(pdpCount);
+							readPDPParam(pdpVal);
+							pdpCount++;
+						}
+					} else {
+						readPDPParam(check_val);
+					}
+				} else if (propKey.startsWith("PAP_URL")) {
+					String check_val = prop.getProperty(propKey);
+					if (check_val == null) {
+						throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Properties file doesn't have the PAP_URL parameter");
+					}
+					if (check_val.contains(";")) {
+						pap_default = new ArrayList<String>(Arrays.asList(check_val.split("\\s*;\\s*")));
+						int papCount = 0;
+						while (papCount < pap_default.size()) {
+							String papVal = pap_default.get(papCount);
+							readPAPParam(papVal);
+							papCount++;
+						}
+					} else {
+						readPAPParam(check_val);
+					}
+				}
+			}
+			if (pdps == null || pdps.isEmpty()) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot Proceed without PDP_URLs");
+				throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot Proceed without PDP_URLs");
+			}
+			
+			if (paps == null || paps.isEmpty()) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot Proceed without PAP_URLs");
+				throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot Proceed with out PAP_URLs");
+			}
+			
+			// Get JUNIT property from properties file when running tests
+			String junit = prop.getProperty("JUNIT");
+			if(junit == null || junit.isEmpty()){
+				logger.info("No JUNIT property provided, this will not be executed as a test.");
+			}else{
+				if(junit.equals("test")){
+					this.junit = true;
+				} else {
+					this.junit = false;
+				}
+			}
+		}
+	}
+	
+	/*
+	 * Read the PDP_URL parameter
+	 */
+	private void readPDPParam(String pdpVal) throws PolicyEngineException{
+		if(pdpVal.contains(",")){
+			List<String> pdpValues = new ArrayList<String>(Arrays.asList(pdpVal.split("\\s*,\\s*")));
+			if(pdpValues.size()==3){
+				// 0 - PDPURL
+				pdps.add(pdpValues.get(0));
+				// 1:2 will be UserID:Password
+				String userID = pdpValues.get(1);
+				String pass = pdpValues.get(2);
+				Base64.Encoder encoder = Base64.getEncoder();
+				encoding.add(encoder.encodeToString((userID+":"+pass).getBytes(StandardCharsets.UTF_8)));
+			}else{
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Credentials to send Request: " + pdpValues);
+				throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No enough Credentials to send Request. " + pdpValues);
+			}
+		}else{
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP value is improper/missing required values: " + pdpVal);
+			throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP value is improper/missing required values.");
+		}
+	}
+	
+	/*
+	 * Read the PAP_URL parameter
+	 */
+	private void readPAPParam(String papVal) throws PolicyEngineException{
+		if(papVal.contains(",")){
+			List<String> papValues = new ArrayList<String>(Arrays.asList(papVal.split("\\s*,\\s*")));
+			if(papValues.size()==3){
+				// 0 - PAPURL
+				paps.add(papValues.get(0));
+				// 1:2 will be UserID:Password
+				String userID = papValues.get(1);
+				String pass = papValues.get(2);
+				Base64.Encoder encoder = Base64.getEncoder();
+				encodingPAP.add(encoder.encodeToString((userID+":"+pass).getBytes(StandardCharsets.UTF_8)));
+			}else{
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Credentials to send Request: " + papValues);
+				throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No enough Credentials to send Request. " + papValues);
+			}
+		}else{
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Credentials to send Request: " + papVal);
+			throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "No enough Credentials to send Request.");
+		}
+	}
+	/*
+	 * Allowing changes to the scheme and Handler.
+	 */
+	public void notification(NotificationScheme scheme, NotificationHandler handler) {
+		this.scheme = scheme;
+		this.handler = handler;
+		logger.debug("Scheme is : " + scheme.toString());
+		logger.debug("Handler is : " + handler.getClass().getName());
+		if (!notificationType.get(0).equals("ueb")){
+			AutoClientEnd.setAuto(scheme, handler);
+		}else {
+			if (this.UEBThread){
+				UEBClientThread.setAuto(scheme, handler);
+				this.UEBThread = registerUEBThread.isAlive();
+			}
+		}
+	
+		//TODO This could also be a Start point for Auto Notifications..
+		if(pdps!=null){
+			if (notificationType.get(0).equals("ueb")  && !this.UEBThread){
+				this.UEBClientThread = new AutoClientUEB(pdps.get(0), uebURLList); 
+				this.UEBClientThread.setAuto(scheme, handler);
+				this.registerUEBThread = new Thread(this.UEBClientThread);
+				this.registerUEBThread.start();
+				this.UEBThread = true;
+			}
+			if (!notificationType.get(0).equals("ueb")){
+				if(pdps.get(0)!=null){
+					if(AutoClientEnd.getURL()==null){
+						AutoClientEnd.start(pdps.get(0));
+					}else {
+						AutoClientEnd.stop();
+						AutoClientEnd.start(pdps.get(0));
+					}
+				}
+			}
+		}
+	}
+
+	/*
+	 * Gets the Notification if one exists. Used only for Manual Polling
+	 * purposes.
+	 */
+	public PDPNotification getNotification(){
+		//TODO manual Polling
+		//Check if there is proper scheme.. 
+		PDPNotification notification = null;
+		if(this.scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS) || this.scheme.equals(NotificationScheme.MANUAL_NOTIFICATIONS)) {
+			if (notificationType.get(0).equals("ueb")){
+				ManualClientEndUEB.start(pdps.get(0), uebURLList, uniqueID);
+				notification = ManualClientEndUEB.result(scheme);
+			}else{
+				ManualClientEnd.start(pdps.get(0));
+				logger.debug("manual notification requested.. : " + scheme.toString());
+				notification = ManualClientEnd.result(scheme);
+			}
+			
+			if (notification == null){
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Notification yet..");
+				return null;
+			} else {
+				return notification;
+			}
+			
+		}else {
+			return null;
+		}
+	}
+
+	/*
+	 * Setting the Scheme.
+	 */
+	public void setScheme(NotificationScheme scheme) {
+		this.scheme = scheme;
+		if (notificationType.get(0).equals("ueb")){
+			AutoClientUEB.setScheme(this.scheme);
+			if (this.scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)){
+				ManualClientEndUEB.createTopic(pdps.get(0), uniqueID, uebURLList);
+			}
+		}else{
+			AutoClientEnd.setScheme(this.scheme);
+		}	
+	}
+
+	/*
+	 * Returns the Scheme
+	 */
+	public NotificationScheme getScheme() {
+		return this.scheme;
+	}
+
+	/*
+	 * Returns the NotificationHandler
+	 */
+	public NotificationHandler getNotificationHandler() {
+		return this.handler;
+	}
+
+	private Collection<PolicyConfig> configResult(
+			Collection<StdStatus> generateRequest) {
+		Collection<PolicyConfig> result = new HashSet<PolicyConfig>();
+		if (generateRequest == null) {
+			return null;
+		}
+		if (!generateRequest.isEmpty()) {
+			for (StdStatus stdStatus : generateRequest) {
+				PolicyConfig policyConfig = new StdPolicyConfig();
+				policyConfig = stdStatus;
+				result.add(policyConfig);
+			}
+		}
+		return result;
+	}
+
+	private Collection<PolicyResponse> eventResult(
+			Collection<StdStatus> generateRequest,
+			Map<String, String> eventAttributes) {
+		Collection<PolicyResponse> result = new HashSet<PolicyResponse>();
+		if (generateRequest == null) {
+			return null;
+		}
+		if (!generateRequest.isEmpty()) {
+			for (StdStatus stdStatus : generateRequest) {
+				StdPolicyResponse policyResponse = new StdPolicyResponse();
+				policyResponse = stdStatus;
+				policyResponse.setRequestAttributes(eventAttributes);
+				result.add(policyResponse);
+			}
+		}
+		return result;
+	}
+
+	private DecisionResponse decisionResult(Collection<StdStatus> generateRequest) {
+		StdDecisionResponse policyDecision = new StdDecisionResponse();
+		if (generateRequest == null) {
+			return policyDecision;
+		}
+		if (!generateRequest.isEmpty()) {
+			for (StdStatus stdStatus : generateRequest) {
+				policyDecision.setDecision(stdStatus.getDecision());
+				policyDecision.setDetails(stdStatus.getDetails());
+			}
+		}
+		return policyDecision;
+	}
+
+	/*
+	 * Stop the Notification Service if its running.
+	 */
+	public void stopNotification() {
+		if (this.scheme != null && this.handler != null) {
+			if (this.scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS)
+					|| this.scheme
+							.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
+				logger.info("Clear Notification called.. ");
+				if (notificationType.get(0).equals("ueb")){
+					this.UEBClientThread.terminate();
+					this.UEBThread = false;
+				}else{
+					AutoClientEnd.stop();
+				}
+			}
+		}
+	}
+	
+	/*
+	 * Create Config Policy API Implementation
+	 */
+	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 {
+		return createConfigPolicy(policyName,policyDescription, ecompName, configName,
+				configAttributes, configType, body, policyScope, requestID, userName , pass, riskLevel, riskType, guard, ttlDate);
+	}
+	
+	public String createConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
+										Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID, String userID, String passcode,
+										String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
+		
+		String response = null;
+		String configBody = null;
+		String resource= "createPolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response = XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource;
+			return response;
+		}
+		
+		//check body for JSON form and remove single quotes if present
+		if (configType.equalsIgnoreCase("JSON")) {
+			if (body.contains("'")) {
+				configBody = body.replace("'", "\"");
+			} else {
+				configBody = body;
+			}
+		} else {
+			configBody = body;
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.";
+		} else if (configName==null||configName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		}else {
+
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("Base", policyName, policyDescription, ecompName, configName, configAttributes, configType, 
+				configBody, false, policyScope,0, riskLevel, riskType, guard, ttlDate);
+
+			//send JSON object to PAP
+			response = (String) callPAP(newPAPPolicy, new String[] {"operation=create", "apiflag=api", "policyType=Config"}, requestID, "Config");
+		}
+		return response;
+
+	}
+	
+	/*
+	 * Create Config Policy API Implementation
+	 */
+	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 {
+		return updateConfigPolicy(policyName, policyDescription, ecompName, configName,
+				configAttributes, configType, body, policyScope, requestID, userName, pass, riskLevel, riskType, guard, ttlDate);
+	}
+	
+	public String updateConfigPolicy(String policyName, String policyDescription, String ecompName, String configName,
+										Map<String, String> configAttributes, String configType, String body, String policyScope, 
+										UUID requestID, String userID, String passcode,String riskLevel, String riskType, String guard, 
+										String ttlDate) throws Exception {
+		
+		String response = null;
+		String configBody = null;
+		String resource= "updatePolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response = XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource;
+			return response;
+		}
+		//check body for JSON form and remove single quotes if present
+		if (configType.equalsIgnoreCase("JSON")) {
+			if (body.contains("'")) {
+				configBody = body.replace("'", "\"");
+			} else {
+				configBody = body;
+			}
+		} else {
+			configBody = body;
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.";
+		} else if (configName==null||configName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+
+			//set values for basic policy information
+			String policyType = "Config";
+			String configPolicyType = "base";
+
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy(configPolicyType, policyName, policyDescription, ecompName, configName, configAttributes, configType, 
+				configBody, true, policyScope,0, riskLevel, riskType, guard, ttlDate);
+
+			//send JSON object to PAP
+			response = (String) callPAP(newPAPPolicy, new String[] {"operation=update", "apiflag=api", "policyType=" + policyType}, requestID, "Config");
+		
+		}
+		return response;
+
+	}
+	
+	
+	/*
+	 * Create Config Firewall Policy API implementation
+	 */
+	public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
+			String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
+		return createConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID, userName, pass, riskLevel, riskType, guard, ttlDate);
+	}
+	
+	public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID, String userID, String passcode,
+			String riskLevel, String riskType, String guard, String ttlDate) throws Exception {		
+       		
+		String response = null;
+		String resource= "createPolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response = XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource;
+			return response;
+		}
+		
+		//set values for basic policy information
+		String configName = firewallJson.get("configName").toString();
+        //String configDescription = firewallJson.get("configDescription").toString();
+		String configDescription = "";
+		String json = firewallJson.toString();
+		
+		boolean levelCheck = isNumeric(riskLevel);
+
+		if (!isJSONValid(json)) {
+			logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Invalid JSON for firewallJson: " + json);
+			throw new PolicyDecisionException(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "Invalid JSON for firewallJson: " + json);
+		}
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("Firewall Config", policyName, configDescription, configName, false, policyScope, json, 0, 
+					riskLevel, riskType, guard, ttlDate);
+			
+			//send JSON object to PAP
+			response = (String) callPAP(newPAPPolicy, new String[] {"operation=create", "apiflag=api", "policyType=Config"}, requestID, "ConfigFirewall");
+		}
+
+		return response;
+	} 
+	
+	/*
+	 * Update Config Firewall Policy API implementation
+	 */
+	public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID, String riskLevel, String riskType, 
+			String guard, String ttlDate) throws Exception {
+		return updateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID, userName, pass, riskLevel, riskType, guard, ttlDate);
+	}
+	
+	public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID, String userID, String passcode,
+			String riskLevel, String riskType, String guard, String ttlDate) throws Exception {
+		
+		String response = null;
+		String resource= "updatePolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response = XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource;
+			return response;
+		}
+		String configName = firewallJson.get("configName").toString();
+	    //String configDescription = firewallJson.get("configDescription").toString();
+		String configDescription = "";  //ASK Lak about this...****
+		String json = firewallJson.toString();
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("Firewall Config", policyName, configDescription, configName, true, policyScope, json, 0,
+														  riskLevel, riskType, guard, ttlDate);
+		
+			//send JSON object to PAP
+			response = (String) callPAP(newPAPPolicy, new String[] {"operation=update", "apiflag=api", "policyType=Config"}, requestID, "ConfigFirewall");
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * Create or Update BRMS Raw Config Policy API implementation
+	 */
+	public String createUpdateBRMSRawPolicy(String policyName, 
+			String policyDescription, 
+			Map<AttributeType, Map<String, String>>  dyanamicFieldConfigAttributes,
+			String brmsRawBody, 
+			String policyScope, 
+			Boolean isEdit, 
+			UUID requestID,
+			String riskLevel, 
+			String riskType, 
+			String guard, 
+			String ttlDate) {
+		
+		String response = null;
+		String operation = null;
+		
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if(policyDescription==null || policyDescription.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No policyDescription given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No policyDescription given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (brmsRawBody==null ||brmsRawBody.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No rule body given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No rule body given.";
+		}  else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			/*String configPolicyType, String policyName, String description, 
+					String configName, Boolean editPolicy, String domain, 
+					Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName, 
+					String configBodyData*/
+			
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("BRMS_Raw",policyName,policyDescription,
+															"BRMS_RAW_RULE",isEdit,policyScope, 
+															dyanamicFieldConfigAttributes.get(AttributeType.RULE), 0, "DROOLS", 
+															brmsRawBody, riskLevel, riskType, guard, ttlDate);
+		
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Config"}, requestID, "ConfigBrmsRaw");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * Create or Update BRMS Param Config Policy API implementation
+	 */
+	public String createUpdateBRMSParamPolicy(String policyName, 
+			String policyDescription, 
+			Map<AttributeType, Map<String, String>>  dyanamicFieldConfigAttributes,
+			String brmsRawBody, 
+			String policyScope, 
+			Boolean isEdit, 
+			UUID requestID,
+			Map<AttributeType, Map<String, String>> drlRuleAndUIParams,
+			String riskLevel, String riskType, String guard, String ttlDate) {
+		
+		String response = null;
+		String operation = null;
+		
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if(policyDescription==null || policyDescription.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No policyDescription given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No policyDescription given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if ((dyanamicFieldConfigAttributes==null)){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Rule Attributes given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Rule Attributes given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		}else {
+			/*public StdPAPPolicy (String configPolicyType, String policyName, String description, 
+					String configName, Boolean editPolicy, String domain, 
+					Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName, 
+					String configBodyData,Map<String,String> drlRuleAndUIParams) */
+			
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("BRMS_Param",policyName,policyDescription,
+															"BRMS_PARAM_RULE",isEdit,policyScope, 
+															drlRuleAndUIParams.get(AttributeType.MATCHING), 0, "DROOLS", 
+															brmsRawBody, drlRuleAndUIParams.get(AttributeType.RULE), riskLevel, riskType, guard, ttlDate);
+		
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Config"}, requestID, "ConfigBrmsParam");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * Create or Update Action Policy API implementation
+	 */
+	public String createUpdateActionPolicy(String policyName, String policyDescription, Map<String,String> componentAttributes, List<String> dynamicRuleAlgorithmLabels,
+								List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmFunctions, List<String> dynamicRuleAlgorithmField2,
+								String actionPerformer, String actionAttribute, String policyScope, Boolean isEdit, UUID requestID) {
+		
+		String response = null;
+		String operation = null;
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+			return response;
+		} else if (componentAttributes==null||componentAttributes.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Component Attributes given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Component Attributes given.";
+			return response;
+		} else if (actionAttribute==null||actionAttribute.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Action Attribute given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Action Attribute given.";
+			return response;
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+			return response;
+		} else if (actionPerformer==null||actionPerformer.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Action Performer given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Action Performer given.";
+			return response;
+		} else if (!actionPerformer.equals("PEP")) {
+			if (!actionPerformer.equals("PDP")) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Action Performer given.");
+				response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Action Performer given.";
+				return response;
+			}
+		}
+		
+		StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyDescription, componentAttributes, dynamicRuleAlgorithmLabels, dynamicRuleAlgorithmFunctions, 
+					dynamicRuleAlgorithmField1, dynamicRuleAlgorithmField2, actionPerformer, actionAttribute, isEdit, policyScope, 0);
+
+			//send JSON object to PAP
+		try {
+			response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Action"}, requestID, "Action");
+		} catch (Exception e) {
+				// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+			
+		return response;
+
+	}
+	
+	/*
+	 * Create or Update Decision Policy implementation
+	 */
+	private String createUpdateDecisionPolicy(String policyName, String policyDescription, String ecompName, RuleProvider ruleProvider, Map<String,String> componentAttributes, Map<String,String> settings,
+			List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmFunctions, List<String> dynamicRuleAlgorithmField2,
+			String policyScope, Boolean isEdit, UUID requestID) {
+		
+		String response = null;
+		String operation = null;
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No ECOMP Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else {
+			
+			if (ruleProvider==null) {
+				ruleProvider = RuleProvider.CUSTOM ;
+			}
+			
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyDescription, ecompName, ruleProvider.toString(), componentAttributes, settings, dynamicRuleAlgorithmLabels, dynamicRuleAlgorithmFunctions, 
+									dynamicRuleAlgorithmField1, dynamicRuleAlgorithmField2, null, null, null, isEdit, policyScope, 0);
+		
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Decision"}, requestID, "Decision");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * Create or Update ClosedLoop_Fault policy implementation
+	 */
+	private String createUpdateClosedLoopPolicy(String policyName, JsonObject configBody, String policyDescription, String policyScope, Boolean isEdit, 
+			UUID requestID,String riskLevel, String riskType, String guard, String ttlDate) {
+		
+		String response = null;
+		String operation = null;
+		String oldPolicyName = null;
+		
+		if (isEdit){
+			operation = "update";
+			if (policyName.endsWith("_Draft")) {
+				oldPolicyName = policyName + "_Draft.1";
+			}
+		} else {
+			operation = "create";
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		// get values and attributes from the JsonObject
+		String ecompName = configBody.get("ecompname").toString().replace("\"", "");
+		String jsonBody = configBody.toString();
+
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			
+
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_Fault", policyName, policyDescription, ecompName, 
+					jsonBody, false, oldPolicyName, null, isEdit, policyScope, 0, riskLevel, riskType, guard, ttlDate); 
+
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Config"}, requestID, "ConfigClosedLoop");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
+		return response;
+		
+	}
+	
+	private String createUpdateClosedLoopPmPolicy(String policyName, JsonObject configBody, String policyDescription, String policyScope, Boolean isEdit, 
+			UUID requestID, String riskLevel, String riskType, String guard, String ttlDate) {
+		
+		String response = null;
+		String operation = null;
+		String oldPolicyName = null;
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		// get values and attributes from the JsonObject
+		String ecompName = configBody.get("ecompname").toString().replace("\"", "");
+		String serviceType = configBody.get("serviceTypePolicyName").toString().replace("\"", "");
+		String jsonBody = configBody.toString();
+
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			
+
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_PM", policyName, policyDescription, ecompName, 
+					jsonBody, false, oldPolicyName, serviceType, isEdit, policyScope, 0, riskLevel, riskType, guard, ttlDate); 
+
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Config"}, requestID, "ConfigClosedLoop");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
+		return response;
+		
+	}
+	
+	public Boolean validateNONASCIICharactersAndAllowSpaces(Object json){
+		Boolean isValidForm = false;
+		if (json instanceof String) {
+			String jsonString = (String)json;
+			if (jsonString.isEmpty()) {
+				logger.info("JSON String is empty so cannot validate NON ACSII Characters.");
+			} else {
+				if(CharMatcher.ASCII.matchesAllOf((CharSequence) jsonString)){
+					logger.info("The Value does not contain ASCII Characters");
+				   	 isValidForm = true;
+				}else{
+					logger.error("The Value Contains Non ASCII Characters");
+					isValidForm = false;
+				}	
+			}
+		} else if (json instanceof JsonObject) {
+			JsonObject jsonObj = (JsonObject)json;
+			if (jsonObj.isEmpty()){
+				logger.info("JSON object is empty so cannot validate NON ACSII Characters.");
+			} else {
+				if(CharMatcher.ASCII.matchesAllOf((CharSequence) jsonObj.toString())){
+					logger.info("The Value does not contain ASCII Characters");
+				   	 isValidForm = true;
+				}else{
+					logger.error("The Value Contains Non ASCII Characters");
+					isValidForm = false;
+				}	
+			}
+			
+		}
+		
+		return isValidForm;
+	}
+	
+	private String createUpdateMicroServicesPolicy(String policyName, JsonObject microServiceAttributes, String ecompName, String policyScope, Boolean isEdit, UUID requestID,
+			String riskLevel, String riskType, String guard, String ttlDate) {
+		
+		String response = null;
+		String operation = null;
+		
+		if (isEdit){
+			operation = "update";
+		} else {
+			operation = "create";
+		}
+		
+		boolean levelCheck = isNumeric(riskLevel);
+		
+		// get values and attributes from the JsonObject
+		String microService = microServiceAttributes.get("service").toString().replace("\"", "");
+		String uuid = microServiceAttributes.get("uuid").toString().replace("\"", "");
+		String msLocation = microServiceAttributes.get("location").toString().replace("\"", "");;
+		String policyDescription = microServiceAttributes.get("description").toString().replace("\"", "");
+		String configName = microServiceAttributes.get("configName").toString().replace("\"", "");
+		String priority = microServiceAttributes.get("priority").toString().replace("\"", "");
+		String version = microServiceAttributes.get("version").toString().replace("\"", "");
+
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (ecompName==null||ecompName.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Ecomp Name given.";
+		} else if (configName==null||configName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Configuration Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Configuration Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (!levelCheck){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+		} else {
+			
+
+			StdPAPPolicy newPAPPolicy = new StdPAPPolicy("DCAE Micro Service", policyName, policyDescription, ecompName, 
+							configName, microService, uuid, msLocation, microServiceAttributes.toString(), priority, 
+							version, isEdit, policyScope, 0, riskLevel, riskType, guard, ttlDate); 
+
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Config"}, requestID, "ConfigMS");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
+		return response;
+		
+	}
+	
+	
+	/*
+	 * Push a policy to the PDP API implementation
+	 */
+	public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws Exception {
+		return pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID, userName, pass);
+	}
+	
+	public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID, String userID, String passcode) throws Exception {
+		String resource= "pushPolicy";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			return (XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+		}
+		String response = null;
+		String filePrefix = null;
+		String clientScope = null;
+		String activeVersion = null;
+		
+		//get the client scope based policy type
+		if (policyType.equalsIgnoreCase("Firewall")){
+			clientScope = "ConfigFirewall";
+			filePrefix = "Config_FW_";
+		} else if (policyType.equalsIgnoreCase("Action")) {
+			clientScope = "Action";
+			filePrefix = "Action_";
+		} else if (policyType.equalsIgnoreCase("Decision")){
+			clientScope = "Decision";
+			filePrefix = "Decision_";
+		} else if (policyType.equalsIgnoreCase("Base")){
+			clientScope = "Config";
+			filePrefix = "Config_";
+		} else if (policyType.equalsIgnoreCase("ClosedLoop_Fault")){
+			clientScope = "ConfigClosedLoop";
+			filePrefix = "Config_Fault_";
+		} else if (policyType.equalsIgnoreCase("ClosedLoop_PM")){
+			clientScope = "ConfigClosedLoop";
+			filePrefix = "Config_PM_";
+		} else if (policyType.equalsIgnoreCase("MicroService")) {
+			clientScope = "ConfigMS";
+			filePrefix = "Config_MS_";
+		}else if (policyType.equalsIgnoreCase("BRMS_RAW")){
+			clientScope = "ConfigBrmsRaw";
+			filePrefix = "Config_BRMS_Raw_";
+		} else if (policyType.equalsIgnoreCase("BRMS_PARAM")){
+			clientScope = "ConfigBrmsParam";
+			filePrefix = "Config_BRMS_Param_";
+		} else {
+			clientScope = null;
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + policyType + " is not a valid Policy Type.");
+			return XACMLErrorConstants.ERROR_DATA_ISSUE + policyType + " is not a valid Policy Type.";
+		}
+		
+		logger.debug("clientScope is " + clientScope);
+		logger.debug("filePrefix is " + filePrefix);
+		
+		if (pdpGroup == null) {
+			pdpGroup = "default";
+		}
+		
+		if (policyName==null||policyName.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (policyScope==null||policyScope.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Scope given.";
+		} else if (policyType==null||policyType.equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Type given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Type given.";
+		} else {
+			// requestID null check. 
+			if(requestID==null){
+				requestID =  UUID.randomUUID();
+				logger.debug("Request ID not provided.  Generating request ID " + requestID.toString());
+			}
+
+			// change call to getActiveVersion to pass requestID for PAP to receive on the GET process so PAP won't generate another 
+	//		activeVersion = getActiveVersion(policyScope, filePrefix, policyName, clientScope);
+			activeVersion = getActiveVersion(policyScope, filePrefix, policyName, clientScope, requestID);
+			logger.debug("The active version of " + policyScope + File.separator + filePrefix + policyName + " is " + activeVersion);
+			
+			String id = null;
+			if (activeVersion.equalsIgnoreCase("pe100")) {
+				logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "response code of the URL is 403. PEP is not Authorized for making this Request!! "
+						+ "\n Contact Administrator for this Scope. ");
+				return XACMLErrorConstants.ERROR_PERMISSIONS + "response code of the URL is 403. PEP is not Authorized for making this Request!! "
+						+ "Contact Administrator for this Scope. ";
+						
+			} else if (activeVersion.equalsIgnoreCase("pe300")) {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "response code of the URL is 404.  "
+						+ "This indicates a problem with getting the version from the PAP or the policy does not exist.");
+				return XACMLErrorConstants.ERROR_DATA_ISSUE + "response code of the URL is 404.  "
+						+ "This indicates a problem with getting the version from the PAP or the policy does not exist.";
+			}
+			
+			
+			if (!activeVersion.equalsIgnoreCase("0")) {
+				id = policyScope + "." + filePrefix + policyName + "." + activeVersion + ".xml";
+				logger.debug("The policyId is " + id);
+			} else {
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the activeVersion for this policy.  "
+						+ "This indicates the policy does not exist, please verify the policy exists.");
+				return XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the activeVersion for this policy. could not retrieve the activeVersion for this policy.  "
+						+ "This indicates the policy does not exist, please verify the policy exists.";
+			}
+
+			// change call to getgitPath to pass requestID for PAP to receive on the GET process so PAP won't generate another 
+			// String gitPath = getGitPath(policyScope, filePrefix, policyName, activeVersion, clientScope);
+			String gitPath = getGitPath(policyScope, filePrefix, policyName, activeVersion, clientScope, requestID);
+			logger.debug("Full gitPath policy xml file: " + gitPath);
+
+			// change call to getSelectedURI to pass requestID for PAP to receive on the GET process so PAP won't generate another 
+			// URI selectedURI = getSelectedURI(gitPath, clientScope);
+			URI selectedURI = getSelectedURI(gitPath, clientScope, requestID);
+			
+			logger.debug("The selectedURI is : " + selectedURI.toString());
+			String name = filePrefix+policyName;
+					
+			StdPDPPolicy selectedPolicy = new StdPDPPolicy(id, true, name, selectedURI, isValid, policyId, description, pushVersion);
+			
+			logger.debug("StdPDPPolicy object contains: " + selectedPolicy.getId() + ", " + selectedPolicy.getName() + ", " + selectedPolicy.getLocation().toString());
+			
+			response = copyPolicy(selectedPolicy, pdpGroup, clientScope, requestID);
+			
+			logger.debug("copyPolicy response:  " + response);
+			
+			if(response.contains("successfully")){
+				response = (String) callPAP(selectedPolicy, new String[]{"groupId=" + pdpGroup, "policyId="+id, "apiflag=addPolicyToGroup", "operation=PUT"}, requestID, clientScope);
+			}
+			
+			logger.debug("Final API response: " + response);
+		}
+		
+		return response;
+		
+	}
+	
+	private String deletePolicyFromPAP(DeletePolicyParameters parameters) {
+		String response = null;
+		String clientScope = null;
+		String pdpGroup = parameters.getPdpGroup();
+		
+		if (pdpGroup==null){
+			pdpGroup="NA";
+		}
+		
+		//get the client scope based policy type
+		if (parameters.getPolicyName().contains("Config_FW")){
+			clientScope = "ConfigFirewall";
+		} else if (parameters.getPolicyName().contains("Action")) {
+			clientScope = "Action";
+		} else if (parameters.getPolicyName().contains("Decision")){
+			clientScope = "Decision";
+		} else if (parameters.getPolicyName().contains("Config_Fault")){
+			clientScope = "ConfigClosedLoop";
+		} else if (parameters.getPolicyName().contains("Config_PM")){
+			clientScope = "ConfigClosedLoop";
+		} else if (parameters.getPolicyName().contains("Config_MS")){
+			clientScope = "ConfigMS";
+		} else if (parameters.getPolicyName().contains("Config_BRMS_Raw")){
+			clientScope = "ConfigBrmsRaw";
+		} else if (parameters.getPolicyName().contains("Config_BRMS_Param")){
+			clientScope = "ConfigBrmsParam";
+		} else {
+			clientScope = "Config";
+		}
+		
+		logger.debug("clientScope is " + clientScope);
+		
+		if (clientScope==null||clientScope.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + parameters.getPolicyName() + " is not a valid Policy Name.");
+			return XACMLErrorConstants.ERROR_DATA_ISSUE + parameters.getPolicyName() + " is not a valid Policy Name.";
+		}
+		
+		if (parameters.getPolicyName()==null||parameters.getPolicyName().equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (parameters.getDeleteCondition()==null||parameters.getDeleteCondition().equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Delete Condition given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Delete Condition given.";
+		} else {
+			
+			StdPAPPolicy deletePapPolicy = new StdPAPPolicy(parameters.getPolicyName(), parameters.getDeleteCondition().toString()); 
+
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(deletePapPolicy, new String[] {"groupId="+pdpGroup, "apiflag=deletePapApi", "operation=delete" }, parameters.getRequestID(), clientScope);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}		
+			
+		}
+		
+		return response;
+	}
+	
+	private String deletePolicyFromPDP(DeletePolicyParameters parameters) {
+		String response = null;
+		String clientScope = null;
+		String pdpGroup = parameters.getPdpGroup();
+		
+		if (pdpGroup==null){
+			pdpGroup="NA";
+		}
+		
+		//get the client scope based policy type
+		if (parameters.getPolicyName().contains("Config_FW")){
+			clientScope = "ConfigFirewall";
+		} else if (parameters.getPolicyName().contains("Action")) {
+			clientScope = "Action";
+		} else if (parameters.getPolicyName().contains("Decision")){
+			clientScope = "Decision";
+		} else if (parameters.getPolicyName().contains("Config_Fault")){
+			clientScope = "ConfigClosedLoop";
+		} else if (parameters.getPolicyName().contains("Config_PM")){
+			clientScope = "ConfigClosedLoop";
+		} else if (parameters.getPolicyName().contains("Config_MS")){
+			clientScope = "ConfigMS";
+		}else if (parameters.getPolicyName().contains("Config_BRMS_Raw")){
+			clientScope = "ConfigBrmsRaw";
+		} else if (parameters.getPolicyName().contains("Config_BRMS_Param")){
+			clientScope = "ConfigBrmsParam";
+		} else {
+			clientScope = "Config";
+		}
+		
+		logger.debug("clientScope is " + clientScope);
+		
+		if (clientScope==null||clientScope.equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + parameters.getPolicyName() + " is not a valid Policy Name.");
+			return XACMLErrorConstants.ERROR_DATA_ISSUE + parameters.getPolicyName() + " is not a valid Policy Name.";
+		}
+		
+		if (parameters.getPolicyName()==null||parameters.getPolicyName().equalsIgnoreCase("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
+		} else if (parameters.getPdpGroup()==null||parameters.getPdpGroup().equals("")){
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "No PDP Group given.");
+			response = XACMLErrorConstants.ERROR_DATA_ISSUE + "No PDP Group given.";
+		} else {
+			
+			//send JSON object to PAP
+			try {
+				response = (String) callPAP(null, new String[] {"policyName="+parameters.getPolicyName(), "groupId="+pdpGroup, "apiflag=deletePdpApi", "operation=delete" }, parameters.getRequestID(), clientScope);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}		
+			
+		}
+		
+		return response;
+	}
+	
+	/*
+	 * Copy a single Policy file from the input stream to the PAP Servlet.
+	 * Either this works (silently) or it throws an exception.
+	 * 
+	 */
+	public String copyFile(String policyId, String group, StdPAPPolicy location, String clientScope, UUID requestID) throws PAPException {
+		String response = null;
+		//String clientScope = null;
+		
+		// send the policy file to the PAP Servlet
+		try {
+			response = (String) callPAP(location, new String[] {"groupId=" + group, "policyId="+policyId, "apiflag=api", "operation=post"}, requestID, clientScope);
+		} catch (Exception e) {
+			String message = "Unable to PUT policy '" + policyId + "', e:" + e;
+			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
+			throw new PAPException(message);
+		}
+		
+		return response;
+	}
+	
+	public String copyPolicy(PDPPolicy policy, String group, String policyType, UUID requestID) throws PAPException {
+		String response = null;
+		
+		if (policy == null || group == null) {
+			throw new PAPException("Null input policy="+policy+"  group="+group);
+		}
+		try {
+			StdPAPPolicy location = new StdPAPPolicy(policy.getLocation());
+			response = copyFile(policy.getId(), group, location, policyType, requestID);
+		} catch (Exception e) {
+			String message = "Unable to PUT policy '" + policy.getId() + "', e:" + e;
+			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
+			throw new PAPException(message);
+		}
+		
+		return response;
+	}
+
+	public Object callPAP(Object content, String[] parameters, UUID requestID, String clientScope) throws Exception {
+		String response = null;
+		HttpURLConnection connection = null;
+		String requestMethod = null;
+		String operation = null;
+		responseCode = 0; 
+		// Checking for the available PDPs is done during the first Request and the List is going to have the connected PDP as first element.
+		// This makes it Real-Time to change the list depending on their availability.
+		if (paps == null || paps.isEmpty()) {
+		logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
+		throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
+		}else {
+			int papsCount = 0;
+			boolean connected = false;
+			while (papsCount < paps.size()) {
+				try {
+					String fullURL = paps.get(0);
+					if (parameters != null && parameters.length > 0) {
+						String queryString = "";
+						for (String p : parameters) {
+							queryString += "&" + p;
+							if (p.equalsIgnoreCase("operation=post")){
+								requestMethod = "POST";
+							} else if (p.equalsIgnoreCase("operation=delete")){
+								requestMethod = "DELETE";
+								operation = "delete";
+							} else {
+								requestMethod = "PUT";
+								if (p.equalsIgnoreCase("operation=create")){
+									operation = "create";
+								} else if (p.equalsIgnoreCase("operation=update")){
+									operation = "update";
+								} else if (p.equalsIgnoreCase("operation=createDictionary")){
+									operation = "createDictionary";
+								}
+							}
+						}
+						fullURL += "?" + queryString.substring(1);
+					}
+	
+					URL url = new URL (fullURL);
+					
+					//Open the connection
+					connection = (HttpURLConnection)url.openConnection();
+					
+					// Setting Content-Type
+					connection.setRequestProperty("Content-Type",
+							"application/json");
+					
+					// Adding Authorization
+					connection.setRequestProperty("Authorization", "Basic "
+							+ encodingPAP.get(0));
+					
+					connection.setRequestProperty("Environment", environment);
+					connection.setRequestProperty("ClientScope", clientScope);
+					
+					//set the method and headers
+					connection.setRequestMethod(requestMethod);
+					connection.setUseCaches(false);
+					connection.setInstanceFollowRedirects(false);
+					connection.setDoOutput(true);
+					connection.setDoInput(true);
+					// Adding RequestID
+					if (requestID == null) {
+						requestID = UUID.randomUUID();
+						logger.info("No request ID provided, sending generated ID: " + requestID.toString());
+					} else {
+						logger.info("Using provided request ID: " + requestID.toString());
+					}
+					connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
+
+					if (content != null) {
+						if (content instanceof InputStream) {
+							try {
+								//send  current configuration
+								try (OutputStream os = connection.getOutputStream()) {
+									int count = IOUtils.copy((InputStream)content, os);
+									if (logger.isDebugEnabled()) {
+										logger.debug("copied to output, bytes=" + count);
+									}
+								}
+							} catch (Exception e) {
+								logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to write content in 'PUT'", e);
+								throw e;
+							}
+						} else {
+							// the content is an object to be encoded in JSON
+							ObjectMapper mapper = new ObjectMapper();
+							if(!junit){
+								mapper.writeValue(connection.getOutputStream(), content);
+							}
+						}
+					}
+	
+					//DO the connect
+					connection.connect();
+					responseCode = connection.getResponseCode();
+					// If Connected to PAP then break from the loop and continue with the Request 
+					if (connection.getResponseCode() > 0 || junit) {
+						connected = true;
+						break;
+
+					} else {
+						logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
+					}
+				} catch (Exception e) {
+					// This means that the PAP is not working 
+					if (junit) {
+						connected = true;
+						break;
+					}
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
+				}
+				papsCount++;
+			}
+	
+			if (connected) {
+				//Read the Response
+				logger.debug("connected to the PAP : " + paps.get(0));
+				logger.debug("--- Response: ---");
+				Map<String, List<String>> headers = connection.getHeaderFields();
+				for (String key : headers.keySet()) {
+					logger.debug("Header :" + key + "  Value: " + headers.get(key));
+				}
+				try {
+					if (responseCode == 200 || junit) {
+						
+						// Check for successful creation of policy
+						String isSuccess = null;
+						if(!junit){ //is this a junit test?
+							isSuccess = connection.getHeaderField("successMapKey");
+							operation = connection.getHeaderField("operation");
+						} else {
+							isSuccess = "success";
+						}
+						
+						if (isSuccess.equals("success")) {
+							if (operation.equals("update")) {
+								logger.info("Transaction ID: " + requestID + " --Policy Updated Successfully!" );
+								response = "Transaction ID: " + requestID + " --Policy with the name " + connection.getHeaderField("policyName") + " was successfully updated.";
+							} else if (operation.equals("delete")) {
+								logger.info("Transaction ID: " + requestID + " --Policy Deleted Successfully!");
+								response = "Transaction ID: " + requestID + " --The policy was successfully deleted.";    
+							} else if (operation.equals("import")) {
+								logger.info("Transaction ID: " + requestID + " --Policy Engine Import Successful!");
+								response = "Transaction ID: " + requestID + " --The policy engine import for " + connection.getHeaderField("service") +  " was successfull.";    
+							}else {
+								logger.info("Transaction ID: " + requestID + " --Policy Created Successfully!" );
+								response = "Transaction ID: " + requestID + " --Policy with the name " + connection.getHeaderField("policyName") + " was successfully created.";
+							}
+									
+						} else {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Unable to Create/Update the Policy!");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Unable to Create/Update the Policy!";
+						}
+					} else if (connection.getResponseCode() == 202) {
+						if (connection.getHeaderField("operation")!=null && connection.getHeaderField("operation").equalsIgnoreCase("delete")){
+							if (connection.getHeaderField("lockdown")!=null && connection.getHeaderField("lockdown").equals("true")){
+								logger.warn("Transaction ID: " + requestID + "Policies are locked down.");
+								response = "Transaction ID: " + requestID + " --Policies are locked down, please try again later.";
+							}
+						}
+					} else if (connection.getResponseCode() == 204) {
+						if (connection.getHeaderField("operation")!=null && connection.getHeaderField("operation").equals("push")){
+							logger.info("Transaction ID: " + requestID + " --Policy '" + connection.getHeaderField("policyId") +
+									"' was successfully pushed to the PDP group '" + connection.getHeaderField("groupId") + "'.");
+							response = "Transaction ID: " + requestID + " --Policy '" + connection.getHeaderField("policyId") +
+									"' was successfully pushed to the PDP group '" + connection.getHeaderField("groupId") + "'.";
+						}
+					} else if (connection.getResponseCode() == 400 && connection.getHeaderField("error")!=null){
+						if (connection.getHeaderField("error").equals("noPolicyExist")) {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy does not exist on the PDP.");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy does not exist on the PDP.";
+						} else if (connection.getHeaderField("error").equals("invalidPolicyName")) {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid policyName... "
+        				+ "policyName must be the full name of the file to be deleted including version and extension");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid policyName... "
+			        				+ "policyName must be the full name of the file to be deleted including version and extension";
+						} else if (connection.getHeaderField("error").equals("actionPolicyDB")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Could not find " + connection.getHeaderField("actionAttribute") + " in the ActionPolicyDict table.");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid actionAttribute given.";
+						} else if (connection.getHeaderField("error").equals("serviceModelDB")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Service or Version.  The Service Model, " 
+									+ connection.getHeaderField("modelName") + " of version " + connection.getHeaderField("modelVersion") 
+									+ " was not found in the dictionary.");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Service or Version.  The Service Model, " 
+									+ connection.getHeaderField("modelName") + " of version " + connection.getHeaderField("modelVersion") 
+									+ " was not found in the dictionary.";
+						} else if (connection.getHeaderField("error").equals("FWDBError")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error when inserting Firewall ConfigBody data into database.");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Error when inserting Firewall ConfigBody data into the database.";
+						} else if (connection.getHeaderField("error").equals("savePolicy")){
+							logger.error(connection.getHeaderField("message"));
+							response = connection.getHeaderField("message");
+						}
+					} else if (connection.getResponseCode() == 403) {
+						logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "response code of the URL is " 
+									+ connection.getResponseCode() + ". PEP is not Authorized for making this Request!! \n Contact Administrator for this Scope. ");
+						response = XACMLErrorConstants.ERROR_PERMISSIONS + "response code of the URL is " 
+								+ connection.getResponseCode() + ". PEP is not Authorized for making this Request!! \n Contact Administrator for this Scope. ";	
+					} else if (connection.getResponseCode() == 404 && connection.getHeaderField("error")!=null) {
+						if (connection.getHeaderField("error").equals("unknownGroupId")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + connection.getHeaderField("message"));
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + connection.getHeaderField("message") +  
+									" Please check the pdpGroup you are requesting to move the policy to.";
+						}
+					} else if (connection.getResponseCode() == 409 && connection.getHeaderField("error")!=null) {
+						if (connection.getHeaderField("error").equals("modelExistsDB")) {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Import Value Exist Error");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Import Value Exist Error:  The import value "+connection.getHeaderField("service")+" already exist on the PAP. "
+									+ "Please create a new import value.";
+						}else if (connection.getHeaderField("error").equals("policyExists")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy Exist Error");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy Exist Error:  The Policy "+connection.getHeaderField("policyName")+" already exist on the PAP. "
+									+ "Please create a new policy or use the update API to modify the existing one.";
+						}
+					} else if (connection.getResponseCode() == 500 && connection.getHeaderField("error")!=null) {
+						if (connection.getHeaderField("error").equals("jpautils")){
+							logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Could not create JPAUtils instance on the PAP");
+							response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Could not create JPAUtils instance on the PAP";
+						} else if (connection.getHeaderField("error").equals("deleteDB")){
+							logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Failed to delete Policy from database.");
+							response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Failed to delete Policy from database.";
+						} else if (connection.getHeaderField("error").equals("deleteFile")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot delete the policy file.");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot delete the policy file";
+						} else if (connection.getHeaderField("error").equals("groupUpdate")){
+							logger.error(connection.getHeaderField("message"));
+							response = connection.getHeaderField("message");
+						}else if (connection.getHeaderField("error").equals("unknown")){
+							logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
+							response = XACMLErrorConstants.ERROR_UNKNOWN + "Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.";
+						} else if (connection.getHeaderField("error").equals("deleteConfig")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot delete the configuration or action body file in specified location");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot delete the configuration or action body file in specified location.";
+						}else if (connection.getHeaderField("error").equals("missing")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create value in database because service does match a value in file");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create value in database because service does match a value in file";
+						}else if (connection.getHeaderField("error").equals("importDB")){
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Database errors during policy engine import");
+							response = XACMLErrorConstants.ERROR_DATA_ISSUE + "Database errors during policy engine import";
+						}else if (connection.getHeaderField("error").equals("policyCopyError")){
+							logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + connection.getHeaderField("message"));
+							response = XACMLErrorConstants.ERROR_PROCESS_FLOW + connection.getHeaderField("message");
+						}else if (connection.getHeaderField("error").equals("addGroupError")){
+							logger.error(connection.getHeaderField("message"));
+							response = connection.getHeaderField("message");
+						}else if (connection.getHeaderField("error").equals("error")){
+							logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Could not create or update the policy for and unknown reason");
+							response = XACMLErrorConstants.ERROR_UNKNOWN + "Could not create or update the policy for and unknown reason";
+						}
+					} else {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "BAD REQUEST:  Error occured while attempting perform this operation.. the request may be incorrect.");
+						response = XACMLErrorConstants.ERROR_DATA_ISSUE + "BAD REQUEST:  Error occured while attempting perform this operation.. the request may be incorrect.";
+					}
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+					response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + e;
+					throw new Exception(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"ERROR in connecting to the PAP ", e);
+				} 
+				
+				if (junit){
+					response = "success";
+				}
+				return response;
+	
+			} else {
+				response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps;
+				return response;
+			}	
+		}
+	
+	}
+	
+	// change getSelectedURI method to receive requestID to be used to send to PAP on the GET request so PAP won't generate another
+	// private URI getSelectedURI(String gitPath, String clientScope){
+	private URI getSelectedURI(String gitPath, String clientScope, UUID requestID){
+		//Connect to the PAP
+		URI selectedURI = null;
+		HttpURLConnection connection = null;
+		String [] parameters = {"apiflag=uri", "gitPath="+gitPath};
+
+
+		// Checking for the available PDPs is done during the first Request and the List is going to have the connected PDP as first element.
+		// This makes it Real-Time to change the list depending on their availability.
+		if (paps == null || paps.isEmpty()) {
+		logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
+		try {
+			throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
+		} catch (Exception e) {
+			logger.error(e.getMessage());
+		}
+		}else {
+			int papsCount = 0;
+			boolean connected = false;
+			while (papsCount < paps.size()) {
+				try {
+					String fullURL = paps.get(0);
+					if (parameters != null && parameters.length > 0) {
+						String queryString = "";
+						for (String p : parameters) {
+							queryString += "&" + p;
+						}
+						fullURL += "?" + queryString.substring(1);
+					}
+	
+					URL url = new URL (fullURL);
+					
+					//Open the connection
+					connection = (HttpURLConnection)url.openConnection();
+					
+					// Setting Content-Type
+					connection.setRequestProperty("Content-Type",
+							"application/json");
+					
+					// Adding Authorization
+					connection.setRequestProperty("Authorization", "Basic "
+							+ encodingPAP.get(0));
+					
+					connection.setRequestProperty("Environment", environment);
+					connection.setRequestProperty("ClientScope", clientScope);
+					
+					//set the method and headers
+					connection.setRequestMethod("GET");
+					connection.setUseCaches(false);
+					connection.setInstanceFollowRedirects(false);
+					connection.setDoOutput(true);
+					connection.setDoInput(true);
+
+					// set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
+					connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
+	
+					//DO the connect
+					connection.connect();
+					responseCode = connection.getResponseCode();
+					// If Connected to PAP then break from the loop and continue with the Request 
+					if (connection.getResponseCode() > 0) {
+						connected = true;
+						break;
+
+					} else {
+						logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
+					}
+				} catch (Exception e) {
+					// This means that the PAP is not working 
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
+				}
+				papsCount++;
+			}
+	
+			if (connected) {
+				//Read the Response
+				logger.debug("connected to the PAP : " + paps.get(0));
+				logger.debug("--- Response: ---");
+				Map<String, List<String>> headers = connection.getHeaderFields();
+				for (String key : headers.keySet()) {
+					logger.debug("Header :" + key + "  Value: " + headers.get(key));
+				}
+				try {
+					if (connection.getResponseCode() == 200) {
+						// Check for successful creation of policy
+						String uri = connection.getHeaderField("selectedURI");
+						logger.debug("URI from Header: " + uri);
+						if (uri != null && !uri.equalsIgnoreCase("")) {
+							selectedURI = URI.create(uri);
+							return selectedURI;
+						} else {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the gitPath from the PAP");
+						}
+					} else if (connection.getResponseCode() == 404) {
+						logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "response code of the URL is " 
+									+ connection.getResponseCode() + ". This indicates a problem with getting the gitPath from the PAP");
+					} else {
+						logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "BAD REQUEST:  Error occured while getting the gitPath from the PAP. The request may be incorrect.");
+					}
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+					try {
+						throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ", e);
+					} catch (Exception e1) {
+						logger.error(e1.getMessage());
+					}
+				} 
+	
+			} else {
+				logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps);
+				try {
+					throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ");
+				} catch (Exception e) {
+					logger.error(e.getMessage());
+				}
+			}	
+		}
+		return selectedURI;
+						
+	}
+	
+	// Make a call to the PAP to get the gitPath
+	// change getGitPath method to receive requestID to be used to send to PAP on the GET request so PAP won't generate another
+	// private String getGitPath(String policyScope, String filePrefix, String policyName, String activeVersion, String clientScope){
+	private String getGitPath(String policyScope, String filePrefix, String policyName, String activeVersion, String clientScope, UUID requestID){
+
+		//Connect to the PAP
+		String gitPath = null;
+		HttpURLConnection connection = null;
+		String [] parameters = {"apiflag=gitPath", "policyScope="+policyScope, "filePrefix="+filePrefix, 
+									"policyName="+policyName, "activeVersion="+activeVersion};
+		
+
+		// Checking for the available PDPs is done during the first Request and the List is going to have the connected PDP as first element.
+		// This makes it Real-Time to change the list depending on their availability.
+		if (paps == null || paps.isEmpty()) {
+		logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
+		try {
+			throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
+		} catch (Exception e) {
+			logger.error(e.getMessage());
+		}
+		}else {
+			int papsCount = 0;
+			boolean connected = false;
+			while (papsCount < paps.size()) {
+				try {
+					String fullURL = paps.get(0);
+					if (parameters != null && parameters.length > 0) {
+						String queryString = "";
+						for (String p : parameters) {
+							queryString += "&" + p;
+						}
+						fullURL += "?" + queryString.substring(1);
+					}
+	
+					URL url = new URL (fullURL);
+					
+					//Open the connection
+					connection = (HttpURLConnection)url.openConnection();
+					
+					// Setting Content-Type
+					connection.setRequestProperty("Content-Type",
+							"application/json");
+					
+					// Adding Authorization
+					connection.setRequestProperty("Authorization", "Basic "
+							+ encodingPAP.get(0));
+					
+					connection.setRequestProperty("Environment", environment);
+					connection.setRequestProperty("ClientScope", clientScope);
+					
+					//set the method and headers
+					connection.setRequestMethod("GET");
+					connection.setUseCaches(false);
+					connection.setInstanceFollowRedirects(false);
+					connection.setDoOutput(true);
+					connection.setDoInput(true);
+
+					// set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
+					connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
+	
+					//DO the connect
+					connection.connect();
+	
+					// If Connected to PAP then break from the loop and continue with the Request 
+					if (connection.getResponseCode() > 0) {
+						connected = true;
+						break;
+
+					} else {
+						logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
+					}
+				} catch (Exception e) {
+					// This means that the PAP is not working 
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
+				}
+				papsCount++;
+			}
+	
+			if (connected) {
+				//Read the Response
+				logger.debug("connected to the PAP : " + paps.get(0));
+				logger.debug("--- Response: ---");
+				Map<String, List<String>> headers = connection.getHeaderFields();
+				for (String key : headers.keySet()) {
+					logger.debug("Header :" + key + "  Value: " + headers.get(key));
+				}
+				try {
+					if (connection.getResponseCode() == 200) {
+						// Check for successful creation of policy
+						gitPath = connection.getHeaderField("gitPath");
+						this.policyId = connection.getHeaderField("policyId");
+						this.description = connection.getHeaderField("description");
+						this.pushVersion = connection.getHeaderField("version");
+						String isValid = connection.getHeaderField("isValid");
+						this.isValid = Boolean.parseBoolean(isValid);
+						
+						logger.debug("GitPath from Header: " + gitPath);
+						logger.debug("policyId from Header: " + policyId);
+						logger.debug("description from Header: " + description);
+						logger.debug("version from Header: " + pushVersion);
+						logger.debug("isValid from Header: " + isValid);
+						
+						if (gitPath != null && !gitPath.equalsIgnoreCase("")) {
+							return gitPath;
+						} else {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the gitPath from the PAP");
+						}
+					} else if (connection.getResponseCode() == 404) {
+						logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "response code of the URL is " 
+									+ connection.getResponseCode() + ". This indicates a problem with getting the gitPath from the PAP");
+					} else {
+						logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "BAD REQUEST:  Error occured while getting the gitPath from the PAP. The request may be incorrect.");
+					}
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+					try {
+						throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ", e);
+					} catch (Exception e1) {
+						logger.error(e1.getMessage());
+					}
+				} 
+	
+			} else {
+				logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps);
+				try {
+					throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ");
+				} catch (Exception e) {
+					logger.error(e.getMessage());
+				}
+			}	
+		}
+		return gitPath;
+						
+	}
+
+	// change getActiveVersion method to receive requestID to be used to send to PAP on the GET request so PAP won't generate another
+//	private String getActiveVersion(String policyScope, String filePrefix, String policyName, String clientScope) {
+	private String getActiveVersion(String policyScope, String filePrefix, String policyName, String clientScope, UUID requestID) {		
+
+		//Connect to the PAP
+		String version = null;
+		HttpURLConnection connection = null;
+		String [] parameters = {"apiflag=version","policyScope="+policyScope, "filePrefix="+filePrefix, "policyName="+policyName};
+		
+
+		// Checking for the available PDPs is done during the first Request and the List is going to have the connected PDP as first element.
+		// This makes it Real-Time to change the list depending on their availability.
+		if (paps == null || paps.isEmpty()) {
+		logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
+		try {
+			throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
+		} catch (Exception e) {
+			logger.error(e.getMessage());
+		}
+		}else {
+			int papsCount = 0;
+			boolean connected = false;
+			while (papsCount < paps.size()) {
+				try {
+					String fullURL = paps.get(0);
+					if (parameters != null && parameters.length > 0) {
+						String queryString = "";
+						for (String p : parameters) {
+							queryString += "&" + p;
+						}
+						fullURL += "?" + queryString.substring(1);
+					}
+	
+					URL url = new URL (fullURL);
+					
+					//Open the connection
+					connection = (HttpURLConnection)url.openConnection();
+					
+					// Setting Content-Type
+					connection.setRequestProperty("Content-Type",
+							"application/json");
+					
+					// Adding Authorization
+					connection.setRequestProperty("Authorization", "Basic "
+							+ encodingPAP.get(0));
+					
+					connection.setRequestProperty("Environment", environment);
+					connection.setRequestProperty("ClientScope", clientScope);
+
+					
+					//set the method and headers
+					connection.setRequestMethod("GET");
+					connection.setUseCaches(false);
+					connection.setInstanceFollowRedirects(false);
+					connection.setDoOutput(true);
+					connection.setDoInput(true);
+
+					// set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
+					connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
+	
+					//DO the connect
+					connection.connect();
+	
+					// If Connected to PAP then break from the loop and continue with the Request 
+					if (connection.getResponseCode() > 0) {
+						connected = true;
+						break;
+
+					} else {
+						logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
+					}
+				} catch (Exception e) {
+					// This means that the PAP is not working 
+					logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
+				}
+				papsCount++;
+			}
+	
+			if (connected) {
+				//Read the Response
+				logger.debug("connected to the PAP : " + paps.get(0));
+				logger.debug("--- Response: ---");
+				Map<String, List<String>> headers = connection.getHeaderFields();
+				for (String key : headers.keySet()) {
+					logger.debug("Header :" + key + "  Value: " + headers.get(key));
+				}
+				try {
+					if (connection.getResponseCode() == 200) {
+						// Check for successful creation of policy
+						version = connection.getHeaderField("version");
+						logger.debug("ActiveVersion from the Header: " + version);
+					} else if (connection.getResponseCode() == 403) {
+						logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "response code of the URL is " 
+								+ connection.getResponseCode() + ". PEP is not Authorized for making this Request!! \n Contact Administrator for this Scope. ");
+						version = "pe100";
+					} else if (connection.getResponseCode() == 404) {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "response code of the URL is " 
+									+ connection.getResponseCode() + ". This indicates a problem with getting the version from the PAP");
+						version = "pe300";
+					} else {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "BAD REQUEST:  Error occured while getting the version from the PAP. The request may be incorrect.");
+					}
+				} catch (IOException e) {
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
+					try {
+						throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ", e);
+					} catch (Exception e1) {
+						logger.error(e1.getMessage());
+					}
+				} 
+	
+			} else {
+				logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps);
+				try {
+					throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ");
+				} catch (Exception e) {
+					logger.error(e.getMessage());
+				}
+			}	
+		}
+		return version;
+	}
+	
+	// Validation for json inputs
+	public static boolean isJSONValid(String data) {
+		try {
+			new JSONObject(data);
+			InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
+			JsonReader jsonReader = Json.createReader(stream);
+			logger.debug("Json Value is: " + jsonReader.read().toString() );
+		} catch (Exception e) {
+			return false;
+		}
+		return true;
+	}
+	
+	/*
+	 * Rotate the PDP list upon WEBsocket Failures
+	 */
+	public static void rotateList() {
+		Collections.rotate(pdps, -1);
+		Collections.rotate(encoding, -1);
+		/* not required for 1510. //TODO uncomment when PAP API has been implemented
+		 * This Broke the PyPDP :( Since there is no PAP LIST yet. 
+		Collections.rotate(paps,  -1);
+		Collections.rotate(encodingPAP, -1);
+		*/
+	}
+
+	/*
+	 * Get the latest PDP
+	 */
+	public static String getPDPURL() {
+		return pdps.get(0);
+	}
+	
+	/*
+	 * Get the latest PAP
+	 */
+	public static String getPAPURL() {
+		return paps.get(0);
+	}
+	
+	private JsonObject stringToJsonObject(String value) throws Exception{
+		JsonReader jsonReader = Json.createReader(new StringReader(value));
+		JsonObject object = jsonReader.readObject();
+		jsonReader.close();
+		return object;
+	}
+	
+	private String getJsonResponseString() {
+		String jsonString = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},"
+				+ "\"AssociatedAdvice\":[{\"AttributeAssignment\":[{\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\","
+				+ "\"Issuer\":\"\",\"AttributeId\":\"type\",\"Value\":\"Configuration\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},"
+				+ "{\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"URLID\",\"Value\":"
+				+ "\"$URL/Config/JunitTest.Config_testing.1.json\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#anyURI\"},{\"Category\":"
+				+ "\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"PolicyName\",\"Value\":"
+				+ "\"JunitTest.Config_testing.1.xml\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},{\"Category\":"
+				+ "\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"VersionNumber\",\"Value\":"
+				+ "\"1\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},{\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\","
+				+ "\"Issuer\":\"\",\"AttributeId\":\"matching:ECOMPName\",\"Value\":\"test\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},"
+				+ "{\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"matching:ConfigName\","
+				+ "\"Value\":\"TestName\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},{\"Category\":"
+				+ "\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"matching:service\","
+				+ "\"Value\":\"ControllerServiceOpendcaeCapsuleServiceInstance\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},"
+				+ "{\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"matching:uuid\","
+				+ "\"Value\":\"TestUUID\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},{\"Category\":"
+				+ "\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"matching:Location\","
+				+ "\"Value\":\"Edge\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\"},{\"Category\":"
+				+ "\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Issuer\":\"\",\"AttributeId\":\"Priority\",\"Value\":\"1\",\"DataType\":"
+				+ "\"http://www.w3.org/2001/XMLSchema#string\"}],\"Id\":\"MSID\"}],\"Decision\":\"Permit\"}]}";
+		
+		return jsonString;
+	}
+	
+	public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws Exception {
+		return policyEngineImport(importParameters, userName,  pass);
+	}
+	
+	public PolicyChangeResponse policyEngineImport(ImportParameters importParameters, String userID, String passcode) throws Exception {
+		StdPolicyChangeResponse response = new StdPolicyChangeResponse();
+		String resource= "policyEngineImport";
+		if(!checkPermissions(userID, passcode, resource)){
+			logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseMessage(XACMLErrorConstants.ERROR_PERMISSIONS + "You are not allowed to Make this Request. Please contact PolicyAdmin to give access to:" + resource);
+			response.setResponseCode(401);
+			return response;
+		}
+		InputStream targetStream = null;
+		if(importParameters.getServiceName()!=null && importParameters.getVersion()!=null && importParameters.getServiceType()!=null){
+			// This is Config Class Policy. 
+			if(importParameters.getFilePath()!=null){
+				File input = new File(importParameters.getFilePath());
+				if (input.getName().endsWith(".xmi") ||  input.getName().endsWith(".zip")){
+				    try {
+				    	if (input.exists()){
+				    		targetStream = new FileInputStream(input);
+				    	}else {
+							logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "File provided in ImportParameters does not exists.");
+							response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "File provided in ImportParameters does not exist.");		
+							return response;
+				    	}
+					} catch (Exception e) {
+						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error reading in File");
+						response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error in reading in the file provided");
+					}	
+				}else{
+					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect File Data type.");
+					response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect File Type Given. Please use a file of type .xmi or .zip.");		
+					return response;
+				}
+				String[] parameters = new String[] {"importService=" + importParameters.getServiceType(), "serviceName=" 
+						+ importParameters.getServiceName(), "fileName=" + input.getName(), "version=" + importParameters.getVersion()};
+				String responseMessage =  (String) callPAP(targetStream, parameters, importParameters.getRequestID(), "importMS");
+				response.setResponseMessage(responseMessage);
+			}else{
+				logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing required ImportParameters value.");
+				response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing required ImportParameters value.");		
+			}
+		}else{
+			logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing required ImportParameters value.");
+			response.setResponseMessage(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing required ImportParameters value.");		
+		}	
+		return response;
+	}
+	
+	/*
+	 * Give userID, Passcode and the Resoruce they are requesting for. 
+	 */
+	private boolean checkPermissions(String userID, String passcode, String resource){
+		Boolean result = false;
+		if(pyPDPClientFile!=null){
+			// Backward compatible pyPDP called us. So validate the user names and scope.
+			Path clientPath = Paths.get(pyPDPClientFile);
+			if (Files.notExists(clientPath)) {
+				result = false;
+			}else if(clientPath.toString().endsWith(".properties")) {
+				try {
+					HashMap<String, ArrayList<String>> clientMap = readProps(clientPath);
+					if (clientMap.containsKey(userID) && clientMap.get(userID).get(0).equals(passcode)) {
+						result= true;
+					}
+				} catch (Exception e) {
+					result = false;
+				}
+			}
+		}else{
+			//Allowing Every Client who ever don't have access for AAF and Backup Client file
+			result = true;
+		}
+		return result;
+	}
+	
+	private HashMap<String, ArrayList<String>> readProps(Path clientPath) throws Exception{
+		InputStream in;
+		Properties clientProp = new Properties();
+		try {
+			in = new FileInputStream(clientPath.toFile());
+			clientProp.load(in);
+		} catch (IOException e) {
+			logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+			throw new Exception(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"Cannot Load the Properties file", e);
+		}
+		// Read the Properties and Load the Clients and their scopes.
+		HashMap<String, ArrayList<String>>clientMap = new HashMap<String, ArrayList<String>>();
+		// 
+		for (Object propKey : clientProp.keySet()) {
+			String clientID = (String)propKey; 
+			String clientValue = clientProp.getProperty(clientID);
+			if (clientValue != null) {
+				if (clientValue.contains(",")) {
+					ArrayList<String> clientValues = new ArrayList<String>(Arrays.asList(clientValue.split("\\s*,\\s*")));
+					if(clientValues.get(0)!=null || clientValues.get(1)!=null || clientValues.get(0).isEmpty() || clientValues.get(1).isEmpty()){
+						clientMap.put(clientID, clientValues);
+					}
+				} 
+			}
+		}
+		if (clientMap == null || clientMap.isEmpty()) {
+			logger.debug(XACMLErrorConstants.ERROR_PERMISSIONS + "No Clients ID , Client Key and Scopes are available. Cannot serve any Clients !!");
+			throw new Exception("Empty Client file");
+		}
+		return clientMap;
+	}
+	
+	protected boolean isNumeric(String str)
+	{
+		for (char c : str.toCharArray())
+		{
+			if (!Character.isDigit(c)) return false;
+		}
+		return true;
+	} 
+	
+	private String ConvertDate(Date date){
+		String strDate = null;
+		if (date!=null)
+		{
+			SimpleDateFormat dateformatJava = new SimpleDateFormat("dd-MM-yyyy");
+			strDate = dateformatJava.format(date);
+		}
+		
+		return strDate;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyResponse.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyResponse.java
new file mode 100644
index 0000000..eed40ba
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyResponse.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.std;
+
+import java.util.Map;
+
+import org.openecomp.policy.api.PolicyResponse;
+import org.openecomp.policy.api.PolicyResponseStatus;
+
+/**
+ * PolicyResponse Implementation class. 
+ * 
+ * @version 0.1 
+ *
+ */
+public class StdPolicyResponse implements PolicyResponse{
+	private PolicyResponseStatus policyResponseStatus; 
+	private Map<String,String> actionAdvised;
+	private Map<String,String> actionTaken;
+	private Map<String,String> requestAttributes;
+	private String policyResponseMessage; 
+	
+	@Override
+	public PolicyResponseStatus getPolicyResponseStatus() {
+		return policyResponseStatus;
+	}
+
+	@Override
+	public Map<String, String> getActionAdvised() {
+		return actionAdvised;
+	}
+
+	@Override
+	public Map<String, String> getActionTaken() {
+		return actionTaken;
+	}
+
+	@Override
+	public Map<String, String> getRequestAttributes() {
+		return requestAttributes;
+	}
+
+	@Override
+	public String getPolicyResponseMessage() {
+		return policyResponseMessage;
+	}
+
+	public void setPolicyResponseStatus(PolicyResponseStatus policyResponseStatus) {
+		this.policyResponseStatus = policyResponseStatus;
+	}
+
+	public void setActionAdvised(Map<String, String> actionAdvised) {
+		this.actionAdvised = actionAdvised;
+	}
+
+	public void setActionTaken(Map<String, String> actionTaken) {
+		this.actionTaken = actionTaken;
+	}
+
+	public void setRequestAttributes(Map<String, String> requestAttributes) {
+		this.requestAttributes = requestAttributes;
+	}
+
+	public void setPolicyResponseMessage(String policyResponseMessage) {
+		this.policyResponseMessage = policyResponseMessage;
+	}
+	
+	public void setPolicyResponseStatus(String policyResponseMessage, PolicyResponseStatus policyResponseStatus) {
+		this.policyResponseMessage = policyResponseMessage;
+		this.policyResponseStatus = policyResponseStatus;
+	}
+	
+	@Override
+	public String toString() {
+		return "PolicyResponse [ policyResponseStatus=" + policyResponseStatus + ", policyResponseMessage=" + policyResponseMessage + ", " +
+				""
+				+ "]";
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdStatus.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdStatus.java
new file mode 100644
index 0000000..a7d22b7
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdStatus.java
@@ -0,0 +1,235 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.openecomp.policy.std;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.json.JsonObject;
+
+import org.openecomp.policy.api.DecisionResponse;
+import org.openecomp.policy.api.PolicyConfig;
+import org.openecomp.policy.api.PolicyConfigStatus;
+import org.openecomp.policy.api.PolicyDecision;
+import org.openecomp.policy.api.PolicyResponse;
+import org.openecomp.policy.api.PolicyResponseStatus;
+import org.openecomp.policy.api.PolicyType;
+import org.w3c.dom.Document;
+
+public class StdStatus extends StdPolicyResponse implements PolicyConfig, PolicyResponse, DecisionResponse{
+	private PolicyType policyType;
+	private Properties properties;
+	private JsonObject jsonObject;
+	private Document document;
+	private String other;
+	private PolicyConfigStatus policyConfigStatus;
+	private String configStatus;
+	private PolicyResponseStatus policyResponseStatus; 
+	private Map<String,String> actionAdvised;
+	private Map<String,String> actionTaken;
+	private Map<String,String> requestAttributes;
+	private String policyResponseMessage; 
+	private String policyName;
+	private String policyVersion;
+	private Map<String,String> matchingConditions;
+	private Map<String,String> responseAttributes;
+	private PolicyDecision policyDecision;
+	private String details;
+	
+	public void setStatus(String message, PolicyResponseStatus policyResponseStatus, PolicyConfigStatus policyConfigStatus) {
+		this.configStatus = message; 
+		this.policyResponseMessage = message;
+		this.policyResponseStatus = policyResponseStatus;
+		this.policyConfigStatus = policyConfigStatus;
+	}
+	@Override
+	public PolicyResponseStatus getPolicyResponseStatus() {
+		return policyResponseStatus;
+	}
+
+	@Override
+	public Map<String, String> getActionAdvised() {
+		return actionAdvised;
+	}
+	
+	@Override
+	public Map<String, String> getActionTaken() {
+		return actionTaken;
+	}
+
+	@Override
+	public Map<String, String> getRequestAttributes() {
+		return requestAttributes;
+	}
+
+	@Override
+	public String getPolicyResponseMessage() {
+		return policyResponseMessage;
+	}
+
+	public void setPolicyResponseStatus(PolicyResponseStatus policyResponseStatus) {
+		this.policyResponseStatus = policyResponseStatus;
+	}
+	
+	public void setActionAdvised(Map<String, String> actionAdvised) {
+		this.actionAdvised = actionAdvised;
+	}
+
+	public void setActionTaken(Map<String, String> actionTaken) {
+		this.actionTaken = actionTaken;
+	}
+
+	public void setRequestAttributes(Map<String, String> requestAttributes) {
+		this.requestAttributes = requestAttributes;
+	}
+
+	public void setPolicyResponseMessage(String policyResponseMessage) {
+		this.policyResponseMessage = policyResponseMessage;
+	}
+	
+	public void setPolicyResponseStatus(String policyResponseMessage, PolicyResponseStatus policyResponseStatus) {
+		this.policyResponseMessage = policyResponseMessage;
+		this.policyResponseStatus = policyResponseStatus;
+	}
+	
+	@Override
+	public PolicyType getType() {
+		return policyType;
+	}
+
+	@Override
+	public Properties toProperties() {
+		return properties;
+	}
+
+	@Override
+	public JsonObject toJSON() {
+		return jsonObject;
+	}
+
+	@Override
+	public Document toXML() {
+		return document;
+	}
+
+	@Override
+	public PolicyConfigStatus getPolicyConfigStatus() {
+		return policyConfigStatus;
+	}
+
+	@Override
+	public String getPolicyConfigMessage() {
+		return configStatus;
+	}
+	
+	@Override
+	public String getPolicyName() {
+		if(policyName!=null && policyName.contains(".xml")){
+			return (policyName.substring(0, policyName.substring(0, policyName.lastIndexOf(".")).lastIndexOf(".")));
+		}
+		return policyName;
+	}
+	
+	@Override
+	public String getPolicyVersion() {
+		return policyVersion;
+	}
+	
+	@Override
+	public Map<String,String> getMatchingConditions(){
+		return matchingConditions;
+	}
+	
+	@Override
+	public Map<String,String> getResponseAttributes(){
+		return responseAttributes;
+	}
+
+	public void setPolicyType(PolicyType policyType) {
+		this.policyType = policyType;
+	}
+
+	public void setProperties(Properties properties) {
+		this.properties = properties;
+	}
+
+	public void setJsonObject(JsonObject jsonObject) {
+		this.jsonObject = jsonObject;
+	}
+
+	public void setDocument(Document document) {
+		this.document = document;
+	}
+	
+	public void setConfigStatus(String configStatus) {
+		this.configStatus = configStatus;
+	}
+	
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+	
+	public void setPolicyVersion(String policyVersion) {
+		this.policyVersion = policyVersion;
+	}
+	
+	public void setMatchingConditions(Map<String,String> matchingConditions){
+		this.matchingConditions = matchingConditions;
+	}
+	
+	public void setResposneAttributes(Map<String,String> responseAttributes){
+		this.responseAttributes = responseAttributes;
+	}
+	
+	public void setPolicyConfigStatus(PolicyConfigStatus policyConfigStatus) {
+		this.policyConfigStatus = policyConfigStatus;
+	}
+	
+	public void setPolicyConfigStatus(String configStatus, PolicyConfigStatus policyConfigStatus) {
+		this.policyConfigStatus = policyConfigStatus;
+		this.configStatus = configStatus;
+	}
+	
+	@Override
+	public String toOther() {
+		return other;
+	}
+	
+	public void setOther(String other) {
+		this.other = other;
+	}
+	
+	public PolicyDecision getDecision() {
+		return policyDecision;
+	}
+	public void setDecision(PolicyDecision policyDecision) {
+		this.policyDecision = policyDecision;
+	}
+	
+	public void setDetails(String details){
+		this.details = details;
+	}
+	
+	public String getDetails(){
+		return details;
+	}
+}
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/package-info.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/package-info.java
new file mode 100644
index 0000000..a10f347
--- /dev/null
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineAPI
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.std;
+/**
+ * Provides standard implementations of the interfaces from the {@link org.openecomp.policy.api} package.
+ *
+ * @version 0.3 
+ *
+ */
diff --git a/PolicyEngineAPI/src/main/resources/log4j.properties b/PolicyEngineAPI/src/main/resources/log4j.properties
new file mode 100644
index 0000000..83a68a7
--- /dev/null
+++ b/PolicyEngineAPI/src/main/resources/log4j.properties
@@ -0,0 +1,56 @@
+###
+# ============LICENSE_START=======================================================
+# PolicyEngineAPI
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#
+# Use this properties for debugging and development.
+#
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, FILE
+
+# A1 is set to be a DailyRollingFileAppender.
+log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
+
+# Set the name of the file
+log4j.appender.FILE.File=policyEngineLog.log
+
+# Set the immediate flush to true (default)
+log4j.appender.FILE.ImmediateFlush=true
+
+# Set the threshold to debug mode
+log4j.appender.FILE.Threshold=debug
+
+# Set the append to false, should not overwrite
+log4j.appender.FILE.Append=true
+
+# Set the DatePattern
+log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
+
+# A1 uses PatternLayout.
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{yyyy_MM_dd_HH_mm_ss_SSS} [%t] %-5p %l- %m%n
+
+# For AstraGW feature. 
+log4j.appender.astra=org.apache.log4j.FileAppender
+log4j.appender.astra.File=astragw.log
+log4j.appender.astra.layout=org.apache.log4j.PatternLayout
+log4j.appender.astra.layout.ConversionPattern=%d{yyyy_MM_dd_HH_mm_ss_SSS} [%t] %-5p %l- %m%n
+log4j.category.astraLogger=TRACE, astra
+log4j.additivity.astraLogger=false
diff --git a/PolicyEngineAPI/src/main/resources/logback.xml b/PolicyEngineAPI/src/main/resources/logback.xml
new file mode 100644
index 0000000..dd36a50
--- /dev/null
+++ b/PolicyEngineAPI/src/main/resources/logback.xml
@@ -0,0 +1,252 @@
+<!--
+  ============LICENSE_START=======================================================
+  PolicyEngineAPI
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  ============LICENSE_END=========================================================
+  -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+  <!--<jmxConfigurator /> -->
+  <!-- directory path for all other type logs -->
+  <property name="logDir" value="logs" />
+  
+  <!-- directory path for debugging type logs -->
+  <property name="debugDir" value="logs" />
+  
+  <!--  specify the component name 
+    <ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC"  -->
+  <property name="componentName" value="Policy"></property>
+  <property name="subComponentName" value="PolicyEngineAPI"></property>
+  
+  <!--  log file names -->
+  <property name="errorLogName" value="error" />
+  <property name="metricsLogName" value="metrics" />
+  <property name="auditLogName" value="audit" />
+  <property name="debugLogName" value="debug" />
+  
+  
+      <!-- modified time stamp format -->
+ 
+   <!--    A U D I T 
+           <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+           <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{ElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+   -->
+   <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+  
+  
+  
+   <!--    M E T R I C 
+          <property name="defaultMetricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+   -->
+   <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+  
+     
+   
+   <!--   E R R O R
+          <property name="defaultErrorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDesciption}|%msg%n" />
+   -->
+   <property name="defaultErrorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{requestId}|%t|%X{serviceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDesciption}|%msg%n" />
+  
+  
+  
+   <!--   D E B U G
+          <property name="debugLoggerPatternOld" value="%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|[%caller{3}]|%msg%n" />
+          <property name="debugLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" /> -->
+   -->
+   <property name="debugLoggerPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestId}|%msg%n" />  
+   
+ 
+   
+   <!--   D E F A U L T 
+          <property name="defaultPatternOld" value="%d{MM/dd-HH:mm:ss.SSS}|%logger|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|%msg%n" />
+          <property name="defaultPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+   -->
+   <property name="defaultPattern" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}|%c||%msg%n" />
+   
+ 
+ 
+   <!--   P A T H
+          <property name="logDirectory" value="${catalina.base}/${logDir}/${componentName}/${subComponentName}" />
+          <property name="debugLogDirectory" value="${catalina.base}/${debugDir}/${componentName}/${subComponentName}" />   
+   -->   
+   <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
+   <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
+   
+
+ 
+ 
+  <!-- Example evaluator filter applied against console appender -->
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>${defaultPattern}</pattern>
+    </encoder>
+  </appender>
+
+  <!-- ============================================================================ -->
+  <!-- EELF Appenders -->
+  <!-- ============================================================================ -->
+
+  <!-- The EELFAppender is used to record events to the general application 
+    log -->
+        
+  <!-- EELF Audit Appender. This appender is used to record audit engine 
+    related logging events. The audit logger and appender are specializations 
+    of the EELF application root logger and appender. This can be used to segregate 
+    Policy engine events from other components, or it can be eliminated to record 
+    these events as part of the application root log. -->
+    
+  <appender name="EELFAudit"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${auditLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${auditLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+         <pattern>${defaultAuditPattern}</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFAudit" />
+  </appender>
+
+
+
+
+<appender name="EELFMetrics"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${metricsLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${metricsLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+      <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - 
+        %msg%n"</pattern> -->
+      <pattern>${defaultMetricPattern}</pattern>
+    </encoder>
+  </appender>
+  
+  <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFMetrics"/>
+  </appender>
+
+
+
+   
+  <appender name="EELFError"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${errorLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${errorLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+     <level>ERROR</level>
+     </filter>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+      <pattern>${defaultErrorPattern}</pattern>
+    </encoder>
+  </appender>
+  
+  <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFError"/>
+  </appender>
+
+
+  
+  <appender name="EELFDebug"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${debugLogDirectory}/${debugLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${debugLogDirectory}/${debugLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+     <level>INFO</level>
+     </filter>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+      <pattern>${debugLoggerPattern}</pattern>
+    </encoder>
+  </appender>
+  
+  <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFDebug" />
+    <includeCallerData>true</includeCallerData>
+  </appender>
+ 
+  
+  <!-- ============================================================================ -->
+  <!--  EELF loggers -->
+  <!-- ============================================================================ -->
+ 
+  <logger name="com.att.eelf.audit" level="info" additivity="false">
+    <appender-ref ref="asyncEELFAudit" />
+  </logger>
+  
+  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="asyncEELFMetrics" />
+  </logger>
+ 
+    <logger name="com.att.eelf.error" level="error" additivity="false">
+  <appender-ref ref="asyncEELFError" />
+  </logger>
+  
+   <logger name="com.att.eelf.debug" level="info" additivity="false">
+        <appender-ref ref="asyncEELFDebug" />
+  </logger>
+  
+  
+  
+  <root level="INFO">
+        <appender-ref ref="asyncEELFDebug" />
+        <appender-ref ref="asyncEELFError" />
+  </root>
+
+</configuration>
