You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/12/18 12:11:20 UTC
[tinkerpop] branch master updated: TINKERPOP-2327 Removed
deprecated NIO channelizer support CTR
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 4c1b690 TINKERPOP-2327 Removed deprecated NIO channelizer support CTR
4c1b690 is described below
commit 4c1b6906147f0787765093a1c53facbf4d3acb53
Author: stephen <sp...@gmail.com>
AuthorDate: Wed Dec 18 07:10:43 2019 -0500
TINKERPOP-2327 Removed deprecated NIO channelizer support CTR
---
CHANGELOG.asciidoc | 1 +
docs/src/upgrade/release-3.5.x.asciidoc | 6 ++
.../tinkerpop/gremlin/driver/Channelizer.java | 22 -----
.../driver/handler/NioGremlinRequestEncoder.java | 72 ----------------
.../driver/handler/NioGremlinResponseDecoder.java | 63 --------------
.../tinkerpop/gremlin/driver/simple/NioClient.java | 92 --------------------
.../gremlin/server/channel/NioChannelizer.java | 78 -----------------
.../handler/NioGremlinBinaryRequestDecoder.java | 99 ----------------------
.../handler/NioGremlinResponseFrameEncoder.java | 50 -----------
.../server/handler/SaslAuthenticationHandler.java | 5 --
.../gremlin/server/GremlinDriverIntegrateTest.java | 23 -----
.../server/GremlinServerAuditLogIntegrateTest.java | 43 ----------
.../gremlin/server/TestClientFactory.java | 6 --
...tractGremlinServerChannelizerIntegrateTest.java | 43 ----------
.../channel/NioChannelizerIntegrateTest.java | 56 ------------
15 files changed, 7 insertions(+), 652 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 68b15dc..d3318de 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -50,6 +50,7 @@ This release also includes changes from <<release-3-4-3, 3.4.3>>.
* Removed Gryo serialization configurations from Gremlin Server sample configurations and default configurations.
* Removed previously deprecated `TraversalStrategies.applyStrategies()`.
* Removed previously deprecated `scriptEvaluationTimeout`.
+* Removed previously deprecated `NioChannelizer` and related classes.
* Removed previously deprecated remote traversal side-effects.
* Removed previously deprecated `Serializers.DEFAULT_RESULT_SERIALIZER` and `Serializers.DEFAULT_REQUEST_SERIALIZER`.
* Removed previously deprecated `decr` and `incr` from `Order`.
diff --git a/docs/src/upgrade/release-3.5.x.asciidoc b/docs/src/upgrade/release-3.5.x.asciidoc
index 2e8913e..db1426f 100644
--- a/docs/src/upgrade/release-3.5.x.asciidoc
+++ b/docs/src/upgrade/release-3.5.x.asciidoc
@@ -225,8 +225,11 @@ The following deprecated classes, methods or fields have been removed in this ve
** `org.apache.tinkerpop.gremlin.driver.Cluster.Builder#keyFile(String)`
** `org.apache.tinkerpop.gremlin.driver.Cluster.Builder#keyPassword(String)`
** `org.apache.tinkerpop.gremlin.driver.Cluster.Builder#trustCertificateChainFile(String)`
+** `org.apache.tinkerpop.gremlin.driver.handler.NioGremlinRequestEncoder`
+** `org.apache.tinkerpop.gremlin.driver.handler.NioGremlinResponseDecoder`
** `org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversalSideEffects`
** `org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal#getSideEffects()`
+** `org.apache.tinkerpop.gremlin.driver.simple.NioClient`
* `gremlin-python`
** `org.apache.tinkerpop.gremlin.python.jsr223.*`
* `gremlin-server`
@@ -236,6 +239,9 @@ The following deprecated classes, methods or fields have been removed in this ve
** `org.apache.tinkerpop.gremlin.server.Settings.SslSettings.keyPassword`
** `org.apache.tinkerpop.gremlin.server.Settings.SslSettings.trustCertificateChainFile`
** `org.apache.tinkerpop.gremlin.server.ResponseHandlerContext`
+** `org.apache.tinkerpop.gremlin.server.channel.NioChannelizer`
+** `org.apache.tinkerpop.gremlin.server.handler.NioGremlinBinaryRequestDecoder`
+** `org.apache.tinkerpop.gremlin.server.handler.NioGremlinResponseFrameEncoder`
** `org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.evalOpInternal(ResponseHandlerContext, Supplier, BindingSupplier)`
** `org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.generateMetaData(ChannelHandlerContext, RequestMessage, ResponseStatusCode, Iterator)`
** `org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(ResponseHandlerContext, Iterator)`
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java
index c4bd3e1..fdf3df7 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java
@@ -23,8 +23,6 @@ import io.netty.handler.codec.http.EmptyHttpHeaders;
import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
import io.netty.handler.codec.http.websocketx.PingWebSocketFrame;
import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException;
-import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinRequestEncoder;
-import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinResponseDecoder;
import org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler;
import org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinRequestEncoder;
import org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinResponseDecoder;
@@ -37,7 +35,6 @@ import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
import io.netty.handler.codec.http.websocketx.WebSocketVersion;
import io.netty.handler.ssl.SslContext;
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
import java.util.Optional;
import java.util.UUID;
@@ -223,23 +220,4 @@ public interface Channelizer extends ChannelHandler {
}
}
}
-
- /**
- * NIO {@link Channelizer} implementation.
- *
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
- @Deprecated
- public final class NioChannelizer extends AbstractChannelizer {
- @Override
- public void init(final Connection connection) {
- super.init(connection);
- }
-
- @Override
- public void configure(ChannelPipeline pipeline) {
- pipeline.addLast("gremlin-decoder", new NioGremlinResponseDecoder(cluster.getSerializer()));
- pipeline.addLast("gremlin-encoder", new NioGremlinRequestEncoder(true, cluster.getSerializer()));
- }
- }
}
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinRequestEncoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinRequestEncoder.java
deleted file mode 100644
index be99226..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinRequestEncoder.java
+++ /dev/null
@@ -1,72 +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.tinkerpop.gremlin.driver.handler;
-
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
-import org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.MessageToByteEncoder;
-import io.netty.util.CharsetUtil;
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-public final class NioGremlinRequestEncoder extends MessageToByteEncoder<Object> {
- private boolean binaryEncoding;
-
- private final MessageSerializer serializer;
-
- public NioGremlinRequestEncoder(final boolean binaryEncoding, final MessageSerializer serializer) {
- this.binaryEncoding = binaryEncoding;
- this.serializer = serializer;
- }
-
- @Override
- protected void encode(final ChannelHandlerContext channelHandlerContext, final Object msg, final ByteBuf byteBuf) throws Exception {
- final RequestMessage requestMessage = (RequestMessage) msg;
- try {
- if (binaryEncoding) {
- // wrap the serialized message/payload inside of a "frame". this works around the problem where
- // the length of the payload is not encoded into the general protocol. that length isn't needed
- // for websockets because under that protocol, the message is wrapped in a "websocket frame". this
- // is not the optimal way to deal with this really, but it does prevent a protocol change in this
- // immediate moment trying to get the NioChannelizer working.
- final ByteBuf bytes = serializer.serializeRequestAsBinary(requestMessage, channelHandlerContext.alloc());
- byteBuf.writeInt(bytes.readableBytes());
- byteBuf.writeBytes(bytes);
- } else {
- final MessageTextSerializer textSerializer = (MessageTextSerializer) serializer;
- final byte [] bytes = textSerializer.serializeRequestAsString(requestMessage).getBytes(CharsetUtil.UTF_8);
- byteBuf.writeInt(bytes.length);
- byteBuf.writeBytes(bytes);
- }
- } catch (Exception ex) {
- throw new ResponseException(ResponseStatusCode.REQUEST_ERROR_SERIALIZATION, String.format(
- "An error occurred during serialization of this request [%s] - it could not be sent to the server - Reason: %s",
- requestMessage, ex));
- }
- }
-}
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinResponseDecoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinResponseDecoder.java
deleted file mode 100644
index 25e3a1c..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/NioGremlinResponseDecoder.java
+++ /dev/null
@@ -1,63 +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.tinkerpop.gremlin.driver.handler;
-
-import io.netty.handler.codec.ReplayingDecoder;
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
-
-import java.util.List;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-public final class NioGremlinResponseDecoder extends ReplayingDecoder<NioGremlinResponseDecoder.DecoderState> {
- private final MessageSerializer serializer;
- private int messageLength;
-
- public NioGremlinResponseDecoder(final MessageSerializer serializer) {
- super(DecoderState.MESSAGE_LENGTH);
- this.serializer = serializer;
- }
-
- @Override
- protected void decode(final ChannelHandlerContext channelHandlerContext, final ByteBuf byteBuf, final List<Object> objects) throws Exception {
- switch (state()) {
- case MESSAGE_LENGTH:
- messageLength = byteBuf.readInt();
- checkpoint(DecoderState.MESSAGE);
- case MESSAGE:
- final ByteBuf messageFrame = byteBuf.readBytes(messageLength);
- objects.add(serializer.deserializeResponse(messageFrame));
- checkpoint(DecoderState.MESSAGE_LENGTH);
- break;
- default:
- throw new Error("Invalid message received from Gremlin Server");
- }
- }
-
- public enum DecoderState {
- MESSAGE_LENGTH,
- MESSAGE
- }
-}
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
deleted file mode 100644
index 0643ad1..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
+++ /dev/null
@@ -1,92 +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.tinkerpop.gremlin.driver.simple;
-
-import io.netty.buffer.PooledByteBufAllocator;
-import io.netty.channel.ChannelOption;
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinRequestEncoder;
-import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinResponseDecoder;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelPipeline;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1;
-
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * A simple, non-thread safe Gremlin Server client using NIO. Typical use is for testing and demonstration.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-public class NioClient extends AbstractClient {
- private final Channel channel;
-
- public NioClient() {
- this(URI.create("gs://localhost:8182"));
- }
-
- public NioClient(final URI uri) {
- super("nio-client-%d");
- final Bootstrap b = new Bootstrap().group(group);
- b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
-
- try {
- final MessageSerializer serializer = new GraphBinaryMessageSerializerV1();
- b.channel(NioSocketChannel.class)
- .handler(new ChannelInitializer<SocketChannel>() {
- @Override
- protected void initChannel(final SocketChannel ch) {
- final ChannelPipeline p = ch.pipeline();
- p.addLast(
- new NioGremlinResponseDecoder(serializer),
- new NioGremlinRequestEncoder(true, serializer),
- callbackResponseHandler);
- }
- });
-
- channel = b.connect(uri.getHost(), uri.getPort()).sync().channel();
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void writeAndFlush(final RequestMessage requestMessage) throws Exception {
- channel.writeAndFlush(requestMessage).get();
- }
-
- @Override
- public void close() throws IOException {
- try {
- channel.close().get();
- } catch (Exception ignored) {
-
- } finally {
- group.shutdownGracefully().awaitUninterruptibly();
- }
- }
-}
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizer.java
deleted file mode 100644
index 8043580..0000000
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizer.java
+++ /dev/null
@@ -1,78 +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.tinkerpop.gremlin.server.channel;
-
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
-import org.apache.tinkerpop.gremlin.server.AbstractChannelizer;
-import org.apache.tinkerpop.gremlin.server.Channelizer;
-import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator;
-import org.apache.tinkerpop.gremlin.server.handler.GremlinResponseFrameEncoder;
-import org.apache.tinkerpop.gremlin.server.handler.NioGremlinBinaryRequestDecoder;
-import io.netty.channel.ChannelPipeline;
-import io.netty.handler.logging.LogLevel;
-import io.netty.handler.logging.LoggingHandler;
-import org.apache.tinkerpop.gremlin.server.handler.NioGremlinResponseFrameEncoder;
-import org.apache.tinkerpop.gremlin.server.handler.SaslAuthenticationHandler;
-import org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link Channelizer} that exposes an NIO-based Gremlin endpoint with a custom protocol.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-public class NioChannelizer extends AbstractChannelizer {
- private static final Logger logger = LoggerFactory.getLogger(NioChannelizer.class);
-
- private SaslAuthenticationHandler authenticationHandler;
- private GremlinResponseFrameEncoder gremlinResponseFrameEncoder;
- private NioGremlinResponseFrameEncoder nioGremlinResponseFrameEncoder;
-
- @Override
- public void init(final ServerGremlinExecutor serverGremlinExecutor) {
- super.init(serverGremlinExecutor);
-
- // configure authentication - null means don't bother to add authentication to the pipeline
- if (authenticator != null)
- authenticationHandler = authenticator.getClass() == AllowAllAuthenticator.class ?
- null : new SaslAuthenticationHandler(authenticator, settings.authentication);
-
- gremlinResponseFrameEncoder = new GremlinResponseFrameEncoder();
- nioGremlinResponseFrameEncoder = new NioGremlinResponseFrameEncoder();
- }
-
- @Override
- public void configure(final ChannelPipeline pipeline) {
- if (logger.isDebugEnabled())
- pipeline.addLast(new LoggingHandler("log-io", LogLevel.DEBUG));
-
- pipeline.addLast("nio-frame-encoder", nioGremlinResponseFrameEncoder);
- pipeline.addLast("response-frame-encoder", gremlinResponseFrameEncoder);
- pipeline.addLast("request-binary-decoder", new NioGremlinBinaryRequestDecoder(serializers));
-
- if (logger.isDebugEnabled())
- pipeline.addLast(new LoggingHandler("log-codec", LogLevel.DEBUG));
-
- if (authenticationHandler != null)
- pipeline.addLast(PIPELINE_AUTHENTICATOR, authenticationHandler);
- }
-}
\ No newline at end of file
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinBinaryRequestDecoder.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinBinaryRequestDecoder.java
deleted file mode 100644
index ed30049..0000000
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinBinaryRequestDecoder.java
+++ /dev/null
@@ -1,99 +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.tinkerpop.gremlin.server.handler;
-
-import io.netty.handler.codec.ReplayingDecoder;
-import io.netty.util.CharsetUtil;
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- *
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-public class NioGremlinBinaryRequestDecoder extends ReplayingDecoder<NioGremlinBinaryRequestDecoder.DecoderState> {
- private static final Logger logger = LoggerFactory.getLogger(NioGremlinBinaryRequestDecoder.class);
- private final Map<String, MessageSerializer> serializers;
- private int messageLength;
-
- public NioGremlinBinaryRequestDecoder(final Map<String, MessageSerializer> serializers) {
- super(DecoderState.MESSAGE_LENGTH);
- this.serializers = serializers;
- }
-
- @Override
- protected void decode(final ChannelHandlerContext channelHandlerContext, final ByteBuf byteBuf, final List<Object> objects) throws Exception {
- switch (state()) {
- case MESSAGE_LENGTH:
- messageLength = byteBuf.readInt();
- checkpoint(DecoderState.MESSAGE);
- case MESSAGE:
- try {
- final ByteBuf messageFrame = byteBuf.readBytes(messageLength);
- final int contentTypeLength = messageFrame.readByte();
- final ByteBuf contentTypeFrame = messageFrame.readBytes(contentTypeLength);
- final String contentType = contentTypeFrame.toString(CharsetUtil.UTF_8);
- final MessageSerializer serializer = select(contentType, ServerSerializers.DEFAULT_BINARY_SERIALIZER);
-
- // it's important to re-initialize these channel attributes as they apply globally to the channel. in
- // other words, the next request to this channel might not come with the same configuration and mixed
- // state can carry through from one request to the next
- channelHandlerContext.channel().attr(StateKey.SESSION).set(null);
- channelHandlerContext.channel().attr(StateKey.SERIALIZER).set(serializer);
- channelHandlerContext.channel().attr(StateKey.USE_BINARY).set(true);
-
- // subtract the contentTypeLength and the byte that held it from the full message length to
- // figure out how long the rest of the message is
- final int payloadLength = messageLength - 1 - contentTypeLength;
- objects.add(serializer.deserializeRequest(messageFrame.readBytes(payloadLength)));
- } catch (SerializationException se) {
- objects.add(RequestMessage.INVALID);
- }
-
- checkpoint(DecoderState.MESSAGE_LENGTH);
- break;
- default:
- throw new Error("Invalid message sent to Gremlin Server");
- }
- }
-
- public MessageSerializer select(final String mimeType, final MessageSerializer defaultSerializer) {
- if (logger.isWarnEnabled() && !serializers.containsKey(mimeType))
- logger.warn("Gremlin Server is not configured with a serializer for the requested mime type [{}] - using {} by default",
- mimeType, defaultSerializer.getClass().getName());
-
- return serializers.getOrDefault(mimeType, defaultSerializer);
- }
-
- public enum DecoderState {
- MESSAGE_LENGTH,
- MESSAGE
- }
-}
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinResponseFrameEncoder.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinResponseFrameEncoder.java
deleted file mode 100644
index 3129494..0000000
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/NioGremlinResponseFrameEncoder.java
+++ /dev/null
@@ -1,50 +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.tinkerpop.gremlin.server.handler;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandler;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.MessageToByteEncoder;
-import io.netty.util.CharsetUtil;
-import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
-
-/**
- * Encodes {@code ByteBuf} and {@code String} values to bytes to be written over NIO.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.3.10, not replaced, use {@link WebSocketClient}.
- */
-@Deprecated
-@ChannelHandler.Sharable
-public class NioGremlinResponseFrameEncoder extends MessageToByteEncoder<Frame> {
- @Override
- protected void encode(final ChannelHandlerContext ctx, final Frame frame, final ByteBuf byteBuf) throws Exception {
- if (frame.getMsg() instanceof ByteBuf) {
- final ByteBuf bytes = (ByteBuf) frame.getMsg();
- byteBuf.writeInt(bytes.readableBytes());
- byteBuf.writeBytes(bytes);
- bytes.release();
- } else if (frame.getMsg() instanceof String) {
- final byte [] bytes = ((String) frame.getMsg()).getBytes(CharsetUtil.UTF_8);
- byteBuf.writeInt(bytes.length);
- byteBuf.writeBytes(bytes);
- }
- }
-}
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
index 3e11ae8..6b2d248 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java
@@ -21,8 +21,6 @@ package org.apache.tinkerpop.gremlin.server.handler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
-import io.netty.handler.codec.base64.Base64Decoder;
import io.netty.util.Attribute;
import java.net.InetAddress;
@@ -37,13 +35,11 @@ import org.apache.tinkerpop.gremlin.driver.Tokens;
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
-import org.apache.tinkerpop.gremlin.server.Context;
import org.apache.tinkerpop.gremlin.server.GremlinServer;
import org.apache.tinkerpop.gremlin.server.Settings;
import org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser;
import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException;
import org.apache.tinkerpop.gremlin.server.auth.Authenticator;
-import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
import org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +47,6 @@ import org.slf4j.LoggerFactory;
/**
* A SASL authentication handler that allows the {@link Authenticator} to be plugged into it. This handler is meant
* to be used with protocols that process a {@link RequestMessage} such as the {@link WebSocketChannelizer}
- * or the {@link NioChannelizer}
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index d365de2..47327af 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.server;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.log4j.Level;
import org.apache.tinkerpop.gremlin.TestHelper;
-import org.apache.tinkerpop.gremlin.driver.Channelizer;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.RequestOptions;
@@ -42,7 +41,6 @@ import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin;
import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.Storage;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
@@ -160,9 +158,6 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
throw new RuntimeException(ex);
}
break;
- case "shouldWorkOverNioTransport":
- settings.channelizer = NioChannelizer.class.getName();
- break;
case "shouldFailWithBadClientSideSerialization":
final List<String> custom = Arrays.asList(
JsonBuilder.class.getName() + ";" + JsonBuilderGryoSerializer.class.getName(),
@@ -577,24 +572,6 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
}
@Test
- public void shouldWorkOverNioTransport() throws Exception {
- final Cluster cluster = TestClientFactory.build().channelizer(Channelizer.NioChannelizer.class.getName()).create();
- final Client client = cluster.connect();
-
- final AtomicInteger checked = new AtomicInteger(0);
- final ResultSet results = client.submit("[1,2,3,4,5,6,7,8,9]");
- while (!results.allItemsAvailable()) {
- assertTrue(results.getAvailableItemCount() < 10);
- checked.incrementAndGet();
- Thread.sleep(100);
- }
-
- assertTrue(checked.get() > 0);
- assertEquals(9, results.getAvailableItemCount());
- cluster.close();
- }
-
- @Test
public void shouldStream() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
index 5d34a78..0394c39 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
@@ -32,7 +32,6 @@ import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator;
import org.apache.tinkerpop.gremlin.server.auth.Krb5Authenticator;
import org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator;
import org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer;
-import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
@@ -42,15 +41,10 @@ import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
import java.util.Base64;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import java.util.stream.Stream;
import static org.apache.log4j.Level.INFO;
@@ -138,11 +132,6 @@ public class GremlinServerAuditLogIntegrateTest extends AbstractGremlinServerInt
authConfig.put("keytab", kdcServer.serviceKeytabFile.getAbsolutePath());
authConfig.put("principal", kdcServer.serverPrincipal);
break;
- case "shouldAuditLogWithNioTransport":
- settings.channelizer = NioChannelizer.class.getName();
- authConfig.put("keytab", kdcServer.serviceKeytabFile.getAbsolutePath());
- authConfig.put("principal", kdcServer.serverPrincipal);
- break;
case "shouldAuditLogWithHttpTransport":
settings.host = "localhost";
settings.channelizer = HttpChannelizer.class.getName();
@@ -278,38 +267,6 @@ public class GremlinServerAuditLogIntegrateTest extends AbstractGremlinServerInt
}
@Test
- public void shouldAuditLogWithNioTransport() throws Exception {
- final Cluster cluster = TestClientFactory.build().channelizer(Channelizer.NioChannelizer.class.getName())
- .jaasEntry(TESTCONSOLE).protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
- final Client client = cluster.connect();
- try {
- assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
- assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
- assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
- } finally {
- cluster.close();
- }
-
- // wait for logger to flush - (don't think there is a way to detect this)
- stopServer();
- Thread.sleep(1000);
-
- final List<LoggingEvent> log = recordingAppender.getEvents();
- final Stream<LoggingEvent> auditEvents = log.stream().filter(event -> event.getLoggerName().equals(AUDIT_LOGGER_NAME));
- final LoggingEvent authEvent = auditEvents
- .filter(event -> event.getMessage().toString().contains("Krb5Authenticator")).iterator().next();
- final String authMsg = authEvent.getMessage().toString();
- assertTrue(authEvent.getLevel() == INFO &&
- authMsg.matches(String.format("User %s with address .*? authenticated by Krb5Authenticator", kdcServer.clientPrincipalName)));
- assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
- item.getMessage().toString().matches("User with address .*? requested: 1\\+1")));
- assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
- item.getMessage().toString().matches("User with address .*? requested: 1\\+2")));
- assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
- item.getMessage().toString().matches("User with address .*? requested: 1\\+3")));
- }
-
- @Test
public void shouldAuditLogWithHttpTransport() throws Exception {
final CloseableHttpClient httpclient = HttpClients.createDefault();
final HttpGet httpget = new HttpGet(TestClientFactory.createURLString("?gremlin=1-1"));
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
index 0eb1467..f760442 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
@@ -19,7 +19,6 @@
package org.apache.tinkerpop.gremlin.server;
import org.apache.tinkerpop.gremlin.driver.Cluster;
-import org.apache.tinkerpop.gremlin.driver.simple.NioClient;
import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
import java.net.URI;
@@ -31,7 +30,6 @@ public final class TestClientFactory {
public static final int PORT = 45940;
public static final URI WEBSOCKET_URI = URI.create("ws://localhost:" + PORT + "/gremlin");
- public static final URI NIO_URI = URI.create("gs://localhost:" + PORT);
public static final String HTTP = "http://localhost:" + PORT;
public static final String RESOURCE_PATH = "conf/remote-objects.yaml";
@@ -47,10 +45,6 @@ public final class TestClientFactory {
return new WebSocketClient(WEBSOCKET_URI);
}
- public static NioClient createNioClient() {
- return new NioClient(NIO_URI);
- }
-
public static String createURLString() {
return createURLString("");
}
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/AbstractGremlinServerChannelizerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/AbstractGremlinServerChannelizerIntegrateTest.java
index b604254..4071e06 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/AbstractGremlinServerChannelizerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/AbstractGremlinServerChannelizerIntegrateTest.java
@@ -22,7 +22,6 @@ import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.tinkerpop.gremlin.driver.AuthProperties;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
-import org.apache.tinkerpop.gremlin.driver.Channelizer;
import org.apache.tinkerpop.gremlin.server.AbstractGremlinServerIntegrationTest;
import org.apache.tinkerpop.gremlin.server.Settings;
import org.apache.tinkerpop.gremlin.server.TestClientFactory;
@@ -61,8 +60,6 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
protected static final String WSS = "wss";
protected static final String WS_AND_HTTP = "wsAndHttp";
protected static final String WSS_AND_HTTPS = "wssAndHttps";
- protected static final String NIO = "nio";
- protected static final String NIO_SECURE = "nioSecure";
public abstract String getProtocol();
public abstract String getSecureProtocol();
@@ -160,10 +157,7 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
private CloseableHttpClient httpClient = null;
private Cluster wsCluster = null;
private Cluster.Builder wsBuilder = null;
- private Cluster nioCluster = null;
- private Cluster.Builder nioBuilder = null;
private Client wsClient = null;
- private Client.ClusteredClient nioClient = null;
private boolean secure = false;
@@ -192,13 +186,6 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
secure = true;
this.wsBuilder = TestClientFactory.build();
break;
- case NIO:
- this.nioBuilder = TestClientFactory.build();
- break;
- case NIO_SECURE:
- this.nioBuilder = TestClientFactory.build();
- secure = true;
- break;
}
}
@@ -228,9 +215,6 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
if (wsCluster != null) {
wsCluster.close();
}
- if (nioCluster != null) {
- nioCluster.close();
- }
}
public void sendAndAssertUnauthorized(final String gremlin, final String username, final String password) throws Exception {
@@ -249,15 +233,6 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
assertEquals("Username and/or password are incorrect", e.getCause().getMessage());
}
}
- if (nioBuilder != null) {
- setNioClient(username, password);
- try {
- nioClient.submit(gremlin);
- } catch(Exception e) {
- assertEquals("Username and/or password are incorrect", e.getCause().getMessage());
- }
- }
-
}
public void sendAndAssert(final String gremlin, final Object result, final String username, final String password) throws Exception {
@@ -275,24 +250,6 @@ abstract class AbstractGremlinServerChannelizerIntegrateTest extends AbstractGre
setWsClient(username, password);
assertEquals(result, wsClient.submit(gremlin).all().get().get(0).getInt());
}
- if (nioClient != null) {
- assertEquals(result, nioClient.submit(gremlin).all().get().get(0).getInt());
- }
- }
-
- private void setNioClient(final String username, final String password) {
- nioBuilder.channelizer(Channelizer.NioChannelizer.class.getName());
- if (username != null && password != null) {
- final AuthProperties authProps = new AuthProperties()
- .with(Property.USERNAME, username)
- .with(Property.PASSWORD, password);
-
- nioCluster = nioBuilder.enableSsl(secure).sslSkipCertValidation(true).authProperties(authProps).create();
- nioClient = nioCluster.connect();
- } else {
- nioCluster = nioBuilder.enableSsl(secure).create();
- nioClient = nioCluster.connect();
- }
}
private void setWsClient(final String username, final String password) {
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizerIntegrateTest.java
deleted file mode 100644
index 8388b40..0000000
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/NioChannelizerIntegrateTest.java
+++ /dev/null
@@ -1,56 +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.tinkerpop.gremlin.server.channel;
-
-
-import org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator;
-import org.apache.tinkerpop.gremlin.server.Settings;
-
-import java.util.Map;
-import java.util.HashMap;
-
-public class NioChannelizerIntegrateTest extends AbstractGremlinServerChannelizerIntegrateTest {
-
- @Override
- public String getProtocol() {
- return NIO;
- }
-
- @Override
- public String getSecureProtocol() {
- return NIO_SECURE;
- }
-
- @Override
- public String getChannelizer() {
- return NioChannelizer.class.getName();
- }
-
- @Override
- public Settings.AuthenticationSettings getAuthSettings() {
- final Settings.AuthenticationSettings authSettings = new Settings.AuthenticationSettings();
- final Map<String,Object> authConfig = new HashMap<>();
- authSettings.authenticator = SimpleAuthenticator.class.getName();
- authConfig.put(SimpleAuthenticator.CONFIG_CREDENTIALS_DB, "conf/tinkergraph-credentials.properties");
- authSettings.config = authConfig;
-
- return authSettings;
- }
-
-}