@ -52,26 +52,19 @@ public class LocalConnectionSource extends BaseConnectionSource {
@Override
public String [ ] testConnection ( ConnectionInfoBean database ) throws Exception {
try {
// 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager . setTransEncryptionLevel ( 1 ) ;
return ConnectionProcessorFactory . testConnectionWithSchemaReturn ( database ) ;
} catch ( DriverNotFoundException e ) {
throw new DriverUnExistException ( ) ;
} finally {
TransmissionEncryptionManager . removeTransEncryptionLevel ( ) ;
}
}
@Override
public void add ( ConnectionInfoBean bean ) throws Exception {
try {
TransmissionEncryptionManager . setTransEncryptionLevel ( 1 ) ;
Connection connection = ConnectionProcessorFactory . createConnection ( bean ) ;
validate ( bean . getConnectionName ( ) , connection ) ;
ConnectionProcessorFactory . addConnection ( bean ) ;
} catch ( DriverNotFoundException e ) {
throw new DriverUnExistException ( ) ;
} finally {
TransmissionEncryptionManager . removeTransEncryptionLevel ( ) ;
}
}
@ -84,14 +77,11 @@ public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void update ( ConnectionInfoBean bean ) throws Exception {
try {
TransmissionEncryptionManager . setTransEncryptionLevel ( 1 ) ;
Connection connection = ConnectionProcessorFactory . createConnection ( bean ) ;
validate ( bean . getConnectionName ( ) , connection ) ;
ConnectionProcessorFactory . updateConnection ( bean . getConnectionName ( ) , bean ) ;
} catch ( DriverNotFoundException e ) {
throw new DriverUnExistException ( ) ;
} finally {
TransmissionEncryptionManager . removeTransEncryptionLevel ( ) ;
}
}