mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 16:35:25 +02:00
[274688] [api][dstore] DStoreConnectorService.internalConnect() needs to be cleaned up
This commit is contained in:
parent
55e45a9d04
commit
0a3861b2bb
1 changed files with 50 additions and 17 deletions
|
@ -816,6 +816,48 @@ public class DStoreConnectorService extends StandardConnectorService implements
|
||||||
return clientConnection.connect(null, timeout);
|
return clientConnection.connect(null, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect via an overridden launchServer method
|
||||||
|
*
|
||||||
|
* @param clientConnection the clientConnection
|
||||||
|
* @param info the signon info
|
||||||
|
* @param serverLauncher the server launcher
|
||||||
|
* @param monitor the progress monitor
|
||||||
|
*
|
||||||
|
* @return the connection status
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected ConnectionStatus connectWithOther(ClientConnection clientConnection, SystemSignonInformation info, IServerLauncherProperties serverLauncher, IProgressMonitor monitor) throws Exception {
|
||||||
|
ConnectionStatus connectStatus = launchServer(clientConnection, info, serverLauncher, monitor);
|
||||||
|
if (!connectStatus.isConnected() && !clientConnection.isKnownStatus(connectStatus.getMessage())){
|
||||||
|
if (connectStatus.isSLLProblem()){
|
||||||
|
if (setSSLProperties(true)){
|
||||||
|
connectStatus = launchServer(clientConnection, info, serverLauncher, monitor);
|
||||||
|
if (!connectStatus.isConnected() && connectStatus.isSLLProblem()){
|
||||||
|
List certs = connectStatus.getUntrustedCertificates();
|
||||||
|
if (certs != null && certs.size() > 0){ // we have untrusted certificates - so import them
|
||||||
|
ISystemKeystoreProvider provider = SystemKeystoreProviderManager.getInstance().getDefaultProvider();
|
||||||
|
if (provider != null){
|
||||||
|
if (provider.importCertificates(certs, getHostName())){
|
||||||
|
return connectWithOther(clientConnection, info, serverLauncher, monitor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isConnecting = false;
|
||||||
|
throw new InterruptedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // SSL connect problem
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connectStatus;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Initialize the DataStore connection.
|
* Initialize the DataStore connection.
|
||||||
*
|
*
|
||||||
|
@ -1242,6 +1284,8 @@ public class DStoreConnectorService extends StandardConnectorService implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#connect(IProgressMonitor)
|
* @see org.eclipse.rse.core.subsystems.IConnectorService#connect(IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
|
@ -1286,34 +1330,23 @@ public class DStoreConnectorService extends StandardConnectorService implements
|
||||||
connectStatus = connectStatusPair.getConnectStatus();
|
connectStatus = connectStatusPair.getConnectStatus();
|
||||||
launchStatus = connectStatusPair.getLaunchStatus();
|
launchStatus = connectStatusPair.getLaunchStatus();
|
||||||
|
|
||||||
if (connectStatus == null){
|
//if (connectStatus == null){
|
||||||
return; // error handling completed
|
// _isConnecting = false;
|
||||||
}
|
// return; // error handling completed
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else if (serverLauncherType == ServerLaunchType.RUNNING_LITERAL){ // connect to running server
|
else if (serverLauncherType == ServerLaunchType.RUNNING_LITERAL){ // connect to running server
|
||||||
connectStatus = connectWithRunning(monitor);
|
connectStatus = connectWithRunning(monitor);
|
||||||
}
|
}
|
||||||
else { // server launcher type is unknown
|
else { // server launcher type is unknown
|
||||||
connectStatus = launchServer(clientConnection, info, serverLauncher, monitor);
|
connectStatus = connectWithOther(clientConnection, info, serverLauncher, monitor);
|
||||||
if (!connectStatus.isConnected() && !clientConnection.isKnownStatus(connectStatus.getMessage())){
|
|
||||||
if (connectStatus.isSLLProblem()){
|
|
||||||
if (setSSLProperties(true)){
|
|
||||||
connectStatus = launchServer(clientConnection, info, serverLauncher, monitor);
|
|
||||||
if (!connectStatus.isConnected() && connectStatus.isSLLProblem()){
|
|
||||||
_isConnecting = false;
|
|
||||||
importCertsAndReconnect(connectStatus, monitor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectStatus != null && connectStatus.isConnected()){ // connected
|
if (connectStatus != null && connectStatus.isConnected()){ // connected
|
||||||
initializeConnection(launchStatus, connectStatus, alertedNONSSL, monitor);
|
initializeConnection(launchStatus, connectStatus, alertedNONSSL, monitor);
|
||||||
}
|
}
|
||||||
else { // diagnosis, reconnection and other connection failure handling
|
else { // diagnosis, reconnection and other connection failure handling
|
||||||
handleConnectionFailure(connectStatus, launchStatus, serverLauncher, serverLauncherType, monitor);
|
handleConnectionFailure(launchStatus, connectStatus, serverLauncher, serverLauncherType, monitor);
|
||||||
}
|
}
|
||||||
_isConnecting = false;
|
_isConnecting = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue