Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Javadoc #1382

Merged
merged 1 commit into from
Feb 23, 2023
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
3 changes: 3 additions & 0 deletions driver/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The Neo4j Java Driver module.
*/
@SuppressWarnings({"requires-automatic", "requires-transitive-automatic"})
module org.neo4j.driver {
exports org.neo4j.driver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public BookmarkManagerConfigBuilder withBookmarksSupplier(Supplier<Set<Bookmark>
return this;
}

/**
* Builds an instance of {@link BookmarkManagerConfig}.
* @return the config
*/
public BookmarkManagerConfig build() {
return new BookmarkManagerConfig(this);
}
Expand Down
86 changes: 86 additions & 0 deletions driver/src/main/java/org/neo4j/driver/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,77 @@ public final class Config implements Serializable {

private static final Config EMPTY = builder().build();

/**
* The {@link QueryTask} {@link BookmarkManager}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this now be ExecuteQuery?

*/
private final BookmarkManager queryBookmarkManager;

/**
* User defined logging
*/
private final Logging logging;

/**
* The flag indicating if leaked sessions logging is enabled.
*/
private final boolean logLeakedSessions;

/**
* The maximum connection pool size.
*/
private final int maxConnectionPoolSize;

/**
* The idle time that defines if connection should be tested before being handed out by the connection pool.
*/
private final long idleTimeBeforeConnectionTest;
/**
* The maximum connection lifetime in milliseconds.
*/
private final long maxConnectionLifetimeMillis;
/**
* The maximum amount of time connection acquisition will attempt to acquire a connection from the connection pool.
*/
private final long connectionAcquisitionTimeoutMillis;

/**
* The security settings.
*/
private final SecuritySettings securitySettings;

/**
* The fetch size.
*/
private final long fetchSize;
/**
* The stale routing table purge delay in milliseconds.
*/
private final long routingTablePurgeDelayMillis;
/**
* The managed transactions maximum retry time.
*/
private final long maxTransactionRetryTimeMillis;

/**
* The configured connection timeout value in milliseconds.
*/
private final int connectionTimeoutMillis;
/**
* The server address resolver.
*/
private final ServerAddressResolver resolver;

/**
* The event loop thread count.
*/
private final int eventLoopThreads;
/**
* The user_agent configured for this driver.
*/
private final String userAgent;
/**
* The {@link MetricsAdapter}.
*/
private final MetricsAdapter metricsAdapter;

private Config(ConfigBuilder builder) {
Expand Down Expand Up @@ -185,10 +230,18 @@ public int connectionTimeoutMillis() {
return connectionTimeoutMillis;
}

/**
* Returns the maximum connection pool size.
* @return the maximum size
*/
public int maxConnectionPoolSize() {
return maxConnectionPoolSize;
}

/**
* Returns the connection acquisition timeout in milliseconds.
* @return the acquisition timeout
*/
public long connectionAcquisitionTimeoutMillis() {
return connectionAcquisitionTimeoutMillis;
}
Expand Down Expand Up @@ -250,10 +303,18 @@ public long maxTransactionRetryTimeMillis() {
return maxTransactionRetryTimeMillis;
}

/**
* Returns the fetch size.
* @return the fetch size
*/
public long fetchSize() {
return fetchSize;
}

/**
* Returns the number of {@link io.netty.channel.EventLoop} threads.
* @return the number of threads
*/
public int eventLoopThreads() {
return eventLoopThreads;
}
Expand All @@ -265,6 +326,10 @@ public boolean isMetricsEnabled() {
return this.metricsAdapter != MetricsAdapter.DEV_NULL;
}

/**
* Returns the {@link MetricsAdapter}.
* @return the metrics adapter
*/
public MetricsAdapter metricsAdapter() {
return this.metricsAdapter;
}
Expand Down Expand Up @@ -730,14 +795,35 @@ public static final class TrustStrategy implements Serializable {
* The trust strategy that the driver supports
*/
public enum Strategy {
/**
* Trust all certificates.
*/
TRUST_ALL_CERTIFICATES,
/**
* Trust custom CA-signed certificates.
*/
TRUST_CUSTOM_CA_SIGNED_CERTIFICATES,
/**
* Trust system CA-signed certificates.
*/
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES
}

/**
* The strategy type.
*/
private final Strategy strategy;
/**
* The configured certificate files.
*/
private final List<File> certFiles;
/**
* The flag indicating if hostname verification is enabled for this trust strategy.
*/
private boolean hostnameVerificationEnabled = true;
/**
* The revocation strategy used for verifying certificates.
*/
private RevocationCheckingStrategy revocationCheckingStrategy = RevocationCheckingStrategy.NO_CHECKS;

private TrustStrategy(Strategy strategy) {
Expand Down
15 changes: 15 additions & 0 deletions driver/src/main/java/org/neo4j/driver/QueryConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,25 @@ public final class QueryConfig implements Serializable {

private static final QueryConfig DEFAULT = builder().build();

/**
* The routing mode.
*/
private final RoutingControl routing;
/**
* The target database.
*/
private final String database;
/**
* The impersonated user.
*/
private final String impersonatedUser;
/**
* The bookmark manager.
*/
private final BookmarkManager bookmarkManager;
/**
* The flag indicating if default bookmark manager should be used.
*/
private final boolean useDefaultBookmarkManager;

/**
Expand Down
24 changes: 24 additions & 0 deletions driver/src/main/java/org/neo4j/driver/Records.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,42 @@
public final class Records {
private Records() {}

/**
* Returns a function mapping record to a value from a given index.
* @param index the index value
* @return the function
*/
public static Function<Record, Value> column(int index) {
return column(index, Values.ofValue());
}

/**
* Returns a function mapping record to a value from a given key.
* @param key the key value
* @return the function
*/
public static Function<Record, Value> column(String key) {
return column(key, Values.ofValue());
}

/**
* Returns a function mapping record to a value of a target type from a given index.
* @param index the index value
* @param mapFunction the function mapping value to a value of a target type
* @return the function
* @param <T> the target type
*/
public static <T> Function<Record, T> column(final int index, final Function<Value, T> mapFunction) {
return record -> mapFunction.apply(record.get(index));
}

/**
* Returns a function mapping record to a value of a target type from a given key.
* @param key the key value
* @param mapFunction the function mapping value to a value of a target type
* @return the function
* @param <T> the target type
*/
public static <T> Function<Record, T> column(final String key, final Function<Value, T> mapFunction) {
return recordAccessor -> mapFunction.apply(recordAccessor.get(key));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public enum RevocationCheckingStrategy {
/** Require stapled revocation status and verify OCSP revocation checks, fail if no revocation status is stapled to the certificate. */
STRICT;

/**
* Returns whether a given strategy requires revocation checking.
* @param revocationCheckingStrategy the strategy
* @return whether revocation checking is required
*/
public static boolean requiresRevocationChecking(RevocationCheckingStrategy revocationCheckingStrategy) {
return revocationCheckingStrategy.equals(STRICT) || revocationCheckingStrategy.equals(VERIFY_IF_PRESENT);
}
Expand Down
22 changes: 22 additions & 0 deletions driver/src/main/java/org/neo4j/driver/SessionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,29 @@ public final class SessionConfig implements Serializable {

private static final SessionConfig EMPTY = builder().build();

/**
* The initial bookmarks.
*/
private final Iterable<Bookmark> bookmarks;
/**
* The default type of access.
*/
private final AccessMode defaultAccessMode;
/**
* The target database name.
*/
private final String database;
/**
* The fetch size.
*/
private final Long fetchSize;
/**
* The impersonated user.
*/
private final String impersonatedUser;
/**
* The bookmark manager.
*/
private final BookmarkManager bookmarkManager;

private SessionConfig(Builder builder) {
Expand Down Expand Up @@ -348,6 +366,10 @@ public Builder withBookmarkManager(BookmarkManager bookmarkManager) {
return this;
}

/**
* Builds the {@link SessionConfig}.
* @return the config
*/
public SessionConfig build() {
return new SessionConfig(this);
}
Expand Down
6 changes: 6 additions & 0 deletions driver/src/main/java/org/neo4j/driver/TransactionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ public final class TransactionConfig implements Serializable {

private static final TransactionConfig EMPTY = builder().build();

/**
* the transaction timeout
*/
private final Duration timeout;
/**
* The transaction metadata.
*/
private final Map<String, Object> metadata;

// Values are not serializable, hence, we keep a transient volatile map of them around
Expand Down
Loading