package org.onap.policy.controlloop.actorserviceprovider.impl;
import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import org.onap.policy.controlloop.actorserviceprovider.Operator;
import org.onap.policy.controlloop.actorserviceprovider.Util;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.ActorParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.slf4j.Logger;
/**
* Extracts the operator parameters from the actor parameters, for a given operator.
- * This method assumes each operation has its own set of parameters.
+ * This method translates the parameters to an {@link ActorParams} and then creates a function
+ * that will extract operator-specific parameters.
*
* @param actorParameters actor parameters
* @return a function to extract the operator parameters from the actor parameters.
* the given operation name
*/
protected Function<String, Map<String, Object>> makeOperatorParameters(Map<String, Object> actorParameters) {
+ String actorName = getName();
- return operName -> Util.translateToMap(getName() + "." + operName, actorParameters.get(operName));
+ // @formatter:off
+ return Util.translate(actorName, actorParameters, ActorParams.class)
+ .doValidation(actorName)
+ .makeOperationParameters(actorName);
+ // @formatter:on
}
/**
"failed to shutdown operation {}.{}", actorName, oper.getName()));
// @formatter:on
}
-
- // TODO old code: remove lines down to **HERE**
-
- @Override
- public String actor() {
- return null;
- }
-
- @Override
- public List<String> recipes() {
- return Collections.emptyList();
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return Collections.emptyList();
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return Collections.emptyList();
- }
-
- // **HERE**
}