Monitoring policy creation foundation
[policy/xacml-pdp.git] / applications / common / src / main / java / org / onap / policy / pdp / xacml / application / common / XacmlApplicationServiceProvider.java
1 /* ============LICENSE_START=======================================================
2  * ONAP
3  * ================================================================================
4  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.pdp.xacml.application.common;
23
24 import java.nio.file.Path;
25 import java.util.List;
26 import java.util.Map;
27
28 import org.json.JSONObject;
29
30 /**
31  * This interface is how the XACML REST controller can communicate
32  * with Policy Type implementation applications.
33  * Applications should register themselves as this service provider
34  * and implement these methods.
35  *
36  * @author pameladragosh
37  *
38  */
39 public interface XacmlApplicationServiceProvider {
40
41     /**
42      * Name of the application for auditing and organization of its data.
43      *
44      * @return String
45      */
46     String           applicationName();
47
48     /**
49      * Returns a list of action decisions supported by the application.
50      *
51      * @return List of String (eg. "configure", "placement", "naming")
52      */
53     List<String>     actionDecisionsSupported();
54
55     /**
56      * Initializes the application and gives it a Path for storing its
57      * data. The Path may be already populated with previous data.
58      *
59      * @param pathForData Local Path
60      */
61     void             initialize(Path pathForData);
62
63     /**
64      * Returns a list of supported Tosca Policy Types.
65      *
66      * @return List of Strings (eg. "onap.policy.foo.bar")
67      */
68     List<String>     supportedPolicyTypes();
69
70     /**
71      * Asks whether the application can support the incoming
72      * Tosca Policy Type and version.
73      *
74      * @param policyType String Tosca Policy Type
75      * @param policyTypeVersion String of the Tosca Policy Type version
76      * @return true if supported
77      */
78     boolean          canSupportPolicyType(String policyType, String policyTypeVersion);
79
80     /**
81      * Load a Map representation of a Tosca Policy.
82      *
83      * @param toscaPolicies Map of Tosca Policy Objects
84      */
85     void             loadPolicies(Map<String, Object> toscaPolicies);
86
87     /**
88      * Makes a decision given the incoming request and returns a response.
89      *
90      * <P>NOTE: I may want to change this to an object that represents the
91      * schema.
92      *
93      * @param jsonSchema Incoming Json
94      * @return response
95      */
96     JSONObject       makeDecision(JSONObject jsonSchema);
97
98 }