fdb87378e6b0ccaa9e518e7a3306080532a270b0
[policy/drools-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * feature-active-standby-management
4  * ================================================================================
5  * Copyright (C) 2017-2018 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 
34     //(has it been too long since the Pdp sent an update)
35     public boolean isPdpCurrent(DroolsPdp pdp);
36
37     // Updates DESIGNATED boolean in PDP record.
38     public void setDesignated(DroolsPdp pdp, boolean designated);
39
40     // Marks droolspdpentity.DESIGNATED=false, so another PDP-D will go active.
41     public void standDownPdp(String pdpId);
42
43     // This is used in a JUnit test environment to manually
44     // insert a PDP
45     public void insertPdp(DroolsPdp pdp);
46
47     // This is used in a JUnit test environment to manually
48     // delete a PDP
49     public void deletePdp(String pdpId);
50
51     // This is used in a JUnit test environment to manually
52     // clear the droolspdpentity table.
53     public void deleteAllPdps();
54
55     // This is used in a JUnit test environment to manually
56     // get a PDP
57     public DroolsPdpEntity getPdp(String pdpId);
58
59     // Used by DroolsPdpsElectionHandler to determine if the currently designated
60     // PDP has failed.
61     public boolean hasDesignatedPdpFailed(Collection<DroolsPdp> pdps);
62
63
64 }