1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Bug 141835 - user ids were not being persisted across workbench startups.

This commit is contained in:
David Dykstal 2006-06-23 22:01:32 +00:00
parent 9ab955d6bf
commit ebeab3de94
15 changed files with 469 additions and 433 deletions

View file

@ -456,9 +456,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
*/ */
protected synchronized void internalConnect(IProgressMonitor monitor) throws Exception protected synchronized void internalConnect(IProgressMonitor monitor) throws Exception
{ {
if (isConnected()) if (isConnected()) {
{
// could have been called b4
return; return;
} }
@ -476,7 +474,8 @@ public class DStoreConnectorService extends AbstractConnectorService implements
clientConnection.setHost(getHostName()); clientConnection.setHost(getHostName());
clientConnection.setPort(Integer.toString(getPort())); clientConnection.setPort(Integer.toString(getPort()));
ISubSystem ss = getPrimarySubSystem(); // ISubSystem ss = getPrimarySubSystem();
getPrimarySubSystem();
IIBMServerLauncher serverLauncher = getIBMServerLauncher(); IIBMServerLauncher serverLauncher = getIBMServerLauncher();
ServerLaunchType serverLauncherType = null; ServerLaunchType serverLauncherType = null;
@ -1239,19 +1238,19 @@ public class DStoreConnectorService extends AbstractConnectorService implements
/** /**
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#isPasswordCached() * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#isPasswordCached()
*/ */
public boolean isPasswordCached() // public boolean isPasswordCached() // DWD is this method needed?
{ // {
// For Windows we never prompt for userid / password so we don't need // // For Windows we never prompt for userid / password so we don't need
// to clear the password cache // // to clear the password cache
if (getPrimarySubSystem().getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) // if (getPrimarySubSystem().getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS))
{ // {
return false; // return false;
} // }
else // else
{ // {
return super.isPasswordCached(); // return super.isPasswordCached();
} // }
} // }

View file

@ -0,0 +1,18 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Kushal Munir (IBM) - Initial API and implementation.
********************************************************************************/
package org.eclipse.rse.core;
/**
* These constants define the set of preference names that the RSE core uses.
*/
public interface IRSEPreferenceNames {
public static final String ST_DEFAULT_USERID = "systemType.defaultUserId";
public static final String ST_ENABLED = "systemType.enabled";
}

View file

@ -18,10 +18,15 @@ package org.eclipse.rse.ui;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.IRSEPreferenceNames;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
/** /**
@ -83,31 +88,33 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
} }
/** /**
* Create an url from the argument absolute or relative path. The bundle * Create a URL from the argument absolute or relative path. The bundle parameter is
* parameter is used as the base for relative paths and is allowed to be * used as the base for relative paths and may be null.
* null. *
* * @param value
* @param value * the absolute or relative path
* the absolute or relative path * @param definingBundle
* @param definingBundle * bundle to be used for relative paths (may be null)
* bundle to be used for relative paths (may be null) * @return the URL to the resource
* @return */
*/ public static URL getUrl(String value, Bundle definingBundle) {
public static URL getUrl(String value, Bundle definingBundle) { URL result = null;
try { try {
if (value != null) if (value != null) {
return new URL(value); result = new URL(value);
} catch (MalformedURLException e) { }
if (definingBundle != null) } catch (MalformedURLException e) {
return Platform.find(definingBundle, new Path(value)); if (definingBundle != null) {
} IPath path = new Path(value);
result = FileLocator.find(definingBundle, path, null);
return null; }
} }
return result;
}
/** /**
* Returns the name of the system type if the object passed in is of type <code>IRSESystemType</code>. * Returns the name of the system type if the object passed in is of type <code>IRSESystemType</code>. Otherwise, returns the value of the parent implementation.
* Otherwise, returns the value of the parent implementation. *
* @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object) * @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object)
*/ */
public String getLabel(Object object) { public String getLabel(Object object) {
@ -136,10 +143,8 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
} }
public boolean isEnableOffline(Object object) { public boolean isEnableOffline(Object object) {
if ((object != null) && (object instanceof IRSESystemType)) { if ((object != null) && (object instanceof IRSESystemType)) {
String property = ((IRSESystemType)object).getProperty(ENABLE_OFFLINE); String property = ((IRSESystemType)object).getProperty(ENABLE_OFFLINE);
if (property != null) { if (property != null) {
return Boolean.valueOf(property).booleanValue(); return Boolean.valueOf(property).booleanValue();
} }
@ -152,21 +157,89 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
} }
} }
/**
* Returns the enabled state of a particular system type.
* @param object the object being adapted, usually a system type.
* @return true if that system type is enabled. false if the object is
* not a system type or if it is not enabled.
*/
public boolean isEnabled(Object object) { public boolean isEnabled(Object object) {
//TODO boolean result = false;
return true; IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences();
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
if (!prefs.contains(key)) {
prefs.setDefault(key, true);
}
result = prefs.getBoolean(key);
}
return result;
} }
/**
* Sets the enabled state of a particular system type.
* @param object The system type being adapted.
* @param isEnabled true if the system type is enabled. false if it is not.
*/
public void setIsEnabled(Object object, boolean isEnabled) { public void setIsEnabled(Object object, boolean isEnabled) {
//TODO IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
Plugin core = RSECorePlugin.getDefault();
Preferences prefs = core.getPluginPreferences();
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
prefs.setValue(key, isEnabled);
core.savePluginPreferences();
}
} }
/**
* Return the default user id for a particular system type. If none
* is defined then the "user.name" system property is used.
* @param object The system type being adapted.
* @return The default user id. Will be null if the object is not a system type
*/
public String getDefaultUserId(Object object) { public String getDefaultUserId(Object object) {
//TODO String result = null;
return ""; IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences();
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
if (!prefs.contains(key)) {
prefs.setDefault(key, System.getProperty("user.name"));
}
result = prefs.getString(key);
}
return result;
} }
/**
* Set the default user id for this system type. Stored in the RSE core preferences.
* @param object the system type that we are adapting
* @param defaultUserId the id to set for this system type
*/
public void setDefaultUserId(Object object, String defaultUserId) { public void setDefaultUserId(Object object, String defaultUserId) {
//TODO IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
Plugin core = RSECorePlugin.getDefault();
Preferences prefs = core.getPluginPreferences();
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
prefs.setValue(key, defaultUserId);
core.savePluginPreferences();
}
} }
private String getPreferencesKey(IRSESystemType systemType, String preference) {
String key = systemType.getName() + "." + preference;
return key;
}
private IRSESystemType getSystemType(Object systemTypeCandidate) {
IRSESystemType result = null;
if (systemTypeCandidate instanceof IRSESystemType) {
result = (IRSESystemType) systemTypeCandidate;
}
return result;
}
} }

