metadata) {
- future.complete(null);
- }
-
- @Override
- public void onFailure(Throwable error) {
- future.completeExceptionally(error);
- }
-
- @Override
- public void onRecord(Value[] fields) {
- throw new UnsupportedOperationException(
- "Telemetry is not expected to receive records: " + Arrays.toString(fields));
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelActivityLogger.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelActivityLogger.java
deleted file mode 100644
index 22e65cfab2..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelActivityLogger.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.logging;
-
-import static java.lang.String.format;
-
-import io.netty.channel.Channel;
-import java.util.ResourceBundle;
-import org.neo4j.driver.internal.bolt.api.LoggingProvider;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.async.connection.ChannelAttributes;
-
-public class ChannelActivityLogger implements System.Logger {
- private final Channel channel;
- private final String localChannelId;
- private final System.Logger delegate;
-
- private String dbConnectionId;
- private String serverAddress;
-
- public ChannelActivityLogger(Channel channel, LoggingProvider logging, Class> owner) {
- this(channel, logging.getLog(owner));
- }
-
- private ChannelActivityLogger(Channel channel, System.Logger delegate) {
- this.channel = channel;
- this.delegate = delegate;
- this.localChannelId = channel != null ? channel.id().toString() : null;
- }
-
- @Override
- public String getName() {
- return delegate.getName();
- }
-
- @Override
- public boolean isLoggable(Level level) {
- return delegate.isLoggable(level);
- }
-
- @Override
- public void log(Level level, ResourceBundle bundle, String msg, Throwable thrown) {
- delegate.log(level, bundle, reformat(msg), thrown);
- }
-
- @Override
- public void log(Level level, ResourceBundle bundle, String format, Object... params) {
- delegate.log(level, bundle, reformat(format), params);
- }
-
- String reformat(String message) {
- if (channel == null) {
- return message;
- }
-
- var dbConnectionId = getDbConnectionId();
- var serverAddress = getServerAddress();
-
- return format(
- "[0x%s][%s][%s] %s",
- localChannelId, valueOrEmpty(serverAddress), valueOrEmpty(dbConnectionId), message);
- }
-
- private String getDbConnectionId() {
- if (dbConnectionId == null) {
- dbConnectionId = ChannelAttributes.connectionId(channel);
- }
- return dbConnectionId;
- }
-
- private String getServerAddress() {
-
- if (serverAddress == null) {
- var serverAddress = ChannelAttributes.serverAddress(channel);
- this.serverAddress = serverAddress != null ? serverAddress.toString() : null;
- }
-
- return serverAddress;
- }
-
- /**
- * Returns the submitted value if it is not null or an empty string if it is.
- */
- private static String valueOrEmpty(String value) {
- return value != null ? value : "";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelErrorLogger.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelErrorLogger.java
deleted file mode 100644
index 21e3b768f2..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/logging/ChannelErrorLogger.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.logging;
-
-import io.netty.channel.Channel;
-import org.neo4j.driver.internal.bolt.api.LoggingProvider;
-
-/**
- * Dedicated logger for channel error logging.
- *
- * It keeps messages shorter in debug mode and provides more details in trace mode.
- */
-public class ChannelErrorLogger extends ChannelActivityLogger {
- private static final String DEBUG_MESSAGE_FORMAT = "%s (%s)";
-
- public ChannelErrorLogger(Channel channel, LoggingProvider logging) {
- super(channel, logging, ChannelErrorLogger.class);
- }
-
- public void traceOrDebug(String message, Throwable error) {
- if (isLoggable(Level.TRACE)) {
- log(Level.ERROR, message, error);
- } else {
- log(Level.DEBUG, String.format(DEBUG_MESSAGE_FORMAT, message, error.getClass()));
- }
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/AbstractMessageWriter.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/AbstractMessageWriter.java
deleted file mode 100644
index 5793673012..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/AbstractMessageWriter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import static java.util.Objects.requireNonNull;
-
-import java.io.IOException;
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public abstract class AbstractMessageWriter implements MessageFormat.Writer {
- private final ValuePacker packer;
- private final Map encodersByMessageSignature;
- private final ValueFactory valueFactory;
-
- protected AbstractMessageWriter(
- ValuePacker packer, Map encodersByMessageSignature, ValueFactory valueFactory) {
- this.packer = requireNonNull(packer);
- this.encodersByMessageSignature = requireNonNull(encodersByMessageSignature);
- this.valueFactory = requireNonNull(valueFactory);
- }
-
- @Override
- public final void write(Message msg) throws IOException {
- var signature = msg.signature();
- var encoder = encodersByMessageSignature.get(signature);
- if (encoder == null) {
- throw new IOException("No encoder found for message " + msg + " with signature " + signature);
- }
- encoder.encode(msg, packer, valueFactory);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltPatchesListener.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltPatchesListener.java
deleted file mode 100644
index 6584400b3d..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltPatchesListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.util.Set;
-
-public interface BoltPatchesListener {
- String DATE_TIME_UTC_PATCH = "utc";
-
- void handle(Set patches);
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltProtocol.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltProtocol.java
deleted file mode 100644
index 19bb66cd0a..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/BoltProtocol.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.async.connection.ChannelAttributes.protocolVersion;
-
-import io.netty.channel.Channel;
-import java.time.Clock;
-import java.time.Duration;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionStage;
-import org.neo4j.driver.internal.bolt.api.AccessMode;
-import org.neo4j.driver.internal.bolt.api.BoltAgent;
-import org.neo4j.driver.internal.bolt.api.BoltProtocolVersion;
-import org.neo4j.driver.internal.bolt.api.DatabaseName;
-import org.neo4j.driver.internal.bolt.api.LoggingProvider;
-import org.neo4j.driver.internal.bolt.api.NotificationConfig;
-import org.neo4j.driver.internal.bolt.api.RoutingContext;
-import org.neo4j.driver.internal.bolt.api.exception.BoltClientException;
-import org.neo4j.driver.internal.bolt.api.exception.BoltUnsupportedFeatureException;
-import org.neo4j.driver.internal.bolt.api.summary.BeginSummary;
-import org.neo4j.driver.internal.bolt.api.summary.DiscardSummary;
-import org.neo4j.driver.internal.bolt.api.summary.RouteSummary;
-import org.neo4j.driver.internal.bolt.api.summary.RunSummary;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.async.connection.BoltProtocolUtil;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.spi.Connection;
-
-public interface BoltProtocol {
- MessageFormat createMessageFormat();
-
- CompletionStage initializeChannel(
- Channel channel,
- String userAgent,
- BoltAgent boltAgent,
- Map authMap,
- RoutingContext routingContext,
- NotificationConfig notificationConfig,
- Clock clock,
- CompletableFuture latestAuthMillisFuture,
- ValueFactory valueFactory);
-
- CompletionStage route(
- Connection connection,
- Map routingContext,
- Set bookmarks,
- String databaseName,
- String impersonatedUser,
- MessageHandler handler,
- Clock clock,
- LoggingProvider logging,
- ValueFactory valueFactory);
-
- CompletionStage beginTransaction(
- Connection connection,
- DatabaseName databaseName,
- AccessMode accessMode,
- String impersonatedUser,
- Set bookmarks,
- Duration txTimeout,
- Map txMetadata,
- String txType,
- NotificationConfig notificationConfig,
- MessageHandler handler,
- LoggingProvider logging,
- ValueFactory valueFactory);
-
- CompletionStage commitTransaction(Connection connection, MessageHandler handler);
-
- CompletionStage rollbackTransaction(Connection connection, MessageHandler handler);
-
- CompletionStage telemetry(Connection connection, Integer api, MessageHandler handler);
-
- CompletionStage runAuto(
- Connection connection,
- DatabaseName databaseName,
- AccessMode accessMode,
- String impersonatedUser,
- String query,
- Map parameters,
- Set bookmarks,
- Duration txTimeout,
- Map txMetadata,
- NotificationConfig notificationConfig,
- MessageHandler handler,
- LoggingProvider logging,
- ValueFactory valueFactory);
-
- CompletionStage run(
- Connection connection, String query, Map parameters, MessageHandler handler);
-
- CompletionStage pull(
- Connection connection, long qid, long request, PullMessageHandler handler, ValueFactory valueFactory);
-
- CompletionStage discard(
- Connection connection,
- long qid,
- long number,
- MessageHandler handler,
- ValueFactory valueFactory);
-
- CompletionStage reset(Connection connection, MessageHandler handler);
-
- default CompletionStage logoff(Connection connection, MessageHandler handler) {
- return CompletableFuture.failedStage(new BoltUnsupportedFeatureException("logoff not supported"));
- }
-
- default CompletionStage logon(
- Connection connection,
- Map authMap,
- Clock clock,
- MessageHandler handler,
- ValueFactory valueFactory) {
- return CompletableFuture.failedStage(new BoltUnsupportedFeatureException("logon not supported"));
- }
-
- /**
- * Returns the protocol version. It can be used for version specific error messages.
- * @return the protocol version.
- */
- BoltProtocolVersion version();
-
- static BoltProtocol forChannel(Channel channel) {
- return forVersion(protocolVersion(channel));
- }
-
- static BoltProtocol forVersion(BoltProtocolVersion version) {
- var protocol = BoltProtocolUtil.versionToProtocol.get(version);
- if (protocol != null) {
- return protocol;
- } else {
- throw new BoltClientException("Unknown protocol version: " + version);
- }
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/Message.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/Message.java
deleted file mode 100644
index dd77b8e4d6..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/Message.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-/**
- * Base class for all protocol messages.
- */
-public interface Message {
- byte signature();
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageEncoder.java
deleted file mode 100644
index dc1a9a4041..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageEncoder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public interface MessageEncoder {
- void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException;
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageFormat.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageFormat.java
deleted file mode 100644
index 218771c1d6..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageFormat.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackInput;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackOutput;
-
-public interface MessageFormat {
- interface Writer {
- void write(Message msg) throws IOException;
- }
-
- interface Reader {
- void read(ResponseMessageHandler handler) throws IOException;
- }
-
- Writer newWriter(PackOutput output, ValueFactory valueFactory);
-
- Reader newReader(PackInput input, ValueFactory valueFactory);
-
- /**
- * Enables datetime in UTC if supported by the given message format. This is only for use with formats that support multiple modes.
- *
- * This only takes effect on subsequent writer and reader creation via {@link #newWriter(PackOutput, ValueFactory)} and {@link #newReader(PackInput, ValueFactory)}.
- */
- default void enableDateTimeUtc() {}
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageHandler.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageHandler.java
deleted file mode 100644
index 7b67fe07ee..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/MessageHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-public interface MessageHandler {
- void onError(Throwable throwable);
-
- void onSummary(T summary);
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/PullMessageHandler.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/PullMessageHandler.java
deleted file mode 100644
index 9ca5346f98..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/PullMessageHandler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import org.neo4j.driver.internal.bolt.api.summary.PullSummary;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-
-public interface PullMessageHandler extends MessageHandler {
- void onRecord(Value[] fields);
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ResponseMessageHandler.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ResponseMessageHandler.java
deleted file mode 100644
index 2cd81da268..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ResponseMessageHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.GqlError;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-
-public interface ResponseMessageHandler {
- void handleSuccessMessage(Map meta);
-
- void handleRecordMessage(Value[] fields);
-
- void handleFailureMessage(GqlError gqlError);
-
- void handleIgnoredMessage();
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValuePacker.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValuePacker.java
deleted file mode 100644
index b85c6168fa..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValuePacker.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.io.IOException;
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-
-public interface ValuePacker {
- void packStructHeader(int size, byte signature) throws IOException;
-
- void pack(String string) throws IOException;
-
- void pack(Value value) throws IOException;
-
- void pack(Map map) throws IOException;
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValueUnpacker.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValueUnpacker.java
deleted file mode 100644
index 9e646cfaed..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/ValueUnpacker.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging;
-
-import java.io.IOException;
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-
-public interface ValueUnpacker {
- @SuppressWarnings("UnusedReturnValue")
- long unpackStructHeader() throws IOException;
-
- int unpackStructSignature() throws IOException;
-
- Map unpackMap() throws IOException;
-
- Value[] unpackArray() throws IOException;
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonMessageReader.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonMessageReader.java
deleted file mode 100644
index 50844d9c3e..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonMessageReader.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.common;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Objects;
-import org.neo4j.driver.internal.bolt.api.GqlError;
-import org.neo4j.driver.internal.bolt.api.GqlStatusError;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageFormat;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ResponseMessageHandler;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValueUnpacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.response.FailureMessage;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.response.IgnoredMessage;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.response.RecordMessage;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.response.SuccessMessage;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackInput;
-
-public class CommonMessageReader implements MessageFormat.Reader {
- protected final ValueUnpacker unpacker;
- protected final ValueFactory valueFactory;
-
- public CommonMessageReader(PackInput input, boolean dateTimeUtcEnabled, ValueFactory valueFactory) {
- this(new CommonValueUnpacker(input, dateTimeUtcEnabled, valueFactory), valueFactory);
- }
-
- protected CommonMessageReader(ValueUnpacker unpacker, ValueFactory valueFactory) {
- this.unpacker = unpacker;
- this.valueFactory = Objects.requireNonNull(valueFactory);
- }
-
- @Override
- public void read(ResponseMessageHandler handler) throws IOException {
- unpacker.unpackStructHeader();
- var type = unpacker.unpackStructSignature();
- switch (type) {
- case SuccessMessage.SIGNATURE -> unpackSuccessMessage(handler);
- case FailureMessage.SIGNATURE -> unpackFailureMessage(handler);
- case IgnoredMessage.SIGNATURE -> unpackIgnoredMessage(handler);
- case RecordMessage.SIGNATURE -> unpackRecordMessage(handler);
- default -> throw new IOException("Unknown message type: " + type);
- }
- }
-
- private void unpackSuccessMessage(ResponseMessageHandler output) throws IOException {
- var map = unpacker.unpackMap();
- output.handleSuccessMessage(map);
- }
-
- protected void unpackFailureMessage(ResponseMessageHandler output) throws IOException {
- var params = unpacker.unpackMap();
- var code = params.get("code").asString();
- var message = params.get("message").asString();
- var diagnosticRecord = Map.ofEntries(
- Map.entry("CURRENT_SCHEMA", valueFactory.value("/")),
- Map.entry("OPERATION", valueFactory.value("")),
- Map.entry("OPERATION_CODE", valueFactory.value("0")));
- var gqlError = new GqlError(
- GqlStatusError.UNKNOWN.getStatus(),
- GqlStatusError.UNKNOWN.getStatusDescription(message),
- code,
- message,
- diagnosticRecord,
- null);
- output.handleFailureMessage(gqlError);
- }
-
- private void unpackIgnoredMessage(ResponseMessageHandler output) {
- output.handleIgnoredMessage();
- }
-
- private void unpackRecordMessage(ResponseMessageHandler output) throws IOException {
- var fields = unpacker.unpackArray();
- output.handleRecordMessage(fields);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValuePacker.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValuePacker.java
deleted file mode 100644
index bc4475d4e7..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValuePacker.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.common;
-
-import static java.time.ZoneOffset.UTC;
-
-import java.io.IOException;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.OffsetTime;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.values.IsoDuration;
-import org.neo4j.driver.internal.bolt.api.values.Point;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackOutput;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackStream;
-
-public class CommonValuePacker implements ValuePacker {
-
- public static final byte DATE = 'D';
- public static final int DATE_STRUCT_SIZE = 1;
-
- public static final byte TIME = 'T';
- public static final int TIME_STRUCT_SIZE = 2;
-
- public static final byte LOCAL_TIME = 't';
- public static final int LOCAL_TIME_STRUCT_SIZE = 1;
-
- public static final byte LOCAL_DATE_TIME = 'd';
- public static final int LOCAL_DATE_TIME_STRUCT_SIZE = 2;
-
- public static final byte DATE_TIME_WITH_ZONE_OFFSET = 'F';
- public static final byte DATE_TIME_WITH_ZONE_OFFSET_UTC = 'I';
- public static final byte DATE_TIME_WITH_ZONE_ID = 'f';
- public static final byte DATE_TIME_WITH_ZONE_ID_UTC = 'i';
- public static final int DATE_TIME_STRUCT_SIZE = 3;
-
- public static final byte DURATION = 'E';
- public static final int DURATION_TIME_STRUCT_SIZE = 4;
-
- public static final byte POINT_2D_STRUCT_TYPE = 'X';
- public static final int POINT_2D_STRUCT_SIZE = 3;
-
- public static final byte POINT_3D_STRUCT_TYPE = 'Y';
- public static final int POINT_3D_STRUCT_SIZE = 4;
-
- private final boolean dateTimeUtcEnabled;
- protected final PackStream.Packer packer;
-
- public CommonValuePacker(PackOutput output, boolean dateTimeUtcEnabled) {
- this.dateTimeUtcEnabled = dateTimeUtcEnabled;
- this.packer = new PackStream.Packer(output);
- }
-
- @Override
- public final void packStructHeader(int size, byte signature) throws IOException {
- packer.packStructHeader(size, signature);
- }
-
- @Override
- public final void pack(String string) throws IOException {
- packer.pack(string);
- }
-
- @Override
- public final void pack(Value value) throws IOException {
- packInternalValue(value);
- }
-
- @Override
- public final void pack(Map map) throws IOException {
- if (map == null || map.isEmpty()) {
- packer.packMapHeader(0);
- return;
- }
- packer.packMapHeader(map.size());
- for (var entry : map.entrySet()) {
- packer.pack(entry.getKey());
- pack(entry.getValue());
- }
- }
-
- protected void packInternalValue(Value value) throws IOException {
- switch (value.type()) {
- case DATE -> packDate(value.asLocalDate());
- case TIME -> packTime(value.asOffsetTime());
- case LOCAL_TIME -> packLocalTime(value.asLocalTime());
- case LOCAL_DATE_TIME -> packLocalDateTime(value.asLocalDateTime());
- case DATE_TIME -> {
- if (dateTimeUtcEnabled) {
- packZonedDateTimeUsingUtcBaseline(value.asZonedDateTime());
- } else {
- packZonedDateTime(value.asZonedDateTime());
- }
- }
- case DURATION -> packDuration(value.asIsoDuration());
- case POINT -> packPoint(value.asPoint());
- case NULL -> packer.packNull();
- case BYTES -> packer.pack(value.asByteArray());
- case STRING -> packer.pack(value.asString());
- case BOOLEAN -> packer.pack(value.asBoolean());
- case INTEGER -> packer.pack(value.asLong());
- case FLOAT -> packer.pack(value.asDouble());
- case MAP -> {
- packer.packMapHeader(value.size());
- for (var s : value.keys()) {
- packer.pack(s);
- pack(value.get(s));
- }
- }
- case LIST -> {
- packer.packListHeader(value.size());
- for (var item : value.values()) {
- pack(item);
- }
- }
- default -> throw new IOException("Unknown type: " + value.type().name());
- }
- }
-
- private void packDate(LocalDate localDate) throws IOException {
- packer.packStructHeader(DATE_STRUCT_SIZE, DATE);
- packer.pack(localDate.toEpochDay());
- }
-
- private void packTime(OffsetTime offsetTime) throws IOException {
- var nanoOfDayLocal = offsetTime.toLocalTime().toNanoOfDay();
- var offsetSeconds = offsetTime.getOffset().getTotalSeconds();
-
- packer.packStructHeader(TIME_STRUCT_SIZE, TIME);
- packer.pack(nanoOfDayLocal);
- packer.pack(offsetSeconds);
- }
-
- private void packLocalTime(LocalTime localTime) throws IOException {
- packer.packStructHeader(LOCAL_TIME_STRUCT_SIZE, LOCAL_TIME);
- packer.pack(localTime.toNanoOfDay());
- }
-
- private void packLocalDateTime(LocalDateTime localDateTime) throws IOException {
- var epochSecondUtc = localDateTime.toEpochSecond(UTC);
- var nano = localDateTime.getNano();
-
- packer.packStructHeader(LOCAL_DATE_TIME_STRUCT_SIZE, LOCAL_DATE_TIME);
- packer.pack(epochSecondUtc);
- packer.pack(nano);
- }
-
- @SuppressWarnings("DuplicatedCode")
- private void packZonedDateTimeUsingUtcBaseline(ZonedDateTime zonedDateTime) throws IOException {
- var instant = zonedDateTime.toInstant();
- var epochSecondLocal = instant.getEpochSecond();
- var nano = zonedDateTime.getNano();
- var zone = zonedDateTime.getZone();
-
- if (zone instanceof ZoneOffset) {
- var offsetSeconds = ((ZoneOffset) zone).getTotalSeconds();
-
- packer.packStructHeader(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_OFFSET_UTC);
- packer.pack(epochSecondLocal);
- packer.pack(nano);
- packer.pack(offsetSeconds);
- } else {
- var zoneId = zone.getId();
-
- packer.packStructHeader(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_ID_UTC);
- packer.pack(epochSecondLocal);
- packer.pack(nano);
- packer.pack(zoneId);
- }
- }
-
- @SuppressWarnings("DuplicatedCode")
- private void packZonedDateTime(ZonedDateTime zonedDateTime) throws IOException {
- var epochSecondLocal = zonedDateTime.toLocalDateTime().toEpochSecond(UTC);
- var nano = zonedDateTime.getNano();
-
- var zone = zonedDateTime.getZone();
- if (zone instanceof ZoneOffset) {
- var offsetSeconds = ((ZoneOffset) zone).getTotalSeconds();
-
- packer.packStructHeader(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_OFFSET);
- packer.pack(epochSecondLocal);
- packer.pack(nano);
- packer.pack(offsetSeconds);
- } else {
- var zoneId = zone.getId();
-
- packer.packStructHeader(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_ID);
- packer.pack(epochSecondLocal);
- packer.pack(nano);
- packer.pack(zoneId);
- }
- }
-
- private void packDuration(IsoDuration duration) throws IOException {
- packer.packStructHeader(DURATION_TIME_STRUCT_SIZE, DURATION);
- packer.pack(duration.months());
- packer.pack(duration.days());
- packer.pack(duration.seconds());
- packer.pack(duration.nanoseconds());
- }
-
- private void packPoint(Point point) throws IOException {
- if (Double.isNaN(point.z())) {
- packPoint2D(point);
- } else {
- packPoint3D(point);
- }
- }
-
- private void packPoint2D(Point point) throws IOException {
- packer.packStructHeader(POINT_2D_STRUCT_SIZE, POINT_2D_STRUCT_TYPE);
- packer.pack(point.srid());
- packer.pack(point.x());
- packer.pack(point.y());
- }
-
- private void packPoint3D(Point point) throws IOException {
- packer.packStructHeader(POINT_3D_STRUCT_SIZE, POINT_3D_STRUCT_TYPE);
- packer.pack(point.srid());
- packer.pack(point.x());
- packer.pack(point.y());
- packer.pack(point.z());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValueUnpacker.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValueUnpacker.java
deleted file mode 100644
index 1f69c62f98..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/common/CommonValueUnpacker.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.common;
-
-import static java.time.ZoneOffset.UTC;
-
-import java.io.IOException;
-import java.time.DateTimeException;
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.OffsetTime;
-import java.time.ZoneId;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.function.Supplier;
-import org.neo4j.driver.internal.bolt.api.exception.BoltClientException;
-import org.neo4j.driver.internal.bolt.api.exception.BoltProtocolException;
-import org.neo4j.driver.internal.bolt.api.values.Node;
-import org.neo4j.driver.internal.bolt.api.values.Path;
-import org.neo4j.driver.internal.bolt.api.values.Relationship;
-import org.neo4j.driver.internal.bolt.api.values.Segment;
-import org.neo4j.driver.internal.bolt.api.values.Type;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValueUnpacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackInput;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.packstream.PackStream;
-
-public class CommonValueUnpacker implements ValueUnpacker {
- public static final byte DATE = 'D';
- public static final int DATE_STRUCT_SIZE = 1;
-
- public static final byte TIME = 'T';
- public static final int TIME_STRUCT_SIZE = 2;
-
- public static final byte LOCAL_TIME = 't';
- public static final int LOCAL_TIME_STRUCT_SIZE = 1;
-
- public static final byte LOCAL_DATE_TIME = 'd';
- public static final int LOCAL_DATE_TIME_STRUCT_SIZE = 2;
-
- public static final byte DATE_TIME_WITH_ZONE_OFFSET = 'F';
- public static final byte DATE_TIME_WITH_ZONE_OFFSET_UTC = 'I';
- public static final byte DATE_TIME_WITH_ZONE_ID = 'f';
- public static final byte DATE_TIME_WITH_ZONE_ID_UTC = 'i';
- public static final int DATE_TIME_STRUCT_SIZE = 3;
-
- public static final byte DURATION = 'E';
- public static final int DURATION_TIME_STRUCT_SIZE = 4;
-
- public static final byte POINT_2D_STRUCT_TYPE = 'X';
- public static final int POINT_2D_STRUCT_SIZE = 3;
-
- public static final byte POINT_3D_STRUCT_TYPE = 'Y';
- public static final int POINT_3D_STRUCT_SIZE = 4;
-
- public static final byte NODE = 'N';
- public static final byte RELATIONSHIP = 'R';
- public static final byte UNBOUND_RELATIONSHIP = 'r';
- public static final byte PATH = 'P';
-
- private static final int NODE_FIELDS = 3;
- private static final int RELATIONSHIP_FIELDS = 5;
-
- private final boolean dateTimeUtcEnabled;
- protected final PackStream.Unpacker unpacker;
- protected final ValueFactory valueFactory;
-
- public CommonValueUnpacker(PackInput input, boolean dateTimeUtcEnabled, ValueFactory valueFactory) {
- this.dateTimeUtcEnabled = dateTimeUtcEnabled;
- this.unpacker = new PackStream.Unpacker(input);
- this.valueFactory = Objects.requireNonNull(valueFactory);
- }
-
- @Override
- public long unpackStructHeader() throws IOException {
- return unpacker.unpackStructHeader();
- }
-
- @Override
- public int unpackStructSignature() throws IOException {
- return unpacker.unpackStructSignature();
- }
-
- @Override
- public Map unpackMap() throws IOException {
- var size = (int) unpacker.unpackMapHeader();
- if (size == 0) {
- return Collections.emptyMap();
- }
- Map map = new HashMap<>(size);
- for (var i = 0; i < size; i++) {
- var key = unpacker.unpackString();
- map.put(key, unpack());
- }
- return map;
- }
-
- @Override
- public Value[] unpackArray() throws IOException {
- var size = (int) unpacker.unpackListHeader();
- var values = new Value[size];
- for (var i = 0; i < size; i++) {
- values[i] = unpack();
- }
- return values;
- }
-
- protected Value unpack() throws IOException {
- var type = unpacker.peekNextType();
- switch (type) {
- case NULL -> {
- return valueFactory.value(unpacker.unpackNull());
- }
- case BOOLEAN -> {
- return valueFactory.value(unpacker.unpackBoolean());
- }
- case INTEGER -> {
- return valueFactory.value(unpacker.unpackLong());
- }
- case FLOAT -> {
- return valueFactory.value(unpacker.unpackDouble());
- }
- case BYTES -> {
- return valueFactory.value(unpacker.unpackBytes());
- }
- case STRING -> {
- return valueFactory.value(unpacker.unpackString());
- }
- case MAP -> {
- return valueFactory.value(unpackMap());
- }
- case LIST -> {
- var size = (int) unpacker.unpackListHeader();
- var vals = new Value[size];
- for (var j = 0; j < size; j++) {
- vals[j] = unpack();
- }
- return valueFactory.value(vals);
- }
- case STRUCT -> {
- var size = unpacker.unpackStructHeader();
- var structType = unpacker.unpackStructSignature();
- return unpackStruct(size, structType);
- }
- }
- throw new IOException("Unknown value type: " + type);
- }
-
- private Value unpackStruct(long size, byte type) throws IOException {
- switch (type) {
- case DATE -> {
- ensureCorrectStructSize(Type.DATE, DATE_STRUCT_SIZE, size);
- return unpackDate();
- }
- case TIME -> {
- ensureCorrectStructSize(Type.TIME, TIME_STRUCT_SIZE, size);
- return unpackTime();
- }
- case LOCAL_TIME -> {
- ensureCorrectStructSize(Type.LOCAL_TIME, LOCAL_TIME_STRUCT_SIZE, size);
- return unpackLocalTime();
- }
- case LOCAL_DATE_TIME -> {
- ensureCorrectStructSize(Type.LOCAL_DATE_TIME, LOCAL_DATE_TIME_STRUCT_SIZE, size);
- return unpackLocalDateTime();
- }
- case DATE_TIME_WITH_ZONE_OFFSET -> {
- if (!dateTimeUtcEnabled) {
- ensureCorrectStructSize(Type.DATE_TIME, DATE_TIME_STRUCT_SIZE, size);
- return unpackDateTime(ZoneMode.OFFSET, BaselineMode.LEGACY);
- } else {
- throw instantiateExceptionForUnknownType(type);
- }
- }
- case DATE_TIME_WITH_ZONE_OFFSET_UTC -> {
- if (dateTimeUtcEnabled) {
- ensureCorrectStructSize(Type.DATE_TIME, DATE_TIME_STRUCT_SIZE, size);
- return unpackDateTime(ZoneMode.OFFSET, BaselineMode.UTC);
- } else {
- throw instantiateExceptionForUnknownType(type);
- }
- }
- case DATE_TIME_WITH_ZONE_ID -> {
- if (!dateTimeUtcEnabled) {
- ensureCorrectStructSize(Type.DATE_TIME, DATE_TIME_STRUCT_SIZE, size);
- return unpackDateTime(ZoneMode.ZONE_ID, BaselineMode.LEGACY);
- } else {
- throw instantiateExceptionForUnknownType(type);
- }
- }
- case DATE_TIME_WITH_ZONE_ID_UTC -> {
- if (dateTimeUtcEnabled) {
- ensureCorrectStructSize(Type.DATE_TIME, DATE_TIME_STRUCT_SIZE, size);
- return unpackDateTime(ZoneMode.ZONE_ID, BaselineMode.UTC);
- } else {
- throw instantiateExceptionForUnknownType(type);
- }
- }
- case DURATION -> {
- ensureCorrectStructSize(Type.DURATION, DURATION_TIME_STRUCT_SIZE, size);
- return unpackDuration();
- }
- case POINT_2D_STRUCT_TYPE -> {
- ensureCorrectStructSize(Type.POINT, POINT_2D_STRUCT_SIZE, size);
- return unpackPoint2D();
- }
- case POINT_3D_STRUCT_TYPE -> {
- ensureCorrectStructSize(Type.POINT, POINT_3D_STRUCT_SIZE, size);
- return unpackPoint3D();
- }
- case NODE -> {
- ensureCorrectStructSize(Type.NODE, getNodeFields(), size);
- return valueFactory.value(unpackNode());
- }
- case RELATIONSHIP -> {
- ensureCorrectStructSize(Type.RELATIONSHIP, getRelationshipFields(), size);
- return valueFactory.value(unpackRelationship());
- }
- case PATH -> {
- ensureCorrectStructSize(Type.PATH, 3, size);
- return valueFactory.value(unpackPath());
- }
- default -> throw instantiateExceptionForUnknownType(type);
- }
- }
-
- protected Relationship unpackRelationship() throws IOException {
- var urn = unpacker.unpackLong();
- var startUrn = unpacker.unpackLong();
- var endUrn = unpacker.unpackLong();
- var relType = unpacker.unpackString();
- var props = unpackMap();
-
- return valueFactory.relationship(
- urn,
- String.valueOf(urn),
- startUrn,
- String.valueOf(startUrn),
- endUrn,
- String.valueOf(endUrn),
- relType,
- props);
- }
-
- @SuppressWarnings("DuplicatedCode")
- protected Node unpackNode() throws IOException {
- var urn = unpacker.unpackLong();
-
- var numLabels = (int) unpacker.unpackListHeader();
- List labels = new ArrayList<>(numLabels);
- for (var i = 0; i < numLabels; i++) {
- labels.add(unpacker.unpackString());
- }
- var numProps = (int) unpacker.unpackMapHeader();
- Map props = new HashMap<>(numProps);
- for (var j = 0; j < numProps; j++) {
- var key = unpacker.unpackString();
- props.put(key, unpack());
- }
-
- return valueFactory.node(urn, String.valueOf(urn), labels, props);
- }
-
- @SuppressWarnings("DuplicatedCode")
- protected Path unpackPath() throws IOException {
- // List of unique nodes
- var uniqNodes = new Node[(int) unpacker.unpackListHeader()];
- for (var i = 0; i < uniqNodes.length; i++) {
- ensureCorrectStructSize(Type.NODE, getNodeFields(), unpacker.unpackStructHeader());
- ensureCorrectStructSignature("NODE", NODE, unpacker.unpackStructSignature());
- uniqNodes[i] = unpackNode();
- }
-
- // List of unique relationships, without start/end information
- var uniqRels = new Relationship[(int) unpacker.unpackListHeader()];
- for (var i = 0; i < uniqRels.length; i++) {
- ensureCorrectStructSize(Type.RELATIONSHIP, 3, unpacker.unpackStructHeader());
- ensureCorrectStructSignature(
- "UNBOUND_RELATIONSHIP", UNBOUND_RELATIONSHIP, unpacker.unpackStructSignature());
- var id = unpacker.unpackLong();
- var relType = unpacker.unpackString();
- var props = unpackMap();
- uniqRels[i] = valueFactory.relationship(
- id, String.valueOf(id), -1, String.valueOf(-1), -1, String.valueOf(-1), relType, props);
- }
-
- // Path sequence
- var length = (int) unpacker.unpackListHeader();
-
- // Knowing the sequence length, we can create the arrays that will represent the nodes, rels and segments in
- // their "path order"
- var segments = new Segment[length / 2];
- var nodes = new Node[segments.length + 1];
- var rels = new Relationship[segments.length];
-
- Node prevNode = uniqNodes[0], nextNode; // Start node is always 0, and isn't encoded in the sequence
- nodes[0] = prevNode;
- Relationship rel;
- for (var i = 0; i < segments.length; i++) {
- var relIdx = (int) unpacker.unpackLong();
- nextNode = uniqNodes[(int) unpacker.unpackLong()];
- // Negative rel index means this rel was traversed "inversed" from its direction
- if (relIdx < 0) {
- rel = uniqRels[(-relIdx) - 1]; // -1 because rel idx are 1-indexed
- rel.setStartAndEnd(
- nextNode.id(), String.valueOf(nextNode.id()), prevNode.id(), String.valueOf(prevNode.id()));
- } else {
- rel = uniqRels[relIdx - 1];
- rel.setStartAndEnd(
- prevNode.id(), String.valueOf(prevNode.id()), nextNode.id(), String.valueOf(nextNode.id()));
- }
-
- nodes[i + 1] = nextNode;
- rels[i] = rel;
- segments[i] = valueFactory.segment(prevNode, rel, nextNode);
- prevNode = nextNode;
- }
- return valueFactory.path(Arrays.asList(segments), Arrays.asList(nodes), Arrays.asList(rels));
- }
-
- protected final void ensureCorrectStructSize(Type type, int expected, long actual) {
- if (expected != actual) {
- var structName = type.toString();
- throw new BoltClientException(String.format(
- "Invalid message received, serialized %s structures should have %d fields, "
- + "received %s structure has %d fields.",
- structName, expected, structName, actual));
- }
- }
-
- protected void ensureCorrectStructSignature(String structName, byte expected, byte actual) {
- if (expected != actual) {
- throw new BoltClientException(String.format(
- "Invalid message received, expected a `%s`, signature 0x%s. Received signature was 0x%s.",
- structName, Integer.toHexString(expected), Integer.toHexString(actual)));
- }
- }
-
- private Value unpackDate() throws IOException {
- var epochDay = unpacker.unpackLong();
- return valueFactory.value(LocalDate.ofEpochDay(epochDay));
- }
-
- private Value unpackTime() throws IOException {
- var nanoOfDayLocal = unpacker.unpackLong();
- var offsetSeconds = Math.toIntExact(unpacker.unpackLong());
-
- var localTime = LocalTime.ofNanoOfDay(nanoOfDayLocal);
- var offset = ZoneOffset.ofTotalSeconds(offsetSeconds);
- return valueFactory.value(OffsetTime.of(localTime, offset));
- }
-
- private Value unpackLocalTime() throws IOException {
- var nanoOfDayLocal = unpacker.unpackLong();
- return valueFactory.value(LocalTime.ofNanoOfDay(nanoOfDayLocal));
- }
-
- private Value unpackLocalDateTime() throws IOException {
- var epochSecondUtc = unpacker.unpackLong();
- var nano = Math.toIntExact(unpacker.unpackLong());
- return valueFactory.value(LocalDateTime.ofEpochSecond(epochSecondUtc, nano, UTC));
- }
-
- private Value unpackDateTime(ZoneMode unpackOffset, BaselineMode useUtcBaseline) throws IOException {
- var epochSecondLocal = unpacker.unpackLong();
- var nano = Math.toIntExact(unpacker.unpackLong());
- Supplier zoneIdSupplier;
- if (unpackOffset == ZoneMode.OFFSET) {
- var offsetSeconds = Math.toIntExact(unpacker.unpackLong());
- zoneIdSupplier = () -> ZoneOffset.ofTotalSeconds(offsetSeconds);
- } else {
- var zoneIdString = unpacker.unpackString();
- zoneIdSupplier = () -> ZoneId.of(zoneIdString);
- }
- ZoneId zoneId;
- try {
- zoneId = zoneIdSupplier.get();
- } catch (DateTimeException e) {
- return valueFactory.unsupportedDateTimeValue(e);
- }
- return useUtcBaseline == BaselineMode.UTC
- ? valueFactory.value(newZonedDateTimeUsingUtcBaseline(epochSecondLocal, nano, zoneId))
- : valueFactory.value(newZonedDateTime(epochSecondLocal, nano, zoneId));
- }
-
- private Value unpackDuration() throws IOException {
- var months = unpacker.unpackLong();
- var days = unpacker.unpackLong();
- var seconds = unpacker.unpackLong();
- var nanoseconds = Math.toIntExact(unpacker.unpackLong());
- return valueFactory.isoDuration(months, days, seconds, nanoseconds);
- }
-
- private Value unpackPoint2D() throws IOException {
- var srid = Math.toIntExact(unpacker.unpackLong());
- var x = unpacker.unpackDouble();
- var y = unpacker.unpackDouble();
- return valueFactory.point(srid, x, y);
- }
-
- private Value unpackPoint3D() throws IOException {
- var srid = Math.toIntExact(unpacker.unpackLong());
- var x = unpacker.unpackDouble();
- var y = unpacker.unpackDouble();
- var z = unpacker.unpackDouble();
- return valueFactory.point(srid, x, y, z);
- }
-
- private static ZonedDateTime newZonedDateTime(long epochSecondLocal, long nano, ZoneId zoneId) {
- var instant = Instant.ofEpochSecond(epochSecondLocal, nano);
- var localDateTime = LocalDateTime.ofInstant(instant, UTC);
- return ZonedDateTime.of(localDateTime, zoneId);
- }
-
- private ZonedDateTime newZonedDateTimeUsingUtcBaseline(long epochSecondLocal, int nano, ZoneId zoneId) {
- var instant = Instant.ofEpochSecond(epochSecondLocal, nano);
- var localDateTime = LocalDateTime.ofInstant(instant, zoneId);
- return ZonedDateTime.of(localDateTime, zoneId);
- }
-
- private BoltProtocolException instantiateExceptionForUnknownType(byte type) {
- return new BoltProtocolException("Unknown struct type: " + type);
- }
-
- protected int getNodeFields() {
- return NODE_FIELDS;
- }
-
- protected int getRelationshipFields() {
- return RELATIONSHIP_FIELDS;
- }
-
- private enum ZoneMode {
- OFFSET,
- ZONE_ID
- }
-
- private enum BaselineMode {
- UTC,
- LEGACY
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/BeginMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/BeginMessageEncoder.java
deleted file mode 100644
index 3cf233fb22..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/BeginMessageEncoder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.BeginMessage;
-
-public class BeginMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, BeginMessage.class);
- var beginMessage = (BeginMessage) message;
- packer.packStructHeader(1, beginMessage.signature());
- packer.pack(beginMessage.metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/CommitMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/CommitMessageEncoder.java
deleted file mode 100644
index d47c1592da..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/CommitMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.CommitMessage;
-
-public class CommitMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, CommitMessage.class);
- packer.packStructHeader(0, CommitMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardAllMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardAllMessageEncoder.java
deleted file mode 100644
index 6d13df0b27..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardAllMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.DiscardAllMessage;
-
-public class DiscardAllMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, DiscardAllMessage.class);
- packer.packStructHeader(0, DiscardAllMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardMessageEncoder.java
deleted file mode 100644
index 284f3f6f12..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/DiscardMessageEncoder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.DiscardMessage;
-
-public class DiscardMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, DiscardMessage.class);
- packer.packStructHeader(1, DiscardMessage.SIGNATURE);
- packer.pack(((DiscardMessage) message).metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/GoodbyeMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/GoodbyeMessageEncoder.java
deleted file mode 100644
index 87e56792c3..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/GoodbyeMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.GoodbyeMessage;
-
-public class GoodbyeMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, GoodbyeMessage.class);
- packer.packStructHeader(0, GoodbyeMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/HelloMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/HelloMessageEncoder.java
deleted file mode 100644
index ad216c33f8..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/HelloMessageEncoder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.HelloMessage;
-
-public class HelloMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, HelloMessage.class);
- var helloMessage = (HelloMessage) message;
- packer.packStructHeader(1, helloMessage.signature());
- packer.pack(helloMessage.metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogoffMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogoffMessageEncoder.java
deleted file mode 100644
index d98e1f4970..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogoffMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.LogoffMessage;
-
-public class LogoffMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, LogoffMessage.class);
- packer.packStructHeader(0, message.signature());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogonMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogonMessageEncoder.java
deleted file mode 100644
index 387d545c52..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/LogonMessageEncoder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.LogonMessage;
-
-public class LogonMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, LogonMessage.class);
- var logonMessage = (LogonMessage) message;
- packer.packStructHeader(1, logonMessage.signature());
- packer.pack(logonMessage.metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullAllMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullAllMessageEncoder.java
deleted file mode 100644
index 10cb3db1b4..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullAllMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.PullAllMessage;
-
-public class PullAllMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, PullAllMessage.class);
- packer.packStructHeader(0, PullAllMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullMessageEncoder.java
deleted file mode 100644
index ae1a766c33..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/PullMessageEncoder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.PullMessage;
-
-public class PullMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, PullMessage.class);
- packer.packStructHeader(1, PullMessage.SIGNATURE);
- packer.pack(((PullMessage) message).metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/ResetMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/ResetMessageEncoder.java
deleted file mode 100644
index 3284f7a31f..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/ResetMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.ResetMessage;
-
-public class ResetMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, ResetMessage.class);
- packer.packStructHeader(0, ResetMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RollbackMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RollbackMessageEncoder.java
deleted file mode 100644
index d049b5715b..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RollbackMessageEncoder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.RollbackMessage;
-
-public class RollbackMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, RollbackMessage.class);
- packer.packStructHeader(0, RollbackMessage.SIGNATURE);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteMessageEncoder.java
deleted file mode 100644
index cf9e6d95fe..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteMessageEncoder.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.RouteMessage;
-
-/**
- * Encodes the ROUTE message to the stream
- */
-public class RouteMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, RouteMessage.class);
- var routeMessage = (RouteMessage) message;
- packer.packStructHeader(3, message.signature());
- packer.pack(routeMessage.routingContext());
- packer.pack(valueFactory.value(routeMessage.bookmarks()));
- packer.pack(routeMessage.databaseName());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteV44MessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteV44MessageEncoder.java
deleted file mode 100644
index 661002bca1..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RouteV44MessageEncoder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.RouteMessage;
-
-/**
- * Encodes the ROUTE message to the stream
- */
-public class RouteV44MessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, RouteMessage.class);
- var routeMessage = (RouteMessage) message;
- packer.packStructHeader(3, message.signature());
- packer.pack(routeMessage.routingContext());
- packer.pack(valueFactory.value(routeMessage.bookmarks()));
-
- Map params;
- if (routeMessage.impersonatedUser() != null && routeMessage.databaseName() == null) {
- params = Collections.singletonMap("imp_user", valueFactory.value(routeMessage.impersonatedUser()));
- } else if (routeMessage.databaseName() != null) {
- params = Collections.singletonMap("db", valueFactory.value(routeMessage.databaseName()));
- } else {
- params = Collections.emptyMap();
- }
- packer.pack(params);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RunWithMetadataMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RunWithMetadataMessageEncoder.java
deleted file mode 100644
index 9757c7e4e4..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/RunWithMetadataMessageEncoder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.RunWithMetadataMessage;
-
-public class RunWithMetadataMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, RunWithMetadataMessage.class);
- var runMessage = (RunWithMetadataMessage) message;
- packer.packStructHeader(3, runMessage.signature());
- packer.pack(runMessage.query());
- packer.pack(runMessage.parameters());
- packer.pack(runMessage.metadata());
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/TelemetryMessageEncoder.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/TelemetryMessageEncoder.java
deleted file mode 100644
index 4d3ff8ae9a..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/encode/TelemetryMessageEncoder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.encode;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.MessageEncoder;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.ValuePacker;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.TelemetryMessage;
-
-public class TelemetryMessageEncoder implements MessageEncoder {
- @Override
- public void encode(Message message, ValuePacker packer, ValueFactory valueFactory) throws IOException {
- checkArgument(message, TelemetryMessage.class);
- var telemetryMessage = (TelemetryMessage) message;
- packer.packStructHeader(1, TelemetryMessage.SIGNATURE);
- packer.pack(valueFactory.value(telemetryMessage.api()));
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/AbstractStreamingMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/AbstractStreamingMessage.java
deleted file mode 100644
index 5636aa2a99..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/AbstractStreamingMessage.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.util.MetadataExtractor.ABSENT_QUERY_ID;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public abstract class AbstractStreamingMessage implements Message {
- private final Map metadata = new HashMap<>();
-
- AbstractStreamingMessage(long n, long id, ValueFactory valueFactory) {
- this.metadata.put("n", valueFactory.value(n));
- if (id != ABSENT_QUERY_ID) {
- this.metadata.put("qid", valueFactory.value(id));
- }
- }
-
- public Map metadata() {
- return metadata;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- var that = (AbstractStreamingMessage) o;
- return Objects.equals(metadata, that.metadata);
- }
-
- protected abstract String name();
-
- @Override
- public int hashCode() {
- return Objects.hash(metadata);
- }
-
- @Override
- public String toString() {
- return String.format("%s %s", name(), metadata);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/BeginMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/BeginMessage.java
deleted file mode 100644
index 2124136e9f..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/BeginMessage.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.TransactionMetadataBuilder.buildMetadata;
-
-import java.time.Duration;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.neo4j.driver.internal.bolt.api.AccessMode;
-import org.neo4j.driver.internal.bolt.api.DatabaseName;
-import org.neo4j.driver.internal.bolt.api.LoggingProvider;
-import org.neo4j.driver.internal.bolt.api.NotificationConfig;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public class BeginMessage extends MessageWithMetadata {
- public static final byte SIGNATURE = 0x11;
-
- public BeginMessage(
- Set bookmarks,
- Duration txTimeout,
- Map txMetadata,
- DatabaseName databaseName,
- AccessMode mode,
- String impersonatedUser,
- String txType,
- NotificationConfig notificationConfig,
- boolean legacyNotifications,
- LoggingProvider logging,
- ValueFactory valueFactory) {
- this(
- bookmarks,
- txTimeout,
- txMetadata,
- mode,
- databaseName,
- impersonatedUser,
- txType,
- notificationConfig,
- legacyNotifications,
- logging,
- valueFactory);
- }
-
- public BeginMessage(
- Set bookmarks,
- Duration txTimeout,
- Map txMetadata,
- AccessMode mode,
- DatabaseName databaseName,
- String impersonatedUser,
- String txType,
- NotificationConfig notificationConfig,
- boolean legacyNotifications,
- LoggingProvider logging,
- ValueFactory valueFactory) {
- super(buildMetadata(
- txTimeout,
- txMetadata,
- databaseName,
- mode,
- bookmarks,
- impersonatedUser,
- txType,
- notificationConfig,
- legacyNotifications,
- logging,
- valueFactory));
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- var that = (BeginMessage) o;
- return Objects.equals(metadata(), that.metadata());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(metadata());
- }
-
- @Override
- public String toString() {
- return "BEGIN " + metadata();
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/CommitMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/CommitMessage.java
deleted file mode 100644
index 7e5a00dd87..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/CommitMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public class CommitMessage implements Message {
- public static final byte SIGNATURE = 0x12;
-
- public static final Message COMMIT = new CommitMessage();
-
- private CommitMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "COMMIT";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardAllMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardAllMessage.java
deleted file mode 100644
index 6f2c2b2d7e..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardAllMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public class DiscardAllMessage implements Message {
- public static final byte SIGNATURE = 0x2F;
-
- public static final DiscardAllMessage DISCARD_ALL = new DiscardAllMessage();
-
- private DiscardAllMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "DISCARD_ALL";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardMessage.java
deleted file mode 100644
index 281e9de82c..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/DiscardMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public class DiscardMessage extends AbstractStreamingMessage {
- public static final byte SIGNATURE = 0x2F;
-
- public DiscardMessage(long n, long id, ValueFactory valueFactory) {
- super(n, id, valueFactory);
- }
-
- @Override
- protected String name() {
- return "DISCARD";
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/GoodbyeMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/GoodbyeMessage.java
deleted file mode 100644
index da29e1c3d0..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/GoodbyeMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public class GoodbyeMessage implements Message {
- public static final byte SIGNATURE = 0x02;
-
- public static final GoodbyeMessage GOODBYE = new GoodbyeMessage();
-
- private GoodbyeMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "GOODBYE";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/HelloMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/HelloMessage.java
deleted file mode 100644
index fea034ff9a..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/HelloMessage.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import org.neo4j.driver.internal.bolt.api.BoltAgent;
-import org.neo4j.driver.internal.bolt.api.NotificationConfig;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public class HelloMessage extends MessageWithMetadata {
- public static final byte SIGNATURE = 0x01;
-
- private static final String USER_AGENT_METADATA_KEY = "user_agent";
- private static final String BOLT_AGENT_METADATA_KEY = "bolt_agent";
- private static final String BOLT_AGENT_PRODUCT_KEY = "product";
- private static final String BOLT_AGENT_PLATFORM_KEY = "platform";
- private static final String BOLT_AGENT_LANGUAGE_KEY = "language";
- private static final String BOLT_AGENT_LANGUAGE_DETAIL_KEY = "language_details";
- private static final String ROUTING_CONTEXT_METADATA_KEY = "routing";
- private static final String PATCH_BOLT_METADATA_KEY = "patch_bolt";
- private static final String CREDENTIALS_KEY = "credentials";
-
- private static final String DATE_TIME_UTC_PATCH_VALUE = "utc";
-
- private final ValueFactory valueFactory;
-
- public HelloMessage(
- String userAgent,
- BoltAgent boltAgent,
- Map authMap,
- Map routingContext,
- boolean includeDateTimeUtc,
- NotificationConfig notificationConfig,
- boolean legacyNotifications,
- ValueFactory valueFactory) {
- super(buildMetadata(
- userAgent,
- boltAgent,
- authMap,
- routingContext,
- includeDateTimeUtc,
- notificationConfig,
- legacyNotifications,
- valueFactory));
- this.valueFactory = Objects.requireNonNull(valueFactory);
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- var that = (HelloMessage) o;
- return Objects.equals(metadata(), that.metadata());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(metadata());
- }
-
- @Override
- public String toString() {
- Map metadataCopy = new HashMap<>(metadata());
- metadataCopy.replace(CREDENTIALS_KEY, valueFactory.value("******"));
- return "HELLO " + metadataCopy;
- }
-
- private static Map buildMetadata(
- String userAgent,
- BoltAgent boltAgent,
- Map authMap,
- Map routingContext,
- boolean includeDateTimeUtc,
- NotificationConfig notificationConfig,
- boolean legacyNotifications,
- ValueFactory valueFactory) {
- Map result = new HashMap<>();
- for (var entry : authMap.entrySet()) {
- result.put(entry.getKey(), valueFactory.value(entry.getValue()));
- }
- if (userAgent != null) {
- result.put(USER_AGENT_METADATA_KEY, valueFactory.value(userAgent));
- }
- if (boltAgent != null) {
- var boltAgentMap = toMap(boltAgent);
- result.put(BOLT_AGENT_METADATA_KEY, valueFactory.value(boltAgentMap));
- }
- if (routingContext != null) {
- result.put(ROUTING_CONTEXT_METADATA_KEY, valueFactory.value(routingContext));
- }
- if (includeDateTimeUtc) {
- result.put(PATCH_BOLT_METADATA_KEY, valueFactory.value(Collections.singleton(DATE_TIME_UTC_PATCH_VALUE)));
- }
- MessageWithMetadata.appendNotificationConfig(result, notificationConfig, legacyNotifications, valueFactory);
- return result;
- }
-
- private static HashMap toMap(BoltAgent boltAgent) {
- var boltAgentMap = new HashMap();
- boltAgentMap.put(BOLT_AGENT_PRODUCT_KEY, boltAgent.product());
- if (boltAgent.platform() != null) {
- boltAgentMap.put(BOLT_AGENT_PLATFORM_KEY, boltAgent.platform());
- }
- if (boltAgent.language() != null) {
- boltAgentMap.put(BOLT_AGENT_LANGUAGE_KEY, boltAgent.language());
- }
- if (boltAgent.languageDetails() != null) {
- boltAgentMap.put(BOLT_AGENT_LANGUAGE_DETAIL_KEY, boltAgent.languageDetails());
- }
- return boltAgentMap;
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogoffMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogoffMessage.java
deleted file mode 100644
index c07dd60378..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogoffMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public class LogoffMessage implements Message {
- public static final byte SIGNATURE = 0x6B;
-
- public static final LogoffMessage INSTANCE = new LogoffMessage();
-
- private LogoffMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "LOGOFF";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogonMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogonMessage.java
deleted file mode 100644
index bd78b83dc0..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/LogonMessage.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public class LogonMessage extends MessageWithMetadata {
- public static final byte SIGNATURE = 0x6A;
- private static final String CREDENTIALS_KEY = "credentials";
-
- private final ValueFactory valueFactory;
-
- public LogonMessage(Map authMap, ValueFactory valueFactory) {
- super(authMap);
- this.valueFactory = Objects.requireNonNull(valueFactory);
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- Map metadataCopy = new HashMap<>(metadata());
- metadataCopy.replace(CREDENTIALS_KEY, valueFactory.value("******"));
- return "LOGON " + metadataCopy;
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MessageWithMetadata.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MessageWithMetadata.java
deleted file mode 100644
index de03325f40..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MessageWithMetadata.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import java.util.Map;
-import org.neo4j.driver.internal.bolt.api.NotificationClassification;
-import org.neo4j.driver.internal.bolt.api.NotificationConfig;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-abstract class MessageWithMetadata implements Message {
- static final String NOTIFICATIONS_MINIMUM_SEVERITY = "notifications_minimum_severity";
- static final String NOTIFICATIONS_DISABLED_CATEGORIES = "notifications_disabled_categories";
- static final String NOTIFICATIONS_DISABLED_CLASSIFICATIONS = "notifications_disabled_classifications";
- private final Map metadata;
-
- public MessageWithMetadata(Map metadata) {
- this.metadata = metadata;
- }
-
- public Map metadata() {
- return metadata;
- }
-
- static void appendNotificationConfig(
- Map result,
- NotificationConfig config,
- boolean legacyNotifications,
- ValueFactory valueFactory) {
- if (config != null) {
- var severity = config.minimumSeverity();
- if (severity != null) {
- result.put(
- NOTIFICATIONS_MINIMUM_SEVERITY,
- valueFactory.value(severity.type().toString()));
- }
- var disabledClassifications = config.disabledClassifications();
- if (disabledClassifications != null) {
- var list = disabledClassifications.stream()
- .map(NotificationClassification::type)
- .map(Enum::toString)
- .toList();
- result.put(
- legacyNotifications
- ? NOTIFICATIONS_DISABLED_CATEGORIES
- : NOTIFICATIONS_DISABLED_CLASSIFICATIONS,
- valueFactory.value(list));
- }
- }
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MultiDatabaseUtil.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MultiDatabaseUtil.java
deleted file mode 100644
index d55b663e6a..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/MultiDatabaseUtil.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.api.BoltProtocolVersion;
-import org.neo4j.driver.internal.bolt.api.DatabaseName;
-import org.neo4j.driver.internal.bolt.api.exception.BoltClientException;
-
-public final class MultiDatabaseUtil {
- public static void assertEmptyDatabaseName(DatabaseName databaseName, BoltProtocolVersion boltVersion) {
- if (databaseName.databaseName().isPresent()) {
- throw new BoltClientException(String.format(
- "Database name parameter for selecting database is not supported in Bolt Protocol Version %s. "
- + "Database name: '%s'",
- boltVersion, databaseName.description()));
- }
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullAllMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullAllMessage.java
deleted file mode 100644
index ff85872147..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullAllMessage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-/**
- * PULL_ALL request message
- *
- * Sent by clients to pull the entirety of the remaining stream down.
- */
-public class PullAllMessage implements Message {
- public static final byte SIGNATURE = 0x3F;
-
- public static final PullAllMessage PULL_ALL = new PullAllMessage();
-
- private PullAllMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "PULL_ALL";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullMessage.java
deleted file mode 100644
index 8690fc549a..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/PullMessage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-/**
- * PULL request message
- *
- * Sent by clients to pull the entirety of the remaining stream down.
- */
-public class PullMessage extends AbstractStreamingMessage {
- public static final byte SIGNATURE = 0x3F;
-
- public PullMessage(long n, long id, ValueFactory valueFactory) {
- super(n, id, valueFactory);
- }
-
- @Override
- protected String name() {
- return "PULL";
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/ResetMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/ResetMessage.java
deleted file mode 100644
index 59f5b35ea3..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/ResetMessage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-/**
- * RESET request message
- *
- * Sent by clients to reset a session to a clean state - closing any open transaction or result streams.
- * This also acknowledges receipt of failures sent by the server. This is required to
- * allow optimistic sending of multiple messages before responses have been received - pipelining.
- *
- * When something goes wrong, we want the server to stop processing our already sent messages,
- * but the server cannot tell the difference between what was sent before and after we saw the
- * error.
- *
- * This message acts as a barrier after an error, informing the server that we've seen the error
- * message, and that messages that follow this one are safe to execute.
- */
-public class ResetMessage implements Message {
- public static final byte SIGNATURE = 0x0F;
-
- public static final ResetMessage RESET = new ResetMessage();
-
- private ResetMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "RESET";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RollbackMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RollbackMessage.java
deleted file mode 100644
index a60197b6d6..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RollbackMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-public class RollbackMessage implements Message {
- public static final byte SIGNATURE = 0x13;
-
- public static final Message ROLLBACK = new RollbackMessage();
-
- private RollbackMessage() {}
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return "ROLLBACK";
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RouteMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RouteMessage.java
deleted file mode 100644
index 01f3aeca64..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RouteMessage.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import static java.util.Collections.unmodifiableMap;
-
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.Message;
-
-/**
- * From the application point of view it is not interesting to know about the role a member plays in the cluster. Instead, the application needs to know which
- * instance can provide the wanted service.
- *
- * This message is used to fetch this routing information.
- */
-public record RouteMessage(
- Map routingContext, Set bookmarks, String databaseName, String impersonatedUser)
- implements Message {
- public static final byte SIGNATURE = 0x66;
-
- /**
- * Constructor
- *
- * @param routingContext The routing context used to define the routing table. Multi-datacenter deployments is one of its use cases.
- * @param bookmarks The bookmarks used when getting the routing table.
- * @param databaseName The name of the database to get the routing table for.
- * @param impersonatedUser The name of the impersonated user to get the routing table for, should be {@code null} for non-impersonated requests
- */
- public RouteMessage(
- Map routingContext, Set bookmarks, String databaseName, String impersonatedUser) {
- this.routingContext = unmodifiableMap(routingContext);
- this.bookmarks = bookmarks;
- this.databaseName = databaseName;
- this.impersonatedUser = impersonatedUser;
- }
-
- @Override
- public byte signature() {
- return SIGNATURE;
- }
-
- @Override
- public String toString() {
- return String.format("ROUTE %s %s %s %s", routingContext, bookmarks, databaseName, impersonatedUser);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- var that = (RouteMessage) o;
- return routingContext.equals(that.routingContext)
- && Objects.equals(databaseName, that.databaseName)
- && Objects.equals(impersonatedUser, that.impersonatedUser);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(routingContext, databaseName, impersonatedUser);
- }
-}
diff --git a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RunWithMetadataMessage.java b/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RunWithMetadataMessage.java
deleted file mode 100644
index 592643c180..0000000000
--- a/bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/messaging/request/RunWithMetadataMessage.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [https://neo4j.com]
- *
- * 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
- *
- * 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.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request;
-
-import static java.util.Collections.emptyMap;
-import static org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.request.TransactionMetadataBuilder.buildMetadata;
-
-import java.time.Duration;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.neo4j.driver.internal.bolt.api.AccessMode;
-import org.neo4j.driver.internal.bolt.api.DatabaseName;
-import org.neo4j.driver.internal.bolt.api.LoggingProvider;
-import org.neo4j.driver.internal.bolt.api.NotificationConfig;
-import org.neo4j.driver.internal.bolt.api.values.Value;
-import org.neo4j.driver.internal.bolt.api.values.ValueFactory;
-
-public class RunWithMetadataMessage extends MessageWithMetadata {
- public static final byte SIGNATURE = 0x10;
-
- private final String query;
- private final Map parameters;
-
- public static RunWithMetadataMessage autoCommitTxRunMessage(
- String query,
- Map parameters,
- Duration txTimeout,
- Map txMetadata,
- DatabaseName databaseName,
- AccessMode mode,
- Set bookmarks,
- String impersonatedUser,
- NotificationConfig notificationConfig,
- boolean legacyNotifications,
- LoggingProvider logging,
- ValueFactory valueFactory) {
- var metadata = buildMetadata(
- txTimeout,
- txMetadata,
- databaseName,
- mode,
- bookmarks,
- impersonatedUser,
- null,
- notificationConfig,
- legacyNotifications,
- logging,
- valueFactory);
- return new RunWithMetadataMessage(query, parameters, metadata);
- }
-
- public static RunWithMetadataMessage unmanagedTxRunMessage(String query, Map parameters) {
- return new RunWithMetadataMessage(query, parameters, emptyMap());
- }
-
- private RunWithMetadataMessage(String query, Map