@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect ;
package com.fr.design.data.datapane.connect ;
import com.fanruan.datasource.driver.bean.DriverLoaderBean ;
import com.fine.swing.ui.layout.Layouts ;
import com.fine.swing.ui.layout.Layouts ;
import com.fine.theme.icon.LazyIcon ;
import com.fine.theme.icon.LazyIcon ;
import com.fine.theme.utils.FineUIUtils ;
import com.fine.theme.utils.FineUIUtils ;
@ -361,7 +362,7 @@ public class JDBCDefPane extends JPanel {
private void initMap ( ) {
private void initMap ( ) {
Map < String , DriverLoader > driverLoaders = null ;
Map < String , DriverLoader > driverLoaders = null ;
try {
try {
driverLoaders = ConnectionRepository . getInstance ( ) . getDriverLoaders ( ) ;
driverLoaders = toDriverLoaders ( ConnectionRepository . getInstance ( ) . getDriverLoaders ( ) ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
FineLoggerFactory . getLogger ( ) . error ( e . getMessage ( ) , e ) ;
FineLoggerFactory . getLogger ( ) . error ( e . getMessage ( ) , e ) ;
driverLoaders = new HashMap < > ( ) ;
driverLoaders = new HashMap < > ( ) ;
@ -370,6 +371,24 @@ public class JDBCDefPane extends JPanel {
nameAndRepresent = getDriverLoaderAndRepresent ( driverLoaders ) ;
nameAndRepresent = getDriverLoaderAndRepresent ( driverLoaders ) ;
}
}
private Map < String , DriverLoader > toDriverLoaders ( Map < String , DriverLoaderBean > driverLoaders ) {
Map < String , DriverLoader > map = new HashMap < > ( ) ;
for ( Map . Entry < String , DriverLoaderBean > entry : driverLoaders . entrySet ( ) ) {
map . put ( entry . getKey ( ) , createDriverLoader ( entry . getValue ( ) ) ) ;
}
return map ;
}
private DriverLoader createDriverLoader ( DriverLoaderBean value ) {
DriverLoader driverLoader = new DriverLoader ( ) ;
driverLoader . setName ( value . getName ( ) ) ;
driverLoader . setDriverClass ( value . getDriverClass ( ) ) ;
driverLoader . setDriverJarFiles ( value . getDriverJarFiles ( ) ) ;
driverLoader . setLoadingStrategy ( value . getLoadingStrategy ( ) ) ;
driverLoader . setDriverList ( value . getDriverList ( ) ) ;
return driverLoader ;
}
private HashBiMap < String , String > getDriverLoaderAndRepresent ( Map < String , DriverLoader > driverLoaders ) {
private HashBiMap < String , String > getDriverLoaderAndRepresent ( Map < String , DriverLoader > driverLoaders ) {
HashBiMap < String , String > driverHashBiMap = HashBiMap . create ( ) ;
HashBiMap < String , String > driverHashBiMap = HashBiMap . create ( ) ;
if ( WorkContext . getCurrent ( ) . isWarDeploy ( ) ) {
if ( WorkContext . getCurrent ( ) . isWarDeploy ( ) ) {