View file

@ -49,20 +49,20 @@ public class SystemClearPasswordAction extends SystemBaseAction
} }
/** /**
* Override of parent. Called when testing if action should be enabled base on current * Override of parent.
* selection. We check the selected object is one of our subsystems, and we are not * Called when testing if an action should be enabled based on the current selection.
* already connected. * The clear password action can be enabled if the selected object is a subsystem
* that is not connected and has a password that is saved.
* @return true if the clear password action can be enabled.
*/ */
public boolean checkObjectType(Object obj) public boolean checkObjectType(Object obj) {
{ boolean result = false;
if (!(obj instanceof ISubSystem) || if (obj instanceof ISubSystem) {
((ISubSystem)obj).getConnectorService().isConnected() || ISubSystem subsystem = (ISubSystem) obj;
!(((ISubSystem)obj).getConnectorService().isPasswordCached(true))) { IConnectorService cs = subsystem.getConnectorService();
return false; result = !cs.isConnected() && cs.isPasswordCached(true);
}
else {
return true;
} }
return result;
} }
/** /**

View file

@ -196,6 +196,7 @@ public class RemoteSystemsPreferencePage
// --------------------------------------------------------- // ---------------------------------------------------------
// GETTERS/SETTERS FOR EACH OF THE USER PREFERENCE VALUES... // GETTERS/SETTERS FOR EACH OF THE USER PREFERENCE VALUES...
// --------------------------------------------------------- // ---------------------------------------------------------
// DWD these preferences methods should be moved to SystemPreferencesManager since they are not a proper function of a preference page.
/** /**
* Return the names of the profiles the user has elected to make "active". * Return the names of the profiles the user has elected to make "active".
*/ */
@ -566,10 +567,11 @@ public class RemoteSystemsPreferencePage
} }
/** /**
* Save the preference store * Save the preference store.
*/ */
private static void savePreferenceStore() private static void savePreferenceStore()
{ {
/* plugin preferences and preference stores are actually the same store and are flushed to disk using this call */
RSEUIPlugin.getDefault().savePluginPreferences(); RSEUIPlugin.getDefault().savePluginPreferences();
} }

View file

@ -132,7 +132,7 @@ public class SystemTypeFieldEditor extends FieldEditor
tableViewer.setCellModifier(this); tableViewer.setCellModifier(this);
CellEditor editors[] = new CellEditor[columnHeaders.length]; CellEditor editors[] = new CellEditor[columnHeaders.length];
userIdCellEditor = new TextCellEditor(table); userIdCellEditor = new TextCellEditor(table);
enabledCellEditor = new ComboBoxCellEditor(table, enabledStateStrings, SWT.READ_ONLY); enabledCellEditor = new ComboBoxCellEditor(table, enabledStateStrings, SWT.READ_ONLY); // DWD should consider a checkbox for this.
editors[COLUMN_USERID] = userIdCellEditor; editors[COLUMN_USERID] = userIdCellEditor;
editors[COLUMN_ENABLED] = enabledCellEditor; editors[COLUMN_ENABLED] = enabledCellEditor;
tableViewer.setCellEditors(editors); tableViewer.setCellEditors(editors);

View file

@ -32,12 +32,9 @@ import org.eclipse.rse.ui.SystemResources;
/** /**
* A pool of host objects. * A pool of host objects.
* There is one pool per profile. * There is one pool per profile.
* It is named the same as its owning profile. * It is named the same as its owning profile.
*/ * It is not persisted but provides a means of manipulating lists of host objects.
/* * Hosts are created and destroyed by the host pool so that the the relationships between the two can be maintained.
* DWD this may be a candidate for elimination. It is not persisted but derived
* when Host objects come into existance. Not sure it provides much value. Code
* could be implemented directly in the profile.
*/ */
public class SystemHostPool extends RSEModelObject implements ISystemHostPool public class SystemHostPool extends RSEModelObject implements ISystemHostPool
{ {
@ -50,13 +47,15 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
protected String name = NAME_EDEFAULT; protected String name = NAME_EDEFAULT;
private java.util.List connections = null; private java.util.List connections = null;
/**
* Default constructor. Typically called by MOF. /**
* Default constructor.
*/ */
protected SystemHostPool() protected SystemHostPool()
{ {
super(); super();
} }
/** /**
* Reset for a full refresh from disk, such as after a team synch * Reset for a full refresh from disk, such as after a team synch
*/ */
@ -209,6 +208,10 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
addHost(conn); // only record internally if saved successfully addHost(conn); // only record internally if saved successfully
conn.setHostPool(this); conn.setHostPool(this);
conn.setAliasName(aliasName); conn.setAliasName(aliasName);
// DWD if default userID is null, and location is in the connection we should retrieve it and use it as the initial value.
if (defaultUserId == null && defaultUserIdLocation == ISystemUserIdConstants.USERID_LOCATION_CONNECTION) {
defaultUserId = conn.getDefaultUserId();
}
updateHost(conn, systemType, aliasName, hostName, description, defaultUserId, defaultUserIdLocation); updateHost(conn, systemType, aliasName, hostName, description, defaultUserId, defaultUserIdLocation);
} catch (Exception e) } catch (Exception e)

