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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### :crab: Changed
- Breaking Change: Remove suggested ClusterId functionality. For applications that use a single cluster database **no changes are required**. For application that access multiple database clusters, all connection string **should be** reviewed and a mandatory `clusterId` parameter **should be added**. ([PR #1570](https://github.com/aws/aws-advanced-jdbc-wrapper/pull/1570)).
- Breaking Change: Remove deprecated code. ([PR #1572](https://github.com/aws/aws-advanced-jdbc-wrapper/pull/1572)).

### :magic_wand: Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ public ConnectionProviderManager(
this.effectiveConnProvider = effectiveConnProvider;
}

/**
* Setter that can optionally be called to request a non-default {@link ConnectionProvider}. The
* requested ConnectionProvider will be used to establish future connections unless it does not
* support a requested URL, in which case the default ConnectionProvider will be used. See
* {@link ConnectionProvider#acceptsUrl} for more info.
*
* @param connProvider the {@link ConnectionProvider} to use to establish new connections
* @deprecated Use {@link Driver#setCustomConnectionProvider(ConnectionProvider)} instead.
*/
@Deprecated
public static void setConnectionProvider(ConnectionProvider connProvider) {
Driver.setCustomConnectionProvider(connProvider);
}

/**
* Get the {@link ConnectionProvider} to use to establish a connection using the given driver
* protocol, host details, and properties. If a non-default ConnectionProvider has been set using
Expand Down Expand Up @@ -163,18 +149,6 @@ public HostSpec getHostSpecByStrategy(List<HostSpec> hosts, HostRole role, Strin
return this.defaultProvider.getHostSpecByStrategy(hosts, role, strategy, props);
}

/**
* Clears the non-default {@link ConnectionProvider} if it has been set. The default
* ConnectionProvider will be used if the non-default ConnectionProvider has not been set or has
* been cleared.
*
* @deprecated Use {@link Driver#resetCustomConnectionProvider()} instead
*/
@Deprecated
public static void resetProvider() {
Driver.resetCustomConnectionProvider();
}

/**
* Releases any resources held by the available {@link ConnectionProvider} instances.
*/
Expand All @@ -185,29 +159,6 @@ public static void releaseResources() {
}
}

/**
* Sets a custom connection initialization function. It'll be used
* for every brand-new database connection.
*
* @param func A function that initialize a new connection
*
* @deprecated @see Driver#setConnectionInitFunc(ConnectionInitFunc)
*/
@Deprecated
public static void setConnectionInitFunc(final @NonNull ConnectionInitFunc func) {
Driver.setConnectionInitFunc(func);
}

/**
* Resets a custom connection initialization function.
*
* @deprecated Use {@link Driver#resetConnectionInitFunc()} instead
*/
@Deprecated
public static void resetConnectionInitFunc() {
Driver.resetConnectionInitFunc();
}

public void initConnection(
final @Nullable Connection connection,
final @NonNull String protocol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ public String getOriginalUrl() {
return this.originalUrl;
}

@Override
public void setAllowedAndBlockedHosts(AllowedAndBlockedHosts allowedAndBlockedHosts) {
throw new UnsupportedOperationException(
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"setAllowedAndBlockedHosts"}));
}

@Override
public boolean acceptsStrategy(HostRole role, String strategy) throws SQLException {
throw new UnsupportedOperationException(
Expand All @@ -216,12 +210,6 @@ public HostRole getHostRole(Connection conn) throws SQLException {
return this.hostListProvider.getHostRole(conn);
}

@Override
@Deprecated
public ConnectionProvider getConnectionProvider() {
return this.pluginManager.defaultConnProvider;
}

@Override
public ConnectionProvider getDefaultConnectionProvider() {
return this.connectionProviderManager.getDefaultProvider();
Expand Down Expand Up @@ -538,11 +526,6 @@ public void releaseResources() {
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"releaseResources"}));
}

@Override
public boolean isNetworkException(Throwable throwable) {
return this.isNetworkException(throwable, this.targetDriverDialect);
}

@Override
public boolean isNetworkException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
if (this.exceptionHandler != null) {
Expand All @@ -559,11 +542,6 @@ public boolean isNetworkException(final String sqlState) {
return this.exceptionManager.isNetworkException(this.dbDialect, sqlState);
}

@Override
public boolean isLoginException(Throwable throwable) {
return this.isLoginException(throwable, this.targetDriverDialect);
}

@Override
public boolean isLoginException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
if (this.exceptionHandler != null) {
Expand Down Expand Up @@ -666,31 +644,6 @@ public <T> T getPlugin(final Class<T> pluginClazz) {
return null;
}

@Override
public <T> void setStatus(Class<T> clazz, @Nullable T status, boolean clusterBound) {
throw new UnsupportedOperationException(
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"setStatus"}));
}

@Override
public <T> void setStatus(Class<T> clazz, @Nullable T status, String key) {
throw new UnsupportedOperationException(
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"setStatus"}));
}

