mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-23 16:23:52 +02:00
Add new persistence provider. Streamlined connection path formatting in preparation for investigation of 141835.
This commit is contained in:
parent
c797d09625
commit
4373e7f2a2
2 changed files with 68 additions and 81 deletions
|
@ -390,8 +390,8 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <i>Method used internally, and available externally. Fully implemented, do not override.</i><br>
|
* <i>Do not override.</i>
|
||||||
* Return the password for this system's subsystem we are associated with.
|
* <p>Returns the password for this connector service.
|
||||||
* <p>
|
* <p>
|
||||||
* The search order for the password is as follows:</p>
|
* The search order for the password is as follows:</p>
|
||||||
* <ol>
|
* <ol>
|
||||||
|
@ -402,8 +402,9 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
||||||
* the user.
|
* the user.
|
||||||
* </ol>
|
* </ol>
|
||||||
* Throws InterruptedException if user is prompted and user cancels that prompt.
|
* Throws InterruptedException if user is prompted and user cancels that prompt.
|
||||||
*
|
* @param shell parent for the prompt dialog if needed.
|
||||||
* @param shell parent for the prompt dialog if needed. Can be null if know password exists.
|
* @param forcePrompt if true then present the prompt even if the password is stored.
|
||||||
|
* Can be null if the password is known to exist.
|
||||||
*/
|
*/
|
||||||
public void promptForPassword(Shell shell, boolean forcePrompt)
|
public void promptForPassword(Shell shell, boolean forcePrompt)
|
||||||
throws InterruptedException
|
throws InterruptedException
|
||||||
|
@ -416,24 +417,23 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the password information associated with this connector service.
|
||||||
SystemSignonInformation passwordInformation = getPasswordInformation();
|
SystemSignonInformation passwordInformation = getPasswordInformation();
|
||||||
// 1a. Check the transient in memory password ...
|
|
||||||
|
// Check the transient in memory password ...
|
||||||
// Test if userId has been changed... d43274
|
// Test if userId has been changed... d43274
|
||||||
String oldUserId = getUserId();
|
String oldUserId = getUserId();
|
||||||
if (passwordInformation != null && !forcePrompt)
|
if (passwordInformation != null && !forcePrompt) {
|
||||||
{
|
|
||||||
boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid());
|
boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid());
|
||||||
String hostName = getHostName();//RSEUIPlugin.getQualifiedHostName(getHostName());
|
//RSEUIPlugin.getQualifiedHostName(getHostName());
|
||||||
|
String hostName = getHostName();
|
||||||
same = same && hostName.equalsIgnoreCase(passwordInformation.getHostname());
|
same = same && hostName.equalsIgnoreCase(passwordInformation.getHostname());
|
||||||
if (!same)
|
if (!same) {
|
||||||
{
|
|
||||||
clearPasswordCache();
|
clearPasswordCache();
|
||||||
passwordInformation = null;
|
passwordInformation = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 1b. If a transient in memory password was found, test if it is still valid ...
|
// 1b. If a transient in memory password was found, test if it is still valid ...
|
||||||
// but don't issue a message yet, just set a flag
|
// but don't issue a message yet, just set a flag
|
||||||
boolean pwdInvalidFlag = false;
|
boolean pwdInvalidFlag = false;
|
||||||
|
@ -528,7 +528,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
||||||
else
|
else
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
//return password;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.ui.GenericMessages;
|
import org.eclipse.rse.ui.GenericMessages;
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
import org.eclipse.rse.ui.ISystemMessages;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.SystemResources;
|
|
||||||
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -64,8 +63,6 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
import org.eclipse.ui.progress.UIJob;
|
import org.eclipse.ui.progress.UIJob;
|
||||||
import org.eclipse.ui.progress.WorkbenchJob;
|
import org.eclipse.ui.progress.WorkbenchJob;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is designed to be subclassed. Its role is three-fold:
|
* This class is designed to be subclassed. Its role is three-fold:
|
||||||
* <ol>
|
* <ol>
|
||||||
|
@ -675,13 +672,19 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
// System.out.println("ConnectionName: " + connectionName);
|
// System.out.println("ConnectionName: " + connectionName);
|
||||||
|
|
||||||
// RESID_PERCONNECTION_FILTERPOOL = com.ibm.etools.systems.ui.perConnection.filterpool=Filter Pool for connection %1
|
// RESID_PERCONNECTION_FILTERPOOL = com.ibm.etools.systems.ui.perConnection.filterpool=Filter Pool for connection %1
|
||||||
String name = SystemResources.RESID_PERCONNECTION_FILTERPOOL;
|
// String name = SystemResources.RESID_PERCONNECTION_FILTERPOOL;
|
||||||
|
//
|
||||||
StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase());
|
// StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase());
|
||||||
profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0)));
|
// profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0)));
|
||||||
|
//
|
||||||
name = SystemMessage.sub(name, "%1", profileNameBuffer.toString());
|
// name = SystemMessage.sub(name, "%1", profileNameBuffer.toString());
|
||||||
name = SystemMessage.sub(name, "%2", connectionName);
|
// name = SystemMessage.sub(name, "%2", connectionName);
|
||||||
|
/*
|
||||||
|
* DWD - Need to keep this name short and not translatable
|
||||||
|
* since it names a team sharable resource. Not qualified by the profile
|
||||||
|
* name since that is implicit by being in a profile.
|
||||||
|
*/
|
||||||
|
String name = "CN-" + connectionName;
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2515,55 +2518,40 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
* @param forcePrompt Forces the signon prompt to be displayed even if a valid password in cached in memory
|
* @param forcePrompt Forces the signon prompt to be displayed even if a valid password in cached in memory
|
||||||
* or saved on disk.
|
* or saved on disk.
|
||||||
*/
|
*/
|
||||||
public void connect(Shell shell, boolean forcePrompt) throws Exception
|
public void connect(Shell shell, boolean forcePrompt) throws Exception {
|
||||||
{
|
|
||||||
// yantzi: artemis60, (defect 53082) check that the connection has not been deleted before continuing,
|
// yantzi: artemis60, (defect 53082) check that the connection has not been deleted before continuing,
|
||||||
// this is a defenisve measure to protect against code that stores a handle to subsystems but does
|
// this is a defenisve measure to protect against code that stores a handle to subsystems but does
|
||||||
// not do this check
|
// not do this check
|
||||||
if (RSEUIPlugin.getTheSystemRegistry().getHost(getSystemProfile(), getHost().getAliasName()) == null)
|
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||||
{
|
IHost host = getHost();
|
||||||
// connection no longer exists
|
String hostName = host.getAliasName();
|
||||||
|
ISystemProfile profile = getSystemProfile();
|
||||||
|
if (registry.getHost(profile, hostName) == null) { // connection no longer exists
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECTION_DELETED);
|
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECTION_DELETED);
|
||||||
msg.makeSubstitution(getHost().getAliasName());
|
msg.makeSubstitution(hostName);
|
||||||
throw new SystemMessageException(msg);
|
throw new SystemMessageException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shell = shell; //FIXME remove this
|
this.shell = shell; //FIXME remove this
|
||||||
|
|
||||||
// yantzi: artemis 6.0, offline support
|
// yantzi: artemis 6.0, offline support
|
||||||
if (isOffline())
|
if (isOffline()) {
|
||||||
{
|
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT);
|
||||||
SystemMessage sMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT);
|
msg.makeSubstitution(hostName);
|
||||||
sMsg.makeSubstitution(getHost().getAliasName());
|
throw new SystemMessageException(msg);
|
||||||
throw new SystemMessageException(sMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//DY operation = OPERATION_CONNECT;
|
//DY operation = OPERATION_CONNECT;
|
||||||
if (isConnected() || !supportsConnecting)
|
if (!isConnected() && supportsConnecting) {
|
||||||
return;
|
|
||||||
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(shell);
|
IRunnableContext runnableContext = getRunnableContext(shell);
|
||||||
if (runnableContext instanceof ProgressMonitorDialog)
|
if (runnableContext instanceof ProgressMonitorDialog) {
|
||||||
((ProgressMonitorDialog) runnableContext).setCancelable(true);
|
((ProgressMonitorDialog) runnableContext).setCancelable(true);
|
||||||
|
}
|
||||||
try
|
getConnectorService().promptForPassword(shell, forcePrompt); // prompt for userid and password
|
||||||
{
|
|
||||||
getConnectorService().promptForPassword(shell, forcePrompt); // prompt for password
|
|
||||||
ConnectJob job = new ConnectJob();
|
ConnectJob job = new ConnectJob();
|
||||||
scheduleJob(job, null, shell != null);
|
scheduleJob(job, null, shell != null);
|
||||||
|
|
||||||
IStatus status = job.getResult();
|
IStatus status = job.getResult();
|
||||||
if (status != null && status.isOK())
|
if (status != null && status.isOK()) {
|
||||||
{
|
registry.connectedStatusChange(this, true, false);
|
||||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
|
||||||
sr.connectedStatusChange(this, true, false);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException exc)
|
|
||||||
{
|
|
||||||
throw exc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue