This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new ab716056ac feat: Add adapter API to StreamPipes client (#3658)
ab716056ac is described below
commit ab716056acdfbfa6a303c26fb2abf0ba75ee19e5
Author: Dominik Riemer <[email protected]>
AuthorDate: Wed Jun 11 08:23:18 2025 +0200
feat: Add adapter API to StreamPipes client (#3658)
---
.../apache/streampipes/client/api/IAdapterApi.java | 54 +++++++++++++
.../streampipes/client/api/IStreamPipesClient.java | 2 +
.../streampipes/client/StreamPipesClient.java | 7 ++
.../apache/streampipes/client/api/AdapterApi.java | 88 ++++++++++++++++++++++
4 files changed, 151 insertions(+)
diff --git
a/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IAdapterApi.java
b/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IAdapterApi.java
new file mode 100644
index 0000000000..6a60f2d049
--- /dev/null
+++
b/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IAdapterApi.java
@@ -0,0 +1,54 @@
+/*
+ * 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.streampipes.client.api;
+
+import org.apache.streampipes.model.connect.adapter.AdapterDescription;
+import org.apache.streampipes.model.message.SuccessMessage;
+
+public interface IAdapterApi extends CRUDApi<String, AdapterDescription> {
+
+ /**
+ * Starts the adapter with the given elementId.
+ * @param elementId The elementId of the adapter to start
+ * @return a {@link SuccessMessage} indicating the success of the operation
+ */
+ SuccessMessage start(String elementId);
+
+ /**
+ * Stops the adapter with the given elementId.
+ * @param elementId The elementId of the adapter to stop
+ * @return a {@link SuccessMessage} indicating the success of the operation
+ */
+ SuccessMessage stop(String elementId);
+
+ /**
+ * Starts the given adapter.
+ * @param element The adapter to start
+ * @return a {@link SuccessMessage} indicating the success of the operation
+ */
+ SuccessMessage start(AdapterDescription element);
+
+ /**
+ * Stops the given adapter.
+ * @param element The adapter to stop
+ * @return a {@link SuccessMessage} indicating the success of the operation
+ */
+ SuccessMessage stop(AdapterDescription element);
+
+}
diff --git
a/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IStreamPipesClient.java
b/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IStreamPipesClient.java
index 70d5200ed2..ac8df164ca 100644
---
a/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IStreamPipesClient.java
+++
b/streampipes-client-api/src/main/java/org/apache/streampipes/client/api/IStreamPipesClient.java
@@ -40,6 +40,8 @@ public interface IStreamPipesClient extends Serializable {
IPipelineElementTemplateApi pipelineElementTemplates();
+ IAdapterApi adapters();
+
IDataSinkApi sinks();
IDataStreamApi streams();
diff --git
a/streampipes-client/src/main/java/org/apache/streampipes/client/StreamPipesClient.java
b/streampipes-client/src/main/java/org/apache/streampipes/client/StreamPipesClient.java
index 0c7e41ca99..b9c6543760 100644
---
a/streampipes-client/src/main/java/org/apache/streampipes/client/StreamPipesClient.java
+++
b/streampipes-client/src/main/java/org/apache/streampipes/client/StreamPipesClient.java
@@ -17,6 +17,7 @@
*/
package org.apache.streampipes.client;
+import org.apache.streampipes.client.api.AdapterApi;
import org.apache.streampipes.client.api.AdminApi;
import org.apache.streampipes.client.api.CustomRequestApi;
import org.apache.streampipes.client.api.DataLakeMeasureApi;
@@ -24,6 +25,7 @@ import org.apache.streampipes.client.api.DataProcessorApi;
import org.apache.streampipes.client.api.DataSinkApi;
import org.apache.streampipes.client.api.DataStreamApi;
import org.apache.streampipes.client.api.FileApi;
+import org.apache.streampipes.client.api.IAdapterApi;
import org.apache.streampipes.client.api.IAdminApi;
import org.apache.streampipes.client.api.ICustomRequestApi;
import org.apache.streampipes.client.api.IPipelineElementTemplateApi;
@@ -158,6 +160,11 @@ public class StreamPipesClient implements
return new PipelineElementTemplateApi(config);
}
+ @Override
+ public IAdapterApi adapters() {
+ return new AdapterApi(config);
+ }
+
/**
* Get API to work with data sinks
*
diff --git
a/streampipes-client/src/main/java/org/apache/streampipes/client/api/AdapterApi.java
b/streampipes-client/src/main/java/org/apache/streampipes/client/api/AdapterApi.java
new file mode 100644
index 0000000000..2d1b3120f5
--- /dev/null
+++
b/streampipes-client/src/main/java/org/apache/streampipes/client/api/AdapterApi.java
@@ -0,0 +1,88 @@
+/*
+ * 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.streampipes.client.api;
+
+import org.apache.streampipes.client.model.StreamPipesClientConfig;
+import org.apache.streampipes.client.util.StreamPipesApiPath;
+import org.apache.streampipes.model.connect.adapter.AdapterDescription;
+import org.apache.streampipes.model.message.SuccessMessage;
+
+import java.util.List;
+import java.util.Optional;
+
+public class AdapterApi extends AbstractTypedClientApi<AdapterDescription>
+ implements IAdapterApi {
+
+ public AdapterApi(StreamPipesClientConfig clientConfig) {
+ super(clientConfig, AdapterDescription.class);
+ }
+
+ @Override
+ protected StreamPipesApiPath getBaseResourcePath() {
+ return StreamPipesApiPath.fromBaseApiPath()
+ .addToPath("connect")
+ .addToPath("master")
+ .addToPath("adapters");
+ }
+
+ @Override
+ public Optional<AdapterDescription> get(String elementId) {
+ return getSingle(getBaseResourcePath().addToPath(elementId));
+ }
+
+ @Override
+ public List<AdapterDescription> all() {
+ return getAll(getBaseResourcePath());
+ }
+
+ @Override
+ public void create(AdapterDescription element) {
+ post(getBaseResourcePath(), element);
+ }
+
+ @Override
+ public void delete(String id) {
+ delete(getBaseResourcePath().addToPath(id), SuccessMessage.class);
+ }
+
+ @Override
+ public void update(AdapterDescription element) {
+ put(getBaseResourcePath().addToPath(element.getElementId()), element);
+ }
+
+ @Override
+ public SuccessMessage start(String elementId) {
+ return post(getBaseResourcePath().addToPath(elementId).addToPath("start"),
SuccessMessage.class);
+ }
+
+ @Override
+ public SuccessMessage start(AdapterDescription adapter) {
+ return start(adapter.getElementId());
+ }
+
+ @Override
+ public SuccessMessage stop(AdapterDescription adapter) {
+ return stop(adapter.getElementId());
+ }
+
+ @Override
+ public SuccessMessage stop(String elementId) {
+ return post(getBaseResourcePath().addToPath(elementId).addToPath("stop"),
SuccessMessage.class);
+ }
+}