@Override
public <T> T getStatus(@NonNull Class<T> clazz, boolean clusterBound) {
throw new UnsupportedOperationException(
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"getStatus"}));
}

@Override
public <T> T getStatus(@NonNull Class<T> clazz, String key) {
throw new UnsupportedOperationException(
Messages.get("PartialPluginService.unexpectedMethodCall", new Object[] {"getStatus"}));
}

@Override
public boolean isPluginInUse(final Class<? extends ConnectionPlugin> pluginClazz) {
try {
return this.pluginManager.isWrapperFor(pluginClazz);
Expand Down
20 changes: 0 additions & 20 deletions wrapper/src/main/java/software/amazon/jdbc/PluginService.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,6 @@ EnumSet<NodeChangeOptions> setCurrentConnection(

String getOriginalUrl();

/**
* Set the collection of hosts that should be allowed and/or blocked for connections.
*
* @param allowedAndBlockedHosts An object defining the allowed and blocked sets of hosts.
* @deprecated use StorageService#set(key, allowedAndBlockedHosts) instead.
*/
@Deprecated
void setAllowedAndBlockedHosts(AllowedAndBlockedHosts allowedAndBlockedHosts);

/**
* Returns a boolean indicating if the available {@link ConnectionProvider} or
* {@link ConnectionPlugin} instances support the selection of a host with the requested role and
Expand Down Expand Up @@ -240,9 +231,6 @@ Connection forceConnect(

HostSpecBuilder getHostSpecBuilder();

@Deprecated
ConnectionProvider getConnectionProvider();

ConnectionProvider getDefaultConnectionProvider();

boolean isPooledConnectionProvider(HostSpec host, Properties props);
Expand All @@ -259,13 +247,5 @@ Connection forceConnect(

<T> T getPlugin(final Class<T> pluginClazz);

<T> void setStatus(final Class<T> clazz, final @Nullable T status, final boolean clusterBound);

<T> void setStatus(final Class<T> clazz, final @Nullable T status, final String key);

<T> T getStatus(final @NonNull Class<T> clazz, final boolean clusterBound);

<T> T getStatus(final @NonNull Class<T> clazz, final String key);

boolean isPluginInUse(final Class<? extends ConnectionPlugin> pluginClazz);
}
69 changes: 0 additions & 69 deletions wrapper/src/main/java/software/amazon/jdbc/PluginServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ public String getOriginalUrl() {
return this.originalUrl;
}

@Override
@Deprecated
public void setAllowedAndBlockedHosts(AllowedAndBlockedHosts allowedAndBlockedHosts) {
this.servicesContainer.getStorageService().set(this.initialConnectionHostSpec.getHost(), allowedAndBlockedHosts);
}

@Override
public boolean acceptsStrategy(HostRole role, String strategy) throws SQLException {
return this.pluginManager.acceptsStrategy(role, strategy);
Expand All @@ -244,12 +238,6 @@ public HostRole getHostRole(Connection conn) throws SQLException {
return this.hostListProvider.getHostRole(conn);
}

@Override
@Deprecated
public ConnectionProvider getConnectionProvider() {
return this.pluginManager.defaultConnProvider;
}

@Override
public ConnectionProvider getDefaultConnectionProvider() {
return this.connectionProviderManager.getDefaultProvider();
Expand Down Expand Up @@ -663,12 +651,6 @@ public void releaseResources() {
}
}

@Override
@Deprecated
public boolean isNetworkException(Throwable throwable) {
return this.isNetworkException(throwable, this.targetDriverDialect);
}

@Override
public boolean isNetworkException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
if (this.exceptionHandler != null) {
Expand All @@ -685,12 +667,6 @@ public boolean isNetworkException(final String sqlState) {
return this.exceptionManager.isNetworkException(this.dialect, sqlState);
}

@Override
@Deprecated
public boolean isLoginException(Throwable throwable) {
return this.isLoginException(throwable, this.targetDriverDialect);
}

@Override
public boolean isLoginException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
if (this.exceptionHandler != null) {
Expand Down Expand Up @@ -805,51 +781,6 @@ public static void clearCache() {
hostAvailabilityExpiringCache.clear();
}

@Deprecated // Use StorageService#set instead.
public <T> void setStatus(final Class<T> clazz, final @Nullable T status, final boolean clusterBound) {
String clusterId = null;
if (clusterBound) {
try {
clusterId = this.hostListProvider.getClusterId();
} catch (Exception ex) {
// do nothing
}
}
this.setStatus(clazz, status, clusterId);
}

@Deprecated // Use StorageService#set instead.
public <T> void setStatus(final Class<T> clazz, final @Nullable T status, final String key) {
final String cacheKey = this.getStatusCacheKey(clazz, key);
if (status == null) {
statusesExpiringCache.remove(cacheKey);
} else {
statusesExpiringCache.put(cacheKey, status, DEFAULT_STATUS_CACHE_EXPIRE_NANO);
}
}

@Deprecated // Use StorageService#get instead.
public <T> T getStatus(final @NonNull Class<T> clazz, final boolean clusterBound) {
String clusterId = null;
if (clusterBound) {
try {
clusterId = this.hostListProvider.getClusterId();
} catch (Exception ex) {
// do nothing
}
}
return this.getStatus(clazz, clusterId);
}

@Deprecated // Use StorageService#get instead.
public <T> T getStatus(final @NonNull Class<T> clazz, String key) {
return clazz.cast(statusesExpiringCache.get(this.getStatusCacheKey(clazz, key)));
}

protected <T> String getStatusCacheKey(final Class<T> clazz, final String key) {
return String.format("%s::%s", key == null ? "" : key.trim().toLowerCase(), clazz.getName());
}

public boolean isPluginInUse(final Class<? extends ConnectionPlugin> pluginClazz) {
try {
return this.pluginManager.isWrapperFor(pluginClazz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@ public DialectManager(PluginService pluginService) {
this.pluginService = pluginService;
}

/**
* Sets a custom dialect handler.
*
* @param dialect A custom dialect to use.
*
* @deprecated Use software.amazon.jdbc.Driver instead
*/
@Deprecated
public static void setCustomDialect(final @NonNull Dialect dialect) {
Driver.setCustomDialect(dialect);
}

/**
* Resets a custom dialect handler.
*
* @deprecated Use software.amazon.jdbc.Driver instead
*/
@Deprecated
public static void resetCustomDialect() {
Driver.resetCustomDialect();
}

public static void resetEndpointCache() {
knownEndpointDialects.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public abstract class AbstractPgExceptionHandler implements ExceptionHandler {

public abstract List<String> getAccessErrors();

@Override
@Deprecated
public boolean isNetworkException(Throwable throwable) {
return this.isNetworkException(throwable, null);
}

@Override
public boolean isNetworkException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
Throwable exception = throwable;
Expand Down Expand Up @@ -68,12 +62,6 @@ public boolean isNetworkException(final String sqlState) {
return false;
}

@Override
@Deprecated
public boolean isLoginException(final Throwable throwable) {
return this.isLoginException(throwable, null);
}

@Override
public boolean isLoginException(final Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect) {
Throwable exception = throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,11 @@

public interface ExceptionHandler {

/**
* The method determines whether provided throwable is about any network issues.
*
* @param throwable A throwable object to check.
* @return true, if a provided throwable object is network-related.
*
* @deprecated Use similar method below that accepts throwable and target driver dialect.
*/
@Deprecated
boolean isNetworkException(Throwable throwable);

boolean isNetworkException(Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect);

boolean isNetworkException(String sqlState);

boolean isLoginException(String sqlState);

/**
* The method determines whether provided throwable is about any login or authentication issues.
*
* @param throwable A throwable object to check.
* @return true, if a provided throwable object is related to authentication.

* @deprecated Use similar method below that accepts throwable and target driver dialect.
*/
@Deprecated
boolean isLoginException(Throwable throwable);

boolean isLoginException(Throwable throwable, @Nullable TargetDriverDialect targetDriverDialect);
}
Loading
Loading