2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.api;
23 import java.util.Collection;
25 import java.util.UUID;
27 import javax.json.JsonObject;
29 import org.onap.policy.api.NotificationHandler;
30 import org.onap.policy.api.PDPNotification;
31 import org.onap.policy.std.StdPolicyEngine;
34 * PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine
38 public class PolicyEngine{
39 private String propertyFilePath = null;
40 private StdPolicyEngine stdPolicyEngine;
41 private NotificationScheme scheme = null;
42 private NotificationHandler handler = null;
45 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
47 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
48 * @throws PolicyEngineException PolicyEngine Exception
50 public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
51 this.propertyFilePath = propertiesFilePathname ;
52 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, (String)null);
56 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
58 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
59 * @param clientKey depicts String format of Password/ Client_Key.
60 * @throws PolicyEngineException PolicyEngine Exception
62 public PolicyEngine(String propertiesFilePathname, String clientKey) throws PolicyEngineException {
63 this.propertyFilePath = propertiesFilePathname ;
64 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, clientKey);
68 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname and <code>NotificationScheme</code>
70 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
71 * @param scheme the <code>NotificationScheme</code> of {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
72 * @throws PolicyEngineException PolicyEngine Exception
74 public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme) throws PolicyEngineException{
75 this.propertyFilePath = propertiesFilePathname;
77 this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme);
81 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname, <code>NotificationScheme</code> and <code>NotificationHandler</code>
83 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
84 * @param scheme the <code>NotificationScheme</code> of {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
85 * @param handler the <code>NotificationHandler</code> of {@link org.onap.policy.api.NotificationHandler} which defines what should happen when a notification is received.
86 * @throws PolicyEngineException PolicyEngine Exception
88 public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme, NotificationHandler handler) throws PolicyEngineException {
89 this.propertyFilePath = propertiesFilePathname ;
91 this.handler = handler;
92 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler);
96 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name
98 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required.
99 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
100 * @throws PolicyConfigException PolicyConfig Exception
101 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
104 public Collection<PolicyConfig> getConfigByPolicyName(String policyName) throws PolicyConfigException {
105 return getConfig(setConfigRequestParameters(policyName, null, null, null, null));
109 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name
111 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required.
112 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
113 * A different request ID should be passed for each request.
114 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
115 * @throws PolicyConfigException PolicyConfig Exception
116 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
119 public Collection<PolicyConfig> getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
120 return getConfig(setConfigRequestParameters(policyName, null, null, null, requestID));
124 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the onapName
126 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
127 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
128 * @throws PolicyConfigException PolicyConfig Exception
129 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
132 public Collection<PolicyConfig> getConfig(String onapName) throws PolicyConfigException {
133 return getConfig(setConfigRequestParameters(null, onapName, null, null, null));
137 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the onapName
139 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
140 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
141 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
142 * A different request ID should be passed for each request.
143 * @throws PolicyConfigException PolicyConfig Exception
144 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
147 public Collection<PolicyConfig> getConfig(String onapName, UUID requestID) throws PolicyConfigException {
148 return getConfig(setConfigRequestParameters(null, onapName, null, null, requestID));
152 * Requests the configuration of the <code>String</code> which represents the onapName and <code>String</code>
153 * which represents the configName and returns the configuration if different Configurations exist for the
154 * particular onapName.
156 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
157 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
158 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
159 * @throws PolicyConfigException PolicyConfig Exception
160 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
163 public Collection<PolicyConfig> getConfig(String onapName, String configName) throws PolicyConfigException {
164 return getConfig(setConfigRequestParameters(null, onapName, configName, null, null));
168 * Requests the configuration of the <code>String</code> which represents the onapName and <code>String</code>
169 * which represents the configName and returns the configuration if different Configurations exist for the
170 * particular onapName.
172 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
173 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
174 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
175 * A different request ID should be passed for each request.
176 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
177 * @throws PolicyConfigException PolicyConfig Exception
178 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
181 public Collection<PolicyConfig> getConfig(String onapName, String configName, UUID requestID) throws PolicyConfigException {
182 return getConfig(setConfigRequestParameters(null, onapName, configName, null, requestID));
186 * Requests the configuration of the <code>String</code> which represents the onapName, <code>String</code>
187 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific
188 * configuration related to the configAttributes mentioned.
190 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
191 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
192 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
193 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
194 * @throws PolicyConfigException PolicyConfig Exception
195 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
198 public Collection<PolicyConfig> getConfig(String onapName, String configName, Map<String, String> configAttributes) throws PolicyConfigException{
199 return getConfig(setConfigRequestParameters(null, onapName, configName, configAttributes, null));
203 * Requests the configuration of the <code>String</code> which represents the onapName, <code>String</code>
204 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific
205 * configuration related to the configAttributes mentioned.
207 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
208 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
209 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
210 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
211 * A different request ID should be passed for each request.
212 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
213 * @throws PolicyConfigException PolicyConfig Exception
214 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
217 public Collection<PolicyConfig> getConfig(String onapName, String configName, Map<String, String> configAttributes, UUID requestID) throws PolicyConfigException{
218 return getConfig(setConfigRequestParameters(null, onapName, configName, configAttributes, requestID));
222 * Requests the configuration of the <code>ConfigRequestParameters</code> which represents the Config policy request parameters
223 * and returns the specific configuration related to the matching parameters.
225 * @param configRequestParameters {@link org.onap.policy.api.ConfigRequestParameters} which represents the Config policy request parameters.
226 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the configuration.
227 * @throws PolicyConfigException PolicyConfig Exception
229 public Collection<PolicyConfig> getConfig(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
230 return stdPolicyEngine.getConfig(configRequestParameters);
234 * Requests the list of policies based on the <code>ConfigRequestParameters</code> which represents the policy request parameters
235 * and returns the list of policies filtered by the parameters.
237 * @param configRequestParameters {@link org.onap.policy.api.ConfigRequestParameters} which represents the List Policy request parameters.
238 * @return <code>Collection</code> of <code>String</code> which returns the list of policies.
239 * @throws PolicyConfigException PolicyConfig Exception
241 public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters) throws PolicyConfigException{
242 return stdPolicyEngine.listConfig(listPolicyRequestParameters);
247 * Sends the Events specified to the PEP and returns back the PolicyResponse.
249 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
250 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the Response.
251 * @throws PolicyEventException PolicyEvent Exception
252 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
255 public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes) throws PolicyEventException {
256 return stdPolicyEngine.sendEvent(eventAttributes, (UUID) null);
260 * Sends the Events specified to the PEP and returns back the PolicyResponse.
262 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
263 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
264 * A different request ID should be passed for each request.
265 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the Response.
266 * @throws PolicyEventException PolicyEvent Exception
267 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
270 public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes, UUID requestID) throws PolicyEventException {
271 return stdPolicyEngine.sendEvent(eventAttributes, requestID);
275 * Sends the Events specified to the PEP and returns back the PolicyResponse.
277 * @param eventRequestParameters {@link org.onap.policy.api.EventRequestParameters} which represents the Event Request Parameters.
278 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the Response.
279 * @throws PolicyEventException PolicyEvent Exception
281 public Collection<PolicyResponse> sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
282 return stdPolicyEngine.sendEvent(eventRequestParameters);
286 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
288 * @param onapName the <code>String</code> format of the onapName whose Decision is required.
289 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
290 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
291 * @throws PolicyDecisionException PolicyDecision Exception
292 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
295 public DecisionResponse getDecision(String onapName, Map<String,String> decisionAttributes) throws PolicyDecisionException {
296 return stdPolicyEngine.getDecision(onapName, decisionAttributes, null);
300 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
302 * @param onapName the <code>String</code> format of the onapName whose Decision is required.
303 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
304 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
305 * A different request ID should be passed for each request.
306 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
307 * @throws PolicyDecisionException PolicyDecision Exception
308 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
311 public DecisionResponse getDecision(String onapName, Map<String,String> decisionAttributes, UUID requestID) throws PolicyDecisionException {
312 return stdPolicyEngine.getDecision(onapName, decisionAttributes, requestID);
316 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
318 * @param decisionRequestParameters {@link org.onap.policy.api.DecisionRequestParameters} which represents the Decision Request Parameters.
319 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
320 * @throws PolicyDecisionException PolicyDecision Exception
322 public DecisionResponse getDecision(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException {
323 return stdPolicyEngine.getDecision(decisionRequestParameters);
327 * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
329 * @param parameters {@link org.onap.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
330 * @return {@link org.onap.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
331 * @throws PolicyException PolicyException related to the operation
334 public MetricsResponse getMetrics(MetricsRequestParameters parameters) throws PolicyException {
335 return stdPolicyEngine.getMetrics(parameters);
339 * Creates a Config Policy based on given arguments
340 * @param policyName the <code>String</code> format of the Policy Name
341 * @param policyDescription the <code>String</code> format of the Policy Description
342 * @param onapName the <code>String</code> format of the ONAP Name
343 * @param configName the <code>String</code> format of the Config Name
344 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
345 * @param configType the <code>String</code> format of the Config Type
346 * @param body the <code>String</code> format of the Policy Body
347 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
348 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
349 * A different request ID should be passed for each request.
350 * @param riskLevel the <code>String</code> value of risk Level.
351 * @param riskType the <code>String</code> value of risk Type.
352 * @param guard the <code>String</code> value of guard.
353 * @param ttlDate the <code>String</code> value of time to live Date.
354 * @throws PolicyException PolicyException related to the operation.
355 * @return <code>String</code> format of response
356 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
359 public String createConfigPolicy(String policyName, String policyDescription, String onapName, String configName,
360 Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
361 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
362 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, onapName, configName,
363 configAttributes, configType, body, policyScope, requestID,
364 riskLevel, riskType, guard, ttlDate, false);
368 * Creates a Config Policy based on given arguments
369 * @param policyName the <code>String</code> format of the Policy Name
370 * @param policyDescription the <code>String</code> format of the Policy Description
371 * @param onapName the <code>String</code> format of the ONAP Name
372 * @param configName the <code>String</code> format of the Config Name
373 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
374 * @param configType the <code>String</code> format of the Config Type
375 * @param body the <code>String</code> format of the Policy Body
376 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
377 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
378 * A different request ID should be passed for each request.
379 * @param riskLevel the <code>String</code> value of risk Level.
380 * @param riskType the <code>String</code> value of risk Type.
381 * @param guard the <code>String</code> value of guard.
382 * @param ttlDate the <code>String</code> value of time to live Date.
383 * @throws PolicyException PolicyException related to the operation.
384 * @return <code>String</code> format of response
385 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
388 public String updateConfigPolicy(String policyName, String policyDescription, String onapName, String configName,
389 Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
390 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
391 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, onapName, configName,
392 configAttributes, configType, body, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
396 * Creates a Config Firewall Policy based on given arguments
397 * @param policyName the <code>String</code> format of the Policy Name
398 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
399 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
400 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
401 * A different request ID should be passed for each request.
402 * @param riskLevel the <code>String</code> value of risk Level.
403 * @param riskType the <code>String</code> value of risk Type.
404 * @param guard the <code>String</code> value of guard.
405 * @param ttlDate the <code>String</code> value of time to live Date.
406 * @throws PolicyException PolicyException related to the operation.
407 * @return <code>String</code> format of response.
408 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
411 public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
412 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
413 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel,
414 riskType, guard, ttlDate, false);
418 * Updates a Config Firewall Policy based on given arguments
419 * @param policyName the <code>String</code> format of the Policy Name
420 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
421 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
422 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
423 * A different request ID should be passed for each request.
424 * @param riskLevel the <code>String</code> value of risk Level.
425 * @param riskType the <code>String</code> value of risk Type.
426 * @param guard the <code>String</code> value of guard.
427 * @param ttlDate the <code>String</code> value of time to live Date.
428 * @throws PolicyException PolicyException related to the operation.
429 * @return <code>String</code> format of response.
430 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
433 public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
434 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
435 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
439 * Retrieves Dictionary Items for a specified dictionary
441 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item.
442 * @return {@link org.onap.policy.api.DictionaryResponse} which consists of the response related to create dictionary item Request.
443 * @throws PolicyException PolicyException related to the operation
446 public DictionaryResponse getDictionaryItem(DictionaryParameters parameters) throws PolicyException {
447 return stdPolicyEngine.getDictionaryItem(parameters);
451 * Creates a Dictionary Item based on given Dictionary Parameters
453 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item.
454 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to create dictionary item Request.
455 * @throws PolicyException PolicyException related to the operation.
457 public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws PolicyException {
458 return stdPolicyEngine.createDictionaryItem(parameters);
462 * Updates a Dictionary Item based on given Dictionary Parameters
464 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to update a Dictionary Item.
465 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to update dictionary item Request.
466 * @throws PolicyException PolicyException related to the operation.
468 public PolicyChangeResponse updateDictionaryItem(DictionaryParameters parameters) throws PolicyException {
469 return stdPolicyEngine.updateDictionaryItem(parameters);
473 * Creates a Policy based on given Policy Parameters.
475 * @param policyParameters {@link org.onap.policy.api.PolicyParameters} which represents the Policy Parameters required to create a Policy.
476 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request.
477 * @throws PolicyException PolicyException related to the operation.
479 public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws PolicyException {
480 return stdPolicyEngine.createPolicy(policyParameters);
484 * Update Policy based on given Policy Parameters.
486 * @param policyParameters {@link org.onap.policy.api.PolicyParameters} which represents the Policy Parameters required to update a Policy.
487 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request.
488 * @throws PolicyException PolicyException related to the operation.
490 public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws PolicyException {
491 return stdPolicyEngine.updatePolicy(policyParameters);
495 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used.
497 * @param policyScope the <code>String</code> value of the sub scope directory where the policy is located
498 * @param policyName the <code>String</code> format of the Policy Name being pushed.
499 * @param policyType the <code>String</code> format of the Policy Type which is being pushed.
500 * @param pdpGroup the <code>String</code> format of the PDP Group name to which the policy needs to be pushed to.
501 * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
502 * @return <code>String</code> format of the response related to the push Policy Request.
503 * @throws PolicyException PolicyException related to the operation.
504 * @deprecated use {@link #pushPolicy(PushPolicyParameters)} instead.
507 public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws PolicyException {
508 return stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
512 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used.
514 * @param pushPolicyParameters {@link org.onap.policy.api.PushPolicyParameters} which represents the Push Policy parameters required to push a policy.
515 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to the push Policy Request.
516 * @throws PolicyException PolicyException related to the operation.
518 public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws PolicyException {
519 return stdPolicyEngine.pushPolicy(pushPolicyParameters);
523 * Deletes the specified policy from the PAP or PDP.
525 * @param deletePolicyParameters {@link org.onap.policy.api.DeletePolicyParameters} which represents the Delete Policy parameters to delete a policy.
526 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to the Delete Policy Request.
527 * @throws PolicyException PolicyException related to the operation.
529 public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws PolicyException {
530 return stdPolicyEngine.deletePolicy(deletePolicyParameters);
534 * Creates a new Policy Service based on given Service Parameters.
536 * @param importParameters {@link org.onap.policy.api.ImportParameters} which represents the Service Parameters required to create a Policy Service.
537 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related to create import Service.
538 * @throws PolicyException PolicyException related to the operation.
540 public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws PolicyException {
541 return stdPolicyEngine.policyEngineImport(importParameters);
545 * <code>setNotification</code> allows changes to the Notification Scheme and Notification Handler
547 * @param scheme the <code>NotificationScheme</code> of {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
548 * @param handler the <code>NotificationHandler</code> of {@link org.onap.policy.api.NotificationHandler} which defines what should happen when a notification is received.
550 public void setNotification(NotificationScheme scheme, NotificationHandler handler) {
551 this.scheme = scheme;
552 this.handler = handler;
553 stdPolicyEngine.notification(this.scheme,this.handler);
557 * <code>clearNotification</code> shutsDown the Notification Service if the Auto Scehme Notification service is running.
559 public void clearNotification(){
560 stdPolicyEngine.stopNotification();
564 * <code>setNotification</code> allows changes to the Notification Scheme
566 * @param scheme the <code>NotificationScheme</code> of {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
568 public void setScheme(NotificationScheme scheme){
569 this.scheme = scheme;
570 stdPolicyEngine.setScheme(this.scheme);
574 * Gets the <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns.
576 * @return <code>PDPNotification</code> of {@link org.onap.policy.api.PDPNotification} which has the Notification.
578 public PDPNotification getNotification() {
579 return stdPolicyEngine.getNotification();
583 * setClientKey allows the client to use their own implementation logic for Password Protection
584 * and will be used to set the clear text password, this will be used while making Requests.
586 * @param clientKey depicts String format of Password/ Client_Key.
588 public void setClientKey(String clientKey){
589 StdPolicyEngine.setClientKey(clientKey);
592 // Internal Setter Method to help build configRequestParameters.
593 private ConfigRequestParameters setConfigRequestParameters(String policyName, String onapName, String configName, Map<String, String> configAttributes, UUID requestID){
594 ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
595 configRequestParameters.setPolicyName(policyName);
596 configRequestParameters.setOnapName(onapName);
597 configRequestParameters.setConfigName(configName);
598 configRequestParameters.setConfigAttributes(configAttributes);
599 configRequestParameters.setRequestID(requestID);
600 return configRequestParameters;