From 50fc10290979ca98bfffda8c16d7648177ca4445 Mon Sep 17 00:00:00 2001 From: Jonathan Hess Date: Wed, 23 Oct 2024 12:24:51 -0600 Subject: [PATCH] docs: Add missing javadoc comments to public methods. --- .../java/com/google/cloud/sql/ConnectorConfig.java | 10 ++++++++++ .../java/com/google/cloud/sql/CredentialFactory.java | 1 + .../java/com/google/cloud/sql/RefreshStrategy.java | 2 ++ .../com/google/cloud/sql/core/ConnectionConfig.java | 6 ++++++ .../com/google/cloud/sql/core/RefreshStrategy.java | 7 +++++++ 5 files changed, 26 insertions(+) diff --git a/core/src/main/java/com/google/cloud/sql/ConnectorConfig.java b/core/src/main/java/com/google/cloud/sql/ConnectorConfig.java index 1f5e3e456..7c812c22f 100644 --- a/core/src/main/java/com/google/cloud/sql/ConnectorConfig.java +++ b/core/src/main/java/com/google/cloud/sql/ConnectorConfig.java @@ -153,52 +153,62 @@ public static class Builder { private String universeDomain; private RefreshStrategy refreshStrategy = RefreshStrategy.BACKGROUND; + /** Chained setter for TargetPrinciple field. */ public Builder withTargetPrincipal(String targetPrincipal) { this.targetPrincipal = targetPrincipal; return this; } + /** Chained setter for GoogleCredentialsSupplier field. */ public Builder withGoogleCredentialsSupplier( Supplier googleCredentialsSupplier) { this.googleCredentialsSupplier = googleCredentialsSupplier; return this; } + /** Chained setter for GoogleCredentials field. */ public Builder withGoogleCredentials(GoogleCredentials googleCredentials) { this.googleCredentials = googleCredentials; return this; } + /** Chained setter for GoogleCredentialsPath field. */ public Builder withGoogleCredentialsPath(String googleCredentialsPath) { this.googleCredentialsPath = googleCredentialsPath; return this; } + /** Chained setter for Delegates field. */ public Builder withDelegates(List delegates) { this.delegates = delegates; return this; } + /** Chained setter for AdminRootUrl field. */ public Builder withAdminRootUrl(String adminRootUrl) { this.adminRootUrl = adminRootUrl; return this; } + /** Chained setter for AdminServicePath field. */ public Builder withAdminServicePath(String adminServicePath) { this.adminServicePath = adminServicePath; return this; } + /** Chained setter for AdminQuotaProject field. */ public Builder withAdminQuotaProject(String adminQuotaProject) { this.adminQuotaProject = adminQuotaProject; return this; } + /** Chained setter for UniverseDomain field. */ public Builder withUniverseDomain(String universeDomain) { this.universeDomain = universeDomain; return this; } + /** Chained setter for RefreshStrategy field. */ public Builder withRefreshStrategy(RefreshStrategy refreshStrategy) { this.refreshStrategy = refreshStrategy; return this; diff --git a/core/src/main/java/com/google/cloud/sql/CredentialFactory.java b/core/src/main/java/com/google/cloud/sql/CredentialFactory.java index eb1d61927..372614952 100644 --- a/core/src/main/java/com/google/cloud/sql/CredentialFactory.java +++ b/core/src/main/java/com/google/cloud/sql/CredentialFactory.java @@ -32,6 +32,7 @@ public interface CredentialFactory { /** Name of system property that can specify an alternative credential factory. */ String CREDENTIAL_FACTORY_PROPERTY = "cloudSql.socketFactory.credentialFactory"; + /** Creates the HttpRequestInitializer. */ HttpRequestInitializer create(); /** diff --git a/core/src/main/java/com/google/cloud/sql/RefreshStrategy.java b/core/src/main/java/com/google/cloud/sql/RefreshStrategy.java index 5f4e3a512..3afc013c1 100644 --- a/core/src/main/java/com/google/cloud/sql/RefreshStrategy.java +++ b/core/src/main/java/com/google/cloud/sql/RefreshStrategy.java @@ -18,6 +18,8 @@ /** Enum for supported refresh strategies. */ public enum RefreshStrategy { + /** Use the Background refresh strategy. */ BACKGROUND, + /** Use the Lazy refresh strategy. */ LAZY } diff --git a/core/src/main/java/com/google/cloud/sql/core/ConnectionConfig.java b/core/src/main/java/com/google/cloud/sql/core/ConnectionConfig.java index 592612c5b..1dab667ea 100644 --- a/core/src/main/java/com/google/cloud/sql/core/ConnectionConfig.java +++ b/core/src/main/java/com/google/cloud/sql/core/ConnectionConfig.java @@ -239,26 +239,31 @@ public static class Builder { private ConnectorConfig connectorConfig = new ConnectorConfig.Builder().build(); private AuthType authType = DEFAULT_AUTH_TYPE; + /** Chained setter for CloudSqlInstance field. */ public Builder withCloudSqlInstance(String cloudSqlInstance) { this.cloudSqlInstance = cloudSqlInstance; return this; } + /** Chained setter for NamedConnector field. */ public Builder withNamedConnector(String namedConnector) { this.namedConnector = namedConnector; return this; } + /** Chained setter for ConnectorConfig field. */ public Builder withConnectorConfig(ConnectorConfig connectorConfig) { this.connectorConfig = connectorConfig; return this; } + /** Chained setter for UnixSocketPath field. */ public Builder withUnixSocketPath(String unixSocketPath) { this.unixSocketPath = unixSocketPath; return this; } + /** Chained setter for AuthType field. */ public Builder withAuthType(AuthType authType) { this.authType = authType; return this; @@ -276,6 +281,7 @@ public Builder withIpTypes(List ipTypes) { return this; } + /** Chained setter for UnixSocketPathSuffix field. */ public Builder withUnixSocketPathSuffix(String unixSocketPathSuffix) { this.unixSocketPathSuffix = unixSocketPathSuffix; return this; diff --git a/core/src/main/java/com/google/cloud/sql/core/RefreshStrategy.java b/core/src/main/java/com/google/cloud/sql/core/RefreshStrategy.java index f74133c9e..906e6686e 100644 --- a/core/src/main/java/com/google/cloud/sql/core/RefreshStrategy.java +++ b/core/src/main/java/com/google/cloud/sql/core/RefreshStrategy.java @@ -18,11 +18,18 @@ /** Provide the refresh strategy to the DefaultConnectionInfoCache. */ public interface RefreshStrategy { + /** Return the current valid ConnectionInfo, blocking if necessary for up to the timeout. */ ConnectionInfo getConnectionInfo(long timeoutMs); + /** Force a refresh of the ConnectionInfo, possibly in the background. */ void forceRefresh(); + /** Refresh the ConnectionInfo if it has expired or is near expiration. */ void refreshIfExpired(); + /** + * Stop background threads and refresh operations in progress and refuse to start subsequent + * refresh operations. + */ void close(); }