You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/01/22 07:27:20 UTC
[isis] branch ISIS-2947 updated: ISIS-2947: adds dependency on spring-graphql ; adds skeleton WebModuleGraphql.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2947
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/ISIS-2947 by this push:
new d8bfc55 ISIS-2947: adds dependency on spring-graphql ; adds skeleton WebModuleGraphql.
d8bfc55 is described below
commit d8bfc55744e78109e0fbdb72b77979ab7defcd6a
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Jan 22 07:27:07 2022 +0000
ISIS-2947: adds dependency on spring-graphql ; adds skeleton WebModuleGraphql.
---
incubator/viewers/graphql/model/pom.xml | 4 ++
incubator/viewers/graphql/pom.xml | 28 ++++++++
incubator/viewers/graphql/viewer/pom.xml | 7 ++
.../viewer/IsisModuleIncViewerGraphqlViewer.java | 4 ++
.../graphql/viewer/webmodule/WebModuleGraphql.java | 82 ++++++++++++++++++++++
5 files changed, 125 insertions(+)
diff --git a/incubator/viewers/graphql/model/pom.xml b/incubator/viewers/graphql/model/pom.xml
index a12ebd9..f70a224 100644
--- a/incubator/viewers/graphql/model/pom.xml
+++ b/incubator/viewers/graphql/model/pom.xml
@@ -41,6 +41,10 @@
<artifactId>isis-viewer-graphql-applib</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.graphql</groupId>
+ <artifactId>spring-graphql</artifactId>
+ </dependency>
<!-- TEST DEPENDENCIES -->
diff --git a/incubator/viewers/graphql/pom.xml b/incubator/viewers/graphql/pom.xml
index b933a02..9161d64 100644
--- a/incubator/viewers/graphql/pom.xml
+++ b/incubator/viewers/graphql/pom.xml
@@ -69,6 +69,13 @@
<version>2.0.0-SNAPSHOT</version>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.graphql</groupId>
+ <artifactId>spring-graphql</artifactId>
+ <version>1.0.0-M5</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
@@ -78,4 +85,25 @@
<module>viewer</module>
</modules>
+ <repositories>
+ <repository>
+ <id>spring-milestones</id>
+ <name>Spring Milestones</name>
+ <url>https://repo.spring.io/milestone</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>spring-milestones</id>
+ <name>Spring Milestones</name>
+ <url>https://repo.spring.io/milestone</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
</project>
diff --git a/incubator/viewers/graphql/viewer/pom.xml b/incubator/viewers/graphql/viewer/pom.xml
index 02ab69f..f5bd885 100644
--- a/incubator/viewers/graphql/viewer/pom.xml
+++ b/incubator/viewers/graphql/viewer/pom.xml
@@ -30,10 +30,17 @@
</properties>
<dependencies>
+
<dependency>
<groupId>org.apache.isis.incubator.viewer</groupId>
<artifactId>isis-viewer-graphql-model</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-webapp</artifactId>
+ </dependency>
+
</dependencies>
diff --git a/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/IsisModuleIncViewerGraphqlViewer.java b/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/IsisModuleIncViewerGraphqlViewer.java
index 5bb067d..4e33f90 100644
--- a/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/IsisModuleIncViewerGraphqlViewer.java
+++ b/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/IsisModuleIncViewerGraphqlViewer.java
@@ -4,9 +4,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.apache.isis.viewer.graphql.model.IsisModuleIncViewerGraphqlModel;
+import org.apache.isis.viewer.graphql.viewer.webmodule.WebModuleGraphql;
@Configuration
@Import({
+ // @Service's
+ WebModuleGraphql.class,
+
// modules
IsisModuleIncViewerGraphqlModel.class
})
diff --git a/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/webmodule/WebModuleGraphql.java b/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/webmodule/WebModuleGraphql.java
new file mode 100644
index 0000000..9cbcafa
--- /dev/null
+++ b/incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/webmodule/WebModuleGraphql.java
@@ -0,0 +1,82 @@
+/*
+ * 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.isis.viewer.graphql.viewer.webmodule;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.annotation.PriorityPrecedence;
+import org.apache.isis.applib.services.inject.ServiceInjector;
+import org.apache.isis.commons.collections.Can;
+import org.apache.isis.core.config.IsisConfiguration;
+import org.apache.isis.core.webapp.modules.WebModuleAbstract;
+import org.apache.isis.core.webapp.modules.WebModuleContext;
+
+import lombok.Getter;
+import lombok.val;
+
+/**
+ * WebModule that provides the GraphQL Viewer.
+ *
+ * @since 2.0 {@index}
+ *
+ * @implNote CDI feels responsible to resolve injection points for any Servlet or Filter
+ * we register programmatically on the ServletContext.
+ * As long as injection points are considered to be resolved by Spring, we can workaround this fact:
+ * By replacing annotations {@code @Inject} with {@code @Autowire} for any Servlet or Filter,
+ * that get contributed by a WebModule, these will be ignored by CDI.
+ *
+ */
+@Service
+@Named("isis.viewer.graphql.WebModuleGraphql")
+@javax.annotation.Priority(PriorityPrecedence.MIDPOINT - 80)
+@Qualifier("Graphql")
+public final class WebModuleGraphql extends WebModuleAbstract {
+
+ private final IsisConfiguration isisConfiguration;
+
+ @Inject
+ public WebModuleGraphql(
+ final IsisConfiguration isisConfiguration,
+ final ServiceInjector serviceInjector) {
+ super(serviceInjector);
+ this.isisConfiguration = isisConfiguration;
+ }
+
+ @Getter
+ private final String name = "GraphQL";
+
+ @Override
+ public void prepare(WebModuleContext ctx) {
+ super.prepare(ctx);
+ }
+
+ @Override
+ public Can<ServletContextListener> init(ServletContext ctx) throws ServletException {
+ return Can.empty(); // registers no listeners
+ }
+
+
+}