aboutsummaryrefslogtreecommitdiffstats
path: root/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java
blob: 0442912f43be44a979bdb093d8fed337be882419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * ============LICENSE_START=======================================================
 * feature-server-pool
 * ================================================================================
 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.onap.policy.drools.serverpool;

import java.util.Collection;
import java.util.Collections;
import org.onap.policy.common.utils.services.OrderedService;
import org.onap.policy.common.utils.services.OrderedServiceImpl;

public interface ServerPoolApi extends OrderedService {
    /**
     * 'ServerPoolApi.impl.getList()' returns an ordered list of objects
     * implementing the 'ServerPoolApi' interface.
     */
    public static OrderedServiceImpl<ServerPoolApi> impl =
        new OrderedServiceImpl<>(ServerPoolApi.class);

    /**
     * method gives all of the listening features the ability to add
     * classes to the 'HttpServletServer'.
     *
     * @return a Collection of classes implementing REST methods
     */
    public default Collection<Class<?>> servletClasses() {
        return Collections.emptyList();
    }

    /**
     * This is called in the case where no bucket migration data was received
     * from the old owner of the bucket (such as if the old owner failed).
     * It gives one or more features the opportunity to do the restore.
     *
     * @param bucket the bucket that needs restoring
     */
    public default void restoreBucket(Bucket bucket) {
    }

    /**
     * This is called whenever a 'GlobalLocks' object is updated. It was added
     * in order to support persistence, but may be used elsewhere as well.
     *
     * @param bucket the bucket containing the 'GlobalLocks' adjunct
     * @param globalLocks the 'GlobalLocks' adjunct
     */
    public default void lockUpdate(Bucket bucket, TargetLock.GlobalLocks globalLocks) {
    }

    /**
     * This is called when the state of a bucket has changed, but is currently
     * stable, and it gives features the ability to do an audit. The intent is
     * to make sure that the adjunct state is correct; in particular, to remove
     * adjuncts that should no longer be there based upon the current state.
     * Note that this method is called while being synchronized on the bucket.
     *
     * @param bucket the bucket to audit
     * @param isOwner 'true' if the current host owns the bucket
     * @param isBackup 'true' if the current host is a backup for the bucket
     */
    public default void auditBucket(Bucket bucket, boolean isOwner, boolean isBackup) {
    }
}