diff --git a/pom.xml b/pom.xml index bea87b9..0f4f1fc 100644 --- a/pom.xml +++ b/pom.xml @@ -119,6 +119,12 @@ + + com.google.auto.service + auto-service + 1.0-rc2 + compile + org.mockito mockito-all diff --git a/src/main/java/com/dataartisans/flink/dataflow/FlinkRunnerRegistrar.java b/src/main/java/com/dataartisans/flink/dataflow/FlinkRunnerRegistrar.java new file mode 100644 index 0000000..31aec45 --- /dev/null +++ b/src/main/java/com/dataartisans/flink/dataflow/FlinkRunnerRegistrar.java @@ -0,0 +1,54 @@ +/* + * Copyright 2016 Data Artisans GmbH + * + * 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 com.dataartisans.flink.dataflow; + +import com.google.auto.service.AutoService; +import com.dataartisans.flink.dataflow.FlinkPipelineOptions; +import com.dataartisans.flink.dataflow.FlinkPipelineRunner; +import com.google.cloud.dataflow.sdk.options.PipelineOptions; +import com.google.cloud.dataflow.sdk.options.PipelineOptionsRegistrar; +import com.google.cloud.dataflow.sdk.runners.PipelineRunner; +import com.google.cloud.dataflow.sdk.runners.PipelineRunnerRegistrar; +import com.google.common.collect.ImmutableList; + + +/** + * AuteService registrar - will register FlinkRunner and FlinkOptions + * as possible pipeline runner services. + * + * It ends up in META-INF/services and gets picked up by Dataflow. + * + */ +public class FlinkRunnerRegistrar { + private FlinkRunnerRegistrar() { } + + @AutoService(PipelineRunnerRegistrar.class) + public static class Runner implements PipelineRunnerRegistrar { + @Override + public Iterable>> getPipelineRunners() { + return ImmutableList.>>of(FlinkPipelineRunner.class); + } + } + + @AutoService(PipelineOptionsRegistrar.class) + public static class Options implements PipelineOptionsRegistrar { + @Override + public Iterable> getPipelineOptions() { + return ImmutableList.>of(FlinkPipelineOptions.class); + } + } +}