Skip to content

Commit

Permalink
Release 23.12.0 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
firatkucuk authored Dec 6, 2023
1 parent 442bbf3 commit 7affb1e
Show file tree
Hide file tree
Showing 73 changed files with 753 additions and 655 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java=11.0.21-tem
maven=3.9.5
maven=3.9.6
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Just add a single **Lilo** dependency to your `pom.xml` file.
<dependency>
<groupId>io.fria</groupId>
<artifactId>lilo</artifactId>
<version>23.11.1</version>
<version>23.12.0</version>
</dependency>
...
</dependencies>
Expand All @@ -27,7 +27,7 @@ Just add a single **Lilo** dependency to your `pom.xml` file.
If you're using gradle add the dependency to your `build.gradle` file.

```groovy
implementation 'io.fria:lilo:23.11.1'
implementation 'io.fria:lilo:23.12.0'
```

## Basic Usage
Expand Down
2 changes: 1 addition & 1 deletion lilo-spring/.sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java=17.0.9-tem
maven=3.9.5
maven=3.9.6
4 changes: 2 additions & 2 deletions lilo-spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Just add a single **Lilo** dependency to your `pom.xml` file.
<dependency>
<groupId>io.fria</groupId>
<artifactId>lilo-spring</artifactId>
<version>23.11.1</version>
<version>23.12.0</version>
</dependency>
...
</dependencies>
Expand All @@ -23,7 +23,7 @@ Just add a single **Lilo** dependency to your `pom.xml` file.
If you're using gradle add the dependency to your `build.gradle` file.

```groovy
implementation 'io.fria:lilo-spring:23.11.1'
implementation 'io.fria:lilo-spring:23.12.0'
```

## Usage
Expand Down
53 changes: 33 additions & 20 deletions lilo-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.fria</groupId>
<artifactId>lilo-spring</artifactId>
<version>23.11.2-SNAPSHOT</version>
<version>23.12.0</version>

<name>lilo-spring</name>
<description>Lilo GraphQL stitching library Spring Bindings</description>
Expand Down Expand Up @@ -42,20 +42,33 @@
<maven.min.version>3.6.3</maven.min.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<slf4j.version>2.0.9</slf4j.version>
<junit.version>5.10.1</junit.version>
<error-prone.version>2.20.0</error-prone.version>
<checkstyle.version>10.12.4</checkstyle.version>
<spotbugs.version>4.8.1</spotbugs.version>
<spring-boot.version>3.0.12</spring-boot.version>
<spring.version>6.0.3</spring.version>
<!-- Dependency Versions -->
<lilo.version>23.12.0</lilo.version>
<spring.version>6.1.1</spring.version>
<spring-boot.version>3.2.0</spring-boot.version>
<jakarta-servlet.version>6.0.0</jakarta-servlet.version>
<!-- Plugin Versions -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<spotbugs-maven-plugin.version>4.8.2.0</spotbugs-maven-plugin.version>
<fmt-maven-plugin.version>2.21.1</fmt-maven-plugin.version>
<apache-rat-plugin.version>0.15</apache-rat-plugin.version>
<!-- Plugin Dependency Versions -->
<error-prone.version>2.23.0</error-prone.version>
<checkstyle.version>10.12.5</checkstyle.version>
<spotbugs.version>4.8.2</spotbugs.version>
</properties>

<dependencies>
<dependency>
<groupId>io.fria</groupId>
<artifactId>lilo</artifactId>
<version>23.11.2-SNAPSHOT</version>
<version>${lilo.version}</version>
</dependency>

