[ https://issues.apache.org/jira/browse/RYA-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472098#comment-16472098 ]
ASF GitHub Bot commented on RYA-487: ------------------------------------ Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/296#discussion_r187634162 --- Diff: extras/kafka.connect/api/src/main/java/org/apache/rya/kafka/connect/api/sink/RyaSinkConnector.java --- @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.rya.kafka.connect.api.sink; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.kafka.common.config.AbstractConfig; +import org.apache.kafka.connect.sink.SinkConnector; + +import com.jcabi.manifests.Manifests; + +import edu.umd.cs.findbugs.annotations.DefaultAnnotation; +import edu.umd.cs.findbugs.annotations.NonNull; + +/** + * Handles the common components required to task {@link RyaSinkTask}s that write to Rya. + * </p> + * Implementations of this class only need to specify functionality that is specific to the Rya implementation. + */ +@DefaultAnnotation(NonNull.class) +public abstract class RyaSinkConnector extends SinkConnector { + + /** + * Get the configuration that will be provided to the tasks when {@link #taskConfigs(int)} is invoked. + * </p> + * Only called after start has been invoked + * + * @return The configuration object for the connector. + * @throws IllegalStateException Thrown if {@link SinkConnector#start(Map)} has not been invoked yet. + */ + protected abstract AbstractConfig getConfig() throws IllegalStateException; + + @Override + public String version() { + return Manifests.exists("Build-Version") ? Manifests.read("Build-Version") : "UNKNOWN"; + } + + @Override + public List<Map<String, String>> taskConfigs(final int maxTasks) { + final List<Map<String, String>> configs = new ArrayList<>(maxTasks); + for(int i = 0; i < maxTasks; i++) { + configs.add( getConfig().originalsStrings() ); + } + return configs; + } + + @Override + public void stop() { + // Nothing to do since the RyaSinkconnector has no background monitoring. --- End diff -- typo. RyaSinkConnector > Kafka Connect Rya Sink > ---------------------- > > Key: RYA-487 > URL: https://issues.apache.org/jira/browse/RYA-487 > Project: Rya > Issue Type: New Feature > Affects Versions: 4.0.0 > Reporter: Kevin Chilton > Assignee: Kevin Chilton > Priority: Major > Fix For: 4.0.0 > > > Implement a Kafka Connect Sink that writes to Rya. > This sink does not have to handle visibilities. -- This message was sent by Atlassian JIRA (v7.6.3#76005)