Remove legacy actor code from models
[policy/models.git] / models-interactions / model-actors / actor.cds / src / main / java / org / onap / policy / controlloop / actor / cds / CdsActor.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * Copyright (C) 2019-2020 Bell Canada. All rights reserved.
4  * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  * ============LICENSE_END=========================================================
18  */
19
20 package org.onap.policy.controlloop.actor.cds;
21
22 import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
23 import org.onap.policy.controlloop.actorserviceprovider.Operator;
24 import org.onap.policy.controlloop.actorserviceprovider.impl.ActorImpl;
25
26 /**
27  * CDS is an unusual actor in that it uses a single, generic operator to initiate all
28  * operation types. The action taken is always the same, only the operation name changes.
29  */
30 public class CdsActor extends ActorImpl {
31     public static final String NAME = CdsActorConstants.CDS_ACTOR;
32
33     /**
34      * Constructs the object.
35      */
36     public CdsActor() {
37         super(CdsActorConstants.CDS_ACTOR);
38
39         addOperator(new GrpcOperator(CdsActorConstants.CDS_ACTOR, GrpcOperation.NAME, GrpcOperation::new));
40     }
41
42     @Override
43     public Operator getOperator(String name) {
44         /*
45          * All operations are managed by the same operator, regardless of the name.
46          */
47         return super.getOperator(GrpcOperation.NAME);
48     }
49 }