You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2019/05/12 21:50:04 UTC

[unomi] 02/02: UNOMI-180 CDP Specification implementation - Get CDP feature to install properly (but it doesn't start yet since it is missing custom scalar and event registrations) - Fixed GraphQL schema JSON encoding to UTF-8 - Removed references to incubating that are no longer needed.

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

shuber pushed a commit to branch UNOMI-180-CXS-GRAPHQLAPI
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit ed513dae2aa4ae3846d13e1401636983996bf8bc
Author: sergehuber <sh...@jahia.com>
AuthorDate: Sun May 12 23:49:05 2019 +0200

    UNOMI-180 CDP Specification implementation
    - Get CDP feature to install properly (but it doesn't start yet since it is missing custom scalar and event registrations)
    - Fixed GraphQL schema JSON encoding to UTF-8
    - Removed references to incubating that are no longer needed.
---
 graphql/cxs-impl/pom.xml                            |   4 ++--
 .../unomi/graphql/internal/CDPSDLServletImpl.java   |  17 +++++++++--------
 .../cxs-impl/src/main/resources/cdp-schema.graphqls | Bin 45752 -> 22300 bytes
 graphql/karaf-feature/pom.xml                       |  11 ++++-------
 graphql/pom.xml                                     |   2 +-
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml
index 8a0e883..79cd629 100644
--- a/graphql/cxs-impl/pom.xml
+++ b/graphql/cxs-impl/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.4.0-incubating-SNAPSHOT</version>
+            <version>1.4.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
index dfd1ca6..8cafa15 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
@@ -16,35 +16,36 @@
  */
 package org.apache.unomi.graphql.internal;
 
+import com.google.common.base.Charsets;
 import graphql.schema.GraphQLSchema;
-import graphql.schema.StaticDataFetcher;
 import graphql.schema.idl.RuntimeWiring;
 import graphql.schema.idl.SchemaGenerator;
 import graphql.schema.idl.SchemaParser;
 import graphql.schema.idl.TypeDefinitionRegistry;
 import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 
-import static graphql.schema.idl.TypeRuntimeWiring.newTypeWiring;
-
 @Component(
         service={javax.servlet.http.HttpServlet.class,javax.servlet.Servlet.class},
-        property = {"alias=/graphql", "jmx.objectname=graphql.servlet:type=graphql"}
+        property = {"alias=/sdlgraphql", "jmx.objectname=graphql.servlet:type=graphql"}
 )
 public class CDPSDLServletImpl extends HttpServlet {
 
-    @Reference
     private BundleContext bundleContext;
 
+    @Activate
+    void activate(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
     RuntimeWiring buildRuntimeWiring() {
         return RuntimeWiring.newRuntimeWiring()
                 // .scalar(CustomScalar)
@@ -96,7 +97,7 @@ public class CDPSDLServletImpl extends HttpServlet {
 
     private Reader getSchemaReader(String resourceUrl) {
         try {
-            return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream());
+            return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream(), Charsets.UTF_8.name());
         } catch (IOException e) {
             e.printStackTrace();
         }
diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
index 22fba9a..7a924ca 100644
Binary files a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls and b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls differ
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
index 0437dba..b813872 100644
--- a/graphql/karaf-feature/pom.xml
+++ b/graphql/karaf-feature/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>feature</packaging>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
-            <version>20.0</version>
+            <version>24.1.1-jre</version>
         </dependency>
         <dependency>
             <groupId>commons-fileupload</groupId>
@@ -82,7 +82,6 @@
             <version>1.0.2</version>
         </dependency>
 
-<!--
         <dependency>
             <groupId>com.graphql-java-kickstart</groupId>
             <artifactId>graphql-java-servlet</artifactId>
@@ -98,7 +97,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
--->
+
         <dependency>
             <groupId>com.graphql-java</groupId>
             <artifactId>graphql-java</artifactId>
@@ -110,17 +109,15 @@
                 </exclusion>
             </exclusions>
         </dependency>
-<!--
         <dependency>
             <groupId>io.github.graphql-java</groupId>
             <artifactId>graphql-java-annotations</artifactId>
             <version>${graphql.java.annotations.version}</version>
         </dependency>
--->
         <dependency>
             <groupId>org.apache.unomi</groupId>
                 <artifactId>cdp-graphql-api-impl</artifactId>
-            <version>1.4.0-incubating-SNAPSHOT</version>
+            <version>1.4.0-SNAPSHOT</version>
         </dependency>
 
     </dependencies>
diff --git a/graphql/pom.xml b/graphql/pom.xml
index 191e642..260f787 100644
--- a/graphql/pom.xml
+++ b/graphql/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-graphql</artifactId>