<dependency>
Expand All @@ -80,7 +93,7 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<version>${jakarta-servlet.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand All @@ -89,7 +102,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
Expand All @@ -110,12 +123,12 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<version>${maven-surefire-plugin.version}</version>
</plugin>

<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<id>enforce-versions-compile</id>
Expand Down Expand Up @@ -152,7 +165,7 @@

<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -165,7 +178,7 @@

<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.2</version>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -178,7 +191,7 @@

<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.0</version>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
Expand All @@ -205,7 +218,7 @@

<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -220,7 +233,7 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.1.0</version>
<version>${spotbugs-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
Expand All @@ -233,7 +246,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.21.1</version>
<version>${fmt-maven-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -246,7 +259,7 @@
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.15</version>
<version>${apache-rat-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ private ClientSessionWrapper(final @NotNull WebSocketSession nativeSession) {
this.nativeSession = nativeSession;
}

/**
* wrap method helps you create a instance from native spring WebSocketSession
*
* @param nativeSession Session object provided by Spring
* @return Session Wrapper object which contains spring session
*/
public static @Nullable ClientSessionWrapper wrap(
final @Nullable WebSocketSession nativeSession) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;

/** EnableLilo annotation enables Lilo Spring support of the application. */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;

/**
* This interceptor is used for communication between a GraphQL client and Lilo GraphQL Gateway.
* Main purpose of this interface is just adding "Sec-WebSocket-Protocol" header. This one is
* mandatory for some GraphQL clients.
*/
public class GatewayHandshakeInterceptor implements HandshakeInterceptor {

@Override
Expand All @@ -31,7 +36,7 @@ public void afterHandshake(
final @NotNull ServerHttpResponse response,
final @NotNull WebSocketHandler wsHandler,
final @Nullable Exception exception) {
// No logic for after handshaking
// No lilo managed logic for after handshaking
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@
public class GatewayWebSocketHandler extends AbstractWebSocketHandler {

private final @NotNull SubscriptionGatewayHandler gatewayHandler;
private final @NotNull String path;
private final @NotNull String subscriptionPath;

public GatewayWebSocketHandler(final @NotNull Lilo lilo, final @NotNull String path) {
/**
* Constructor creates a GatewayWebSocketHandler which manages websocket communication between
* GraphQL clients and Lilo GraphQL Gateway.
*
* @param lilo Lilo object instance or bean
* @param subscriptionPath subscription path for handling subscription requests. Mostly it's
* /graphql
*/
public GatewayWebSocketHandler(final @NotNull Lilo lilo, final @NotNull String subscriptionPath) {
this.gatewayHandler = new SubscriptionGatewayHandler(lilo);
this.path = path;
this.subscriptionPath = subscriptionPath;
}

@Override
Expand All @@ -51,7 +59,13 @@ protected void handleTextMessage(
ClientSessionWrapper.wrap(nativeSession), message.getPayload());
}

public @NotNull String getPath() {
return this.path;
/**
* Getter for stored GraphQL subscription path for serving GraphQL subscription path. Mostly it's
* /graphql
*
* @return actual value of subscription path
*/
public @NotNull String getSubscriptionPath() {
return this.subscriptionPath;
}
}
25 changes: 23 additions & 2 deletions lilo-spring/src/main/java/io/fria/lilo/spring/LiloConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,45 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.socket.server.support.WebSocketHandlerMapping;

/**
* LiloConfig is the configuration bean directly bound to EnableLilo annotation. When EnableLilo
* annotation is used. A singleton instance of this class is created.
*/
@Configuration
@Import({LiloConfigProperties.class, SubscriptionWebSocketConfigurer.class})
public class LiloConfig {

/**
* GatewayWebSocketHandler bean definition
*
* @param lilo Lilo instance
* @param configProperties LiloConfig properties for getting subscription path
* @return GatewayWebSocketHandler bean singleton instance
*/
@Bean
public @NotNull GatewayWebSocketHandler gatewayWebSocketHandler(
final @NotNull Lilo lilo, final @NotNull LiloConfigProperties configProperties) {
return new GatewayWebSocketHandler(
lilo, Objects.requireNonNull(configProperties.getSubscriptionPath()));
}

/**
* LiloHandlerMapping bean definition
*
* @param configProperties LiloConfig properties for getting subscription path
* @param webSocketHandlerMapping Spring WebSocketHandlerMapping bean for delegating websocket
* requests.
* @param requestMappingHandlerMapping Spring RequestMappingHandlerMapping bean for delegating
* standard web requests.
* @return LiloHandlerMapping bean singleton instance
*/
@Bean
public @Nullable LiloHandlerMapping liloHandlerMapping(
final @NotNull LiloConfigProperties configProperties,
final @NotNull HandlerMapping webSocketHandlerMapping,
final @NotNull WebSocketHandlerMapping webSocketHandlerMapping,
final @NotNull RequestMappingHandlerMapping requestMappingHandlerMapping) {

if (configProperties.getGraphQlPath() == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,50 @@
import org.jetbrains.annotations.Nullable;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
* This class provides code completion support for IDEs when using lilo properties in
* application.yml/properties file. Also provides a programmatic approach to accessing this
* configuration from other classes.
*/
@ConfigurationProperties(prefix = "lilo")
public class LiloConfigProperties {

private @Nullable String graphQlPath = "/graphql";
private @Nullable String subscriptionPath = "/graphql";

/**
* GraphQL path which serves query and mutation operations. By default, it's /graphql
*
* @return GraphQL query/mutation path
*/
public @Nullable String getGraphQlPath() {
return this.graphQlPath;
}

/**
* GraphQL subscription Path, WebSocket handler will be bound to this path. By default, it's
* /graphql
*
* @return GraphQL Subscription path
*/
public @Nullable String getSubscriptionPath() {
return this.subscriptionPath;
}

/**
* setter for GraphQL query and mutation path. If not set, it's /graphql
*
* @param graphQlPath new GraphQL query / mutation path
*/
public void setGraphQlPath(final @NotNull String graphQlPath) {
this.graphQlPath = graphQlPath;
}

/**
* setter for GraphQL subscription path. If not set, it's /graphql
*
* @param subscriptionPath new GraphQL subscription path
*/
public void setSubscriptionPath(final @NotNull String subscriptionPath) {
this.subscriptionPath = subscriptionPath;
}
Expand Down
Loading

0 comments on commit 7affb1e

Please sign in to comment.