Skip to content

Commit

Permalink
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.0.1 to 3.6.0 (
Browse files Browse the repository at this point in the history
#978)

* Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.0.1 to 3.6.0

Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.0.1 to 3.6.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](apache/maven-javadoc-plugin@maven-javadoc-plugin-3.0.1...maven-javadoc-plugin-3.6.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Don't access internal classes directly.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Simons <michael.simons@neo4j.com>
  • Loading branch information
dependabot[bot] and michael-simons committed Oct 16, 2023
1 parent e31b04d commit 60e3e6a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.neo4j.driver.*;
import org.neo4j.driver.exceptions.ClientException;
import org.neo4j.driver.exceptions.ServiceUnavailableException;
import org.neo4j.driver.internal.Scheme;
import org.neo4j.ogm.config.Configuration;
import org.neo4j.ogm.config.Credentials;
import org.neo4j.ogm.config.DatabaseSelectionProvider;
Expand All @@ -67,6 +66,29 @@
*/
public class BoltDriver extends AbstractConfigurableDriver {

private static final String BOLT_URI_SCHEME = "bolt";
private static final String BOLT_HIGH_TRUST_URI_SCHEME = "bolt+s";
private static final String BOLT_LOW_TRUST_URI_SCHEME = "bolt+ssc";
private static final String NEO4J_URI_SCHEME = "neo4j";
private static final String NEO4J_HIGH_TRUST_URI_SCHEME = "neo4j+s";
private static final String NEO4J_LOW_TRUST_URI_SCHEME = "neo4j+ssc";

private static void validateScheme(String scheme) {
if (scheme == null) {
throw new IllegalArgumentException("Scheme must not be null");
}
switch (scheme) {
case BOLT_URI_SCHEME,
BOLT_LOW_TRUST_URI_SCHEME,
BOLT_HIGH_TRUST_URI_SCHEME,
NEO4J_URI_SCHEME,
NEO4J_LOW_TRUST_URI_SCHEME,
NEO4J_HIGH_TRUST_URI_SCHEME -> {
}
default -> throw new IllegalArgumentException("Invalid address format " + scheme);
}
}

private static final Logger LOGGER = LoggerFactory.getLogger(BoltDriver.class);
public static final String CONFIG_PARAMETER_BOLT_LOGGING = "Bolt_Logging";
private static final Method WITH_IMPERSONATED_USER = findWithImpersonatedUser();
Expand All @@ -79,7 +101,6 @@ private static Method findWithImpersonatedUser() {
}
}


private final ExceptionTranslator exceptionTranslator = new BoltDriverExceptionTranslator();

private volatile Driver boltDriver;
Expand Down Expand Up @@ -168,7 +189,7 @@ static boolean isSimpleScheme(String scheme) {

String lowerCaseScheme = scheme.toLowerCase(Locale.ENGLISH);
try {
Scheme.validateScheme(lowerCaseScheme);
validateScheme(lowerCaseScheme);
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException(String.format("'%s' is not a supported scheme.", scheme));
}
Expand Down Expand Up @@ -214,6 +235,7 @@ private URI getSingleURI() {

/**
* Make the 4.0 driver somewhat backward compatible with older configurations
*
* @param uri
* @return
*/
Expand Down Expand Up @@ -244,7 +266,8 @@ public ExceptionTranslator getExceptionTranslator() {

@Override
public Request request(Transaction transaction) {
return new BoltRequest(transaction, this.parameterConversion, new BoltEntityAdapter(typeSystem), getCypherModification());
return new BoltRequest(transaction, this.parameterConversion, new BoltEntityAdapter(typeSystem),
getCypherModification());
}

public <T> T unwrap(Class<T> clazz) {
Expand All @@ -266,12 +289,15 @@ private Session newSession(Transaction.Type type, Iterable<String> bookmarks) {
sessionConfigBuilder = sessionConfigBuilder.withDatabase(database);
}
// a database selection provider different from null or default will override the database
if (this.databaseSelectionProvider != null && this.databaseSelectionProvider != DatabaseSelectionProvider.getDefaultSelectionProvider()) {
sessionConfigBuilder = sessionConfigBuilder.withDatabase(databaseSelectionProvider.getDatabaseSelection().getValue());
if (this.databaseSelectionProvider != null
&& this.databaseSelectionProvider != DatabaseSelectionProvider.getDefaultSelectionProvider()) {
sessionConfigBuilder = sessionConfigBuilder.withDatabase(
databaseSelectionProvider.getDatabaseSelection().getValue());
}
// Avoid the explicit set of the impersonated user if the provided user equals the default user of the connection
// otherwise we would trigger the overhead of impersonation.
if (this.userSelectionProvider != null && this.userSelectionProvider != UserSelectionProvider.getDefaultSelectionProvider()) {
if (this.userSelectionProvider != null
&& this.userSelectionProvider != UserSelectionProvider.getDefaultSelectionProvider()) {
setWithImpersonatedUser(sessionConfigBuilder, userSelectionProvider.getUserSelection().getValue());
}
boltSession = boltDriver.session(sessionConfigBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import java.util.List;
import java.util.Map;

import org.neo4j.driver.internal.value.ListValue;
import org.neo4j.driver.Value;
import org.neo4j.driver.internal.value.NullValue;
import org.neo4j.driver.types.Entity;
import org.neo4j.driver.types.Node;
import org.neo4j.driver.types.Path;
Expand Down Expand Up @@ -112,11 +110,11 @@ public List<Object> relsInPath(Object pathValue) {

private Object toMapped(Value value) {

if (value == null || value instanceof NullValue) {
if (value == null || value.isNull()) {
return null;
}

if (value instanceof ListValue) {
if (org.neo4j.driver.types.TypeSystem.getDefault().LIST().isTypeOf(value)) {
return value.asList(this::toMapped);
} else {
Object object = value.asObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@
import java.util.Map;
import java.util.function.Function;

import org.neo4j.driver.internal.value.DateTimeValue;
import org.neo4j.driver.internal.value.DateValue;
import org.neo4j.driver.internal.value.DurationValue;
import org.neo4j.driver.internal.value.LocalDateTimeValue;
import org.neo4j.driver.internal.value.LocalTimeValue;
import org.neo4j.driver.internal.value.PointValue;
import org.neo4j.driver.internal.value.TimeValue;
import org.neo4j.driver.Value;
import org.neo4j.driver.Values;
import org.neo4j.driver.types.IsoDuration;
import org.neo4j.driver.types.Point;
Expand Down Expand Up @@ -86,11 +80,11 @@ private static void addSpatialFeatures(Map<Class<?>, Function> nativeToMappedAda
private static void addJavaTimeFeature(Map<Class<?>, Function> nativeToMappedAdapter,
Map<Class<?>, Function> mappedToNativeAdapter) {

nativeToMappedAdapter.put(DateValue.class, Values.ofLocalDate());
nativeToMappedAdapter.put(TimeValue.class, Values.ofOffsetTime());
nativeToMappedAdapter.put(LocalTimeValue.class, Values.ofLocalTime());
nativeToMappedAdapter.put(DateTimeValue.class, Values.ofZonedDateTime());
nativeToMappedAdapter.put(LocalDateTimeValue.class, Values.ofLocalDateTime());
nativeToMappedAdapter.put(getType("org.neo4j.driver.internal.value.DateValue"), Values.ofLocalDate());
nativeToMappedAdapter.put(getType("org.neo4j.driver.internal.value.TimeValue"), Values.ofOffsetTime());
nativeToMappedAdapter.put(getType("org.neo4j.driver.internal.value.LocalTimeValue"), Values.ofLocalTime());
nativeToMappedAdapter.put(getType("org.neo4j.driver.internal.value.DateTimeValue"), Values.ofZonedDateTime());
nativeToMappedAdapter.put(getType("org.neo4j.driver.internal.value.LocalDateTimeValue"), Values.ofLocalDateTime());

nativeToMappedAdapter.put(IsoDuration.class, new TemporalAmountAdapter());

Expand All @@ -105,7 +99,7 @@ private static void addJavaTimeFeature(Map<Class<?>, Function> nativeToMappedAda
mappedToNativeAdapter.put(TemporalAmount.class, Values::value);
}

// Those look the same as in embbedded native types, but the packages are different
// Those look the same as in embedded native types, but the packages are different
@SuppressWarnings("Duplicates")
private static void addPassthroughForBuildInTypes(Map<Class<?>, Function> mappedToNativeAdapter) {
/*
Expand All @@ -114,15 +108,26 @@ private static void addPassthroughForBuildInTypes(Map<Class<?>, Function> mapped
params.put("x", Values.isoDuration(526, 45, 97200, 0).asIsoDuration());
session.queryForObject(Long.class, "CREATE (s:`DatesTestBase$Sometime` {temporalAmount: $x}) RETURN id(s)",params);
*/
mappedToNativeAdapter.put(PointValue.class, Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.PointValue"), Function.identity());

mappedToNativeAdapter.put(DateValue.class, Function.identity());
mappedToNativeAdapter.put(TimeValue.class, Function.identity());
mappedToNativeAdapter.put(LocalTimeValue.class, Function.identity());
mappedToNativeAdapter.put(DateTimeValue.class, Function.identity());
mappedToNativeAdapter.put(LocalDateTimeValue.class, Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.DateValue"), Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.TimeValue"), Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.LocalTimeValue"), Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.DateTimeValue"), Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.LocalDateTimeValue"), Function.identity());

mappedToNativeAdapter.put(DurationValue.class, Function.identity());
mappedToNativeAdapter.put(getType("org.neo4j.driver.internal.value.DurationValue"), Function.identity());
}

// I stopped accessing the internal types due to the JavaDoc tool rightfully complaining about it (despite OGM not being supported on the module path)
// We do need those types however in OGM and there is no way around it without rewriting large chunks of the architecture.
@SuppressWarnings("unchecked")
private static Class<Value> getType(String fqn) {
try {
return (Class<Value>) Class.forName(fqn);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}

public boolean supportsAsNativeType(Class<?> clazz) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
<maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
<maven-install-plugin.version>3.1.1</maven-install-plugin.version>
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
<maven-site-plugin.version>3.12.1</maven-site-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
Expand Down

0 comments on commit 60e3e6a

Please sign in to comment.