diff --git a/wrapper/src/main/java/software/amazon/jdbc/hostlistprovider/monitoring/AuroraGlobalDbMonitoringHostListProvider.java b/wrapper/src/main/java/software/amazon/jdbc/hostlistprovider/monitoring/AuroraGlobalDbMonitoringHostListProvider.java index 50bb4263d..9053e93db 100644 --- a/wrapper/src/main/java/software/amazon/jdbc/hostlistprovider/monitoring/AuroraGlobalDbMonitoringHostListProvider.java +++ b/wrapper/src/main/java/software/amazon/jdbc/hostlistprovider/monitoring/AuroraGlobalDbMonitoringHostListProvider.java @@ -23,10 +23,8 @@ import java.util.Properties; import java.util.logging.Logger; import java.util.stream.Collectors; -import software.amazon.jdbc.HostListProviderService; import software.amazon.jdbc.HostSpec; import software.amazon.jdbc.HostSpecBuilder; -import software.amazon.jdbc.PluginService; import software.amazon.jdbc.PropertyDefinition; import software.amazon.jdbc.hostlistprovider.AuroraGlobalDbHostListProvider; import software.amazon.jdbc.util.ConnectionUrlParser; @@ -34,7 +32,6 @@ import software.amazon.jdbc.util.Pair; import software.amazon.jdbc.util.RdsUtils; import software.amazon.jdbc.util.StringUtils; -import software.amazon.jdbc.util.connection.ConnectionService; public class AuroraGlobalDbMonitoringHostListProvider extends MonitoringRdsHostListProvider { diff --git a/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionService.java b/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionService.java deleted file mode 100644 index 1c18a9f28..000000000 --- a/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionService.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package software.amazon.jdbc.util.connection; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Properties; -import software.amazon.jdbc.HostSpec; -import software.amazon.jdbc.PluginService; -import software.amazon.jdbc.util.FullServicesContainer; - -/** - * A service used to open new connections for internal driver use. - * - * @deprecated This interface is deprecated and will be removed in a future version. Use - * {@link software.amazon.jdbc.util.ServiceUtility#createMinimalServiceContainer} followed by - * {@link PluginService#forceConnect} instead. - */ -@Deprecated -public interface ConnectionService { - /** - * Creates an auxiliary connection. Auxiliary connections are driver-internal connections that accomplish various - * specific tasks such as monitoring a host's availability, checking the topology information for a cluster, etc. - * - * @param hostSpec the hostSpec containing the host information for the auxiliary connection. - * @param props the properties for the auxiliary connection. - * @return a new connection to the given host using the given props. - * @throws SQLException if an error occurs while opening the connection. - * @deprecated Use {@link software.amazon.jdbc.util.ServiceUtility#createMinimalServiceContainer} followed by - * {@link PluginService#forceConnect} instead. - */ - @Deprecated - Connection open(HostSpec hostSpec, Properties props) throws SQLException; - - /** - * Get the {@link PluginService} associated with this {@link ConnectionService}. - * - * @return the {@link PluginService} associated with this {@link ConnectionService} - * @deprecated Use {@link software.amazon.jdbc.util.ServiceUtility#createMinimalServiceContainer} followed by - * {@link FullServicesContainer#getPluginService()} instead. - */ - @Deprecated - PluginService getPluginService(); -} diff --git a/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionServiceImpl.java b/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionServiceImpl.java deleted file mode 100644 index 540aea280..000000000 --- a/wrapper/src/main/java/software/amazon/jdbc/util/connection/ConnectionServiceImpl.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package software.amazon.jdbc.util.connection; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Properties; -import software.amazon.jdbc.ConnectionPluginManager; -import software.amazon.jdbc.ConnectionProvider; -import software.amazon.jdbc.HostSpec; -import software.amazon.jdbc.PartialPluginService; -import software.amazon.jdbc.PluginService; -import software.amazon.jdbc.dialect.Dialect; -import software.amazon.jdbc.targetdriverdialect.TargetDriverDialect; -import software.amazon.jdbc.util.FullServicesContainer; -import software.amazon.jdbc.util.FullServicesContainerImpl; -import software.amazon.jdbc.util.PropertyUtils; -import software.amazon.jdbc.util.monitoring.MonitorService; -import software.amazon.jdbc.util.storage.StorageService; -import software.amazon.jdbc.util.telemetry.TelemetryFactory; - -/** - * A service used to open new connections for internal driver use. - * - * @deprecated This class is deprecated and will be removed in a future version. Use - * {@link software.amazon.jdbc.util.ServiceUtility#createMinimalServiceContainer} followed by - * {@link PluginService#forceConnect} instead. - */ -@Deprecated -public class ConnectionServiceImpl implements ConnectionService { - protected final String targetDriverProtocol; - protected final ConnectionPluginManager pluginManager; - protected final PluginService pluginService; - - /** - * Constructs a {@link ConnectionServiceImpl} instance. - * - * @param storageService An instance of storage service - * @param monitorService An instance of monitor service - * @param telemetryFactory An instance of telemetry factory - * @param connectionProvider An instance of connection provider - * @param originalUrl An original Url - * @param targetDriverProtocol A target driver protocol - * @param driverDialect An instance of driver dialect - * @param dbDialect An instance of database dialect - * @param props Properties - * @throws SQLException if errors occurred while creating an instance - * @deprecated Use {@link software.amazon.jdbc.util.ServiceUtility#createMinimalServiceContainer} instead. - */ - @Deprecated - public ConnectionServiceImpl( - StorageService storageService, - MonitorService monitorService, - TelemetryFactory telemetryFactory, - ConnectionProvider connectionProvider, - String originalUrl, - String targetDriverProtocol, - TargetDriverDialect driverDialect, - Dialect dbDialect, - Properties props) throws SQLException { - this.targetDriverProtocol = targetDriverProtocol; - - FullServicesContainer servicesContainer = - new FullServicesContainerImpl(storageService, monitorService, connectionProvider, telemetryFactory); - this.pluginManager = new ConnectionPluginManager(props, telemetryFactory, connectionProvider, null); - servicesContainer.setConnectionPluginManager(this.pluginManager); - - Properties propsCopy = PropertyUtils.copyProperties(props); - PartialPluginService partialPluginService = new PartialPluginService( - servicesContainer, - propsCopy, - originalUrl, - this.targetDriverProtocol, - driverDialect, - dbDialect - ); - - servicesContainer.setHostListProviderService(partialPluginService); - servicesContainer.setPluginService(partialPluginService); - servicesContainer.setPluginManagerService(partialPluginService); - - this.pluginService = partialPluginService; - this.pluginManager.initPlugins(servicesContainer, null); - } - - @Override - @Deprecated - public Connection open(HostSpec hostSpec, Properties props) throws SQLException { - return this.pluginManager.forceConnect(this.targetDriverProtocol, hostSpec, props, true, null); - } - - @Override - @Deprecated - public PluginService getPluginService() { - return this.pluginService; - } -} diff --git a/wrapper/src/test/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPluginTest.java b/wrapper/src/test/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPluginTest.java index 1fb98265e..ac5b9d7b0 100644 --- a/wrapper/src/test/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPluginTest.java +++ b/wrapper/src/test/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPluginTest.java @@ -63,7 +63,6 @@ import software.amazon.jdbc.util.FullServicesContainer; import software.amazon.jdbc.util.RdsUrlType; import software.amazon.jdbc.util.SqlState; -import software.amazon.jdbc.util.connection.ConnectionService; import software.amazon.jdbc.util.telemetry.GaugeCallable; import software.amazon.jdbc.util.telemetry.TelemetryContext; import software.amazon.jdbc.util.telemetry.TelemetryCounter; @@ -82,7 +81,6 @@ class FailoverConnectionPluginTest { .host("reader1").port(1234).role(HostRole.READER).build()); @Mock FullServicesContainer mockContainer; - @Mock ConnectionService mockConnectionService; @Mock PluginService mockPluginService; @Mock Connection mockConnection; @Mock HostSpec mockHostSpec;