时间:2021-07-01 10:21:17 帮助过:11人阅读
We have two providers as you see here, a MySql provider as input and PostgreSql as output.
In the base provider class, be it MySql or PostgreSql we use a Connections class to retrieve ourInputConnection()or ourOutputConnection().
To retrieve the “NixImportConnection” object we rely on the Configuration class which we’ll see next. Here is where we call the Configuration class in NixImportConnection.
We’re one step closer to the connection’s properties in the Configuration class where we’ll retrieve the configuration name of the input and output connections from the app’s properties file.
The properties file is where we define the connection name, giving us the ability to change it at any time based on environment or development needs.
We arrive at our Connections.xml file where the information to populate our Connection Properties formysql.burkey_nixmash andpostgresql.nixmashupdb.
With dual data providers for MySql and PostgreSql we can easily hand-off objects from one source to another with
NixImportMySql db = NixImportMySql.loadProvider();
and
NixImportPostgreSql db = NixImportPostgreSql.loadProvider();