View file

@ -313,7 +313,6 @@ public class RSEDOMExporter implements IRSEDOMExporter
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable())); node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName()); node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription()); node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USER_ID, host.getDefaultUserId());
} }

View file

@ -120,7 +120,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue(); String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue();
boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue()); boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue());
boolean isPromptable = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue()); boolean isPromptable = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue());
String userId = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USER_ID).getValue();
// create host and set it's attributes // create host and set it's attributes
try try
@ -130,7 +129,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
host = profile.createHost(systemType, connectionName, hostName, description); host = profile.createHost(systemType, connectionName, hostName, description);
host.setOffline(isOffline); host.setOffline(isOffline);
host.setPromptable(isPromptable); host.setPromptable(isPromptable);
host.setDefaultUserId(userId);
} }
catch (Exception e) catch (Exception e)
{ {
@ -275,10 +273,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
subSystem = factory.createSubSystemInternal(host); subSystem = factory.createSubSystemInternal(host);
} }
subSystem.setHidden(isHidden); subSystem.setHidden(isHidden);
// name should always be based on the one in plugin.xml
// so commenting this out
//subSystem.setName(name);
subSystem.setHost(host); subSystem.setHost(host);
subSystem.setSubSystemConfiguration(factory); subSystem.setSubSystemConfiguration(factory);
subSystem.setWasRestored(true); subSystem.setWasRestored(true);
@ -480,10 +474,17 @@ public class RSEDOMImporter implements IRSEDOMImporter
{ {
ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile()); ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile());
ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name); ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name);
/*
// create reference to the filterpool * DWD filterpool can be null when restoring since there can be forward references.
ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager(); * A profile may be being restored that has references to a filter pool in a profile that doesn't yet exist.
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool); * Need to create an "unresolved" reference instead of a null object and then patch them up
* at the end.
*/
if (filterPool != null) { // for the time being don't restore a reference if the pool isn't found.
// create reference to the filterpool
ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager();
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool);
}
} }
return filterPoolReference; return filterPoolReference;

View file

@ -48,7 +48,6 @@ public interface IRSEDOMConstants
public static final String ATTRIBUTE_HOSTNAME = "hostname"; public static final String ATTRIBUTE_HOSTNAME = "hostname";
public static final String ATTRIBUTE_OFFLINE = "offline"; public static final String ATTRIBUTE_OFFLINE = "offline";
public static final String ATTRIBUTE_DESCRIPTION = "description"; public static final String ATTRIBUTE_DESCRIPTION = "description";
public static final String ATTRIBUTE_USER_ID = "defaultUserId";
// ConnectorService attributes // ConnectorService attributes
public static final String ATTRIBUTE_GROUP="group"; public static final String ATTRIBUTE_GROUP="group";

View file

