1414 limitations under the License.
1515*/
1616
17- import { PluginServiceManagerContainer } from "./plugin_service_manager_container" ;
18- import { PluginService , PluginServiceImpl } from "./plugin_service" ;
17+ import { PluginService } from "./plugin_service" ;
1918import { DatabaseDialect , DatabaseType } from "./database_dialect/database_dialect" ;
2019import { ConnectionUrlParser } from "./utils/connection_url_parser" ;
2120import { HostListProvider } from "./host_list_provider/host_list_provider" ;
2221import { PluginManager } from "./plugin_manager" ;
2322
2423import pkgStream from "stream" ;
2524import { ClientWrapper } from "./client_wrapper" ;
26- import { ConnectionProviderManager } from "./connection_provider_manager" ;
2725import { DefaultTelemetryFactory } from "./utils/telemetry/default_telemetry_factory" ;
2826import { TelemetryFactory } from "./utils/telemetry/telemetry_factory" ;
2927import { DriverDialect } from "./driver_dialect/driver_dialect" ;
3028import { WrapperProperties } from "./wrapper_property" ;
3129import { DriverConfigurationProfiles } from "./profile/driver_configuration_profiles" ;
3230import { ConfigurationProfile } from "./profile/configuration_profile" ;
33- import { AwsWrapperError , TransactionIsolationLevel , ConnectionProvider } from "./" ;
31+ import { AwsWrapperError , ConnectionProvider , TransactionIsolationLevel } from "./" ;
3432import { Messages } from "./utils/messages" ;
3533import { HostListProviderService } from "./host_list_provider_service" ;
3634import { SessionStateClient } from "./session_state_client" ;
37- import { DriverConnectionProvider } from "./driver_connection_provider " ;
35+ import { ServiceUtils } from "./utils/service_utils " ;
3836import { StorageService } from "./utils/storage/storage_service" ;
37+ import { MonitorService } from "./utils/monitoring/monitor_service" ;
3938import { CoreServicesContainer } from "./utils/core_services_container" ;
39+ import { FullServicesContainer } from "./utils/full_services_container" ;
40+ import { EventPublisher } from "./utils/events/event" ;
4041
4142const { EventEmitter } = pkgStream ;
4243
4344export abstract class AwsClient extends EventEmitter implements SessionStateClient {
4445 private _defaultPort : number = - 1 ;
46+ private readonly fullServiceContainer : FullServicesContainer ;
4547 private readonly storageService : StorageService ;
48+ private readonly monitorService : MonitorService ;
49+ private readonly eventPublisher : EventPublisher ;
4650 protected telemetryFactory : TelemetryFactory ;
4751 protected pluginManager : PluginManager ;
4852 protected pluginService : PluginService ;
@@ -67,7 +71,7 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
6771
6872 this . properties = new Map < string , any > ( Object . entries ( config ) ) ;
6973
70- this . storageService = CoreServicesContainer . getInstance ( ) . getStorageService ( ) ;
74+ this . storageService = CoreServicesContainer . getInstance ( ) . storageService ;
7175
7276 const profileName = WrapperProperties . PROFILE_NAME . get ( this . properties ) ;
7377 if ( profileName && profileName . length > 0 ) {
@@ -103,22 +107,27 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
103107 }
104108 }
105109
110+ const coreServicesContainer : CoreServicesContainer = CoreServicesContainer . getInstance ( ) ;
111+ this . storageService = coreServicesContainer . storageService ;
112+ this . monitorService = coreServicesContainer . monitorService ;
113+ this . eventPublisher = coreServicesContainer . eventPublisher ;
106114 this . telemetryFactory = new DefaultTelemetryFactory ( this . properties ) ;
107- const container = new PluginServiceManagerContainer ( ) ;
108- this . pluginService = new PluginServiceImpl (
109- container ,
115+
116+ this . fullServiceContainer = ServiceUtils . instance . createStandardServiceContainer (
117+ this . storageService ,
118+ this . monitorService ,
119+ this . eventPublisher ,
110120 this ,
121+ this . properties ,
111122 dbType ,
112123 knownDialectsByCode ,
113- this . properties ,
114- this . _configurationProfile ?. getDriverDialect ( ) ?? driverDialect
115- ) ;
116- this . pluginManager = new PluginManager (
117- container ,
118- this . properties ,
119- new ConnectionProviderManager ( connectionProvider ?? new DriverConnectionProvider ( ) , WrapperProperties . CONNECTION_PROVIDER . get ( this . properties ) ) ,
120- this . telemetryFactory
124+ this . _configurationProfile ?. getDriverDialect ( ) ?? driverDialect ,
125+ this . telemetryFactory ,
126+ connectionProvider
121127 ) ;
128+
129+ this . pluginService = this . fullServiceContainer . pluginService ;
130+ this . pluginManager = this . fullServiceContainer . pluginManager ;
122131 }
123132
124133 private async setup ( ) {
@@ -130,12 +139,12 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
130139 await this . setup ( ) ;
131140 const hostListProvider : HostListProvider = this . pluginService
132141 . getDialect ( )
133- . getHostListProvider ( this . properties , this . properties . get ( "host" ) , < HostListProviderService > ( < unknown > this . pluginService ) ) ;
142+ . getHostListProvider ( this . properties , this . properties . get ( "host" ) , this . fullServiceContainer ) ;
134143 this . pluginService . setHostListProvider ( hostListProvider ) ;
135144 await this . pluginService . refreshHostList ( ) ;
136145 const initialHostInfo = this . pluginService . getInitialConnectionHostInfo ( ) ;
137146 if ( initialHostInfo != null ) {
138- await this . pluginManager . initHostProvider ( initialHostInfo , this . properties , < HostListProviderService > ( < unknown > this . pluginService ) ) ;
147+ await this . pluginManager . initHostProvider ( initialHostInfo , this . properties , this . fullServiceContainer . hostListProviderService ) ;
139148 await this . pluginService . refreshHostList ( ) ;
140149 }
141150 }
@@ -159,23 +168,23 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
159168
160169 abstract setReadOnly ( readOnly : boolean ) : Promise < any | void > ;
161170
162- abstract isReadOnly ( ) : boolean ;
171+ abstract isReadOnly ( ) : boolean | undefined ;
163172
164173 abstract setAutoCommit ( autoCommit : boolean ) : Promise < any | void > ;
165174
166- abstract getAutoCommit ( ) : boolean ;
175+ abstract getAutoCommit ( ) : boolean | undefined ;
167176
168177 abstract setTransactionIsolation ( level : TransactionIsolationLevel ) : Promise < any | void > ;
169178
170- abstract getTransactionIsolation ( ) : TransactionIsolationLevel ;
179+ abstract getTransactionIsolation ( ) : TransactionIsolationLevel | undefined ;
171180
172181 abstract setSchema ( schema : any ) : Promise < any | void > ;
173182
174- abstract getSchema ( ) : string ;
183+ abstract getSchema ( ) : string | undefined ;
175184
176185 abstract setCatalog ( catalog : string ) : Promise < any | void > ;
177186
178- abstract getCatalog ( ) : string ;
187+ abstract getCatalog ( ) : string | undefined ;
179188
180189 abstract end ( ) : Promise < any > ;
181190
0 commit comments