diff --git a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java index 09753f666d9..a19097abafb 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java +++ b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java @@ -324,7 +324,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements notifyDisconnection(); clientConnection = null; // DKM - no need to clear uid cache - clearPasswordCache(false); // clear in-memory password + clearPassword(false); // clear in-memory password //clearUserIdCache(); // Clear any cached local user IDs sysInfo = null; installInfo = null; @@ -933,7 +933,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements { if (launchFailed) { - clearPasswordCache(true); + clearPassword(true); } // Display error message @@ -1048,7 +1048,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements { if (launchFailed) { - clearPasswordCache(true); + clearPassword(true); } DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(msg); diff --git a/rse/plugins/org.eclipse.rse.connectorservice.ssh/src/org/eclipse/rse/internal/connectorservice/ssh/SshConnectorService.java b/rse/plugins/org.eclipse.rse.connectorservice.ssh/src/org/eclipse/rse/internal/connectorservice/ssh/SshConnectorService.java index 102fd47873e..ad73f0efd7f 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.ssh/src/org/eclipse/rse/internal/connectorservice/ssh/SshConnectorService.java +++ b/rse/plugins/org.eclipse.rse.connectorservice.ssh/src/org/eclipse/rse/internal/connectorservice/ssh/SshConnectorService.java @@ -350,7 +350,7 @@ public class SshConnectorService extends AbstractConnectorService implements ISs //TODO MOB - keep the session to avoid NPEs in services (disables gc for the session!) // session = null; // DKM - no need to clear uid cache - clearPasswordCache(false); // clear in-memory password + clearPassword(false); // clear in-memory password //clearUserIdCache(); // Clear any cached local user IDs } } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java index 306d6cf6758..97e60324728 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/IConnectorService.java @@ -184,11 +184,6 @@ public interface IConnectorService extends IRSEModelObject { */ public void promptForPassword(boolean forcePrompt) throws InterruptedException; - /** - * Set the password if you got it from somewhere - */ - public void setPassword(String matchingUserId, String password); - /** * Set the password if you got it from somewhere */ @@ -198,30 +193,19 @@ public interface IConnectorService extends IRSEModelObject { * Clear internal userId cache. Called when user uses the property dialog to * change his userId. */ - public void clearUserIdCache(); - - /** - * Clear internal password cache. Called when user uses the property dialog to - * change his userId. - */ - public void clearPasswordCache(); + public void clearUserId(); /** * Clear internal password cache. Called when user uses the property dialog to * change his userId. - * @param clearDiskCache if true, clears the password from disk + * @param onDisk if true, clears the password from disk */ - public void clearPasswordCache(boolean clearDiskCache); + public void clearPassword(boolean onDisk); /** * Return true if password is currently cached. */ - public boolean isPasswordCached(); - - /** - * Return true if password is currently cached. - */ - public boolean isPasswordCached(boolean onDisk); + public boolean hasPassword(boolean onDisk); /** * Return true if this system can inherit the uid and password of diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java index f8617b13282..ae88ebe64ba 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearAllPasswordsAction.java @@ -64,7 +64,7 @@ public class SystemClearAllPasswordsAction extends SystemBaseAction { ISubSystem subsystem = subsystems[i]; IConnectorService system = subsystem.getConnectorService(); - anyOk = !system.isConnected() && system.isPasswordCached(true); + anyOk = !system.isConnected() && system.hasPassword(true); if (anyOk) { @@ -92,13 +92,13 @@ public class SystemClearAllPasswordsAction extends SystemBaseAction { { IConnectorService system = ss.getConnectorService(); - if (system.isPasswordCached() || system.isPasswordCached(true)) + if (system.hasPassword(false) || system.hasPassword(true)) { // get the user id // clear userid/password from memory and fire event //DKM and disk now - system.clearPasswordCache(true); + system.clearPassword(true); RSEUIPlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, ss.getHost())); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java index bdd35083946..6198d54be8b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemClearPasswordAction.java @@ -58,7 +58,7 @@ public class SystemClearPasswordAction extends SystemBaseAction if (obj instanceof ISubSystem) { ISubSystem subsystem = (ISubSystem) obj; IConnectorService cs = subsystem.getConnectorService(); - result = !cs.isConnected() && cs.isPasswordCached(true); + result = !cs.isConnected() && cs.hasPassword(true); } return result; } @@ -71,7 +71,7 @@ public class SystemClearPasswordAction extends SystemBaseAction ISubSystem ss = (ISubSystem)getFirstSelection(); try { IConnectorService system = ss.getConnectorService(); - system.clearPasswordCache(true); + system.clearPassword(true); RSEUIPlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, ss.getHost())); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java index 4e4f91c41ab..672ecd18b08 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java @@ -368,7 +368,7 @@ public final class SignonPreferencePage extends PreferencePage implements IWorkb system = subsystems[k].getConnectorService(); if (system != null) { - system.clearPasswordCache(); + system.clearPassword(false); } } } diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java index 91659874dcc..54ba6a9c718 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java @@ -2544,9 +2544,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven if (subsystems[idx].isConnected()) subsystems[idx].disconnect(); // MJB: added conditional for defect 45754 if (defaultUserIdChanged) { - subsystems[idx].getConnectorService().clearUserIdCache(); + subsystems[idx].getConnectorService().clearUserId(); } - subsystems[idx].getConnectorService().clearPasswordCache(); + subsystems[idx].getConnectorService().clearPassword(false); } catch (Exception exc) { 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 b062602a159..00cef91f036 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 @@ -141,26 +141,14 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer /** * Useful utility method. Fully implemented, do not override.
- * Clear internal userId cache. Called when user uses the property dialog to + * Clear internal userId. Called when user uses the property dialog to * change his userId. By default, sets internal userId value to null so that on * the next call to getUserId() it is requeried from subsystem. - * Also calls {@link #clearPasswordCache()}. + * Also clears the password. */ - final public void clearUserIdCache() { + final public void clearUserId() { _userId = null; - clearPasswordCache(); - } - - /** - * Useful utility method. Fully implemented, do not override.
- * Clear internal password cache. Called when user uses the property dialog to - * change his userId. This method does not remove the password from the disk - * cache - only the memory cache. - * - * @see #clearUserIdCache() - */ - final public void clearPasswordCache() { - clearPasswordCache(false); + clearPassword(false); } /** @@ -169,9 +157,9 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer * change his userId. * * @param onDisk if this is true, clear the password from the disk cache as well - * @see #clearUserIdCache() + * @see #clearUserId() */ - final public void clearPasswordCache(boolean onDisk) { + final public void clearPassword(boolean onDisk) { setPasswordInformation(null); String userId = getUserId(); if (onDisk) { @@ -195,7 +183,7 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer * false if the check should be made for a password in memory only. * @return true if the password is known, false otherwise. */ - final public boolean isPasswordCached(boolean onDisk) { + final public boolean hasPassword(boolean onDisk) { boolean cached = (getPasswordInformation() != null); if (!cached && onDisk) { // now check if cached on disk @@ -209,15 +197,6 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer return cached; } - /** - * Useful utility method. Fully implemented, do not override.
- * Return true if password is currently cached. - */ - final public boolean isPasswordCached() - { - return isPasswordCached(false); - } - /** * Return true if this system can inherit the uid and password of * other ISystems in this connection @@ -436,9 +415,9 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer for (int s = 0; s < uniqueSystems.size(); s++) { IConnectorService system = (IConnectorService)uniqueSystems.get(s); - if (system.isPasswordCached(fromDisk)) + if (system.hasPassword(fromDisk)) { - system.clearPasswordCache(fromDisk); + system.clearPassword(fromDisk); } } } @@ -467,7 +446,7 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer for (int s = 0; s < uniqueSystems.size(); s++) { IConnectorService system = (IConnectorService)uniqueSystems.get(s); - if (!system.isConnected() && !system.isPasswordCached()) + if (!system.isConnected() && !system.hasPassword(false)) { if (system.getPrimarySubSystem().forceUserIdToUpperCase()) { @@ -567,16 +546,6 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer } } - /** - * Useful utility method. Fully implemented, no need to override.
- * A convenience method, fully equivalent to setPassword(matchingUserId, password, false) - * @param matchingUserId the user for which to set the password - * @param password the password to set for this userid - */ - public void setPassword(String matchingUserId, String password) { - setPassword(matchingUserId, password, false); - } - /** * Useful utility method. Fully implemented, no need to override.
* Should passwords be folded to uppercase? @@ -688,7 +657,7 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer { internalDisconnect(monitor); unintializeSubSystems(monitor); - clearPasswordCache(); + clearPassword(false); } /** diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java index eff8cc5ad04..1d559b4128d 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java @@ -39,30 +39,20 @@ public abstract class AbstractDelegatingConnectorService implements IDelegatingC } - public void clearPasswordCache() - { + public void clearPassword(boolean clearDiskCache) { IConnectorService conServ = getRealConnectorService(); if (conServ != null) { - conServ.clearPasswordCache(); + conServ.clearPassword(clearDiskCache); } } - public void clearPasswordCache(boolean clearDiskCache) { + public void clearUserId() { IConnectorService conServ = getRealConnectorService(); if (conServ != null) { - conServ.clearPasswordCache(clearDiskCache); - } - - } - - public void clearUserIdCache() { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.clearUserIdCache(); + conServ.clearUserId(); } } @@ -223,20 +213,11 @@ public abstract class AbstractDelegatingConnectorService implements IDelegatingC return false; } - public boolean isPasswordCached() { + public boolean hasPassword(boolean onDisk) { IConnectorService conServ = getRealConnectorService(); if (conServ != null) { - return conServ.isPasswordCached(); - } - return false; - } - - public boolean isPasswordCached(boolean onDisk) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - return conServ.isPasswordCached(onDisk); + return conServ.hasPassword(onDisk); } return false; } @@ -350,14 +331,6 @@ public abstract class AbstractDelegatingConnectorService implements IDelegatingC } } - public void setPassword(String matchingUserId, String password) { - IConnectorService conServ = getRealConnectorService(); - if (conServ != null) - { - conServ.setPassword(matchingUserId, password); - } - } - public void setPassword(String matchingUserId, String password, boolean persist) { IConnectorService conServ = getRealConnectorService(); 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 a8a6691c19e..80df252994d 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 @@ -448,7 +448,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS RSEPreferencesManager.clearUserId(previousUserIdKey); IConnectorService system = getConnectorService(); if (system != null) - system.clearUserIdCache(); + system.clearUserId(); } /**