Remove legacy actor code from models
[policy/models.git] / models-interactions / model-actors / actor.appclcm / src / main / java / org / onap / policy / controlloop / actor / appclcm / AppcLcmActor.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP
4  * ================================================================================
5  * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
6  * Modifications copyright (c) 2018 Nokia
7  * Modifications Copyright (C) 2019 Nordix Foundation.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.controlloop.actor.appclcm;
24
25 import org.onap.policy.controlloop.actor.appc.AppcOperation;
26 import org.onap.policy.controlloop.actor.appc.ModifyConfigOperation;
27 import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicActor;
28 import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperator;
29 import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicActorParams;
30
31 public class AppcLcmActor extends BidirectionalTopicActor<BidirectionalTopicActorParams> {
32
33     /*
34      * Confirmed by Daniel, should be 'APPC'.
35      * The actor name defined in the yaml for both legacy operations and lcm operations is still “APPC”. Perhaps in a
36      * future review it would be better to distinguish them as two separate actors in the yaml but it should be okay for
37      * now.
38      */
39     public static final String NAME = "APPC";
40
41     /**
42      * Constructs the object.
43      */
44     public AppcLcmActor() {
45         super(NAME, BidirectionalTopicActorParams.class);
46
47         // add LCM operations first as they take precedence
48         for (String opname : AppcLcmConstants.OPERATION_NAMES) {
49             addOperator(new BidirectionalTopicOperator(NAME, opname, this, AppcLcmOperation.SELECTOR_KEYS,
50                             AppcLcmOperation::new));
51         }
52
53         // add legacy operations
54         addOperator(new BidirectionalTopicOperator(NAME, ModifyConfigOperation.NAME, this, AppcOperation.SELECTOR_KEYS,
55                         ModifyConfigOperation::new));
56     }
57
58     /**
59      * This actor should take precedence.
60      */
61     @Override
62     public int getSequenceNumber() {
63         return -1;
64     }
65 }