Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions driver/src/main/java/org/neo4j/driver/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.neo4j.driver.net.ServerAddressResolver;
import org.neo4j.driver.util.Experimental;
import org.neo4j.driver.util.Immutable;
import org.neo4j.driver.util.Preview;
import org.neo4j.driver.util.Resource;

/**
Expand Down Expand Up @@ -144,6 +143,7 @@ public final class Config implements Serializable {
/**
* The notification config.
*/
@SuppressWarnings("deprecation")
private final NotificationConfig notificationConfig;
/**
* The {@link MetricsAdapter}.
Expand Down Expand Up @@ -325,7 +325,10 @@ public long fetchSize() {
*
* @return the notification config
* @since 5.7
* @deprecated superseded by {@link Config#minimumNotificationSeverity()} and
* {@link Config#disabledNotificationClassifications()}.
*/
@Deprecated
public NotificationConfig notificationConfig() {
return notificationConfig;
}
Expand All @@ -336,7 +339,6 @@ public NotificationConfig notificationConfig() {
* @return an {@link Optional} of minimum {@link NotificationSeverity} or an empty {@link Optional} if it is not set
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
public Optional<NotificationSeverity> minimumNotificationSeverity() {
return Optional.ofNullable(((InternalNotificationConfig) notificationConfig).minimumSeverity());
}
Expand All @@ -346,7 +348,6 @@ public Optional<NotificationSeverity> minimumNotificationSeverity() {
* @return the {@link Set} of disabled {@link NotificationClassification}
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
public Set<NotificationClassification> disabledNotificationClassifications() {
var disabledCategories = ((InternalNotificationConfig) notificationConfig).disabledCategories();
return disabledCategories != null
Expand Down Expand Up @@ -428,6 +429,7 @@ public static final class ConfigBuilder {
private long fetchSize = 1000;
private int eventLoopThreads = 0;

@SuppressWarnings("deprecation")
private NotificationConfig notificationConfig = NotificationConfig.defaultConfig();

private boolean telemetryDisabled = false;
Expand Down Expand Up @@ -824,7 +826,11 @@ public ConfigBuilder withUserAgent(String userAgent) {
* @param notificationConfig the notification config
* @return this builder
* @since 5.7
* @deprecated superseded by {@link ConfigBuilder#withMinimumNotificationSeverity(NotificationSeverity)} and
* {@link ConfigBuilder#withDisabledNotificationClassifications(Set)}.
*/
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public ConfigBuilder withNotificationConfig(NotificationConfig notificationConfig) {
this.notificationConfig = Objects.requireNonNull(notificationConfig, "notificationConfig must not be null");
return this;
Expand All @@ -837,7 +843,7 @@ public ConfigBuilder withNotificationConfig(NotificationConfig notificationConfi
* @return this builder
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
@SuppressWarnings("deprecation")
public ConfigBuilder withMinimumNotificationSeverity(NotificationSeverity minimumNotificationSeverity) {
if (minimumNotificationSeverity == null) {
notificationConfig = NotificationConfig.disableAllConfig();
Expand All @@ -854,7 +860,7 @@ public ConfigBuilder withMinimumNotificationSeverity(NotificationSeverity minimu
* @return this builder
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
@SuppressWarnings("deprecation")
public ConfigBuilder withDisabledNotificationClassifications(
Set<NotificationClassification> disabledNotificationClassifications) {
var disabledCategories = disabledNotificationClassifications == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
* Notification category.
*
* @since 5.7
* @deprecated superseded by {@link NotificationClassification}.
*/
@Deprecated
public sealed interface NotificationCategory extends Serializable permits NotificationClassification {
/**
* A hint category.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
*/
package org.neo4j.driver;

import org.neo4j.driver.util.Preview;

/**
* Notification classification.
*
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
@SuppressWarnings("deprecation")
public enum NotificationClassification implements NotificationCategory {
/**
* A hint category.
Expand Down Expand Up @@ -94,6 +92,7 @@ public enum NotificationClassification implements NotificationCategory {
* <p>
* Please note that this category was added to a later server version. Therefore, a compatible server version is
* required to use it.
*
* @since 5.24.0
*/
SCHEMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.Serializable;
import java.util.Set;
import org.neo4j.driver.Config.ConfigBuilder;
import org.neo4j.driver.internal.InternalNotificationConfig;
import org.neo4j.driver.internal.InternalNotificationSeverity;
import org.neo4j.driver.summary.ResultSummary;
Expand All @@ -37,8 +38,13 @@
*
* @since 5.7
* @see ResultSummary#notifications()
* @see org.neo4j.driver.summary.Notification
* @deprecated superseded by e org.neo4j.driver.summary.Notification
* {@link ConfigBuilder#withMinimumNotificationSeverity(NotificationSeverity)},
* {@link ConfigBuilder#withDisabledNotificationClassifications(Set)},
* {@link SessionConfig.Builder#withMinimumNotificationSeverity(NotificationSeverity)} and
* {@link SessionConfig.Builder#withDisabledNotificationClassifications(Set)}.
*/
@Deprecated
public sealed interface NotificationConfig extends Serializable permits InternalNotificationConfig {
/**
* Returns a default notification configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.Serializable;
import org.neo4j.driver.Config.ConfigBuilder;
import org.neo4j.driver.internal.InternalNotificationSeverity;
import org.neo4j.driver.util.Preview;

/**
* Notification severity level.
Expand All @@ -44,6 +43,5 @@ public sealed interface NotificationSeverity extends Serializable, Comparable<No
* @see ConfigBuilder#withMinimumNotificationSeverity(NotificationSeverity)
* @see SessionConfig.Builder#withMinimumNotificationSeverity(NotificationSeverity)
*/
@Preview(name = "GQL-status object")
NotificationSeverity OFF = new InternalNotificationSeverity(Type.OFF, Integer.MAX_VALUE);
}
16 changes: 11 additions & 5 deletions driver/src/main/java/org/neo4j/driver/SessionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.neo4j.driver.exceptions.UnsupportedFeatureException;
import org.neo4j.driver.internal.InternalNotificationConfig;
import org.neo4j.driver.reactive.ReactiveSession;
import org.neo4j.driver.util.Preview;

/**
* The session configurations used to configure a session.
Expand Down Expand Up @@ -70,6 +69,7 @@ public final class SessionConfig implements Serializable {
/**
* The notification config.
*/
@SuppressWarnings("deprecation")
private final NotificationConfig notificationConfig;

private SessionConfig(Builder builder) {
Expand Down Expand Up @@ -171,7 +171,10 @@ public Optional<BookmarkManager> bookmarkManager() {
* Returns notification config.
* @return the notification config
* @since 5.7
* @deprecated superseded by {@link SessionConfig#minimumNotificationSeverity()} and
* {@link SessionConfig#disabledNotificationClassifications()}.
*/
@Deprecated
public NotificationConfig notificationConfig() {
return notificationConfig;
}
Expand All @@ -182,7 +185,6 @@ public NotificationConfig notificationConfig() {
* @return an {@link Optional} of minimum {@link NotificationSeverity} or an empty {@link Optional} if it is not set
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
public Optional<NotificationSeverity> minimumNotificationSeverity() {
return Optional.ofNullable(((InternalNotificationConfig) notificationConfig).minimumSeverity());
}
Expand All @@ -192,7 +194,6 @@ public Optional<NotificationSeverity> minimumNotificationSeverity() {
* @return the {@link Set} of disabled {@link NotificationClassification}
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
public Set<NotificationClassification> disabledNotificationClassifications() {
var disabledCategories = ((InternalNotificationConfig) notificationConfig).disabledCategories();
return disabledCategories != null
Expand Down Expand Up @@ -247,6 +248,7 @@ public static final class Builder {
private String impersonatedUser = null;
private BookmarkManager bookmarkManager;

@SuppressWarnings("deprecation")
private NotificationConfig notificationConfig = NotificationConfig.defaultConfig();

private Builder() {}
Expand Down Expand Up @@ -428,7 +430,11 @@ public Builder withBookmarkManager(BookmarkManager bookmarkManager) {
* @param notificationConfig the notification config
* @return this builder
* @since 5.7
* @deprecated superseded by {@link SessionConfig.Builder#withMinimumNotificationSeverity(NotificationSeverity)} and
* {@link SessionConfig.Builder#withDisabledNotificationClassifications(Set)}.
*/
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public Builder withNotificationConfig(NotificationConfig notificationConfig) {
this.notificationConfig = Objects.requireNonNull(notificationConfig, "notificationConfig must not be null");
return this;
Expand All @@ -441,7 +447,7 @@ public Builder withNotificationConfig(NotificationConfig notificationConfig) {
* @return this builder
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
@SuppressWarnings("deprecation")
public Builder withMinimumNotificationSeverity(NotificationSeverity minimumNotificationSeverity) {
if (minimumNotificationSeverity == null) {
notificationConfig = NotificationConfig.disableAllConfig();
Expand All @@ -458,7 +464,7 @@ public Builder withMinimumNotificationSeverity(NotificationSeverity minimumNotif
* @return this builder
* @since 5.22.0
*/
@Preview(name = "GQL-status object")
@SuppressWarnings("deprecation")
public Builder withDisabledNotificationClassifications(
Set<NotificationClassification> disabledNotificationClassifications) {
var disabledCategories = disabledNotificationClassifications == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static GqlNotificationConfig defaultConfig() {
return new GqlNotificationConfig(null, null);
}

public static GqlNotificationConfig from(NotificationConfig notificationConfig) {
public static GqlNotificationConfig from(@SuppressWarnings("deprecation") NotificationConfig notificationConfig) {
Objects.requireNonNull(notificationConfig);
var config = (InternalNotificationConfig) notificationConfig;
var disabledClassifications = config.disabledCategories() != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.neo4j.driver.NotificationConfig;
import org.neo4j.driver.NotificationSeverity;

@SuppressWarnings("deprecation")
public record InternalNotificationConfig(
NotificationSeverity minimumSeverity, Set<NotificationCategory> disabledCategories)
implements NotificationConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.neo4j.bolt.connection.NotificationSeverity;
import org.neo4j.driver.NotificationCategory;

@SuppressWarnings("deprecation")
public class NotificationConfigMapper {
public static NotificationConfig map(org.neo4j.driver.NotificationConfig config) {
var original = (InternalNotificationConfig) config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public class SessionFactoryImpl implements SessionFactory {
this.homeDatabaseCache = Objects.requireNonNull(homeDatabaseCache);
}

@SuppressWarnings("deprecation")
@Override
public NetworkSession newInstance(
SessionConfig sessionConfig, AuthToken overrideAuthToken, boolean telemetryDisabled) {
Expand Down Expand Up @@ -149,7 +150,7 @@ private NetworkSession createSession(
String impersonatedUser,
@SuppressWarnings("deprecation") Logging logging,
BookmarkManager bookmarkManager,
NotificationConfig notificationConfig,
@SuppressWarnings("deprecation") NotificationConfig notificationConfig,
AuthToken authToken,
boolean telemetryDisabled,
AuthTokenManager authTokenManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public LeakLoggingNetworkSession(
long fetchSize,
@SuppressWarnings("deprecation") Logging logging,
BookmarkManager bookmarkManager,
NotificationConfig notificationConfig,
@SuppressWarnings("deprecation") NotificationConfig notificationConfig,
AuthToken overrideAuthToken,
boolean telemetryDisabled,
AuthTokenManager authTokenManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public NetworkSession(
long fetchSize,
@SuppressWarnings("deprecation") Logging logging,
BookmarkManager bookmarkManager,
org.neo4j.driver.NotificationConfig notificationConfig,
@SuppressWarnings("deprecation") org.neo4j.driver.NotificationConfig notificationConfig,
AuthToken overrideAuthToken,
boolean telemetryDisabled,
AuthTokenManager authTokenManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.neo4j.driver.summary.InputPosition;
import org.neo4j.driver.summary.Notification;

@SuppressWarnings("deprecation")
public class InternalNotification implements Notification {
public static Optional<NotificationCategory> valueOf(String value) {
return Arrays.stream(NotificationClassification.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public class InternalResultSummary implements ResultSummary {
private final SummaryCounters counters;
private final Plan plan;
private final ProfiledPlan profile;

@SuppressWarnings("deprecation")
private final List<Notification> notifications;

private final Set<GqlStatusObject> gqlStatusObjects;
private final long resultAvailableAfter;
private final long resultConsumedAfter;
Expand All @@ -52,7 +55,7 @@ public InternalResultSummary(
SummaryCounters counters,
Plan plan,
ProfiledPlan profile,
List<Notification> notifications,
@SuppressWarnings("deprecation") List<Notification> notifications,
Set<GqlStatusObject> gqlStatusObjects,
long resultAvailableAfter,
long resultConsumedAfter) {
Expand Down Expand Up @@ -104,6 +107,7 @@ public ProfiledPlan profile() {
return profile;
}

@SuppressWarnings("deprecation")
@Override
public List<Notification> notifications() {
return notifications;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public ResultSummary extractSummary(
connection.serverAgent(), connection.serverAddress(), connection.protocolVersion());
var dbInfo = extractDatabaseInfo(metadata);
Set<GqlStatusObject> gqlStatusObjects;
@SuppressWarnings("deprecation")
List<Notification> notifications;
if (legacyNotifications) {
var gqlStatusObjectsAndNotifications = generateGqlStatusObjectsAndExtractNotifications(metadata)
Expand Down Expand Up @@ -409,8 +410,10 @@ private static long extractResultConsumedAfter(Map<String, Value> metadata, Stri
return -1;
}

@SuppressWarnings("deprecation")
private record GqlStatusObjectsAndNotifications(
Set<GqlStatusObject> gqlStatusObjects, List<Notification> notifications) {}

@SuppressWarnings("deprecation")
private record GqlStatusObjectAndNotification(GqlStatusObject gqlStatusObject, Notification notification) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
import org.neo4j.driver.NotificationClassification;
import org.neo4j.driver.NotificationSeverity;
import org.neo4j.driver.internal.summary.InternalGqlNotification;
import org.neo4j.driver.util.Preview;

/**
* A notification subtype of the {@link GqlStatusObject}.
* @since 5.28.8
*
* @see GqlStatusObject
* @since 5.28.8
*/
@Preview(name = "GQL-status object")
public sealed interface GqlNotification extends GqlStatusObject permits InternalGqlNotification {

/**
Expand Down Expand Up @@ -58,6 +57,7 @@ public sealed interface GqlNotification extends GqlStatusObject permits Internal

/**
* Returns {@link NotificationClassification} derived from the diagnostic record.
*
* @return an {@link Optional} of {@link NotificationClassification} or an empty {@link Optional} when the
* classification is either absent or unrecognised
* @see #diagnosticRecord()
Expand All @@ -67,6 +67,7 @@ public sealed interface GqlNotification extends GqlStatusObject permits Internal
/**
* Returns notification classification from the diagnostic record as a {@link String} value retrieved directly from
* the diagnostic record.
*
* @return an {@link Optional} of notification classification or an empty {@link Optional} when it is absent
* @see #diagnosticRecord()
*/
Expand Down
Loading