1 /* ============LICENSE_START=======================================================
 
   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
 
  10  *      http://www.apache.org/licenses/LICENSE-2.0
 
  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.
 
  18  * SPDX-License-Identifier: Apache-2.0
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.onap.policy.pdp.xacml.application.common;
 
  24 import java.nio.file.Path;
 
  25 import java.util.List;
 
  28 import org.onap.policy.models.decisions.concepts.DecisionRequest;
 
  29 import org.onap.policy.models.decisions.concepts.DecisionResponse;
 
  32  * This interface is how the XACML REST controller can communicate
 
  33  * with Policy Type implementation applications.
 
  34  * Applications should register themselves as this service provider
 
  35  * and implement these methods.
 
  37  * @author pameladragosh
 
  40 public interface XacmlApplicationServiceProvider {
 
  43      * Name of the application for auditing and organization of its data.
 
  47     String           applicationName();
 
  50      * Returns a list of action decisions supported by the application.
 
  52      * @return List of String (eg. "configure", "placement", "naming")
 
  54     List<String>     actionDecisionsSupported();
 
  57      * Initializes the application and gives it a Path for storing its
 
  58      * data. The Path may be already populated with previous data.
 
  60      * @param pathForData Local Path
 
  62     void             initialize(Path pathForData);
 
  65      * Returns a list of supported Tosca Policy Types.
 
  67      * @return List of Strings (eg. "onap.policy.foo.bar")
 
  69     List<String>     supportedPolicyTypes();
 
  72      * Asks whether the application can support the incoming
 
  73      * Tosca Policy Type and version.
 
  75      * @param policyType String Tosca Policy Type
 
  76      * @param policyTypeVersion String of the Tosca Policy Type version
 
  77      * @return true if supported
 
  79     boolean          canSupportPolicyType(String policyType, String policyTypeVersion);
 
  82      * Load a Map representation of a Tosca Policy.
 
  84      * @param toscaPolicies Map of Tosca Policy Objects
 
  86     void             loadPolicies(Map<String, Object> toscaPolicies);
 
  89      * Makes a decision given the incoming request and returns a response.
 
  91      * @param request Incoming DecisionRequest object
 
  92      * @return response Responding DecisionResponse object
 
  94     DecisionResponse       makeDecision(DecisionRequest request);