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:
parent
9ab955d6bf
commit
ebeab3de94
15 changed files with 469 additions and 433 deletions
|
@ -456,9 +456,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
|
|||
*/
|
||||
protected synchronized void internalConnect(IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
if (isConnected())
|
||||
{
|
||||
// could have been called b4
|
||||
if (isConnected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -476,7 +474,8 @@ public class DStoreConnectorService extends AbstractConnectorService implements
|
|||
clientConnection.setHost(getHostName());
|
||||
clientConnection.setPort(Integer.toString(getPort()));
|
||||
|
||||
ISubSystem ss = getPrimarySubSystem();
|
||||
// ISubSystem ss = getPrimarySubSystem();
|
||||
getPrimarySubSystem();
|
||||
IIBMServerLauncher serverLauncher = getIBMServerLauncher();
|
||||
|
||||
ServerLaunchType serverLauncherType = null;
|
||||
|
@ -1239,19 +1238,19 @@ public class DStoreConnectorService extends AbstractConnectorService implements
|
|||
/**
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#isPasswordCached()
|
||||
*/
|
||||
public boolean isPasswordCached()
|
||||
{
|
||||
// For Windows we never prompt for userid / password so we don't need
|
||||
// to clear the password cache
|
||||
if (getPrimarySubSystem().getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.isPasswordCached();
|
||||
}
|
||||
}
|
||||
// public boolean isPasswordCached() // DWD is this method needed?
|
||||
// {
|
||||
// // For Windows we never prompt for userid / password so we don't need
|
||||
// // to clear the password cache
|
||||
// if (getPrimarySubSystem().getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return super.isPasswordCached();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
|
@ -18,10 +18,15 @@ package org.eclipse.rse.ui;
|
|||
import java.net.MalformedURLException;
|
||||
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.Platform;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
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
|
||||
* parameter is used as the base for relative paths and is allowed to be
|
||||
* null.
|
||||
*
|
||||
* @param value
|
||||
* the absolute or relative path
|
||||
* @param definingBundle
|
||||
* bundle to be used for relative paths (may be null)
|
||||
* @return
|
||||
*/
|
||||
public static URL getUrl(String value, Bundle definingBundle) {
|
||||
try {
|
||||
if (value != null)
|
||||
return new URL(value);
|
||||
} catch (MalformedURLException e) {
|
||||
if (definingBundle != null)
|
||||
return Platform.find(definingBundle, new Path(value));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
* Create a URL from the argument absolute or relative path. The bundle parameter is
|
||||
* used as the base for relative paths and may be null.
|
||||
*
|
||||
* @param value
|
||||
* the absolute or relative path
|
||||
* @param definingBundle
|
||||
* bundle to be used for relative paths (may be null)
|
||||
* @return the URL to the resource
|
||||
*/
|
||||
public static URL getUrl(String value, Bundle definingBundle) {
|
||||
URL result = null;
|
||||
try {
|
||||
if (value != null) {
|
||||
result = new URL(value);
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
if (definingBundle != null) {
|
||||
IPath path = new Path(value);
|
||||
result = FileLocator.find(definingBundle, path, null);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object)
|
||||
*/
|
||||
public String getLabel(Object object) {
|
||||
|
@ -136,10 +143,8 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
|
|||
}
|
||||
|
||||
public boolean isEnableOffline(Object object) {
|
||||
|
||||
if ((object != null) && (object instanceof IRSESystemType)) {
|
||||
String property = ((IRSESystemType)object).getProperty(ENABLE_OFFLINE);
|
||||
|
||||
if (property != null) {
|
||||
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) {
|
||||
//TODO
|
||||
return true;
|
||||
boolean result = false;
|
||||
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) {
|
||||
//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) {
|
||||
//TODO
|
||||
return "";
|
||||
String result = null;
|
||||
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) {
|
||||
//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;
|
||||
}
|
||||
|
||||
}
|
|
@ -49,20 +49,20 @@ public class SystemClearPasswordAction extends SystemBaseAction
|
|||
}
|
||||
|
||||
/**
|
||||
* Override of parent. Called when testing if action should be enabled base on current
|
||||
* selection. We check the selected object is one of our subsystems, and we are not
|
||||
* already connected.
|
||||
* Override of parent.
|
||||
* Called when testing if an action should be enabled based on the current selection.
|
||||
* 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)
|
||||
{
|
||||
if (!(obj instanceof ISubSystem) ||
|
||||
((ISubSystem)obj).getConnectorService().isConnected() ||
|
||||
!(((ISubSystem)obj).getConnectorService().isPasswordCached(true))) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
public boolean checkObjectType(Object obj) {
|
||||
boolean result = false;
|
||||
if (obj instanceof ISubSystem) {
|
||||
ISubSystem subsystem = (ISubSystem) obj;
|
||||
IConnectorService cs = subsystem.getConnectorService();
|
||||
result = !cs.isConnected() && cs.isPasswordCached(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -196,6 +196,7 @@ public class RemoteSystemsPreferencePage
|
|||
// ---------------------------------------------------------
|
||||
// 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".
|
||||
*/
|
||||
|
@ -566,10 +567,11 @@ public class RemoteSystemsPreferencePage
|
|||
}
|
||||
|
||||
/**
|
||||
* Save the preference store
|
||||
* Save the preference store.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ public class SystemTypeFieldEditor extends FieldEditor
|
|||
tableViewer.setCellModifier(this);
|
||||
CellEditor editors[] = new CellEditor[columnHeaders.length];
|
||||
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_ENABLED] = enabledCellEditor;
|
||||
tableViewer.setCellEditors(editors);
|
||||
|
|
|
@ -32,12 +32,9 @@ import org.eclipse.rse.ui.SystemResources;
|
|||
/**
|
||||
* A pool of host objects.
|
||||
* There is one pool per profile.
|
||||
* It is named the same as its owning profile.
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
||||
{
|
||||
|
@ -50,13 +47,15 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
|
||||
protected String name = NAME_EDEFAULT;
|
||||
private java.util.List connections = null;
|
||||
/**
|
||||
* Default constructor. Typically called by MOF.
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected SystemHostPool()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
conn.setHostPool(this);
|
||||
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);
|
||||
|
||||
} catch (Exception e)
|
||||
|
|
|
@ -313,7 +313,6 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
|||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName());
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription());
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USER_ID, host.getDefaultUserId());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -120,7 +120,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
|
|||
String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue();
|
||||
boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).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
|
||||
try
|
||||
|
@ -130,7 +129,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
|
|||
host = profile.createHost(systemType, connectionName, hostName, description);
|
||||
host.setOffline(isOffline);
|
||||
host.setPromptable(isPromptable);
|
||||
host.setDefaultUserId(userId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -275,10 +273,6 @@ public class RSEDOMImporter implements IRSEDOMImporter
|
|||
subSystem = factory.createSubSystemInternal(host);
|
||||
}
|
||||
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.setSubSystemConfiguration(factory);
|
||||
subSystem.setWasRestored(true);
|
||||
|
@ -480,10 +474,17 @@ public class RSEDOMImporter implements IRSEDOMImporter
|
|||
{
|
||||
ISystemFilterPoolManager filterPoolManager = factory.getFilterPoolManager(subSystem.getSystemProfile());
|
||||
ISystemFilterPool filterPool = filterPoolManager.getSystemFilterPool(name);
|
||||
|
||||
// create reference to the filterpool
|
||||
ISystemFilterPoolReferenceManager referenceManager = subSystem.getFilterPoolReferenceManager();
|
||||
filterPoolReference = referenceManager.addReferenceToSystemFilterPool(filterPool);
|
||||
/*
|
||||
* DWD filterpool can be null when restoring since there can be forward references.
|
||||
* A profile may be being restored that has references to a filter pool in a profile that doesn't yet exist.
|
||||
* 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;
|
||||
|
|
|
@ -48,7 +48,6 @@ public interface IRSEDOMConstants
|
|||
public static final String ATTRIBUTE_HOSTNAME = "hostname";
|
||||
public static final String ATTRIBUTE_OFFLINE = "offline";
|
||||
public static final String ATTRIBUTE_DESCRIPTION = "description";
|
||||
public static final String ATTRIBUTE_USER_ID = "defaultUserId";
|
||||
|
||||
// ConnectorService attributes
|
||||
public static final String ATTRIBUTE_GROUP="group";
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.rse.core.ISystemUserIdConstants;
|
||||
import org.eclipse.rse.core.PasswordPersistenceManager;
|
||||
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.ISystemRegistry;
|
||||
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>
|
||||
* An {@link org.eclipse.rse.core.subsystems.IConnectorService} object is returned from a subsystem object via getSystem(), and
|
||||
* it is used to represent the live connection to a particular subsystem.
|
||||
* <p>
|
||||
* All this could have been done in the subsystem object, but that would clutter it
|
||||
* up too much.
|
||||
* An {@link org.eclipse.rse.core.subsystems.IConnectorService} object
|
||||
* is returned from a subsystem object via getSystem(), and
|
||||
* it is used to represent the live connection to a particular subsystem.
|
||||
* <p>
|
||||
* You must override/implement
|
||||
* <ul>
|
||||
* <li>isConnected
|
||||
* <li>internalConnect
|
||||
* <li>internalDisconnect
|
||||
* <li>isConnected
|
||||
* <li>internalConnect
|
||||
* <li>internalDisconnect
|
||||
* </ul>
|
||||
* You should override:
|
||||
* <ul>
|
||||
* <li>reset
|
||||
* <li>getVersionReleaseModification
|
||||
* <li>getHomeDirectory
|
||||
* <li>getTempDirectory
|
||||
* <li>reset
|
||||
* <li>getVersionReleaseModification
|
||||
* <li>getHomeDirectory
|
||||
* <li>getTempDirectory
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
|
||||
|
@ -181,12 +181,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
// Utility methods...
|
||||
// ------------------
|
||||
|
||||
public ISubSystem[] getSubSystems()
|
||||
final public ISubSystem[] getSubSystems()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -196,7 +199,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
return _primarySubSystem;
|
||||
}
|
||||
|
||||
public IHost getHost()
|
||||
final public IHost getHost()
|
||||
{
|
||||
return _host;
|
||||
}
|
||||
|
@ -205,7 +208,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Returns the system type for this connection:<br> <code>getSubSystem().getSystemConnection().getSystemType()</code>
|
||||
*/
|
||||
public String getHostType()
|
||||
final public String getHostType()
|
||||
{
|
||||
return getHost().getSystemType();
|
||||
}
|
||||
|
@ -213,12 +216,12 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public String getName()
|
||||
final public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
final public String getDescription()
|
||||
{
|
||||
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>
|
||||
* <code>getSubSystem().getSystemConnection().getHostName()</code>
|
||||
*/
|
||||
public String getHostName()
|
||||
final public String getHostName()
|
||||
{
|
||||
return getHost().getHostName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Returns the user Id for this system's subsystem we are associated with.
|
||||
* This is the same as {@link #getLocalUserId()}, but first clears the local
|
||||
* user Id cache if we are not currently connected.
|
||||
*/
|
||||
public String getUserId()
|
||||
{
|
||||
if (_userId != null)
|
||||
{
|
||||
return _userId;
|
||||
}
|
||||
|
||||
return getLocalUserId();
|
||||
}
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Returns the active userId if we are connected.
|
||||
* If not it returns the userId for the primary subsystem ignoring the
|
||||
* cached userId.
|
||||
*/
|
||||
final public String getUserId() {
|
||||
String result = getSubsystemUserId();
|
||||
ISubSystem ss = getPrimarySubSystem();
|
||||
if (ss.isConnected()) {
|
||||
result = getLocalUserId();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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)
|
||||
{
|
||||
if (!_userId.equals(newId))
|
||||
{
|
||||
_userId = newId;
|
||||
setDirty(true);
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String)
|
||||
*/
|
||||
final public void setUserId(String newId) {
|
||||
if (!_userId.equals(newId)) {
|
||||
_userId = newId;
|
||||
setDirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHost(IHost host)
|
||||
{
|
||||
_host = host;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#setHost(org.eclipse.rse.model.IHost)
|
||||
*/
|
||||
final public void setHost(IHost host) {
|
||||
_host = host;
|
||||
}
|
||||
|
||||
/**
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Return the userId for this systems' subsystem we are associated with. If there
|
||||
* is no local user Id value here, then it is queried from the subsystem. However,
|
||||
* if we are connected then the user may have termporarily changed his userId on
|
||||
* the userId/password prompt dialog, in which that temp value is stored here in
|
||||
* a local cache and this method will return it, versus the persistent user Id stored
|
||||
* in the subsystem.
|
||||
*/
|
||||
protected String getLocalUserId()
|
||||
{
|
||||
if (_userId == null)
|
||||
{
|
||||
_userId = System.getProperty("user.name");
|
||||
}
|
||||
return _userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Clear internal userId cache. 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()}.
|
||||
*/
|
||||
public void clearUserIdCache()
|
||||
{
|
||||
_userId = null;
|
||||
clearPasswordCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* <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. This method does not remove the password from the disk
|
||||
* cache - only the memory cache.
|
||||
*
|
||||
* @see #clearUserIdCache()
|
||||
*/
|
||||
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();
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Clear internal userId cache. 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()}.
|
||||
*/
|
||||
final public void clearUserIdCache() {
|
||||
_userId = null;
|
||||
clearPasswordCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* <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. This method does not remove the password from the disk
|
||||
* cache - only the memory cache.
|
||||
*
|
||||
* @see #clearUserIdCache()
|
||||
*/
|
||||
final 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)
|
||||
*/
|
||||
final 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)
|
||||
PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId);
|
||||
}
|
||||
|
||||
if (shareUserPasswordWithConnection())
|
||||
{
|
||||
// clear this uid/password with other ISystems in connection
|
||||
clearPasswordForOtherSystemsInConnection(_userId, onDisk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId);
|
||||
}
|
||||
|
||||
if (shareUserPasswordWithConnection()) {
|
||||
// clear this uid/password with other ISystems in connection
|
||||
clearPasswordForOtherSystemsInConnection(_userId, onDisk);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* Return true if password is currently cached.
|
||||
* <i>Useful utility method. Fully implemented, do not override.</i><br>
|
||||
* 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)
|
||||
{
|
||||
boolean cached = (getPasswordInformation() != null);
|
||||
if (!cached && onDisk)
|
||||
{
|
||||
// now check if cached on disk
|
||||
String systemType = getHostType();
|
||||
String hostName = getHostName();
|
||||
String userId = getUserId();
|
||||
if (userId != null)
|
||||
{
|
||||
return PasswordPersistenceManager.getInstance().passwordExists(systemType, hostName, getUserId());
|
||||
final public boolean isPasswordCached(boolean onDisk) {
|
||||
boolean cached = (getPasswordInformation() != null);
|
||||
if (!cached && onDisk) {
|
||||
// now check if cached on disk
|
||||
String systemType = getHostType();
|
||||
String hostName = getHostName();
|
||||
String userId = 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>
|
||||
* Return true if password is currently cached.
|
||||
*/
|
||||
public boolean isPasswordCached()
|
||||
final public boolean isPasswordCached() // DWD Can we make this final?
|
||||
{
|
||||
return isPasswordCached(false);
|
||||
}
|
||||
|
@ -373,12 +376,12 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
*
|
||||
* @return true if it can inherit the user/password
|
||||
*/
|
||||
public boolean inheritConnectionUserPassword()
|
||||
final public boolean inheritConnectionUserPassword()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return true if this system can share it's uid and password
|
||||
* 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.
|
||||
* Can be null if the password is known to exist.
|
||||
*/
|
||||
public void promptForPassword(Shell shell, boolean forcePrompt)
|
||||
throws InterruptedException
|
||||
{
|
||||
public void promptForPassword(Shell shell, boolean forcePrompt) throws InterruptedException {
|
||||
// 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
|
||||
// dialog (or some other good reason)
|
||||
if (isSuppressSignonPrompt())
|
||||
{
|
||||
throw new InterruptedException();
|
||||
}
|
||||
if (isSuppressSignonPrompt()) throw new InterruptedException();
|
||||
|
||||
// Get the password information associated with this connector service.
|
||||
boolean passwordValid = true;
|
||||
ISignonValidator validator = getSignonValidator();
|
||||
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 ...
|
||||
// Test if userId has been changed... d43274
|
||||
String oldUserId = getUserId();
|
||||
if (passwordInformation != null && !forcePrompt) {
|
||||
boolean same = getPrimarySubSystem().getHost().compareUserIds(oldUserId, passwordInformation.getUserid());
|
||||
//RSEUIPlugin.getQualifiedHostName(getHostName());
|
||||
String hostName = getHostName();
|
||||
boolean same = host.compareUserIds(oldUserId, passwordInformation.getUserid());
|
||||
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 ...
|
||||
// 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
|
||||
boolean pwdInvalidFlag = false;
|
||||
if (passwordInformation != null &&
|
||||
getSignonValidator() != null &&
|
||||
!getSignonValidator().isValid(shell, passwordInformation))
|
||||
{
|
||||
pwdInvalidFlag = true;
|
||||
if (passwordInformation != null && validator != null && !validator.isValid(shell, passwordInformation)) {
|
||||
passwordValid = false;
|
||||
clearPasswordCache();
|
||||
passwordInformation = null;
|
||||
}
|
||||
|
||||
// 2a. Check the saved passwords if we still haven't found a good password.
|
||||
if (passwordInformation == null && getLocalUserId() != null && !forcePrompt)
|
||||
{
|
||||
setPasswordInformation(PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId()));
|
||||
passwordInformation = getPasswordInformation();
|
||||
|
||||
// 2b. Check if saved passwordInfo is still valid
|
||||
if (passwordInformation != null
|
||||
&& getSignonValidator() != null
|
||||
&& !getSignonValidator().isValid(shell, passwordInformation))
|
||||
{
|
||||
pwdInvalidFlag = true;
|
||||
clearPasswordCache();
|
||||
passwordInformation = null;
|
||||
}
|
||||
// Check the saved passwords if we still haven't found a good password.
|
||||
if (passwordInformation == null && oldUserId != null && !forcePrompt) {
|
||||
SystemSignonInformation savedPasswordInformation = ppm.find(hostType, hostName, oldUserId);
|
||||
if (savedPasswordInformation != null) {
|
||||
if (validator != null) {
|
||||
if (!validator.isValid(shell, savedPasswordInformation)) {
|
||||
passwordValid = false;
|
||||
clearPasswordCache();
|
||||
passwordInformation = null;
|
||||
} else {
|
||||
setPasswordInformation(savedPasswordInformation);
|
||||
passwordInformation = getPasswordInformation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we had a saved password (in memory or on disk) that was invalid the tell the user
|
||||
if ((passwordInformation == null) && (pwdInvalidFlag == true))
|
||||
{
|
||||
// If we ran into an invalid password we need to tell the user.
|
||||
// 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);
|
||||
msg.makeSubstitution(getLocalUserId(), getHostName());
|
||||
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
|
||||
if (forcePrompt || ((passwordInformation == null) && (shell != null)))
|
||||
{
|
||||
if ((forcePrompt || (passwordInformation == null)) && (shell != null)) {
|
||||
ISystemPasswordPromptDialog dlg = getPasswordPromptDialog(shell);
|
||||
dlg.setSystemInput(this);
|
||||
|
||||
SystemSignonInformation passInfo = PasswordPersistenceManager.getInstance().find(getHostType(), getHostName(), getLocalUserId());
|
||||
if (passInfo != null)
|
||||
{
|
||||
String password = passInfo.getPassword();
|
||||
passwordInformation = ppm.find(hostType, hostName, oldUserId);
|
||||
if (passwordInformation != null) {
|
||||
String password = passwordInformation.getPassword();
|
||||
dlg.setPassword(password);
|
||||
dlg.setSavePassword(true);
|
||||
} else {
|
||||
dlg.setPassword("");
|
||||
dlg.setSavePassword(false);
|
||||
}
|
||||
|
||||
// Check if password was saved, if so preselect the save checkbox
|
||||
if (getLocalUserId() != null)
|
||||
{
|
||||
dlg.setSavePassword(PasswordPersistenceManager.getInstance().passwordExists(getHostType(), getHostName(), getLocalUserId()));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
dlg.open();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
logException(e);
|
||||
}
|
||||
if (!dlg.wasCancelled())
|
||||
{
|
||||
boolean userIdChanged = dlg.getIsUserIdChanged();
|
||||
if (userIdChanged)
|
||||
{
|
||||
String newUserId = dlg.getUserId();
|
||||
boolean userIdChangePermanent = dlg.getIsUserIdChangePermanent();
|
||||
if (userIdChangePermanent)
|
||||
{
|
||||
updateDefaultUserId(getPrimarySubSystem(), newUserId);
|
||||
}
|
||||
else
|
||||
{
|
||||
setUserId(newUserId);
|
||||
_userId = newUserId;
|
||||
}
|
||||
}
|
||||
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();
|
||||
if (dlg.wasCancelled()) throw new InterruptedException();
|
||||
boolean userIdChanged = dlg.getIsUserIdChanged();
|
||||
if (userIdChanged) {
|
||||
String newUserId = dlg.getUserId();
|
||||
boolean userIdChangePermanent = dlg.getIsUserIdChangePermanent();
|
||||
if (userIdChangePermanent) {
|
||||
updateDefaultUserId(subsystem, newUserId);
|
||||
} else {
|
||||
setUserId(newUserId);
|
||||
_userId = newUserId;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
* else update it in the Connection object
|
||||
*/
|
||||
private void updateDefaultUserId(ISubSystem subsystem, String userId)
|
||||
{
|
||||
if (subsystem.getLocalUserId() != null) // defect 42709
|
||||
{
|
||||
subsystem.getSubSystemConfiguration().
|
||||
updateSubSystem(shell, subsystem, true, userId, false, 0);
|
||||
}
|
||||
// it seems intuitive to update the connection object. defect 42709. Phil
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
* Change the default user Id value in the SubSystem if it is non-null, else
|
||||
* update it in the Connection object
|
||||
*/
|
||||
private void updateDefaultUserId(ISubSystem subsystem, String userId) {
|
||||
String ssLocalUserId = subsystem.getLocalUserId();
|
||||
if (ssLocalUserId != null) { // defect 42709
|
||||
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
|
||||
ssc.updateSubSystem(shell, subsystem, true, userId, false, 0);
|
||||
} else { // it seems intuitive to update the connection object. defect 42709. Phil
|
||||
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>
|
||||
* Instantiates and returns the dialog to prompt for the userId.
|
||||
* <p>
|
||||
* By default returns an instance of SystemPasswordPromptDialog.
|
||||
* Calls forcePasswordToUpperCase() to decide whether the
|
||||
* user Id and password should be folded to uppercase.
|
||||
* <p>
|
||||
* Calls {@link #getUserIdValidator()} and {@link #getPasswordValidator()}
|
||||
* to set the validators. These return null by default by you can override them.
|
||||
* <p>
|
||||
* Before calling open() on the dialog, the getPassword(Shell) method that calls this will
|
||||
* call setSystemInput(this).
|
||||
* <p>
|
||||
* 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
|
||||
*/
|
||||
* <i>A default implementation is supplied, but can be overridden if desired.</i><br>
|
||||
* Instantiates and returns the dialog to prompt for the userId.
|
||||
* <p>
|
||||
* By default returns an instance of SystemPasswordPromptDialog. Calls forcePasswordToUpperCase() to decide whether the user Id and password should be folded to uppercase.
|
||||
* <p>
|
||||
* Calls {@link #getUserIdValidator()} and {@link #getPasswordValidator()} to set the validators. These return null by default by you can override them.
|
||||
* <p>
|
||||
* Before calling open() on the dialog, the getPassword(Shell) method that calls this will call setSystemInput(this).
|
||||
* <p>
|
||||
* 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)
|
||||
{
|
||||
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>
|
||||
* Return the password information for this system's subsystem we are associated with.
|
||||
* This is transient. Assumes it has been set already. The password stored in
|
||||
* SystemSignonInformation is encrypted.
|
||||
* Return the password information for the primary subsystem of this
|
||||
* connector service. Assumes it has been set by the subsystem at the
|
||||
* time the subsystem acquires the connector service.
|
||||
*/
|
||||
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
|
||||
* their connect() method to internalConnect()
|
||||
*
|
||||
*/
|
||||
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
|
||||
* returns true
|
||||
* <i>You must override</i>
|
||||
* unless subsystem.getParentSubSystemFactory().supportsServerLaunchProperties
|
||||
* returns true.
|
||||
* <p>
|
||||
* Attempt to connect to the remote system.<br>
|
||||
* If the subsystem supports server launch,
|
||||
* the default behaviour here is to get the remote server launcher via
|
||||
* {@link #getRemoteServerLauncher()}, and if {@link IServerLauncher#isLaunched()}
|
||||
* returns false, to call {@link IServerLauncher#launch(IProgressMonitor)}.
|
||||
* the default behavior is to get the remote server launcher by
|
||||
* {@link #getRemoteServerLauncher()}, and if {@link IServerLauncher#isLaunched()}
|
||||
* returns false, to call {@link IServerLauncher#launch(IProgressMonitor)}.
|
||||
* <p>
|
||||
* 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());
|
||||
}
|
||||
|
||||
private void logException(Throwable t) {
|
||||
Logger log = LoggerFactory.getInst(RSEUIPlugin.getDefault());
|
||||
log.logError("Unexpected exception", t);
|
||||
}
|
||||
|
||||
protected NewPasswordInfo promptForNewPassword(SystemMessage prompt) throws InterruptedException
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
* A system object manages a live connection to a remote system, with
|
||||
* operations for connecting and disconnecting, and storing information
|
||||
* typically cached from a subsystem: user ID, password, port, etc. Any
|
||||
* information in a System object is thrown out when the workbench goes
|
||||
* down... it is not modelled for persistence.
|
||||
* A connector service manages a live connection to a remote system, with
|
||||
* operations for connecting and disconnecting, and storing information
|
||||
* typically cached from a subsystem: user ID, password, port, etc.
|
||||
* <p>
|
||||
* The SubSystem interface includes a method, getSystem(), which returns an
|
||||
* instance of this interface for that subsystem.
|
||||
* The SubSystem interface includes a method, getConnectorService(), which returns an
|
||||
* instance of an object that implements this interface for that subsystem.
|
||||
* <p>
|
||||
* A single system object can be unique to a subsystem (which is always unique
|
||||
* for a particular tool to a particular connection). It can also be shared
|
||||
* across multiple subsystems in a single connection if those subsystems share
|
||||
* their physical connection to the remote system. This sharing is done via
|
||||
* subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager}
|
||||
* which are returned via another getter method in SubSystem.
|
||||
* A single connector service object can be unique to a subsystem instance, but
|
||||
* it can also be shared across multiple subsystems in a single host if those
|
||||
* subsystems share a physical connection to the remote system. This sharing is done via
|
||||
* subclasses of {@link org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager}
|
||||
* which are returned by another getter method in SubSystem.
|
||||
*/
|
||||
public interface IConnectorService extends IRSEModelObject
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the subsystem object this system is associated with
|
||||
|
|
|
@ -16,42 +16,31 @@
|
|||
|
||||
package org.eclipse.rse.core.subsystems;
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* This is the IBM default implementation of {@link IServerLauncherProperties}. It basically allows for numerous types
|
||||
* This is the implementation of {@link IServerLauncherProperties}. It basically allows for numerous types
|
||||
* of server connecting, as identified in {@link org.eclipse.rse.core.subsystems.ServerLaunchType}. It
|
||||
* also captures the attributes needed to support these.
|
||||
* <p>
|
||||
* 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
|
||||
* 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.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* 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
|
||||
* manages the properties in the Remote Server Launcher property page.
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* <ul>
|
||||
* <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#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#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#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#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#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#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#getIbmAttributes <em>Ibm Attributes</em>}</li>
|
||||
* <li>{@link org.eclipse.rse.core.subsystems.IIBMServerLauncher#getRestrictedTypes <em>Restricted Types</em>}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @see org.eclipse.rse.core.subsystems.SubsystemsPackage#getIBMServerLauncher()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
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.
|
||||
|
@ -104,8 +93,6 @@ public interface IIBMServerLauncher extends IServerLauncherProperties{
|
|||
*/
|
||||
int getRexecPort();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the REXEC port value, as an int
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
* disconnect.
|
||||
* disconnect.
|
||||
* <p>
|
||||
* 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>
|
||||
* 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.
|
||||
* <p>
|
||||
* @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
|
||||
* needs to be changed.
|
||||
* needs to be changed.
|
||||
*/
|
||||
protected boolean needsUpdate(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage;
|
|||
* These include:
|
||||
* <ul>
|
||||
* <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 global setting about whether to show filter pools
|
||||
* <li>The global setting about whether to show filter strings
|
||||
|
@ -253,21 +252,6 @@ public class SystemPreferencesManager
|
|||
// 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
|
||||
*/
|
||||
|
@ -294,18 +278,22 @@ public class SystemPreferencesManager
|
|||
uid = (String)userIdsPerKey.get(key);
|
||||
return uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user Id per key
|
||||
*/
|
||||
public void setUserId(String key, String userId)
|
||||
{
|
||||
if ((key != null) && (userId!=null))
|
||||
{
|
||||
userIdsPerKey = getUserIdsPerKey();
|
||||
userIdsPerKey.put(key,userId);
|
||||
setUserIdsPerKey();
|
||||
}
|
||||
}
|
||||
* 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) {
|
||||
if ((key != null) && (userId != null)) {
|
||||
userIdsPerKey = getUserIdsPerKey();
|
||||
String storedUserId = (String) userIdsPerKey.get(key);
|
||||
if (!storedUserId.equals(userId)) { // don't bother updating if its already there
|
||||
userIdsPerKey.put(key, userId);
|
||||
setUserIdsPerKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the user Id for the given key
|
||||
*/
|
||||
|
@ -435,9 +423,9 @@ public class SystemPreferencesManager
|
|||
*/
|
||||
public void setVerifyConnection(boolean verify)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.VERIFY_CONNECTION,verify);
|
||||
RSEUIPlugin.getDefault().savePluginPreferences();
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.VERIFY_CONNECTION, verify);
|
||||
RSEUIPlugin.getDefault().savePluginPreferences(); // also saves the preference store
|
||||
}
|
||||
|
||||
// ------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue