You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/12/30 10:24:39 UTC

[streampipes] 01/01: Provide extensions resource classes from a single configuration

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch SP-958
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 9c510a08b4130a5919d77304844ef1486d8491a1
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Fri Dec 30 11:24:25 2022 +0100

    Provide extensions resource classes from a single configuration
---
 .../init/AdapterServiceResourceProvider.java       | 44 -------------------
 .../init/AdapterWorkerContainerResourceConfig.java | 38 ----------------
 .../extensions/ExtensionsResourceConfig.java       | 51 ++++++++++++++++++----
 .../BaseExtensionsServiceResourceProvider.java     | 34 ---------------
 .../container/init/ExtensionsResourceProvider.java | 26 -----------
 .../PipelineElementServiceResourceProvider.java    | 39 -----------------
 6 files changed, 43 insertions(+), 189 deletions(-)

diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterServiceResourceProvider.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterServiceResourceProvider.java
deleted file mode 100644
index 1a3971d9c..000000000
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterServiceResourceProvider.java
+++ /dev/null
@@ -1,44 +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.streampipes.connect.container.worker.init;
-
-import org.apache.streampipes.connect.container.worker.rest.AdapterAssetResource;
-import org.apache.streampipes.connect.container.worker.rest.AdapterWorkerResource;
-import org.apache.streampipes.connect.container.worker.rest.GuessResource;
-import org.apache.streampipes.connect.container.worker.rest.HttpServerAdapterResource;
-import org.apache.streampipes.connect.container.worker.rest.RuntimeResolvableResource;
-import org.apache.streampipes.container.init.ExtensionsResourceProvider;
-
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class AdapterServiceResourceProvider implements ExtensionsResourceProvider {
-
-  @Override
-  public List<Class<?>> getResourceClasses() {
-    return Arrays.asList(
-        GuessResource.class,
-        RuntimeResolvableResource.class,
-        AdapterWorkerResource.class,
-        MultiPartFeature.class,
-        AdapterAssetResource.class,
-        HttpServerAdapterResource.class);
-  }
-}
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java
deleted file mode 100644
index 97e7f12e5..000000000
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.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.streampipes.connect.container.worker.init;
-
-import org.apache.streampipes.container.init.BaseExtensionsServiceResourceProvider;
-import org.apache.streampipes.service.base.rest.BaseResourceConfig;
-
-import org.springframework.stereotype.Component;
-
-import java.util.Arrays;
-import java.util.List;
-
-@Component
-public class AdapterWorkerContainerResourceConfig extends BaseResourceConfig {
-
-  @Override
-  public List<List<Class<?>>> getClassesToRegister() {
-    return Arrays.asList(
-        new BaseExtensionsServiceResourceProvider().getResourceClasses(),
-        new AdapterServiceResourceProvider().getResourceClasses());
-  }
-}
diff --git a/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsResourceConfig.java b/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsResourceConfig.java
index a75b0feac..c0d63688c 100644
--- a/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsResourceConfig.java
+++ b/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsResourceConfig.java
@@ -17,14 +17,23 @@
  */
 package org.apache.streampipes.container.extensions;
 
-import org.apache.streampipes.connect.container.worker.init.AdapterServiceResourceProvider;
-import org.apache.streampipes.container.init.BaseExtensionsServiceResourceProvider;
-import org.apache.streampipes.container.init.PipelineElementServiceResourceProvider;
+import org.apache.streampipes.connect.container.worker.rest.AdapterAssetResource;
+import org.apache.streampipes.connect.container.worker.rest.AdapterWorkerResource;
+import org.apache.streampipes.connect.container.worker.rest.GuessResource;
+import org.apache.streampipes.connect.container.worker.rest.HttpServerAdapterResource;
+import org.apache.streampipes.connect.container.worker.rest.RuntimeResolvableResource;
+import org.apache.streampipes.container.api.DataProcessorPipelineElementResource;
+import org.apache.streampipes.container.api.DataSinkPipelineElementResource;
+import org.apache.streampipes.container.api.DataStreamPipelineElementResource;
+import org.apache.streampipes.container.api.MonitoringResource;
+import org.apache.streampipes.container.api.PipelineTemplateResource;
+import org.apache.streampipes.container.api.WelcomePage;
+import org.apache.streampipes.rest.shared.serializer.JacksonSerializationProvider;
 import org.apache.streampipes.service.base.rest.BaseResourceConfig;
 
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
 import org.springframework.stereotype.Component;
 
-import java.util.Arrays;
 import java.util.List;
 
 @Component
@@ -32,9 +41,35 @@ public class ExtensionsResourceConfig extends BaseResourceConfig {
 
   @Override
   public List<List<Class<?>>> getClassesToRegister() {
-    return Arrays.asList(
-        new BaseExtensionsServiceResourceProvider().getResourceClasses(),
-        new AdapterServiceResourceProvider().getResourceClasses(),
-        new PipelineElementServiceResourceProvider().getResourceClasses());
+    return List.of(
+        getAdapterResourceClasses(),
+        getBaseResourceClasses(),
+        getPipelineElementResourceClasses()
+    );
+  }
+
+  private List<Class<?>> getAdapterResourceClasses() {
+    return List.of(
+        GuessResource.class,
+        RuntimeResolvableResource.class,
+        AdapterWorkerResource.class,
+        MultiPartFeature.class,
+        AdapterAssetResource.class,
+        HttpServerAdapterResource.class);
+  }
+
+  private List<Class<?>> getBaseResourceClasses() {
+    return List.of(
+        JacksonSerializationProvider.class,
+        MonitoringResource.class);
+  }
+
+  private List<Class<?>> getPipelineElementResourceClasses() {
+    return List.of(
+        DataSinkPipelineElementResource.class,
+        DataProcessorPipelineElementResource.class,
+        DataStreamPipelineElementResource.class,
+        WelcomePage.class,
+        PipelineTemplateResource.class);
   }
 }
diff --git a/streampipes-container/src/main/java/org/apache/streampipes/container/init/BaseExtensionsServiceResourceProvider.java b/streampipes-container/src/main/java/org/apache/streampipes/container/init/BaseExtensionsServiceResourceProvider.java
deleted file mode 100644
index 5a604bf78..000000000
--- a/streampipes-container/src/main/java/org/apache/streampipes/container/init/BaseExtensionsServiceResourceProvider.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.streampipes.container.init;
-
-import org.apache.streampipes.container.api.MonitoringResource;
-import org.apache.streampipes.rest.shared.serializer.JacksonSerializationProvider;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class BaseExtensionsServiceResourceProvider implements ExtensionsResourceProvider {
-
-  @Override
-  public List<Class<?>> getResourceClasses() {
-    return Arrays.asList(
-        JacksonSerializationProvider.class,
-        MonitoringResource.class);
-  }
-}
diff --git a/streampipes-container/src/main/java/org/apache/streampipes/container/init/ExtensionsResourceProvider.java b/streampipes-container/src/main/java/org/apache/streampipes/container/init/ExtensionsResourceProvider.java
deleted file mode 100644
index 696e7092e..000000000
--- a/streampipes-container/src/main/java/org/apache/streampipes/container/init/ExtensionsResourceProvider.java
+++ /dev/null
@@ -1,26 +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.streampipes.container.init;
-
-import java.util.List;
-
-public interface ExtensionsResourceProvider {
-
-  List<Class<?>> getResourceClasses();
-
-}
diff --git a/streampipes-container/src/main/java/org/apache/streampipes/container/init/PipelineElementServiceResourceProvider.java b/streampipes-container/src/main/java/org/apache/streampipes/container/init/PipelineElementServiceResourceProvider.java
deleted file mode 100644
index da7e09251..000000000
--- a/streampipes-container/src/main/java/org/apache/streampipes/container/init/PipelineElementServiceResourceProvider.java
+++ /dev/null
@@ -1,39 +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.streampipes.container.init;
-
-import org.apache.streampipes.container.api.DataProcessorPipelineElementResource;
-import org.apache.streampipes.container.api.DataSinkPipelineElementResource;
-import org.apache.streampipes.container.api.DataStreamPipelineElementResource;
-import org.apache.streampipes.container.api.PipelineTemplateResource;
-import org.apache.streampipes.container.api.WelcomePage;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class PipelineElementServiceResourceProvider implements ExtensionsResourceProvider {
-  @Override
-  public List<Class<?>> getResourceClasses() {
-    return Arrays.asList(
-        DataSinkPipelineElementResource.class,
-        DataProcessorPipelineElementResource.class,
-        DataStreamPipelineElementResource.class,
-        WelcomePage.class,
-        PipelineTemplateResource.class);
-  }
-}