1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 08:13:50 +02:00

Add new persistence provider. Streamlined connection path formatting in preparation for investigation of 141835.

This commit is contained in:
David Dykstal 2006-05-19 01:27:15 +00:00
parent c797d09625
commit 4373e7f2a2
2 changed files with 68 additions and 81 deletions

View file

@ -390,20 +390,21 @@ 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>
* <li>First check if the password is in transient memory and that it is still valid. * <li>First check if the password is in transient memory and that it is still valid.
* <li>If password not found in transient memory then check password on disk and * <li>If password not found in transient memory then check password on disk and
* verify that it is still valid. * verify that it is still valid.
* <li>If a valid password is not found in transient memory or on disk then prompt * <li>If a valid password is not found in transient memory or on disk then prompt
* 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,23 +417,22 @@ 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 ...
// Test if userId has been changed... d43274 // Check the transient in memory password ...
// 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()); //RSEUIPlugin.getQualifiedHostName(getHostName());
String hostName = 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
@ -528,7 +528,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
else else
throw new InterruptedException(); throw new InterruptedException();
} }
//return password;
} }

View file

@ -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>
@ -671,17 +668,23 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
public String getConnectionOwnedFilterPoolName(String profileName, String connectionName) public String getConnectionOwnedFilterPoolName(String profileName, String connectionName)
{ {
// Similar to SubSystemFactoryImpl#getDefaultFilterPoolName(String)... // Similar to SubSystemFactoryImpl#getDefaultFilterPoolName(String)...
//System.out.println("ProfileName: " + profileName); // System.out.println("ProfileName: " + profileName);
//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,56 +2518,41 @@ 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
if (isOffline()) {
// yantzi: artemis 6.0, offline support SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT);
if (isOffline()) msg.makeSubstitution(hostName);
{ throw new SystemMessageException(msg);
SystemMessage sMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT); }
sMsg.makeSubstitution(getHost().getAliasName()); //DY operation = OPERATION_CONNECT;
throw new SystemMessageException(sMsg); if (!isConnected() && supportsConnecting) {
} IRunnableContext runnableContext = getRunnableContext(shell);
if (runnableContext instanceof ProgressMonitorDialog) {
//DY operation = OPERATION_CONNECT; ((ProgressMonitorDialog) runnableContext).setCancelable(true);
if (isConnected() || !supportsConnecting) }
return; getConnectorService().promptForPassword(shell, forcePrompt); // prompt for userid and password
ConnectJob job = new ConnectJob();
IRunnableContext runnableContext = getRunnableContext(shell); scheduleJob(job, null, shell != null);
if (runnableContext instanceof ProgressMonitorDialog) IStatus status = job.getResult();
((ProgressMonitorDialog)runnableContext).setCancelable(true); if (status != null && status.isOK()) {
registry.connectedStatusChange(this, true, false);
try }
{ }
getConnectorService().promptForPassword(shell, forcePrompt); // prompt for password }
ConnectJob job = new ConnectJob();
scheduleJob(job, null, shell != null);
IStatus status = job.getResult();
if (status != null && status.isOK())
{
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
sr.connectedStatusChange(this, true, false);
return;
}
}
catch (InterruptedException exc)
{
throw exc;
}
}