[POLICY-122] Policy GUI Fixes
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / handler / DictionaryHandler.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP-PAP-REST
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 package org.openecomp.policy.pap.xacml.rest.handler;
21
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24
25 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
26
27 import com.att.research.xacml.util.XACMLProperties;
28
29 public interface DictionaryHandler {
30         String DICTIONARY_DEFAULT_CLASS = DictionaryHandlerImpl.class.getName();
31
32         /*
33          * Get Instance
34          */
35         public static DictionaryHandler getInstance(){
36                 try {
37                         Class<?> dictionaryHandler = Class.forName(XACMLProperties.getProperty("dictionary.impl.className", DICTIONARY_DEFAULT_CLASS));
38                         DictionaryHandler instance = (DictionaryHandler) dictionaryHandler.newInstance(); 
39                         return instance;
40                 } catch (Exception e) {
41                         PolicyLogger.error(e.getMessage());
42                 }
43                 return null;
44         }
45         
46         /*
47          * Get Equivalent for Dictionary Services.
48          */
49         public void doDictionaryAPIGet(HttpServletRequest request, HttpServletResponse response);
50         /*
51          * Put Equivalent for Dictionary Services. 
52          */
53         public void doDictionaryAPIPut(HttpServletRequest request, HttpServletResponse response);
54         
55         /**
56          * Can be used to extend the services.
57          * 
58          * getflag=true indicates Get Request.
59          * getflag=false indicates Put Request.  
60          * @return 
61          */
62         public String extendedOptions(String dictionaryType, HttpServletRequest request, HttpServletResponse response, boolean getflag);
63 }