You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by GitBox <gi...@apache.org> on 2022/01/25 06:26:19 UTC

[GitHub] [isis] andi-huber opened a new pull request #841: GraphQL Initial Scuffolding

andi-huber opened a new pull request #841:
URL: https://github.com/apache/isis/pull/841


   New GraphQL Viewer (Incubator) based on Spring for GraphQL 1.0.0-M5+
   https://spring.io/blog/2022/01/19/spring-for-graphql-1-0-0-m5-released


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791405310



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlCorsProperties.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2012-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.PropertyMapper;
+import org.springframework.boot.convert.DurationUnit;
+import org.springframework.lang.Nullable;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.cors.CorsConfiguration;
+
+/**
+ * Configuration properties for GraphQL endpoint's CORS support.
+ *
+ * @author Andy Wilkinson
+ * @author Brian Clozel

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791405961



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlSourceBuilderCustomizer.java
##########
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import org.springframework.graphql.execution.GraphQlSource;
+
+/**
+ * Callback interface that can be implemented by beans wishing to customize properties of
+ * {@link org.springframework.graphql.execution.GraphQlSource.Builder} whilst retaining
+ * default auto-configuration.
+ *
+ * @author Rossen Stoyanchev

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791406225



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlWebMvcAutoConfiguration.java
##########
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.websocket.server.ServerContainer;
+
+import graphql.GraphQL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.graphql.GraphQlService;
+import org.springframework.graphql.execution.GraphQlSource;
+import org.springframework.graphql.execution.ThreadLocalAccessor;
+import org.springframework.graphql.web.WebGraphQlHandler;
+import org.springframework.graphql.web.WebInterceptor;
+import org.springframework.graphql.web.webmvc.GraphQlHttpHandler;
+import org.springframework.graphql.web.webmvc.GraphQlWebSocketHandler;
+import org.springframework.graphql.web.webmvc.GraphiQlHandler;
+import org.springframework.graphql.web.webmvc.SchemaHandler;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.GenericHttpMessageConverter;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.servlet.HandlerMapping;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.function.RequestPredicates;
+import org.springframework.web.servlet.function.RouterFunction;
+import org.springframework.web.servlet.function.RouterFunctions;
+import org.springframework.web.servlet.function.ServerResponse;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
+import org.springframework.web.socket.server.support.WebSocketHandlerMapping;
+import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
+
+/**
+ * {@link EnableAutoConfiguration Auto-configuration} for enabling Spring GraphQL over
+ * Spring MVC.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791395929



##########
File path: core/metamodel/src/main/java/org/apache/isis/core/metamodel/methods/DomainIncludeAnnotationEnforcesMetamodelContributionValidator.java
##########
@@ -127,13 +127,20 @@ public void validate(final ObjectSpecification spec) {
                     .collect(Collectors.joining("; "));
 
             //FIXME[ISIS-2774] - update message to a more generic one
+

Review comment:
       meanwhile fixed in 'master'




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791395227



##########
File path: .run/DemoAppWicketJdo.run.xml
##########
@@ -0,0 +1,9 @@
+<component name="ProjectRunConfigurationManager">

Review comment:
       I guess we need to add .run entry with gitignore




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791405028



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/source/ExecutionStrategyResolvingWithinInteraction.java
##########
@@ -0,0 +1,35 @@
+package org.apache.isis.viewer.graphql.viewer.source;
+
+import java.util.concurrent.CompletableFuture;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.iactnlayer.InteractionService;
+
+import lombok.RequiredArgsConstructor;
+
+import graphql.execution.AsyncExecutionStrategy;
+import graphql.execution.ExecutionContext;
+import graphql.execution.ExecutionStrategyParameters;
+import graphql.execution.FieldValueInfo;
+
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Inject})
+public class ExecutionStrategyResolvingWithinInteraction extends AsyncExecutionStrategy {
+
+    private final InteractionService interactionService;
+
+    @Override
+    protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
+
+        interactionService.openInteraction();

Review comment:
       use rather ..
   ```
   interactionService.runAnonymous(()->{
   ...
   });
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791395227



##########
File path: .run/DemoAppWicketJdo.run.xml
##########
@@ -0,0 +1,9 @@
+<component name="ProjectRunConfigurationManager">

Review comment:
       I guess we need to add .run entry with gitignore

##########
File path: .run/DemoAppWicketJdo.run.xml
##########
@@ -0,0 +1,9 @@
+<component name="ProjectRunConfigurationManager">

Review comment:
       I guess we need to add a `.run` entry with` gitignore`

##########
File path: core/metamodel/src/main/java/org/apache/isis/core/metamodel/methods/DomainIncludeAnnotationEnforcesMetamodelContributionValidator.java
##########
@@ -127,13 +127,20 @@ public void validate(final ObjectSpecification spec) {
                     .collect(Collectors.joining("; "));
 
             //FIXME[ISIS-2774] - update message to a more generic one
+

Review comment:
       meanwhile fixed in 'master'

##########
File path: core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationCacheDefault.java
##########
@@ -100,7 +102,9 @@ public void forEach(Consumer<T> onSpec, boolean shouldRunConcurrent) {
         if(shouldRunConcurrent) {
             vList.forEachParallel(onSpec);
         } else {
-            vList.forEach(onSpec);
+            vList
+                .stream().sorted(Comparator.comparing(HasLogicalType::getLogicalTypeName))

Review comment:
       Is there a need for sorting? Or is it a debugging thing.

##########
File path: examples/demo/wicket/jdo/src/main/java/demoapp/webapp/wicket/jdo/DemoAppWicketJdo.java
##########
@@ -78,10 +78,15 @@ public static void main(final String[] args) {
     	IsisPresets.prototyping();
         //IsisPresets.logging(WebRequestCycleForIsis.class, "debug");
 
-        System.setProperty("spring.profiles.active", "demo-jdo");
+        System.setProperty("spring.profiles.active", preservingAnyExisting("demo-jdo"));

Review comment:
       logic for adding a spring profile, could be refactored into a common (shared) utility;
   eg. package `org.apache.isis.core.config.util`

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlAutoConfiguration.java
##########
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import graphql.GraphQL;
+import graphql.execution.instrumentation.Instrumentation;
+import graphql.schema.idl.RuntimeWiring;
+import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.format.support.DefaultFormattingConversionService;
+import org.springframework.graphql.GraphQlService;
+import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
+import org.springframework.graphql.execution.BatchLoaderRegistry;
+import org.springframework.graphql.execution.DataFetcherExceptionResolver;
+import org.springframework.graphql.execution.DefaultBatchLoaderRegistry;
+import org.springframework.graphql.execution.ExecutionGraphQlService;
+import org.springframework.graphql.execution.GraphQlSource;
+import org.springframework.graphql.execution.MissingSchemaException;
+import org.springframework.graphql.execution.RuntimeWiringConfigurer;
+
+/**
+ * {@link EnableAutoConfiguration Auto-configuration} for creating a Spring GraphQL base
+ * infrastructure.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/source/ExecutionStrategyResolvingWithinInteraction.java
##########
@@ -0,0 +1,35 @@
+package org.apache.isis.viewer.graphql.viewer.source;
+
+import java.util.concurrent.CompletableFuture;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.iactnlayer.InteractionService;
+
+import lombok.RequiredArgsConstructor;
+
+import graphql.execution.AsyncExecutionStrategy;
+import graphql.execution.ExecutionContext;
+import graphql.execution.ExecutionStrategyParameters;
+import graphql.execution.FieldValueInfo;
+
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Inject})
+public class ExecutionStrategyResolvingWithinInteraction extends AsyncExecutionStrategy {
+
+    private final InteractionService interactionService;
+
+    @Override
+    protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
+
+        interactionService.openInteraction();

Review comment:
       use rather ..
   ```
   interactionService.runAnonymous(()->{
   ...
   });
   ```

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlCorsProperties.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2012-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.PropertyMapper;
+import org.springframework.boot.convert.DurationUnit;
+import org.springframework.lang.Nullable;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.cors.CorsConfiguration;
+
+/**
+ * Configuration properties for GraphQL endpoint's CORS support.
+ *
+ * @author Andy Wilkinson
+ * @author Brian Clozel

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlProperties.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.time.Duration;
+import java.util.Arrays;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * {@link ConfigurationProperties properties} for Spring GraphQL.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlSourceBuilderCustomizer.java
##########
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import org.springframework.graphql.execution.GraphQlSource;
+
+/**
+ * Callback interface that can be implemented by beans wishing to customize properties of
+ * {@link org.springframework.graphql.execution.GraphQlSource.Builder} whilst retaining
+ * default auto-configuration.
+ *
+ * @author Rossen Stoyanchev

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlWebMvcAutoConfiguration.java
##########
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.websocket.server.ServerContainer;
+
+import graphql.GraphQL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.graphql.GraphQlService;
+import org.springframework.graphql.execution.GraphQlSource;
+import org.springframework.graphql.execution.ThreadLocalAccessor;
+import org.springframework.graphql.web.WebGraphQlHandler;
+import org.springframework.graphql.web.WebInterceptor;
+import org.springframework.graphql.web.webmvc.GraphQlHttpHandler;
+import org.springframework.graphql.web.webmvc.GraphQlWebSocketHandler;
+import org.springframework.graphql.web.webmvc.GraphiQlHandler;
+import org.springframework.graphql.web.webmvc.SchemaHandler;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.GenericHttpMessageConverter;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.servlet.HandlerMapping;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.function.RequestPredicates;
+import org.springframework.web.servlet.function.RouterFunction;
+import org.springframework.web.servlet.function.RouterFunctions;
+import org.springframework.web.servlet.function.ServerResponse;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
+import org.springframework.web.socket.server.support.WebSocketHandlerMapping;
+import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
+
+/**
+ * {@link EnableAutoConfiguration Auto-configuration} for enabling Spring GraphQL over
+ * Spring MVC.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/InvalidSchemaLocationsException.java
##########
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2020-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.core.NestedRuntimeException;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.util.Assert;
+
+/**
+ * {@link InvalidSchemaLocationsException} thrown when no schema file could be found in
+ * the provided locations.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?

##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/webmodule/WebModuleGraphql.java
##########
@@ -0,0 +1,96 @@
+/*
+ *  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.graphql.web.WebGraphQlHandler;
+import org.springframework.graphql.web.WebInput;
+import org.springframework.graphql.web.WebOutput;
+import org.springframework.graphql.web.webmvc.GraphQlHttpHandler;
+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;
+
+import reactor.core.publisher.Mono;
+
+/**
+ * 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

Review comment:
       Use `@Autowired` instead, as stated with the java-doc. Should one ever want to use this with the JEE stack (CDI).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791399525



##########
File path: examples/demo/wicket/jdo/src/main/java/demoapp/webapp/wicket/jdo/DemoAppWicketJdo.java
##########
@@ -78,10 +78,15 @@ public static void main(final String[] args) {
     	IsisPresets.prototyping();
         //IsisPresets.logging(WebRequestCycleForIsis.class, "debug");
 
-        System.setProperty("spring.profiles.active", "demo-jdo");
+        System.setProperty("spring.profiles.active", preservingAnyExisting("demo-jdo"));

Review comment:
       logic for adding a spring profile, could be refactored into a common (shared) utility;
   eg. package `org.apache.isis.core.config.util`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791396804



##########
File path: core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationCacheDefault.java
##########
@@ -100,7 +102,9 @@ public void forEach(Consumer<T> onSpec, boolean shouldRunConcurrent) {
         if(shouldRunConcurrent) {
             vList.forEachParallel(onSpec);
         } else {
-            vList.forEach(onSpec);
+            vList
+                .stream().sorted(Comparator.comparing(HasLogicalType::getLogicalTypeName))

Review comment:
       Is there a need for sorting? Or is it a debugging thing.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791405661



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlProperties.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.time.Duration;
+import java.util.Arrays;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * {@link ConfigurationProperties properties} for Spring GraphQL.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791406328



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/InvalidSchemaLocationsException.java
##########
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2020-2021 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.core.NestedRuntimeException;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.util.Assert;
+
+/**
+ * {@link InvalidSchemaLocationsException} thrown when no schema file could be found in
+ * the provided locations.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791395227



##########
File path: .run/DemoAppWicketJdo.run.xml
##########
@@ -0,0 +1,9 @@
+<component name="ProjectRunConfigurationManager">

Review comment:
       I guess we need to add a `.run` entry with` gitignore`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791407011



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/webmodule/WebModuleGraphql.java
##########
@@ -0,0 +1,96 @@
+/*
+ *  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.graphql.web.WebGraphQlHandler;
+import org.springframework.graphql.web.WebInput;
+import org.springframework.graphql.web.WebOutput;
+import org.springframework.graphql.web.webmvc.GraphQlHttpHandler;
+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;
+
+import reactor.core.publisher.Mono;
+
+/**
+ * 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

Review comment:
       Use `@Autowired` instead, as stated with the java-doc. Should one ever want to use this with the JEE stack (CDI).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [isis] andi-huber commented on a change in pull request #841: GraphQL Initial Scuffolding

Posted by GitBox <gi...@apache.org>.
andi-huber commented on a change in pull request #841:
URL: https://github.com/apache/isis/pull/841#discussion_r791403632



##########
File path: incubator/viewers/graphql/viewer/src/main/java/org/apache/isis/viewer/graphql/viewer/spring/GraphQlAutoConfiguration.java
##########
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2012-2022 the original author or authors.
+ *
+ * Licensed 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
+ *
+ *      https://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.spring;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import graphql.GraphQL;
+import graphql.execution.instrumentation.Instrumentation;
+import graphql.schema.idl.RuntimeWiring;
+import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.format.support.DefaultFormattingConversionService;
+import org.springframework.graphql.GraphQlService;
+import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
+import org.springframework.graphql.execution.BatchLoaderRegistry;
+import org.springframework.graphql.execution.DataFetcherExceptionResolver;
+import org.springframework.graphql.execution.DefaultBatchLoaderRegistry;
+import org.springframework.graphql.execution.ExecutionGraphQlService;
+import org.springframework.graphql.execution.GraphQlSource;
+import org.springframework.graphql.execution.MissingSchemaException;
+import org.springframework.graphql.execution.RuntimeWiringConfigurer;
+
+/**
+ * {@link EnableAutoConfiguration Auto-configuration} for creating a Spring GraphQL base
+ * infrastructure.
+ *
+ * @author Brian Clozel

Review comment:
       authorship?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org