d0d33f0f94523558cb8eb9628b1ebc4e87dd8571
[policy/drools-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * feature-active-standby-management
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
21 package org.onap.policy.drools.activestandby;
22
23 import java.util.Collection;
24
25 public interface DroolsPdpsConnector {
26
27         
28         //return a list of PDPs, NOT including this PDP
29         public Collection<DroolsPdp> getDroolsPdps();
30         
31         public void update(DroolsPdp pdp);
32         
33         //determines if the DroolsPdp parameter is considered "current" or expired (has it been too long since the Pdp sent an update)
34         public boolean isPdpCurrent(DroolsPdp pdp);
35         
36         // Updates DESIGNATED boolean in PDP record.
37         public void setDesignated(DroolsPdp pdp, boolean designated);
38         
39         // Marks droolspdpentity.DESIGNATED=false, so another PDP-D will go active.
40         public void standDownPdp(String pdpId);
41                         
42         // This is used in a JUnit test environment to manually
43         // insert a PDP
44         public void insertPdp(DroolsPdp pdp);
45         
46         // This is used in a JUnit test environment to manually
47         // delete a PDP
48         public void deletePdp(String pdpId);
49                 
50         // This is used in a JUnit test environment to manually
51         // clear the droolspdpentity table.
52         public void deleteAllPdps();
53         
54         // This is used in a JUnit test environment to manually
55         // get a PDP
56         public DroolsPdpEntity getPdp(String pdpId);
57         
58         // Used by DroolsPdpsElectionHandler to determine if the currently designated
59         // PDP has failed.
60         public boolean hasDesignatedPdpFailed(Collection<DroolsPdp> pdps);
61
62         
63 }