RYA-377 Interface for topology factory
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/c4966ff6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/c4966ff6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/c4966ff6 Branch: refs/heads/master Commit: c4966ff6c872d948548a90d66bee86be1727ea11 Parents: 0a2170a Author: Andrew Smith <smith...@gmail.com> Authored: Tue Nov 14 15:34:51 2017 -0500 Committer: caleb <caleb.me...@parsons.com> Committed: Tue Jan 9 15:13:00 2018 -0500 ---------------------------------------------------------------------- .../kafka/topology/TopologyBuilderFactory.java | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/c4966ff6/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyBuilderFactory.java ---------------------------------------------------------------------- diff --git a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyBuilderFactory.java b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyBuilderFactory.java new file mode 100644 index 0000000..9e9dd92 --- /dev/null +++ b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyBuilderFactory.java @@ -0,0 +1,48 @@ +/* + * 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.streams.kafka.topology; + +import org.apache.kafka.streams.processor.TopologyBuilder; +import org.openrdf.query.MalformedQueryException; +import org.openrdf.query.algebra.TupleExpr; + +import edu.umd.cs.findbugs.annotations.DefaultAnnotation; +import edu.umd.cs.findbugs.annotations.NonNull; + +/** + * Factory for building {@link TopologyBuilder}s from a SPARQL query. + */ +@DefaultAnnotation(NonNull.class) +public interface TopologyBuilderFactory { + + /** + * Builds a {@link TopologyBuilder} based on the provided sparql query where + * each {@link TupleExpr} in the parsed query is a processor in the + * topology. + * + * @param sparqlQuery - The SPARQL query to build a topology for. (not null) + * @param statementTopic - The topic for the source to read from. (not null) + * @param statementTopic - The topic for the sink to write to. (not null) + * @return - The created {@link TopologyBuilder}. + * @throws MalformedQueryException - The provided query is not a valid + * SPARQL query. + */ + public TopologyBuilder build(final String sparqlQuery, final String statementTopic, final String resultTopic) + throws Exception; +}