@ -16,8 +16,11 @@ import com.fr.design.i18n.Toolkit;
import com.fr.event.EventDispatcher ;
import com.fr.event.EventDispatcher ;
import com.fr.file.ConnectionConfig ;
import com.fr.file.ConnectionConfig ;
import com.fr.file.ConnectionOperator ;
import com.fr.file.ConnectionOperator ;
import com.fr.file.ConnectionOperatorImpl ;
import com.fr.general.NameObject ;
import com.fr.general.NameObject ;
import com.fr.log.FineLoggerFactory ;
import com.fr.log.FineLoggerFactory ;
import com.fr.rpc.ExceptionHandler ;
import com.fr.rpc.RPCInvokerExceptionInfo ;
import com.fr.stable.ArrayUtils ;
import com.fr.stable.ArrayUtils ;
import com.fr.stable.Nameable ;
import com.fr.stable.Nameable ;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
@ -170,7 +173,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
connectionBeans . add ( new ConnectionBean ( nameObject . getName ( ) , oldName , ( Connection ) nameObject . getObject ( ) ) ) ;
connectionBeans . add ( new ConnectionBean ( nameObject . getName ( ) , oldName , ( Connection ) nameObject . getObject ( ) ) ) ;
}
}
try {
try {
WorkContext . getCurrent ( ) . get ( ConnectionOperator . class ) . saveConnection ( connectionBeans ) ;
WorkContext . getCurrent ( ) . get ( ConnectionOperator . class , new ExceptionHandler ( ) {
@Override
public Object callHandler ( RPCInvokerExceptionInfo exceptionInfo ) {
return saveByOldWay ( connectionBeans ) ;
}
} ) . saveConnection ( new ArrayList < > ( connectionConfig . getConnections ( ) . keySet ( ) ) , connectionBeans ) ;
if ( ! WorkContext . getCurrent ( ) . isLocal ( ) ) {
if ( ! WorkContext . getCurrent ( ) . isLocal ( ) ) {
EventDispatcher . fire ( RemoteConfigEvent . EDIT , ConnectionConfig . getInstance ( ) . getNameSpace ( ) ) ;
EventDispatcher . fire ( RemoteConfigEvent . EDIT , ConnectionConfig . getInstance ( ) . getNameSpace ( ) ) ;
}
}
@ -179,6 +187,15 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
}
}
}
private boolean saveByOldWay ( List < ConnectionBean > connectionBeans ) {
try {
return ConnectionOperatorImpl . getInstance ( ) . saveConnection ( connectionBeans ) ;
} catch ( Exception e ) {
FineLoggerFactory . getLogger ( ) . error ( e . getMessage ( ) , e ) ;
return false ;
}
}
public static void showDialog ( Window parent ) {
public static void showDialog ( Window parent ) {
final ConnectionConfig connectionConfig = ConnectionConfig . getInstance ( ) ;
final ConnectionConfig connectionConfig = ConnectionConfig . getInstance ( ) ;
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane ( ) {
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane ( ) {