diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java index b6eac3df592..8185e9f7645 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java @@ -390,20 +390,21 @@ public abstract class AbstractConnectorService extends RSEModelObject implements } /** - * Method used internally, and available externally. Fully implemented, do not override.
- * Return the password for this system's subsystem we are associated with. + * Do not override. + *

Returns the password for this connector service. *

* The search order for the password is as follows:

*
    - *
  1. First check if the password is in transient memory and that it is still valid. - *
  2. If password not found in transient memory then check password on disk and - * verify that it is still valid. - *
  3. If a valid password is not found in transient memory or on disk then prompt - * the user. + *
  4. First check if the password is in transient memory and that it is still valid. + *
  5. If password not found in transient memory then check password on disk and + * verify that it is still valid. + *
  6. If a valid password is not found in transient memory or on disk then prompt + * the user. *
* Throws InterruptedException if user is prompted and user cancels that prompt. - * - * @param shell parent for the prompt dialog if needed. Can be null if know password exists. + * @param shell parent for the prompt dialog if needed. + * @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) throws InterruptedException @@ -416,23 +417,22 @@ public abstract class AbstractConnectorService extends RSEModelObject implements throw new InterruptedException(); } + // Get the password information associated with this connector service. 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(); - if (passwordInformation != null && !forcePrompt) - { - boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid()); - String hostName = getHostName();//RSEUIPlugin.getQualifiedHostName(getHostName()); - same = same && hostName.equalsIgnoreCase(passwordInformation.getHostname()); - if (!same) - { - clearPasswordCache(); - passwordInformation = null; - } - } - - + if (passwordInformation != null && !forcePrompt) { + boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid()); + //RSEUIPlugin.getQualifiedHostName(getHostName()); + String hostName = getHostName(); + same = same && hostName.equalsIgnoreCase(passwordInformation.getHostname()); + if (!same) { + clearPasswordCache(); + passwordInformation = null; + } + } // 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 @@ -528,7 +528,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements else throw new InterruptedException(); } - //return password; } diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java index 0d1762882a1..6d685611e18 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java @@ -52,7 +52,6 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.ui.GenericMessages; import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; import org.eclipse.rse.ui.dialogs.SystemPromptDialog; import org.eclipse.rse.ui.messages.SystemMessageDialog; 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.WorkbenchJob; - - /** * This class is designed to be subclassed. Its role is three-fold: *
    @@ -671,17 +668,23 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS public String getConnectionOwnedFilterPoolName(String profileName, String connectionName) { // Similar to SubSystemFactoryImpl#getDefaultFilterPoolName(String)... - //System.out.println("ProfileName: " + profileName); - //System.out.println("ConnectionName: " + connectionName); + // System.out.println("ProfileName: " + profileName); + // System.out.println("ConnectionName: " + connectionName); // RESID_PERCONNECTION_FILTERPOOL = com.ibm.etools.systems.ui.perConnection.filterpool=Filter Pool for connection %1 - String name = SystemResources.RESID_PERCONNECTION_FILTERPOOL; - - StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase()); - profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0))); - - name = SystemMessage.sub(name, "%1", profileNameBuffer.toString()); - name = SystemMessage.sub(name, "%2", connectionName); +// String name = SystemResources.RESID_PERCONNECTION_FILTERPOOL; +// +// StringBuffer profileNameBuffer = new StringBuffer(profileName.toLowerCase()); +// profileNameBuffer.setCharAt(0, Character.toUpperCase(profileNameBuffer.charAt(0))); +// +// name = SystemMessage.sub(name, "%1", profileNameBuffer.toString()); +// 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; } @@ -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 * 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, // this is a defenisve measure to protect against code that stores a handle to subsystems but does // not do this check - if (RSEUIPlugin.getTheSystemRegistry().getHost(getSystemProfile(), getHost().getAliasName()) == null) - { - // connection no longer exists + ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); + IHost host = getHost(); + 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); - msg.makeSubstitution(getHost().getAliasName()); + msg.makeSubstitution(hostName); throw new SystemMessageException(msg); } - - this.shell = shell; //FIXME remove this - - // yantzi: artemis 6.0, offline support - if (isOffline()) - { - SystemMessage sMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT); - sMsg.makeSubstitution(getHost().getAliasName()); - throw new SystemMessageException(sMsg); - } - - //DY operation = OPERATION_CONNECT; - if (isConnected() || !supportsConnecting) - return; - - IRunnableContext runnableContext = getRunnableContext(shell); - if (runnableContext instanceof ProgressMonitorDialog) - ((ProgressMonitorDialog)runnableContext).setCancelable(true); - - 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; - } - } + this.shell = shell; //FIXME remove this + // yantzi: artemis 6.0, offline support + if (isOffline()) { + SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT); + msg.makeSubstitution(hostName); + throw new SystemMessageException(msg); + } + //DY operation = OPERATION_CONNECT; + if (!isConnected() && supportsConnecting) { + IRunnableContext runnableContext = getRunnableContext(shell); + if (runnableContext instanceof ProgressMonitorDialog) { + ((ProgressMonitorDialog) runnableContext).setCancelable(true); + } + getConnectorService().promptForPassword(shell, forcePrompt); // prompt for userid and password + ConnectJob job = new ConnectJob(); + scheduleJob(job, null, shell != null); + IStatus status = job.getResult(); + if (status != null && status.isOK()) { + registry.connectedStatusChange(this, true, false); + } + } + }