This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch 4172-use-domain-storage-interfaces-instead-of-crudstorage-in-inosqlstorage in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 9d3102a49da51a0c639a32617612b9eca6d62101 Author: Philipp Zehnder <[email protected]> AuthorDate: Thu Feb 12 21:37:31 2026 +0100 refactor(#4172): introduce IExtensionsServiceConfigurationStorage and migrate getExtensionsServiceConfigurationStorage to typed interface --- .../impl/admin/ServiceConfigurationResource.java | 4 +-- .../IExtensionsServiceConfigurationStorage.java | 23 +++++++++++++++ .../streampipes/storage/api/INoSqlStorage.java | 3 +- .../storage/couchdb/CouchDbStorageManager.java | 10 +++---- .../ExtensionsServiceConfigurationStorageImpl.java | 33 ++++++++++++++++++++++ 5 files changed, 63 insertions(+), 10 deletions(-) diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ServiceConfigurationResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ServiceConfigurationResource.java index 378bc4e668..adb0f22aba 100644 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ServiceConfigurationResource.java +++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ServiceConfigurationResource.java @@ -23,7 +23,7 @@ import org.apache.streampipes.model.message.Notifications; import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource; import org.apache.streampipes.rest.security.AuthConstants; import org.apache.streampipes.rest.shared.exception.SpMessageException; -import org.apache.streampipes.storage.api.CRUDStorage; +import org.apache.streampipes.storage.api.IExtensionsServiceConfigurationStorage; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -44,7 +44,7 @@ import java.util.List; @PreAuthorize(AuthConstants.IS_ADMIN_ROLE) public class ServiceConfigurationResource extends AbstractAuthGuardedRestResource { - private final CRUDStorage<SpServiceConfiguration> extensionsServicesConfigStorage = + private final IExtensionsServiceConfigurationStorage extensionsServicesConfigStorage = getNoSqlStorage().getExtensionsServiceConfigurationStorage(); diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IExtensionsServiceConfigurationStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IExtensionsServiceConfigurationStorage.java new file mode 100644 index 0000000000..70b6b187c8 --- /dev/null +++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IExtensionsServiceConfigurationStorage.java @@ -0,0 +1,23 @@ +/* + * 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.storage.api; + +import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; + +public interface IExtensionsServiceConfigurationStorage extends CRUDStorage<SpServiceConfiguration> { +} diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java index 984b23f7b0..d0a324e067 100644 --- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java +++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java @@ -21,7 +21,6 @@ import org.apache.streampipes.model.assets.SpAssetModel; import org.apache.streampipes.model.client.user.Privilege; import org.apache.streampipes.model.client.user.Role; import org.apache.streampipes.model.connect.ConnectTransformationScriptTemplate; -import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; import org.apache.streampipes.model.opcua.Certificate; import org.apache.streampipes.model.template.CompactPipelineTemplate; @@ -71,7 +70,7 @@ public interface INoSqlStorage { IExtensionsServiceStorage getExtensionsServiceStorage(); - CRUDStorage<SpServiceConfiguration> getExtensionsServiceConfigurationStorage(); + IExtensionsServiceConfigurationStorage getExtensionsServiceConfigurationStorage(); ISpCoreConfigurationStorage getSpCoreConfigurationStorage(); diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java index 2f02099f5a..a55b4d6b79 100644 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java @@ -22,7 +22,6 @@ import org.apache.streampipes.model.client.user.Privilege; import org.apache.streampipes.model.client.user.Role; import org.apache.streampipes.model.connect.ConnectTransformationScriptTemplate; import org.apache.streampipes.model.datalake.DataLakeMeasure; -import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; import org.apache.streampipes.model.opcua.Certificate; import org.apache.streampipes.model.template.CompactPipelineTemplate; import org.apache.streampipes.storage.api.CRUDStorage; @@ -34,6 +33,7 @@ import org.apache.streampipes.storage.api.IDataProcessorStorage; import org.apache.streampipes.storage.api.IDataSinkStorage; import org.apache.streampipes.storage.api.IDataStreamStorage; import org.apache.streampipes.storage.api.IExtensionsServiceStorage; +import org.apache.streampipes.storage.api.IExtensionsServiceConfigurationStorage; import org.apache.streampipes.storage.api.IFileMetadataStorage; import org.apache.streampipes.storage.api.IGenericStorage; import org.apache.streampipes.storage.api.IImageStorage; @@ -61,6 +61,7 @@ import org.apache.streampipes.storage.couchdb.impl.DataStreamStorageImpl; import org.apache.streampipes.storage.couchdb.impl.DefaultCrudStorage; import org.apache.streampipes.storage.couchdb.impl.DefaultViewCrudStorage; import org.apache.streampipes.storage.couchdb.impl.ExtensionsServiceStorageImpl; +import org.apache.streampipes.storage.couchdb.impl.ExtensionsServiceConfigurationStorageImpl; import org.apache.streampipes.storage.couchdb.impl.GenericStorageImpl; import org.apache.streampipes.storage.couchdb.impl.FileMetadataStorageImpl; import org.apache.streampipes.storage.couchdb.impl.ImageStorageImpl; @@ -192,11 +193,8 @@ public class CouchDbStorageManager implements INoSqlStorage { } @Override - public CRUDStorage<SpServiceConfiguration> getExtensionsServiceConfigurationStorage() { - return new DefaultCrudStorage<>( - () -> Utils.getCouchDbGsonClient("extensions-services-configurations"), - SpServiceConfiguration.class - ); + public IExtensionsServiceConfigurationStorage getExtensionsServiceConfigurationStorage() { + return new ExtensionsServiceConfigurationStorageImpl(); } @Override diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ExtensionsServiceConfigurationStorageImpl.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ExtensionsServiceConfigurationStorageImpl.java new file mode 100644 index 0000000000..327df666cb --- /dev/null +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ExtensionsServiceConfigurationStorageImpl.java @@ -0,0 +1,33 @@ +/* + * 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.storage.couchdb.impl; + +import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; +import org.apache.streampipes.storage.api.IExtensionsServiceConfigurationStorage; +import org.apache.streampipes.storage.couchdb.utils.Utils; + +public class ExtensionsServiceConfigurationStorageImpl extends DefaultCrudStorage<SpServiceConfiguration> + implements IExtensionsServiceConfigurationStorage { + + public ExtensionsServiceConfigurationStorageImpl() { + super( + () -> Utils.getCouchDbGsonClient("extensions-services-configurations"), + SpServiceConfiguration.class + ); + } +}
