pull Named service up

This commit is contained in:
Jonathan Shook 2020-10-23 02:36:08 -05:00
parent 574a89e75a
commit 4a9fa81b59
9 changed files with 15 additions and 35 deletions

View File

@ -24,8 +24,8 @@ import io.nosqlbench.engine.api.activityimpl.CoreServices;
import io.nosqlbench.engine.api.activityimpl.SimpleActivity;
import io.nosqlbench.engine.api.activityimpl.action.CoreActionDispenser;
import io.nosqlbench.engine.api.activityimpl.motor.CoreMotorDispenser;
import io.nosqlbench.engine.api.util.Named;
import io.nosqlbench.engine.api.util.SimpleServiceLoader;
import io.nosqlbench.nb.spi.Named;
import java.util.Map;
import java.util.Optional;
@ -40,7 +40,7 @@ import java.util.Optional;
*/
public interface ActivityType<A extends Activity> extends Named {
public static SimpleServiceLoader<ActivityType> FINDER = new SimpleServiceLoader<>(ActivityType.class);
SimpleServiceLoader<ActivityType> FINDER = new SimpleServiceLoader<>(ActivityType.class);
/**
* Return the short name of this activity type. The fully qualified name of an activity type is
* this value, prefixed by the package of the implementing class.

View File

@ -18,15 +18,15 @@
package io.nosqlbench.engine.api.activityapi.cyclelog.filters;
import io.nosqlbench.engine.api.activityapi.core.Activity;
import io.nosqlbench.engine.api.util.Named;
import io.nosqlbench.engine.api.util.SimpleConfig;
import io.nosqlbench.engine.api.util.SimpleServiceLoader;
import io.nosqlbench.nb.spi.Named;
import java.util.function.IntPredicate;
public interface ExperimentalResultFilterType extends Named {
public static SimpleServiceLoader<ExperimentalResultFilterType> FINDER =
SimpleServiceLoader<ExperimentalResultFilterType> FINDER =
new SimpleServiceLoader<>(ExperimentalResultFilterType.class);
default IntPredicateDispenser getFilterDispenser(Activity activity) {
@ -41,7 +41,7 @@ public interface ExperimentalResultFilterType extends Named {
IntPredicate getIntPredicate(SimpleConfig conf);
public static class StaticDispenser implements IntPredicateDispenser {
class StaticDispenser implements IntPredicateDispenser {
private final IntPredicate predicate;

View File

@ -17,8 +17,8 @@
package io.nosqlbench.engine.api.activityapi.cyclelog.filters;
import io.nosqlbench.engine.api.util.Named;
import io.nosqlbench.engine.api.util.SimpleServiceLoader;
import io.nosqlbench.nb.spi.Named;
public interface ResultValueFilterType extends Named {

View File

@ -18,12 +18,12 @@
package io.nosqlbench.engine.api.activityapi.input;
import io.nosqlbench.engine.api.activityapi.core.Activity;
import io.nosqlbench.engine.api.util.Named;
import io.nosqlbench.engine.api.util.SimpleServiceLoader;
import io.nosqlbench.nb.spi.Named;
public interface InputType extends Named {
public static SimpleServiceLoader<InputType> FINDER =
SimpleServiceLoader<InputType> FINDER =
new SimpleServiceLoader<>(InputType.class);
InputDispenser getInputDispenser(Activity activity);

View File

@ -18,12 +18,12 @@
package io.nosqlbench.engine.api.activityapi.output;
import io.nosqlbench.engine.api.activityapi.core.Activity;
import io.nosqlbench.engine.api.util.Named;
import io.nosqlbench.engine.api.util.SimpleServiceLoader;
import io.nosqlbench.nb.spi.Named;
public interface OutputType extends Named {
public static SimpleServiceLoader<OutputType> FINDER =
SimpleServiceLoader<OutputType> FINDER =
new SimpleServiceLoader<>(OutputType.class);
OutputDispenser getOutputDispenser(Activity activity);

View File

@ -1,22 +0,0 @@
/*
*
* Copyright 2016 jshook
* 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.
* /
*/
package io.nosqlbench.engine.api.util;
public interface Named {
String getName();
}

View File

@ -17,6 +17,7 @@
package io.nosqlbench.engine.api.util;
import io.nosqlbench.nb.spi.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -27,7 +28,7 @@ import java.util.stream.Collectors;
public class SimpleServiceLoader<T extends Named> {
private static final Logger logger = LoggerFactory.getLogger(SimpleServiceLoader.class);
private Class<? extends T> serviceType;
private final Class<? extends T> serviceType;
private static SimpleServiceLoader instance;
private final Map<String, T> types = new ConcurrentHashMap<>();

View File

@ -1,4 +1,4 @@
package io.nosqlbench.virtdata.core.bindings;
package io.nosqlbench.nb.spi;
public interface Named {
/**

View File

@ -1,5 +1,6 @@
package io.nosqlbench.virtdata.core.bindings;
import io.nosqlbench.nb.spi.Named;
import io.nosqlbench.virtdata.lang.ast.Expression;
import io.nosqlbench.virtdata.lang.ast.FunctionCall;
import io.nosqlbench.virtdata.lang.parser.VirtDataDSL;
@ -106,7 +107,7 @@ public interface VirtDataFunctionLibrary extends Named {
case 0:
return Optional.empty();
case 1:
return Optional.of(DataMapperFunctionMapper.<T>map(resolvedFunctions.get(0).getFunctionObject()));
return Optional.of(DataMapperFunctionMapper.map(resolvedFunctions.get(0).getFunctionObject()));
default:
throw new RuntimeException(
"Found " + resolvedFunctions.size() +