|
| 1 | +package com.dataartisans.flink.dataflow;/* |
| 2 | + * Copyright 2016 Data Artisans GmbH |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import com.google.auto.service.AutoService; |
| 18 | +import com.dataartisans.flink.dataflow.FlinkPipelineOptions; |
| 19 | +import com.dataartisans.flink.dataflow.FlinkPipelineRunner; |
| 20 | +import com.google.cloud.dataflow.sdk.options.PipelineOptions; |
| 21 | +import com.google.cloud.dataflow.sdk.options.PipelineOptionsRegistrar; |
| 22 | +import com.google.cloud.dataflow.sdk.runners.PipelineRunner; |
| 23 | +import com.google.cloud.dataflow.sdk.runners.PipelineRunnerRegistrar; |
| 24 | +import com.google.common.collect.ImmutableList; |
| 25 | + |
| 26 | + |
| 27 | +/** |
| 28 | + * AuteService registrar - will register FlinkRunner and FlinkOptions |
| 29 | + * as possible pipeline runner services. |
| 30 | + * |
| 31 | + * It ends up in META-INF/services and gets picked up by Dataflow. |
| 32 | + * |
| 33 | + */ |
| 34 | +public class FlinkRunnerRegistrar { |
| 35 | + private FlinkRunnerRegistrar() { } |
| 36 | + |
| 37 | + @AutoService(PipelineRunnerRegistrar.class) |
| 38 | + public static class Runner implements PipelineRunnerRegistrar { |
| 39 | + @Override |
| 40 | + public Iterable<Class<? extends PipelineRunner<?>>> getPipelineRunners() { |
| 41 | + return ImmutableList.<Class<? extends PipelineRunner<?>>>of(FlinkPipelineRunner.class); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + @AutoService(PipelineOptionsRegistrar.class) |
| 46 | + public static class Options implements PipelineOptionsRegistrar { |
| 47 | + @Override |
| 48 | + public Iterable<Class<? extends PipelineOptions>> getPipelineOptions() { |
| 49 | + return ImmutableList.<Class<? extends PipelineOptions>>of(FlinkPipelineOptions.class); |
| 50 | + } |
| 51 | + } |
| 52 | +} |
0 commit comments