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 6bee187229c545efb10b73819a935dc68553f8f3
Author: Philipp Zehnder <[email protected]>
AuthorDate: Thu Feb 12 21:16:32 2026 +0100

    refactor(#4172): introduce IUserGroupStorage and migrate 
getUserGroupStorage to typed interface
---
 .../rest/impl/admin/UserGroupResource.java         |  4 +--
 .../service/core/oauth2/UserService.java           | 11 ++++----
 .../streampipes/storage/api/INoSqlStorage.java     |  3 +-
 .../streampipes/storage/api/IUserGroupStorage.java | 23 +++++++++++++++
 .../storage/couchdb/CouchDbStorageManager.java     | 11 +++-----
 .../storage/couchdb/impl/UserGroupStorageImpl.java | 33 ++++++++++++++++++++++
 6 files changed, 69 insertions(+), 16 deletions(-)

diff --git 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
index 63ec62f810..09514715b0 100644
--- 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
+++ 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
@@ -22,7 +22,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.IUserGroupStorage;
 
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -88,7 +88,7 @@ public class UserGroupResource extends 
AbstractAuthGuardedRestResource {
     }
   }
 
-  private CRUDStorage<Group> getUserGroupStorage() {
+  private IUserGroupStorage getUserGroupStorage() {
     return getNoSqlStorage().getUserGroupStorage();
   }
 }
diff --git 
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/oauth2/UserService.java
 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/oauth2/UserService.java
index a692e3a503..cda9f0c054 100755
--- 
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/oauth2/UserService.java
+++ 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/oauth2/UserService.java
@@ -24,10 +24,11 @@ import 
org.apache.streampipes.commons.environment.model.OAuthConfiguration;
 import org.apache.streampipes.model.client.user.Group;
 import org.apache.streampipes.model.client.user.Role;
 import org.apache.streampipes.model.client.user.UserAccount;
-import org.apache.streampipes.resource.management.UserResourceManager;
-import 
org.apache.streampipes.rest.security.OAuth2AuthenticationProcessingException;
-import org.apache.streampipes.storage.api.CRUDStorage;
-import org.apache.streampipes.storage.api.IUserStorage;
+import org.apache.streampipes.resource.management.UserResourceManager;
+import 
org.apache.streampipes.rest.security.OAuth2AuthenticationProcessingException;
+import org.apache.streampipes.storage.api.CRUDStorage;
+import org.apache.streampipes.storage.api.IUserGroupStorage;
+import org.apache.streampipes.storage.api.IUserStorage;
 import org.apache.streampipes.storage.management.StorageDispatcher;
 
 import org.slf4j.Logger;
@@ -48,7 +49,7 @@ public class UserService {
 
   private final IUserStorage userStorage;
   private final CRUDStorage<Role> roleStorage;
-  private final CRUDStorage<Group> groupStorage;
+  private final IUserGroupStorage groupStorage;
   private final Environment env;
   private List<Role> allRoles;
   private List<Group> allGroups;
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 69ed51898b..309f4e02d6 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
@@ -18,7 +18,6 @@
 package org.apache.streampipes.storage.api;
 
 import org.apache.streampipes.model.assets.SpAssetModel;
-import org.apache.streampipes.model.client.user.Group;
 import org.apache.streampipes.model.client.user.PasswordRecoveryToken;
 import org.apache.streampipes.model.client.user.Privilege;
 import org.apache.streampipes.model.client.user.Role;
@@ -42,7 +41,7 @@ public interface INoSqlStorage {
 
   IImageStorage getImageStorage();
 
-  CRUDStorage<Group> getUserGroupStorage();
+  IUserGroupStorage getUserGroupStorage();
 
   IPipelineStorage getPipelineStorageAPI();
 
diff --git 
a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserGroupStorage.java
 
b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserGroupStorage.java
new file mode 100644
index 0000000000..9fcf054f0c
--- /dev/null
+++ 
b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserGroupStorage.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.client.user.Group;
+
+public interface IUserGroupStorage extends CRUDStorage<Group> {
+}
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 b8d8a05eb4..a453802fc5 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
@@ -18,7 +18,6 @@
 package org.apache.streampipes.storage.couchdb;
 
 import org.apache.streampipes.model.assets.SpAssetModel;
-import org.apache.streampipes.model.client.user.Group;
 import org.apache.streampipes.model.client.user.PasswordRecoveryToken;
 import org.apache.streampipes.model.client.user.Privilege;
 import org.apache.streampipes.model.client.user.Role;
@@ -48,6 +47,7 @@ import 
org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
 import org.apache.streampipes.storage.api.IPipelineElementTemplateStorage;
 import org.apache.streampipes.storage.api.IPipelineStorage;
 import org.apache.streampipes.storage.api.ISpCoreConfigurationStorage;
+import org.apache.streampipes.storage.api.IUserGroupStorage;
 import org.apache.streampipes.storage.api.IUserStorage;
 import 
org.apache.streampipes.storage.couchdb.impl.AdapterDescriptionStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.AdapterInstanceStorageImpl;
@@ -66,6 +66,7 @@ import 
org.apache.streampipes.storage.couchdb.impl.PipelineCanvasMetadataStorage
 import 
org.apache.streampipes.storage.couchdb.impl.PipelineElementDescriptionStorageImpl;
 import 
org.apache.streampipes.storage.couchdb.impl.PipelineElementTemplateStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.PipelineStorageImpl;
+import org.apache.streampipes.storage.couchdb.impl.UserGroupStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.UserStorage;
 import org.apache.streampipes.storage.couchdb.utils.Utils;
 
@@ -92,12 +93,8 @@ public class CouchDbStorageManager implements INoSqlStorage {
   }
 
   @Override
-  public CRUDStorage<Group> getUserGroupStorage() {
-    return new DefaultViewCrudStorage<>(
-        Utils::getCouchDbUserClient,
-        Group.class,
-        "users/groups"
-    );
+  public IUserGroupStorage getUserGroupStorage() {
+    return new UserGroupStorageImpl();
   }
 
   @Override
diff --git 
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserGroupStorageImpl.java
 
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserGroupStorageImpl.java
new file mode 100644
index 0000000000..dc895ba6be
--- /dev/null
+++ 
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserGroupStorageImpl.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.client.user.Group;
+import org.apache.streampipes.storage.api.IUserGroupStorage;
+import org.apache.streampipes.storage.couchdb.utils.Utils;
+
+public class UserGroupStorageImpl extends DefaultViewCrudStorage<Group> 
implements IUserGroupStorage {
+
+  public UserGroupStorageImpl() {
+    super(
+        Utils::getCouchDbUserClient,
+        Group.class,
+        "users/groups"
+    );
+  }
+}

Reply via email to