@ -23,6 +23,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.ISystemUserIdConstants; import org.eclipse.rse.core.ISystemUserIdConstants;
import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.PasswordPersistenceManager;
import org.eclipse.rse.internal.model.RSEModelObject; import org.eclipse.rse.internal.model.RSEModelObject;
import org.eclipse.rse.logging.Logger;
import org.eclipse.rse.logging.LoggerFactory;
import org.eclipse.rse.model.IHost; import org.eclipse.rse.model.IHost;
import org.eclipse.rse.model.ISystemRegistry; import org.eclipse.rse.model.ISystemRegistry;
import org.eclipse.rse.model.SystemSignonInformation; import org.eclipse.rse.model.SystemSignonInformation;
@ -40,26 +42,24 @@ import org.eclipse.swt.widgets.Shell;
/** /**
* This is a base class to make it easier to create system classes. * This is a base class to make it easier to create connector service classes.
* <p> * <p>
* An {@link org.eclipse.rse.core.subsystems.IConnectorService} object is returned from a subsystem object via getSystem(), and * An {@link org.eclipse.rse.core.subsystems.IConnectorService} object
* it is used to represent the live connection to a particular subsystem. * is returned from a subsystem object via getSystem(), and
* <p> * it is used to represent the live connection to a particular subsystem.
* All this could have been done in the subsystem object, but that would clutter it
* up too much.
* <p> * <p>
* You must override/implement * You must override/implement
* <ul> * <ul>
* <li>isConnected * <li>isConnected
* <li>internalConnect * <li>internalConnect
* <li>internalDisconnect * <li>internalDisconnect
* </ul> * </ul>
* You should override: * You should override:
* <ul> * <ul>
* <li>reset * <li>reset
* <li>getVersionReleaseModification * <li>getVersionReleaseModification
* <li>getHomeDirectory * <li>getHomeDirectory
* <li>getTempDirectory * <li>getTempDirectory
* </ul> * </ul>
* *
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
@ -181,12 +181,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
// Utility methods... // Utility methods...
// ------------------ // ------------------
public ISubSystem[] getSubSystems() final public ISubSystem[] getSubSystems()
{ {
return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]); return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]);
} }
public ISubSystem getPrimarySubSystem() /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#getPrimarySubSystem()
*/
final public ISubSystem getPrimarySubSystem()
{ {
if (_primarySubSystem == null) if (_primarySubSystem == null)
{ {
@ -196,7 +199,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
return _primarySubSystem; return _primarySubSystem;
} }
public IHost getHost() final public IHost getHost()
{ {
return _host; return _host;
} }
@ -205,7 +208,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* <i>Useful utility method. Fully implemented, do not override.</i><br> * <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the system type for this connection:<br> <code>getSubSystem().getSystemConnection().getSystemType()</code> * Returns the system type for this connection:<br> <code>getSubSystem().getSystemConnection().getSystemType()</code>
*/ */
public String getHostType() final public String getHostType()
{ {
return getHost().getSystemType(); return getHost().getSystemType();
} }
@ -213,12 +216,12 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
/** /**
* *
*/ */
public String getName() final public String getName()
{ {
return _name; return _name;
} }
public String getDescription() final public String getDescription()
{ {
return _description; return _description;
} }
@ -228,141 +231,141 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* Returns the host name for the connection this system's subsystem is associated with:</br> * Returns the host name for the connection this system's subsystem is associated with:</br>
* <code>getSubSystem().getSystemConnection().getHostName()</code> * <code>getSubSystem().getSystemConnection().getHostName()</code>
*/ */
public String getHostName() final public String getHostName()
{ {
return getHost().getHostName(); return getHost().getHostName();
} }
/** /**
* <i>Useful utility method. Fully implemented, do not override.</i><br> * <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the user Id for this system's subsystem we are associated with. * Returns the active userId if we are connected.
* This is the same as {@link #getLocalUserId()}, but first clears the local * If not it returns the userId for the primary subsystem ignoring the
* user Id cache if we are not currently connected. * cached userId.
*/ */
public String getUserId() final public String getUserId() {
{ String result = getSubsystemUserId();
if (_userId != null) ISubSystem ss = getPrimarySubSystem();
{ if (ss.isConnected()) {
return _userId; result = getLocalUserId();
} }
return result;
return getLocalUserId(); }
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Return the userId for this connector service. If there is none
* set for this service then it is retrieved from the primary subsystem.
*/
final protected String getLocalUserId() {
if (_userId == null) {
_userId = getSubsystemUserId();
}
return _userId;
}
/**
* @return the userId from the primary subsystem.
*/
private String getSubsystemUserId() {
ISubSystem ss = getPrimarySubSystem();
String result = ss.getUserId();
return result;
}
public void setUserId(String newId) /* (non-Javadoc)
{ * @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String)
if (!_userId.equals(newId)) */
{ final public void setUserId(String newId) {
_userId = newId; if (!_userId.equals(newId)) {
setDirty(true); _userId = newId;
} setDirty(true);
} }
}
public void setHost(IHost host) /* (non-Javadoc)
{ * @see org.eclipse.rse.core.subsystems.IConnectorService#setHost(org.eclipse.rse.model.IHost)
_host = host; */
} final public void setHost(IHost host) {
_host = host;
}
/** /**
* <i>Useful utility method. Fully implemented, do not override.</i><br> * <i>Useful utility method. Fully implemented, do not override.</i><br>
* Return the userId for this systems' subsystem we are associated with. If there * Clear internal userId cache. Called when user uses the property dialog to
* is no local user Id value here, then it is queried from the subsystem. However, * change his userId. By default, sets internal userId value to null so that on
* if we are connected then the user may have termporarily changed his userId on * the next call to getUserId() it is requeried from subsystem.
* the userId/password prompt dialog, in which that temp value is stored here in * Also calls {@link #clearPasswordCache()}.
* a local cache and this method will return it, versus the persistent user Id stored */
* in the subsystem. final public void clearUserIdCache() {
*/ _userId = null;
protected String getLocalUserId() clearPasswordCache();
{ }
if (_userId == null)
{ /**
_userId = System.getProperty("user.name"); * <i>Useful utility method. Fully implemented, do not override.</i><br>
} * Clear internal password cache. Called when user uses the property dialog to
return _userId; * change his userId. This method does not remove the password from the disk
} * cache - only the memory cache.
*
/** * @see #clearUserIdCache()
* <i>Useful utility method. Fully implemented, do not override.</i><br> */
* Clear internal userId cache. Called when user uses the property dialog to final public void clearPasswordCache() {
* change his userId. By default, sets internal userId value to null so that on clearPasswordCache(false);
* the next call to getUserId() it is requeried from subsystem. }
* Also calls {@link #clearPasswordCache()}.
*/ /**
public void clearUserIdCache() * <i>Useful utility method. Fully implemented, do not override.</i><br>
{ * Clear internal password cache. Called when user uses the property dialog to
_userId = null; * change his userId.
clearPasswordCache(); *
} * @param onDisk if this is true, clear the password from the disk cache as well
* @see #clearUserIdCache(boolean)
/** */
* <i>Useful utility method. Fully implemented, do not override.</i><br> final public void clearPasswordCache(boolean onDisk) {
* Clear internal password cache. Called when user uses the property dialog to setPasswordInformation(null);
* change his userId. This method does not remove the password from the disk
* cache - only the memory cache. if (onDisk) {
* // now get rid of userid/password from disk
* @see #clearUserIdCache() String systemType = getHostType();
*/ String hostName = getHostName();
public void clearPasswordCache()
{
clearPasswordCache(false);
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Clear internal password cache. Called when user uses the property dialog to
* change his userId.
*
* @param onDisk if this is true, clear the password from the disk cache as well
* @see #clearUserIdCache(boolean)
*/
public void clearPasswordCache(boolean onDisk)
{
setPasswordInformation(null);
if (onDisk)
{
// now get rid of userid/password from disk
String systemType = getHostType();
String hostName = getHostName();
if (_userId != null) if (_userId != null)
PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId); PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId);
} }
if (shareUserPasswordWithConnection()) if (shareUserPasswordWithConnection()) {
{ // clear this uid/password with other ISystems in connection
// clear this uid/password with other ISystems in connection clearPasswordForOtherSystemsInConnection(_userId, onDisk);
clearPasswordForOtherSystemsInConnection(_userId, onDisk); }
} }
}
/** /**
* <i>Useful utility method. Fully implemented, do not override.</i><br> * <i>Useful utility method. Fully implemented, do not override.</i><br>
* Return true if password is currently cached. * Return true if password is currently saved either here or in its persisted
* form.
* @param onDisk true if the check should be made for a persisted form as well,
* false if the check should be made for a password in memory only.
* @return true if the password is known, false otherwise.
*/ */
public boolean isPasswordCached(boolean onDisk) final public boolean isPasswordCached(boolean onDisk) {
{ boolean cached = (getPasswordInformation() != null);
boolean cached = (getPasswordInformation() != null); if (!cached && onDisk) {
if (!cached && onDisk) // now check if cached on disk
{ String systemType = getHostType();
// now check if cached on disk String hostName = getHostName();
String systemType = getHostType(); String userId = getUserId();
String hostName = getHostName(); if (userId != null) {
String userId = getUserId(); return PasswordPersistenceManager.getInstance().passwordExists(systemType, hostName, getUserId());
if (userId != null)
{
return PasswordPersistenceManager.getInstance().passwordExists(systemType, hostName, getUserId());
} }
} }
return cached; return cached;
} }
/** /**
* <i>Useful utility method. Fully implemented, do not override.</i><br> * <i>Useful utility method. Fully implemented, do not override.</i><br>
* Return true if password is currently cached. * Return true if password is currently cached.
*/ */
public boolean isPasswordCached() final public boolean isPasswordCached() // DWD Can we make this final?
{ {
return isPasswordCached(false); return isPasswordCached(false);
} }
@ -373,12 +376,12 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* *
* @return true if it can inherit the user/password * @return true if it can inherit the user/password
*/ */
public boolean inheritConnectionUserPassword() final public boolean inheritConnectionUserPassword()
{ {
return true; return true;
} }
/* /**
* Return true if this system can share it's uid and password * Return true if this system can share it's uid and password
* with other ISystems in this connection * with other ISystems in this connection
* *
@ -406,66 +409,61 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* @param forcePrompt if true then present the prompt even if the password is stored. * @param forcePrompt if true then present the prompt even if the password is stored.
* Can be null if the password is known to exist. * 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
{
// dy: March 24, 2003: check if prompting is temporarily suppressed by a tool // dy: March 24, 2003: check if prompting is temporarily suppressed by a tool
// vendor, this should only be suppressed if the user cancelled a previous signon // vendor, this should only be suppressed if the user cancelled a previous signon
// dialog (or some other good reason) // dialog (or some other good reason)
if (isSuppressSignonPrompt()) if (isSuppressSignonPrompt()) throw new InterruptedException();
{
throw new InterruptedException();
}
// Get the password information associated with this connector service. boolean passwordValid = true;
ISignonValidator validator = getSignonValidator();
SystemSignonInformation passwordInformation = getPasswordInformation(); SystemSignonInformation passwordInformation = getPasswordInformation();
ISubSystem subsystem = getPrimarySubSystem();
IHost host = subsystem.getHost();
String hostName = host.getHostName();
String hostType = host.getSystemType();
String oldUserId = getLocalUserId();
PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance();
// 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();
if (passwordInformation != null && !forcePrompt) { if (passwordInformation != null && !forcePrompt) {
boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid()); boolean same = host.compareUserIds(oldUserId, passwordInformation.getUserid());
//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 ... // 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; if (passwordInformation != null && validator != null && !validator.isValid(shell, passwordInformation)) {
if (passwordInformation != null && passwordValid = false;
getSignonValidator() != null &&
!getSignonValidator().isValid(shell, passwordInformation))
{
pwdInvalidFlag = true;
clearPasswordCache(); clearPasswordCache();
passwordInformation = null; passwordInformation = null;
} }
// 2a. Check the saved passwords if we still haven't found a good password. // Check the saved passwords if we still haven't found a good password.
if (passwordInformation == null && getLocalUserId() != null && !forcePrompt) if (passwordInformation == null && oldUserId != null && !forcePrompt) {
{ SystemSignonInformation savedPasswordInformation = ppm.find(hostType, hostName, oldUserId);
setPasswordInformation(PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId())); if (savedPasswordInformation != null) {
passwordInformation = getPasswordInformation(); if (validator != null) {
if (!validator.isValid(shell, savedPasswordInformation)) {
// 2b. Check if saved passwordInfo is still valid passwordValid = false;
if (passwordInformation != null clearPasswordCache();
&& getSignonValidator() != null passwordInformation = null;
&& !getSignonValidator().isValid(shell, passwordInformation)) } else {
{ setPasswordInformation(savedPasswordInformation);
pwdInvalidFlag = true; passwordInformation = getPasswordInformation();
clearPasswordCache(); }
passwordInformation = null; }
} }
} }
// If we had a saved password (in memory or on disk) that was invalid the tell the user // If we ran into an invalid password we need to tell the user.
if ((passwordInformation == null) && (pwdInvalidFlag == true)) // DWD refactor - want to move this to a pluggable class so that this can be moved to core.
{ if (!passwordValid) {
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_INVALID); SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_INVALID);
msg.makeSubstitution(getLocalUserId(), getHostName()); msg.makeSubstitution(getLocalUserId(), getHostName());
SystemMessageDialog dialog = new SystemMessageDialog(shell, msg); SystemMessageDialog dialog = new SystemMessageDialog(shell, msg);
@ -473,60 +471,41 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
} }
// Valid password not found so prompt, or force prompt // Valid password not found so prompt, or force prompt
if (forcePrompt || ((passwordInformation == null) && (shell != null))) if ((forcePrompt || (passwordInformation == null)) && (shell != null)) {
{
ISystemPasswordPromptDialog dlg = getPasswordPromptDialog(shell); ISystemPasswordPromptDialog dlg = getPasswordPromptDialog(shell);
dlg.setSystemInput(this); dlg.setSystemInput(this);
passwordInformation = ppm.find(hostType, hostName, oldUserId);
SystemSignonInformation passInfo = PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId()); if (passwordInformation != null) {
if (passInfo != null) String password = passwordInformation.getPassword();
{
String password = passInfo.getPassword();
dlg.setPassword(password); dlg.setPassword(password);
dlg.setSavePassword(true);
} else {
dlg.setPassword("");
dlg.setSavePassword(false);
} }
try {
// Check if password was saved, if so preselect the save checkbox
if (getLocalUserId() != null)
{
dlg.setSavePassword(PasswordPersistenceManager.getInstance().passwordExists(getHostType(), getHostName(), getLocalUserId()));
}
try
{
dlg.open(); dlg.open();
} } catch (Exception e) {
catch (Exception e) logException(e);
{
e.printStackTrace();
} }
if (!dlg.wasCancelled()) if (dlg.wasCancelled()) throw new InterruptedException();
{ boolean userIdChanged = dlg.getIsUserIdChanged();
boolean userIdChanged = dlg.getIsUserIdChanged(); if (userIdChanged) {
if (userIdChanged) String newUserId = dlg.getUserId();
{ boolean userIdChangePermanent = dlg.getIsUserIdChangePermanent();
String newUserId = dlg.getUserId(); if (userIdChangePermanent) {
boolean userIdChangePermanent = dlg.getIsUserIdChangePermanent(); updateDefaultUserId(subsystem, newUserId);
if (userIdChangePermanent) } else {
{ setUserId(newUserId);
updateDefaultUserId(getPrimarySubSystem(), newUserId); _userId = newUserId;
} }
else }
{ boolean persistPassword = dlg.getIsSavePassword();
setUserId(newUserId); setPassword(dlg.getUserId(), dlg.getPassword(), persistPassword);
_userId = newUserId; if (shareUserPasswordWithConnection()) {
} // share this uid/password with other ISystems in connection
} updatePasswordForOtherSystemsInConnection(dlg.getUserId(), dlg.getPassword(), persistPassword);
boolean persistPassword = dlg.getIsSavePassword(); }
setPassword(dlg.getUserId(), dlg.getPassword(), persistPassword);
if (shareUserPasswordWithConnection())
{
// share this uid/password with other ISystems in connection
updatePasswordForOtherSystemsInConnection(dlg.getUserId(), dlg.getPassword(), persistPassword);
}
}
else
throw new InterruptedException();
} }
} }
@ -600,50 +579,38 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
} }
} }
/** /**
* Change the default user Id value in the SubSystem if it is non-null, * Change the default user Id value in the SubSystem if it is non-null, else
* else update it in the Connection object * update it in the Connection object
*/ */
private void updateDefaultUserId(ISubSystem subsystem, String userId) private void updateDefaultUserId(ISubSystem subsystem, String userId) {
{ String ssLocalUserId = subsystem.getLocalUserId();
if (subsystem.getLocalUserId() != null) // defect 42709 if (ssLocalUserId != null) { // defect 42709
{ ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
subsystem.getSubSystemConfiguration(). ssc.updateSubSystem(shell, subsystem, true, userId, false, 0);
updateSubSystem(shell, subsystem, true, userId, false, 0); } else { // it seems intuitive to update the connection object. defect 42709. Phil
} int whereToUpdate = USERID_LOCATION_CONNECTION;
// it seems intuitive to update the connection object. defect 42709. Phil IHost conn = subsystem.getHost();
else ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
{ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(), conn.getDescription(), userId, whereToUpdate);
int whereToUpdate = USERID_LOCATION_CONNECTION; }
IHost conn = subsystem.getHost(); }
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
conn.getHostName(), conn.getDescription(), userId, whereToUpdate);
}
}
/** /**
* <i>A default implementation is supplied, but can be overridden if desired.</i><br> * <i>A default implementation is supplied, but can be overridden if desired.</i><br>
* Instantiates and returns the dialog to prompt for the userId. * Instantiates and returns the dialog to prompt for the userId.
* <p> * <p>
* By default returns an instance of SystemPasswordPromptDialog. * By default returns an instance of SystemPasswordPromptDialog. Calls forcePasswordToUpperCase() to decide whether the user Id and password should be folded to uppercase.
* Calls forcePasswordToUpperCase() to decide whether the * <p>
* user Id and password should be folded to uppercase. * Calls {@link #getUserIdValidator()} and {@link #getPasswordValidator()} to set the validators. These return null by default by you can override them.
* <p> * <p>
* Calls {@link #getUserIdValidator()} and {@link #getPasswordValidator()} * Before calling open() on the dialog, the getPassword(Shell) method that calls this will call setSystemInput(this).
* to set the validators. These return null by default by you can override them. * <p>
* <p> * After return, it will call wasCancelled() and getUserId(), getIsUserIdChanged(), getIsUserIdChangePermanent() and getPassword().
* Before calling open() on the dialog, the getPassword(Shell) method that calls this will * <p>
* call setSystemInput(this). *
* <p> * @return An instance of a dialog class that implements the ISystemPasswordPromptDialog interface
* After return, it will call wasCancelled() and getUserId(), getIsUserIdChanged(), getIsUserIdChangePermanent() */
* and getPassword().
* <p>
*
* @return An instance of a dialog class that implements the ISystemPasswordPromptDialog interface
*/
protected final ISystemPasswordPromptDialog getPasswordPromptDialog(Shell shell) protected final ISystemPasswordPromptDialog getPasswordPromptDialog(Shell shell)
{ {
ISystemPasswordPromptDialog dlg = new SystemPasswordPromptDialog(shell); ISystemPasswordPromptDialog dlg = new SystemPasswordPromptDialog(shell);
@ -657,9 +624,9 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
/** /**
* <i>Useful utility method. Fully implemented, no need to override.</i><br> * <i>Useful utility method. Fully implemented, no need to override.</i><br>
* Return the password information for this system's subsystem we are associated with. * Return the password information for the primary subsystem of this
* This is transient. Assumes it has been set already. The password stored in * connector service. Assumes it has been set by the subsystem at the
* SystemSignonInformation is encrypted. * time the subsystem acquires the connector service.
*/ */
protected SystemSignonInformation getPasswordInformation() protected SystemSignonInformation getPasswordInformation()
{ {
@ -766,10 +733,10 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
/** /**
* This connection method wrappers the others (internal connect) so that registered subsystems can be notified and initialized after a connect * This connection method wrappers the others (internal connect) so that registered subsystems
* can be notified and initialized after a connect
* Previous implementations that overrode this method should now change * Previous implementations that overrode this method should now change
* their connect() method to internalConnect() * their connect() method to internalConnect()
*
*/ */
public final void connect(IProgressMonitor monitor) throws Exception public final void connect(IProgressMonitor monitor) throws Exception
{ {
@ -796,14 +763,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
} }
/** /**
* <i><b>Abstract</b> - you must override, </i>unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties * <i>You must override</i>
* returns true * unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties
* returns true.
* <p> * <p>
* Attempt to connect to the remote system.<br> * Attempt to connect to the remote system.<br>
* If the subsystem supports server launch, * If the subsystem supports server launch,
* the default behaviour here is to get the remote server launcher via * the default behavior is to get the remote server launcher by
* {@link #getRemoteServerLauncher()}, and if {@link IServerLauncher#isLaunched()} * {@link #getRemoteServerLauncher()}, and if {@link IServerLauncher#isLaunched()}
* returns false, to call {@link IServerLauncher#launch(IProgressMonitor)}. * returns false, to call {@link IServerLauncher#launch(IProgressMonitor)}.
* <p> * <p>
* This is called, by default, from the connect(...) methods of the subsystem. * This is called, by default, from the connect(...) methods of the subsystem.
*/ */
@ -1118,6 +1086,10 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
return RSEUIPlugin.getThePersistenceManager().commit(getHost()); return RSEUIPlugin.getThePersistenceManager().commit(getHost());
} }
private void logException(Throwable t) {
Logger log = LoggerFactory.getInst(RSEUIPlugin.getDefault());
log.logError("Unexpected exception", t);
}
protected NewPasswordInfo promptForNewPassword(SystemMessage prompt) throws InterruptedException protected NewPasswordInfo promptForNewPassword(SystemMessage prompt) throws InterruptedException
{ {

View file

@ -22,28 +22,23 @@ import org.eclipse.swt.widgets.Shell;
/** /**
* This is the interface implemented by System objects. * This is the interface implemented by ConnectorService (formerly System) objects.
* <p> * <p>
* A system object manages a live connection to a remote system, with * A connector service manages a live connection to a remote system, with
* operations for connecting and disconnecting, and storing information * operations for connecting and disconnecting, and storing information
* typically cached from a subsystem: user ID, password, port, etc. Any * typically cached from a subsystem: user ID, password, port, etc.
* information in a System object is thrown out when the workbench goes
* down... it is not modelled for persistence.
* <p> * <p>
* The SubSystem interface includes a method, getSystem(), which returns an * The SubSystem interface includes a method, getConnectorService(), which returns an
* instance of this interface for that subsystem. * instance of an object that implements this interface for that subsystem.
* <p> * <p>
* A single system object can be unique to a subsystem (which is always unique * A single connector service object can be unique to a subsystem instance, but
* for a particular tool to a particular connection). It can also be shared * it can also be shared across multiple subsystems in a single host if those
* across multiple subsystems in a single connection if those subsystems share * subsystems share a physical connection to the remote system. This sharing is done via
* their physical connection to the remote system. This sharing is done via * subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager}
* subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager} * which are returned by another getter method in SubSystem.
* which are returned via another getter method in SubSystem.
*/ */
public interface IConnectorService extends IRSEModelObject public interface IConnectorService extends IRSEModelObject
{ {
/** /**
* Return the subsystem object this system is associated with * Return the subsystem object this system is associated with

View file

@ -16,42 +16,31 @@
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
/** /**
* <!-- begin-user-doc --> * This is the implementation of {@link IServerLauncherProperties}. It basically allows for numerous types
* This is the IBM default implementation of {@link IServerLauncherProperties}. It basically allows for numerous types
* of server connecting, as identified in {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. It * of server connecting, as identified in {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. It
* also captures the attributes needed to support these. * also captures the attributes needed to support these.
* <p> * <p>
* A server launcher is responsible for starting the server-side code needed for this client subsystem to * A server launcher is responsible for starting the server-side code needed for this client subsystem to
* access remote resources on the remote system. It starts the server half of the client/server code needed * access remote resources on the remote system. It starts the server half of the client/server code needed
* for this subsystem. It is consulted in the default implementation of connect() in ISystem, and the * for this subsystem. It is consulted in the default implementation of connect() in ISystem, and the
* manages the properties in the Remote Server Launcher property page. * manages the properties in the Remote Server Launcher property page.
* <!-- end-user-doc -->
*
* <p> * <p>
* The following features are supported: * The following features are supported:
* <ul> * <ul>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerLaunchType <em>Server Launch Type</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerLaunchType <em>Server Launch Type</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getPort <em>Port</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getPort <em>Port</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRexecPort <em>Rexec Port</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRexecPort <em>Rexec Port</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getDaemonPort <em>Daemon Port</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getDaemonPort <em>Daemon Port</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerPath <em>Server Path</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerPath <em>Server Path</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerScript <em>Server Script</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getServerScript <em>Server Script</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getIbmAttributes <em>Ibm Attributes</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getIbmAttributes <em>Ibm Attributes</em>}</li>
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRestrictedTypes <em>Restricted Types</em>}</li> * <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRestrictedTypes <em>Restricted Types</em>}</li>
* </ul> * </ul>
* </p> * </p>
* *
* @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher() * @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher()
* @model
* @generated
*/ */
public interface IIBMServerLauncher extends IServerLauncherProperties{ public interface IIBMServerLauncher extends IServerLauncherProperties{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String copyright = "(c) Copyright IBM Corporation 2002, 2004.";
/** /**
* Returns the value of the '<em><b>Server Launch Type</b></em>' attribute. * Returns the value of the '<em><b>Server Launch Type</b></em>' attribute.
@ -104,8 +93,6 @@ public interface IIBMServerLauncher extends IServerLauncherProperties{
*/ */
int getRexecPort(); int getRexecPort();
/** /**
* Set the REXEC port value, as an int * Set the REXEC port value, as an int
*/ */

View file

@ -1481,14 +1481,14 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Updates user-editable attributes of an existing subsystem instance. * Updates userid and/or port of an existing subsystem instance.
* These attributes typically affect the live connection, so the subsystem will be forced to * These attributes typically affect the live connection, so the subsystem will be forced to
* disconnect. * disconnect.
* <p> * <p>
* If you have your own attributes and own GUI to prompt for these, then call your own * If you have your own attributes and own GUI to prompt for these, then call your own
* method to set your attributes, and call this method via super().xxx(...). * method to set your attributes, and call this method via super().
* <p> * <p>
* The subsystem will be saved to disk. * The changes to the subsystem configuration will be saved to disk.
* Further, it will be asked to disconnect as this data affects the connection. * Further, it will be asked to disconnect as this data affects the connection.
* <p> * <p>
* @param shell parent shell needed in case an error message is displayed * @param shell parent shell needed in case an error message is displayed
@ -1563,7 +1563,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
/** /**
* Used by child classes that override updateSubSystem to establish if anything really * Used by child classes that override updateSubSystem to establish if anything really
* needs to be changed. * needs to be changed.
*/ */
protected boolean needsUpdate(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port) protected boolean needsUpdate(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port)
{ {

View file

@ -34,7 +34,6 @@ import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage;
* These include: * These include:
* <ul> * <ul>
* <li>The list of profile names that are active * <li>The list of profile names that are active
* <li>The global default user Id
* <li>The default user Id per system type * <li>The default user Id per system type
* <li>The global setting about whether to show filter pools * <li>The global setting about whether to show filter pools
* <li>The global setting about whether to show filter strings * <li>The global setting about whether to show filter strings
@ -253,21 +252,6 @@ public class SystemPreferencesManager
// USER ID METHODS... // USER ID METHODS...
// ------------------ // ------------------
/**
* Return overall global user id
*/
//public String getDefaultUserId()
//{
//return RemoteSystemsPreferencePage.getUserIdPreference();
//}
/**
* Set overall global user id
*/
//public void setDefaultUserId(String userId)
//{
//RemoteSystemsPreferencePage.setUserIdPreference(userId);
//}
/** /**
* Return user Id per system type * Return user Id per system type
*/ */
@ -294,18 +278,22 @@ public class SystemPreferencesManager
uid = (String)userIdsPerKey.get(key); uid = (String)userIdsPerKey.get(key);
return uid; return uid;
} }
/** /**
* Set the user Id per key * Set the user Id for this key. The key typically designates a scope for this userid so that a hierarchy
*/ * of user ids can be maintained for inheritance. For example, hosts have greater scope than subsystems.
public void setUserId(String key, String userId) */
{ public void setUserId(String key, String userId) {
if ((key != null) && (userId!=null)) if ((key != null) && (userId != null)) {
{ userIdsPerKey = getUserIdsPerKey();
userIdsPerKey = getUserIdsPerKey(); String storedUserId = (String) userIdsPerKey.get(key);
userIdsPerKey.put(key,userId); if (!storedUserId.equals(userId)) { // don't bother updating if its already there
setUserIdsPerKey(); userIdsPerKey.put(key, userId);
} setUserIdsPerKey();
} }
}
}
/** /**
* Clear the user Id for the given key * Clear the user Id for the given key
*/ */
@ -435,9 +423,9 @@ public class SystemPreferencesManager
*/ */
public void setVerifyConnection(boolean verify) public void setVerifyConnection(boolean verify)
{ {
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore(); IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setValue(ISystemPreferencesConstants.VERIFY_CONNECTION,verify); store.setValue(ISystemPreferencesConstants.VERIFY_CONNECTION, verify);
RSEUIPlugin.getDefault().savePluginPreferences(); RSEUIPlugin.getDefault().savePluginPreferences(); // also saves the preference store
} }
// ------------------ // ------------------