2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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.Properties;
26 import java.util.UUID;
27 import javax.json.JsonObject;
28 import org.onap.policy.std.StdPolicyEngine;
31 * PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine
35 public class PolicyEngine {
36 private final StdPolicyEngine stdPolicyEngine;
37 private NotificationScheme scheme = null;
38 private NotificationHandler handler = null;
41 * PolicyEngine Constructor with <code>Properties</code> structure
43 * @param properties the <code>Properties</code> structure containing the Policy engine parameters
44 * @throws PolicyEngineException PolicyEngine Exception
46 public PolicyEngine(final Properties properties) throws PolicyEngineException {
47 this.stdPolicyEngine = new StdPolicyEngine(properties, (String) null);
51 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
53 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
54 * @throws PolicyEngineException PolicyEngine Exception
56 public PolicyEngine(final String propertiesFilePathname) throws PolicyEngineException {
57 this.stdPolicyEngine = new StdPolicyEngine(propertiesFilePathname, (String) null);
61 * PolicyEngine Constructor with <code>Properties</code> structure
63 * @param properties the <code>Properties</code> structure containing the Policy engine parameters
64 * @param clientKey depicts String format of Password/ Client_Key.
65 * @throws PolicyEngineException PolicyEngine Exception
67 public PolicyEngine(final Properties properties, final String clientKey) throws PolicyEngineException {
68 this.stdPolicyEngine = new StdPolicyEngine(properties, clientKey);
72 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
74 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
75 * @param clientKey depicts String format of Password/ Client_Key.
76 * @throws PolicyEngineException PolicyEngine Exception
78 public PolicyEngine(final String propertiesFilePathname, final String clientKey) throws PolicyEngineException {
79 this.stdPolicyEngine = new StdPolicyEngine(propertiesFilePathname, clientKey);
83 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname and
84 * <code>NotificationScheme</code>
86 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
87 * @param scheme the <code>NotificationScheme</code> of
88 * {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
89 * @throws PolicyEngineException PolicyEngine Exception
91 public PolicyEngine(final String propertiesFilePathname, final NotificationScheme scheme)
92 throws PolicyEngineException {
94 this.stdPolicyEngine = new StdPolicyEngine(propertiesFilePathname, this.scheme);
98 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname,
99 * <code>NotificationScheme</code> and <code>NotificationHandler</code>
101 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
102 * @param scheme the <code>NotificationScheme</code> of
103 * {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
104 * @param handler the <code>NotificationHandler</code> of
105 * {@link org.onap.policy.api.NotificationHandler} which defines what should happen when a
106 * notification is received.
107 * @throws PolicyEngineException PolicyEngine Exception
109 public PolicyEngine(final String propertiesFilePathname, final NotificationScheme scheme,
110 final NotificationHandler handler) throws PolicyEngineException {
111 this.scheme = scheme;
112 this.handler = handler;
113 this.stdPolicyEngine = new StdPolicyEngine(propertiesFilePathname, this.scheme, this.handler);
117 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which
118 * represents the Policy File Name
120 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is
122 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
124 * @throws PolicyConfigException PolicyConfig Exception
125 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
128 public Collection<PolicyConfig> getConfigByPolicyName(final String policyName) throws PolicyConfigException {
129 return getConfig(setConfigRequestParameters(policyName, null, null, null, null));
133 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which
134 * represents the Policy File Name
136 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is
138 * @param requestID unique request ID which will be passed throughout the ONAP components to
139 * correlate logging messages. A different request ID should be passed for each request.
140 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
142 * @throws PolicyConfigException PolicyConfig Exception
143 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
146 public Collection<PolicyConfig> getConfigByPolicyName(final String policyName, final UUID requestID)
147 throws PolicyConfigException {
148 return getConfig(setConfigRequestParameters(policyName, null, null, null, requestID));
152 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which
153 * represents the onapName
155 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
156 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
158 * @throws PolicyConfigException PolicyConfig Exception
159 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
162 public Collection<PolicyConfig> getConfig(final String onapName) throws PolicyConfigException {
163 return getConfig(setConfigRequestParameters(null, onapName, null, null, null));
167 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which
168 * represents the onapName
170 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
171 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
173 * @param requestID unique request ID which will be passed throughout the ONAP components to
174 * correlate logging messages. A different request ID should be passed for each request.
175 * @throws PolicyConfigException PolicyConfig Exception
176 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
179 public Collection<PolicyConfig> getConfig(final String onapName, final UUID requestID)
180 throws PolicyConfigException {
181 return getConfig(setConfigRequestParameters(null, onapName, null, null, requestID));
185 * Requests the configuration of the <code>String</code> which represents the onapName and
186 * <code>String</code> which represents the configName and returns the configuration if different
187 * Configurations exist for the particular onapName.
189 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
190 * @param configName the <code>String</code> format of the configurationName whose configuration is
192 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
194 * @throws PolicyConfigException PolicyConfig Exception
195 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
198 public Collection<PolicyConfig> getConfig(final String onapName, final String configName)
199 throws PolicyConfigException {
200 return getConfig(setConfigRequestParameters(null, onapName, configName, null, null));
204 * Requests the configuration of the <code>String</code> which represents the onapName and
205 * <code>String</code> which represents the configName and returns the configuration if different
206 * Configurations exist for the particular onapName.
208 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
209 * @param configName the <code>String</code> format of the configurationName whose configuration is
211 * @param requestID unique request ID which will be passed throughout the ONAP components to
212 * correlate logging messages. A different request ID should be passed for each request.
213 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
215 * @throws PolicyConfigException PolicyConfig Exception
216 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
219 public Collection<PolicyConfig> getConfig(final String onapName, final String configName, final UUID requestID)
220 throws PolicyConfigException {
221 return getConfig(setConfigRequestParameters(null, onapName, configName, null, requestID));
225 * Requests the configuration of the <code>String</code> which represents the onapName,
226 * <code>String</code> which represents the configName and <code>Map</code> of
227 * <code>String,String</code> which has the configAttribute and returns the specific configuration
228 * related to the configAttributes mentioned.
230 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
231 * @param configName the <code>String</code> format of the configurationName whose configuration is
233 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the
234 * configuration attributes which are required.
235 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
237 * @throws PolicyConfigException PolicyConfig Exception
238 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
241 public Collection<PolicyConfig> getConfig(final String onapName, final String configName,
242 final Map<String, String> configAttributes) throws PolicyConfigException {
243 return getConfig(setConfigRequestParameters(null, onapName, configName, configAttributes, null));
247 * Requests the configuration of the <code>String</code> which represents the onapName,
248 * <code>String</code> which represents the configName and <code>Map</code> of
249 * <code>String,String</code> which has the configAttribute and returns the specific configuration
250 * related to the configAttributes mentioned.
252 * @param onapName the <code>String</code> format of the onapName whose configuration is required.
253 * @param configName the <code>String</code> format of the configurationName whose configuration is
255 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the
256 * configuration attributes which are required.
257 * @param requestID unique request ID which will be passed throughout the ONAP components to
258 * correlate logging messages. A different request ID should be passed for each request.
259 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
261 * @throws PolicyConfigException PolicyConfig Exception
262 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
265 public Collection<PolicyConfig> getConfig(final String onapName, final String configName,
266 final Map<String, String> configAttributes, final UUID requestID) throws PolicyConfigException {
267 return getConfig(setConfigRequestParameters(null, onapName, configName, configAttributes, requestID));
271 * Requests the configuration of the <code>ConfigRequestParameters</code> which represents the
272 * Config policy request parameters and returns the specific configuration related to the matching
275 * @param configRequestParameters {@link org.onap.policy.api.ConfigRequestParameters} which
276 * represents the Config policy request parameters.
277 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyConfig} which has the
279 * @throws PolicyConfigException PolicyConfig Exception
281 public Collection<PolicyConfig> getConfig(final ConfigRequestParameters configRequestParameters)
282 throws PolicyConfigException {
283 return stdPolicyEngine.getConfig(configRequestParameters);
287 * Requests the list of policies based on the <code>ConfigRequestParameters</code> which represents
288 * the policy request parameters and returns the list of policies filtered by the parameters.
290 * @param configRequestParameters {@link org.onap.policy.api.ConfigRequestParameters} which
291 * represents the List Policy request parameters.
292 * @return <code>Collection</code> of <code>String</code> which returns the list of policies.
293 * @throws PolicyConfigException PolicyConfig Exception
295 public Collection<String> listConfig(final ConfigRequestParameters listPolicyRequestParameters)
296 throws PolicyConfigException {
297 return stdPolicyEngine.listConfig(listPolicyRequestParameters);
301 * Requests the list of policies from PDP based on the <code>ConfigNameRequest</code> which
302 * represents the policy request parameters and returns the list of policies filtered by the
305 * @param ConfigNameRequest {@link org.onap.policy.api.ConfigNameRequest} which represents the List
306 * Policy request parameters.
307 * @return <code>Collection</code> of <code>String</code> which returns the list of policies.
308 * @throws PolicyConfigException PolicyConfig Exception
310 public Collection<String> listPolicy(final ConfigNameRequest listPolicyParams) throws PolicyConfigException {
311 return stdPolicyEngine.listPolicy(listPolicyParams);
315 * Sends the Events specified to the PEP and returns back the PolicyResponse.
317 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the
318 * eventAttributes that must contain the event ID and values.
319 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the
321 * @throws PolicyEventException PolicyEvent Exception
322 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
325 public Collection<PolicyResponse> sendEvent(final Map<String, String> eventAttributes) throws PolicyEventException {
326 return stdPolicyEngine.sendEvent(eventAttributes, (UUID) null);
330 * Sends the Events specified to the PEP and returns back the PolicyResponse.
332 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the
333 * eventAttributes that must contain the event ID and values.
334 * @param requestID unique request ID which will be passed throughout the ONAP components to
335 * correlate logging messages. A different request ID should be passed for each request.
336 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the
338 * @throws PolicyEventException PolicyEvent Exception
339 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
342 public Collection<PolicyResponse> sendEvent(final Map<String, String> eventAttributes, final UUID requestID)
343 throws PolicyEventException {
344 return stdPolicyEngine.sendEvent(eventAttributes, requestID);
348 * Sends the Events specified to the PEP and returns back the PolicyResponse.
350 * @param eventRequestParameters {@link org.onap.policy.api.EventRequestParameters} which represents
351 * the Event Request Parameters.
352 * @return <code>Collection</code> of {@link org.onap.policy.api.PolicyResponse} which has the
354 * @throws PolicyEventException PolicyEvent Exception
356 public Collection<PolicyResponse> sendEvent(final EventRequestParameters eventRequestParameters)
357 throws PolicyEventException {
358 return stdPolicyEngine.sendEvent(eventRequestParameters);
362 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
364 * @param onapName the <code>String</code> format of the onapName whose Decision is required.
365 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the
366 * decisionAttributes that must contain the ID and values.
367 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
368 * @throws PolicyDecisionException PolicyDecision Exception
369 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
372 public DecisionResponse getDecision(final String onapName, final Map<String, String> decisionAttributes)
373 throws PolicyDecisionException {
374 return stdPolicyEngine.getDecision(onapName, decisionAttributes, null);
378 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
380 * @param onapName the <code>String</code> format of the onapName whose Decision is required.
381 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the
382 * decisionAttributes that must contain the ID and values.
383 * @param requestID unique request ID which will be passed throughout the ONAP components to
384 * correlate logging messages. A different request ID should be passed for each request.
385 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
386 * @throws PolicyDecisionException PolicyDecision Exception
387 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
390 public DecisionResponse getDecision(final String onapName, final Map<String, String> decisionAttributes,
391 final UUID requestID) throws PolicyDecisionException {
392 return stdPolicyEngine.getDecision(onapName, decisionAttributes, requestID);
396 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision.
398 * @param decisionRequestParameters {@link org.onap.policy.api.DecisionRequestParameters} which
399 * represents the Decision Request Parameters.
400 * @return {@link org.onap.policy.api.DecisionResponse} which has the Decision.
401 * @throws PolicyDecisionException PolicyDecision Exception
403 public DecisionResponse getDecision(final DecisionRequestParameters decisionRequestParameters)
404 throws PolicyDecisionException {
405 return stdPolicyEngine.getDecision(decisionRequestParameters);
409 * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
411 * @param parameters {@link org.onap.policy.api.MetricsRequestParameters} which represents the
412 * Parameters required to get the Policy Metrics
413 * @return {@link org.onap.policy.api.MetricsResponse} which consists of the response related to
414 * getMetrics Request.
415 * @throws PolicyException PolicyException related to the operation
418 public MetricsResponse getMetrics(final MetricsRequestParameters parameters) throws PolicyException {
419 return stdPolicyEngine.getMetrics(parameters);
423 * Creates a Config Policy based on given arguments
425 * @param policyName the <code>String</code> format of the Policy Name
426 * @param policyDescription the <code>String</code> format of the Policy Description
427 * @param onapName the <code>String</code> format of the ONAP Name
428 * @param configName the <code>String</code> format of the Config Name
429 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain
431 * @param configType the <code>String</code> format of the Config Type
432 * @param body the <code>String</code> format of the Policy Body
433 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will
434 * be created and stored
435 * @param requestID unique request ID which will be passed throughout the ONAP components to
436 * correlate logging messages. A different request ID should be passed for each request.
437 * @param riskLevel the <code>String</code> value of risk Level.
438 * @param riskType the <code>String</code> value of risk Type.
439 * @param guard the <code>String</code> value of guard.
440 * @param ttlDate the <code>String</code> value of time to live Date.
441 * @throws PolicyException PolicyException related to the operation.
442 * @return <code>String</code> format of response
443 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
446 public String createConfigPolicy(final String policyName, final String policyDescription, final String onapName,
447 final String configName, final Map<String, String> configAttributes, final String configType,
448 final String body, final String policyScope, final UUID requestID, final String riskLevel,
449 final String riskType, final String guard, final String ttlDate) throws PolicyException {
450 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, onapName, configName,
451 configAttributes, configType, body, policyScope, requestID, riskLevel, riskType, guard, ttlDate, false);
455 * Creates a Config Policy based on given arguments
457 * @param policyName the <code>String</code> format of the Policy Name
458 * @param policyDescription the <code>String</code> format of the Policy Description
459 * @param onapName the <code>String</code> format of the ONAP Name
460 * @param configName the <code>String</code> format of the Config Name
461 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain
463 * @param configType the <code>String</code> format of the Config Type
464 * @param body the <code>String</code> format of the Policy Body
465 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will
466 * be created and stored
467 * @param requestID unique request ID which will be passed throughout the ONAP components to
468 * correlate logging messages. A different request ID should be passed for each request.
469 * @param riskLevel the <code>String</code> value of risk Level.
470 * @param riskType the <code>String</code> value of risk Type.
471 * @param guard the <code>String</code> value of guard.
472 * @param ttlDate the <code>String</code> value of time to live Date.
473 * @throws PolicyException PolicyException related to the operation.
474 * @return <code>String</code> format of response
475 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
478 public String updateConfigPolicy(final String policyName, final String policyDescription, final String onapName,
479 final String configName, final Map<String, String> configAttributes, final String configType,
480 final String body, final String policyScope, final UUID requestID, final String riskLevel,
481 final String riskType, final String guard, final String ttlDate) throws PolicyException {
482 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, onapName, configName,
483 configAttributes, configType, body, policyScope, requestID, riskLevel, riskType, guard, ttlDate, true);
487 * Creates a Config Firewall Policy based on given arguments
489 * @param policyName the <code>String</code> format of the Policy Name
490 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
491 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will
492 * be created and stored
493 * @param requestID unique request ID which will be passed throughout the ONAP components to
494 * correlate logging messages. A different request ID should be passed for each request.
495 * @param riskLevel the <code>String</code> value of risk Level.
496 * @param riskType the <code>String</code> value of risk Type.
497 * @param guard the <code>String</code> value of guard.
498 * @param ttlDate the <code>String</code> value of time to live Date.
499 * @throws PolicyException PolicyException related to the operation.
500 * @return <code>String</code> format of response.
501 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
504 public String createConfigFirewallPolicy(final String policyName, final JsonObject firewallJson,
505 final String policyScope, final UUID requestID, final String riskLevel, final String riskType,
506 final String guard, final String ttlDate) throws PolicyException {
507 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,
508 riskLevel, riskType, guard, ttlDate, false);
512 * Updates a Config Firewall Policy based on given arguments
514 * @param policyName the <code>String</code> format of the Policy Name
515 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
516 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will
517 * be created and stored
518 * @param requestID unique request ID which will be passed throughout the ONAP components to
519 * correlate logging messages. A different request ID should be passed for each request.
520 * @param riskLevel the <code>String</code> value of risk Level.
521 * @param riskType the <code>String</code> value of risk Type.
522 * @param guard the <code>String</code> value of guard.
523 * @param ttlDate the <code>String</code> value of time to live Date.
524 * @throws PolicyException PolicyException related to the operation.
525 * @return <code>String</code> format of response.
526 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
529 public String updateConfigFirewallPolicy(final String policyName, final JsonObject firewallJson,
530 final String policyScope, final UUID requestID, final String riskLevel, final String riskType,
531 final String guard, final String ttlDate) throws PolicyException {
532 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,
533 riskLevel, riskType, guard, ttlDate, true);
537 * Retrieves Dictionary Items for a specified dictionary
539 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the
540 * Dictionary Parameters required to create a Dictionary Item.
541 * @return {@link org.onap.policy.api.DictionaryResponse} which consists of the response related to
542 * create dictionary item Request.
543 * @throws PolicyException PolicyException related to the operation
546 public DictionaryResponse getDictionaryItem(final DictionaryParameters parameters) throws PolicyException {
547 return stdPolicyEngine.getDictionaryItem(parameters);
551 * Creates a Dictionary Item based on given Dictionary Parameters
553 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the
554 * Dictionary Parameters required to create a Dictionary Item.
555 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
556 * to create dictionary item Request.
557 * @throws PolicyException PolicyException related to the operation.
559 public PolicyChangeResponse createDictionaryItem(final DictionaryParameters parameters) throws PolicyException {
560 return stdPolicyEngine.createDictionaryItem(parameters);
564 * Updates a Dictionary Item based on given Dictionary Parameters
566 * @param parameters {@link org.onap.policy.api.DictionaryParameters} which represents the
567 * Dictionary Parameters required to update a Dictionary Item.
568 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
569 * to update dictionary item Request.
570 * @throws PolicyException PolicyException related to the operation.
572 public PolicyChangeResponse updateDictionaryItem(final DictionaryParameters parameters) throws PolicyException {
573 return stdPolicyEngine.updateDictionaryItem(parameters);
577 * Creates a Policy based on given Policy Parameters.
579 * @param policyParameters {@link org.onap.policy.api.PolicyParameters} which represents the Policy
580 * Parameters required to create a Policy.
581 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
582 * to create policy Request.
583 * @throws PolicyException PolicyException related to the operation.
585 public PolicyChangeResponse createPolicy(final PolicyParameters policyParameters) throws PolicyException {
586 return stdPolicyEngine.createPolicy(policyParameters);
590 * Update Policy based on given Policy Parameters.
592 * @param policyParameters {@link org.onap.policy.api.PolicyParameters} which represents the Policy
593 * Parameters required to update a Policy.
594 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
595 * to create policy Request.
596 * @throws PolicyException PolicyException related to the operation.
598 public PolicyChangeResponse updatePolicy(final PolicyParameters policyParameters) throws PolicyException {
599 return stdPolicyEngine.updatePolicy(policyParameters);
603 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used.
605 * @param policyScope the <code>String</code> value of the sub scope directory where the policy is
607 * @param policyName the <code>String</code> format of the Policy Name being pushed.
608 * @param policyType the <code>String</code> format of the Policy Type which is being pushed.
609 * @param pdpGroup the <code>String</code> format of the PDP Group name to which the policy needs to
611 * @param requestID unique request ID which will be passed throughout the ONAP components to
612 * correlate logging messages.
613 * @return <code>String</code> format of the response related to the push Policy Request.
614 * @throws PolicyException PolicyException related to the operation.
615 * @deprecated use {@link #pushPolicy(PushPolicyParameters)} instead.
618 public String pushPolicy(final String policyScope, final String policyName, final String policyType,
619 final String pdpGroup, final UUID requestID) throws PolicyException {
620 return stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
624 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used.
626 * @param pushPolicyParameters {@link org.onap.policy.api.PushPolicyParameters} which represents the
627 * Push Policy parameters required to push a policy.
628 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
629 * to the push Policy Request.
630 * @throws PolicyException PolicyException related to the operation.
632 public PolicyChangeResponse pushPolicy(final PushPolicyParameters pushPolicyParameters) throws PolicyException {
633 return stdPolicyEngine.pushPolicy(pushPolicyParameters);
637 * Deletes the specified policy from the PAP or PDP.
639 * @param deletePolicyParameters {@link org.onap.policy.api.DeletePolicyParameters} which represents
640 * the Delete Policy parameters to delete a policy.
641 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
642 * to the Delete Policy Request.
643 * @throws PolicyException PolicyException related to the operation.
645 public PolicyChangeResponse deletePolicy(final DeletePolicyParameters deletePolicyParameters)
646 throws PolicyException {
647 return stdPolicyEngine.deletePolicy(deletePolicyParameters);
651 * Creates a new Policy Service based on given Service Parameters.
653 * @param importParameters {@link org.onap.policy.api.ImportParameters} which represents the Service
654 * Parameters required to create a Policy Service.
655 * @return {@link org.onap.policy.api.PolicyChangeResponse} which consists of the response related
656 * to create import Service.
657 * @throws PolicyException PolicyException related to the operation.
659 public PolicyChangeResponse policyEngineImport(final ImportParameters importParameters) throws PolicyException {
660 return stdPolicyEngine.policyEngineImport(importParameters);
664 * <code>setNotification</code> allows changes to the Notification Scheme and Notification Handler
666 * @param scheme the <code>NotificationScheme</code> of
667 * {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
668 * @param handler the <code>NotificationHandler</code> of
669 * {@link org.onap.policy.api.NotificationHandler} which defines what should happen when a
670 * notification is received.
672 public void setNotification(final NotificationScheme scheme, final NotificationHandler handler) {
673 this.scheme = scheme;
674 this.handler = handler;
675 stdPolicyEngine.notification(this.scheme, this.handler);
679 * <code>clearNotification</code> shutsDown the Notification Service if the Auto Scehme Notification
680 * service is running.
682 public void clearNotification() {
683 stdPolicyEngine.stopNotification();
687 * <code>setNotification</code> allows changes to the Notification Scheme
689 * @param scheme the <code>NotificationScheme</code> of
690 * {@link org.onap.policy.api.NotificationScheme} which defines the Notification Scheme
692 public void setScheme(final NotificationScheme scheme) {
693 this.scheme = scheme;
694 stdPolicyEngine.setScheme(this.scheme);
698 * Gets the <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns.
700 * @return <code>PDPNotification</code> of {@link org.onap.policy.api.PDPNotification} which has the
703 public PDPNotification getNotification() {
704 return stdPolicyEngine.getNotification();
708 * setClientKey allows the client to use their own implementation logic for Password Protection and
709 * will be used to set the clear text password, this will be used while making Requests.
711 * @param clientKey depicts String format of Password/ Client_Key.
713 public void setClientKey(final String clientKey) {
714 StdPolicyEngine.setClientKey(clientKey);
717 // Internal Setter Method to help build configRequestParameters.
718 private ConfigRequestParameters setConfigRequestParameters(final String policyName, final String onapName,
719 final String configName, final Map<String, String> configAttributes, final UUID requestID) {
720 final ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
721 configRequestParameters.setPolicyName(policyName);
722 configRequestParameters.setOnapName(onapName);
723 configRequestParameters.setConfigName(configName);
724 configRequestParameters.setConfigAttributes(configAttributes);
725 configRequestParameters.setRequestID(requestID);
726 return configRequestParameters;