From 1b5fa4246267675fc45745200e07c1ea255b181a Mon Sep 17 00:00:00 2001 From: qiuyluo Date: Mon, 3 Jul 2023 18:16:18 +0800 Subject: [PATCH] Removing the module subscription-api. --- iotdb-api/subscription-api/pom.xml | 68 ---------- .../api/SubscriptionConfiguration.java | 116 ------------------ .../subscription/api/SubscriptionFactory.java | 47 ------- .../subscription/api/consumer/Consumer.java | 64 ---------- .../api/consumer/pull/PullConsumer.java | 38 ------ .../consumer/push/DataArrivalListener.java | 37 ------ .../api/consumer/push/ExceptionListener.java | 34 ----- .../api/consumer/push/PushConsumer.java | 68 ---------- .../api/dataset/SubscriptionDataSet.java | 22 ---- .../api/exception/SubscriptionException.java | 31 ----- ...SubscriptionStrategyNotValidException.java | 31 ----- .../api/strategy/SubscriptionStrategy.java | 33 ----- .../disorder/DisorderHandlingStrategy.java | 35 ------ .../disorder/IntolerableStrategy.java | 34 ----- .../strategy/disorder/WatermarkStrategy.java | 36 ------ .../topic/MultipleConnectionStrategy.java | 63 ---------- .../strategy/topic/SingleTopicStrategy.java | 52 -------- .../api/strategy/topic/TopicsStrategy.java | 24 ---- pom.xml | 1 - 19 files changed, 834 deletions(-) delete mode 100644 iotdb-api/subscription-api/pom.xml delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionConfiguration.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionFactory.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/Consumer.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/pull/PullConsumer.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/DataArrivalListener.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/ExceptionListener.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/PushConsumer.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/dataset/SubscriptionDataSet.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionException.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionStrategyNotValidException.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/SubscriptionStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/DisorderHandlingStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/IntolerableStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/WatermarkStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/MultipleConnectionStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/SingleTopicStrategy.java delete mode 100644 iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/TopicsStrategy.java diff --git a/iotdb-api/subscription-api/pom.xml b/iotdb-api/subscription-api/pom.xml deleted file mode 100644 index 2c0f3627866e..000000000000 --- a/iotdb-api/subscription-api/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - iotdb-parent - org.apache.iotdb - 1.3.0-SNAPSHOT - ../../pom.xml - - 4.0.0 - subscription-api - - - get-jar-with-dependencies - - - - maven-assembly-plugin - ${maven.assembly.version} - - - jar-with-dependencies - - - - - make-assembly - - package - - - single - - - - - - - - - - - org.apache.iotdb - tsfile - ${project.version} - provided - - - diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionConfiguration.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionConfiguration.java deleted file mode 100644 index 3372f9e28044..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionConfiguration.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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.iotdb.subscription.api; - -import org.apache.iotdb.subscription.api.exception.SubscriptionException; -import org.apache.iotdb.subscription.api.strategy.disorder.DisorderHandlingStrategy; -import org.apache.iotdb.subscription.api.strategy.topic.TopicsStrategy; - -public class SubscriptionConfiguration { - - private String host; - private Integer port; - private String username; - private String password; - private String group; - private DisorderHandlingStrategy disorderHandlingStrategy; - private TopicsStrategy topicStrategy; - - private SubscriptionConfiguration() { - // allowed to be constructed by builder - } - - private void check() throws SubscriptionException { - if (host == null) { - throw new SubscriptionException("Host is not set!"); - } - if (port == null) { - throw new SubscriptionException("Port is not set!"); - } - if (username == null) { - throw new SubscriptionException("Username is not set!"); - } - if (password == null) { - throw new SubscriptionException("Password is not set!"); - } - if (group == null) { - throw new SubscriptionException("Group is not set!"); - } - - if (disorderHandlingStrategy == null) { - throw new SubscriptionException("WatermarkStrategy is not set!"); - } - disorderHandlingStrategy.check(); - - if (topicStrategy == null) { - throw new SubscriptionException("TopicStrategy is not set!"); - } - topicStrategy.check(); - } - - public static class Builder { - - private final SubscriptionConfiguration subscriptionConfiguration; - - public Builder() { - subscriptionConfiguration = new SubscriptionConfiguration(); - } - - public Builder host(String host) { - subscriptionConfiguration.host = host; - return this; - } - - public Builder port(int port) { - subscriptionConfiguration.port = port; - return this; - } - - public Builder username(String username) { - subscriptionConfiguration.username = username; - return this; - } - - public Builder password(String password) { - subscriptionConfiguration.password = password; - return this; - } - - public Builder group(String group) { - subscriptionConfiguration.group = group; - return this; - } - - public Builder disorderHandlingStrategy(DisorderHandlingStrategy disorderHandlingStrategy) { - subscriptionConfiguration.disorderHandlingStrategy = disorderHandlingStrategy; - return this; - } - - public Builder topicStrategy(TopicsStrategy topicStrategy) { - subscriptionConfiguration.topicStrategy = topicStrategy; - return this; - } - - public SubscriptionConfiguration build() { - subscriptionConfiguration.check(); - return subscriptionConfiguration; - } - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionFactory.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionFactory.java deleted file mode 100644 index 3da98245d6ac..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/SubscriptionFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.iotdb.subscription.api; - -import org.apache.iotdb.subscription.api.consumer.pull.PullConsumer; -import org.apache.iotdb.subscription.api.consumer.push.PushConsumer; -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -public interface SubscriptionFactory { - - /** - * Create a push consumer. - * - * @param subscriptionConfiguration subscription configuration - * @return push consumer - * @throws SubscriptionException if the subscription configuration is not valid - */ - PushConsumer createPushConsumer(SubscriptionConfiguration subscriptionConfiguration) - throws SubscriptionException; - - /** - * Create a pull consumer. - * - * @param subscriptionConfiguration subscription configuration - * @return pull consumer - * @throws SubscriptionException if the subscription configuration is not valid - */ - PullConsumer createPullConsumer(SubscriptionConfiguration subscriptionConfiguration) - throws SubscriptionException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/Consumer.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/Consumer.java deleted file mode 100644 index 7ae0cf782855..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/Consumer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.iotdb.subscription.api.consumer; - -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -import java.util.List; - -public interface Consumer extends AutoCloseable { - - /** - * Open the subscription. - * - * @throws SubscriptionException if the subscription cannot be opened - */ - void openSubscription() throws SubscriptionException; - - /** - * Close the subscription. - * - * @throws SubscriptionException if the subscription cannot be closed - */ - void closeSubscription() throws SubscriptionException; - - /** - * Check if the subscription is closed. - * - * @return true if the subscription is closed, false otherwise - */ - boolean isClosed(); - - /** - * Get the consumer group of the subscription. - * - * @return the consumer group - * @throws SubscriptionException if the consumer group cannot be retrieved - */ - String consumerGroup() throws SubscriptionException; - - /** - * Get the topics of the subscription. - * - * @return the topics - * @throws SubscriptionException if the topics cannot be retrieved - */ - List subscription() throws SubscriptionException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/pull/PullConsumer.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/pull/PullConsumer.java deleted file mode 100644 index ebc7e9e83e28..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/pull/PullConsumer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.iotdb.subscription.api.consumer.pull; - -import org.apache.iotdb.subscription.api.consumer.Consumer; -import org.apache.iotdb.subscription.api.dataset.SubscriptionDataSet; -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -import java.util.List; - -public interface PullConsumer extends Consumer { - - /** - * Poll data from the subscription server. - * - * @param timeoutInMs timeout in milliseconds. If no data arrives in the given time, return null. - * @return a list of SubscriptionDataSets - * @throws SubscriptionException if any error occurs - */ - List poll(long timeoutInMs) throws SubscriptionException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/DataArrivalListener.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/DataArrivalListener.java deleted file mode 100644 index cd4aee24898a..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/DataArrivalListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.iotdb.subscription.api.consumer.push; - -import org.apache.iotdb.subscription.api.dataset.SubscriptionDataSet; -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -import java.util.List; - -@FunctionalInterface -public interface DataArrivalListener { - - /** - * Called when data arrives in the subscription. - * - * @param subscriptionDataSets the data - * @throws SubscriptionException if the data cannot be handled - */ - void onDataArrival(List subscriptionDataSets) throws SubscriptionException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/ExceptionListener.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/ExceptionListener.java deleted file mode 100644 index 108e7d66145d..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/ExceptionListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.iotdb.subscription.api.consumer.push; - -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -@FunctionalInterface -public interface ExceptionListener { - - /** - * Called when an exception occurs in the subscription. - * - * @param subscriptionException the exception - * @throws SubscriptionException if the exception cannot be handled - */ - void onException(SubscriptionException subscriptionException) throws SubscriptionException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/PushConsumer.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/PushConsumer.java deleted file mode 100644 index c8a4d358010f..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/consumer/push/PushConsumer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.iotdb.subscription.api.consumer.push; - -import org.apache.iotdb.subscription.api.consumer.Consumer; -import org.apache.iotdb.subscription.api.exception.SubscriptionException; - -public interface PushConsumer extends Consumer { - - /** - * Register a listener to listen to the data arrival. The method should be called before the - * consumer is started. The DataArrivalListener can NOT be changed once the consumer is started. - * - * @param listener the listener to listen to the data arrival. - * @throws SubscriptionException if the listener cannot be registered. Mainly because the - * PushConsumer is running. - */ - void registerDataArrivalListener(DataArrivalListener listener) throws SubscriptionException; - - /** - * Register a listener to listen to the exception. The method should be called before the consumer - * is started. The ExceptionListener can NOT be changed once the consumer is started. - * - * @param listener the listener to listen to the exception. - * @throws SubscriptionException if the listener cannot be registered. Mainly because the - * PushConsumer is running. - */ - void registerExceptionListener(ExceptionListener listener) throws SubscriptionException; - - /** - * Start the consumer to listen to the data. If the consumer is already listening, do nothing. - * - * @throws SubscriptionException if the consumer cannot start, e.g. the DataArrivalListener is not - * registered or the ExceptionListener is not registered. - */ - void start() throws SubscriptionException; - - /** - * Stop the consumer to listen to the data. If the consumer is not listening, do nothing. - * - * @throws SubscriptionException if the consumer cannot stop. - */ - void stop() throws SubscriptionException; - - /** - * Check if the consumer is listening to the data. - * - * @return true if the consumer is listening to the data, false otherwise. - */ - boolean isListening(); -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/dataset/SubscriptionDataSet.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/dataset/SubscriptionDataSet.java deleted file mode 100644 index 019219289878..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/dataset/SubscriptionDataSet.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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.iotdb.subscription.api.dataset; - -public interface SubscriptionDataSet {} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionException.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionException.java deleted file mode 100644 index 3cb660c24cb7..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.iotdb.subscription.api.exception; - -public class SubscriptionException extends RuntimeException { - - public SubscriptionException(String message) { - super(message); - } - - public SubscriptionException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionStrategyNotValidException.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionStrategyNotValidException.java deleted file mode 100644 index 171f6c95a6d7..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/exception/SubscriptionStrategyNotValidException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.iotdb.subscription.api.exception; - -public class SubscriptionStrategyNotValidException extends SubscriptionException { - - public SubscriptionStrategyNotValidException(String message) { - super(message); - } - - public SubscriptionStrategyNotValidException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/SubscriptionStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/SubscriptionStrategy.java deleted file mode 100644 index 57352c95818b..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/SubscriptionStrategy.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy; - -import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidException; - -/** Subscription strategy interface. */ -public interface SubscriptionStrategy { - - /** - * Check if the strategy is valid. - * - * @throws SubscriptionStrategyNotValidException if invalid strategy is set - */ - void check() throws SubscriptionStrategyNotValidException; -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/DisorderHandlingStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/DisorderHandlingStrategy.java deleted file mode 100644 index 57faca6f8975..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/DisorderHandlingStrategy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.disorder; - -import org.apache.iotdb.subscription.api.strategy.SubscriptionStrategy; - -public abstract class DisorderHandlingStrategy implements SubscriptionStrategy { - - protected final long watermark; - - protected DisorderHandlingStrategy(long watermark) { - this.watermark = watermark; - } - - public long getWatermark() { - return watermark; - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/IntolerableStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/IntolerableStrategy.java deleted file mode 100644 index 6ea3ccf52af0..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/IntolerableStrategy.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.disorder; - -import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidException; - -public class IntolerableStrategy extends DisorderHandlingStrategy { - - protected IntolerableStrategy() { - super(0); - } - - @Override - public void check() throws SubscriptionStrategyNotValidException { - // do nothing - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/WatermarkStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/WatermarkStrategy.java deleted file mode 100644 index 7af3fc5ac3db..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/disorder/WatermarkStrategy.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.disorder; - -import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidException; - -public class WatermarkStrategy extends DisorderHandlingStrategy { - - public WatermarkStrategy(long watermark) { - super(watermark); - } - - @Override - public void check() throws SubscriptionStrategyNotValidException { - if (watermark < 0) { - throw new SubscriptionStrategyNotValidException("watermark should be a non-negative number!"); - } - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/MultipleConnectionStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/MultipleConnectionStrategy.java deleted file mode 100644 index 18af9687f2cd..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/MultipleConnectionStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.topic; - -import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidException; -import org.apache.iotdb.tsfile.read.common.parser.PathNodesGenerator; - -import org.antlr.v4.runtime.misc.ParseCancellationException; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class MultipleConnectionStrategy implements TopicsStrategy { - - private final List topics; - - public MultipleConnectionStrategy(List topics) { - this.topics = topics; - } - - public MultipleConnectionStrategy(String... topics) { - this.topics = new ArrayList<>(); - this.topics.addAll(Arrays.asList(topics)); - } - - public List getTopics() { - return topics; - } - - @Override - public void check() throws SubscriptionStrategyNotValidException { - if (topics == null || topics.isEmpty()) { - throw new SubscriptionStrategyNotValidException("topics are not set!"); - } - topics.forEach( - topic -> { - try { - PathNodesGenerator.checkPath(topic); - } catch (ParseCancellationException e) { - throw new SubscriptionStrategyNotValidException( - String.format("%s is not a legal path pattern!", topic), e); - } - }); - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/SingleTopicStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/SingleTopicStrategy.java deleted file mode 100644 index 07ec534a1295..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/SingleTopicStrategy.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.topic; - -import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidException; -import org.apache.iotdb.tsfile.read.common.parser.PathNodesGenerator; - -import org.antlr.v4.runtime.misc.ParseCancellationException; -import org.apache.commons.lang3.StringUtils; - -public class SingleTopicStrategy implements TopicsStrategy { - - private final String topic; - - public SingleTopicStrategy(String topic) { - this.topic = topic; - } - - public String getTopic() { - return topic; - } - - @Override - public void check() throws SubscriptionStrategyNotValidException { - if (StringUtils.isAllBlank(topic)) { - throw new SubscriptionStrategyNotValidException("topic is not set!"); - } - try { - PathNodesGenerator.checkPath(topic); - } catch (ParseCancellationException e) { - throw new SubscriptionStrategyNotValidException( - String.format("%s is not a legal path pattern", topic), e); - } - } -} diff --git a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/TopicsStrategy.java b/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/TopicsStrategy.java deleted file mode 100644 index 6826ca5149a7..000000000000 --- a/iotdb-api/subscription-api/src/main/java/org/apache/iotdb/subscription/api/strategy/topic/TopicsStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.iotdb.subscription.api.strategy.topic; - -import org.apache.iotdb.subscription.api.strategy.SubscriptionStrategy; - -public interface TopicsStrategy extends SubscriptionStrategy {} diff --git a/pom.xml b/pom.xml index 35142508c0ce..92e2d02eec8c 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,6 @@ iotdb-client/isession iotdb-core/mlnode iotdb-api/pipe-api - iotdb-api/subscription-api