2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.controlloop.actorserviceprovider.impl;
24 import java.util.function.Function;
25 import org.onap.policy.controlloop.actorserviceprovider.Util;
26 import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpActorParams;
29 * Actor that uses HTTP, where the only additional property that an operator needs is a
30 * URL. The actor's parameters must be an {@link HttpActorParams} and its operator
31 * parameters are expected to be an {@link HttpParams}.
33 public class HttpActor extends ActorImpl {
36 * Constructs the object.
38 * @param name actor's name
40 public HttpActor(String name) {
45 * Translates the parameters to an {@link HttpActorParams} and then creates a function
46 * that will extract operator-specific parameters.
49 protected Function<String, Map<String, Object>> makeOperatorParameters(Map<String, Object> actorParameters) {
50 String actorName = getName();
53 return Util.translate(actorName, actorParameters, HttpActorParams.class)
54 .doValidation(actorName)
55 .makeOperationParameters(actorName);