mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
[168977][api][refactor] - stage 3.4
- introduced AuthenticatingConnectorService as a superclass of AbstractConnectorService - moved almost all methods from AbstractConnectorService to AuthenticatingConnectorService. AbstractConnectorService now handled the creation of the StandardCredentialsProvider for all subclasses. - moved AbstractConnectorService back to UI with the intention of renaming it StandardConnectorService - moved requiresPassword, supportsPassword, requiresUserId, and supportsUserId back to IConnectorService from ICredentialsProvider. - removed SshCredentialsProvider and DStoreCredentialsProvider, their connector services can now use the StandardCredentialsProvider
This commit is contained in:
parent
64282f800a
commit
afa5e999a1
21 changed files with 336 additions and 354 deletions
|
@ -23,9 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
import org.eclipse.rse.core.subsystems.BasicConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.BasicCredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
import org.eclipse.rse.examples.daytime.DaytimeResources;
|
import org.eclipse.rse.examples.daytime.DaytimeResources;
|
||||||
import org.eclipse.rse.examples.daytime.service.DaytimeService;
|
import org.eclipse.rse.examples.daytime.service.DaytimeService;
|
||||||
import org.eclipse.rse.examples.daytime.service.IDaytimeService;
|
import org.eclipse.rse.examples.daytime.service.IDaytimeService;
|
||||||
|
@ -38,11 +36,10 @@ import org.eclipse.rse.examples.daytime.service.IDaytimeService;
|
||||||
* here. We basically keep a local "connected" flag only, so to make sure that
|
* here. We basically keep a local "connected" flag only, so to make sure that
|
||||||
* the remote host is only accessed when the user explicitly requested so.
|
* the remote host is only accessed when the user explicitly requested so.
|
||||||
*/
|
*/
|
||||||
public class DaytimeConnectorService extends AbstractConnectorService {
|
public class DaytimeConnectorService extends BasicConnectorService {
|
||||||
|
|
||||||
private boolean fIsConnected = false;
|
private boolean fIsConnected = false;
|
||||||
private DaytimeService fDaytimeService;
|
private DaytimeService fDaytimeService;
|
||||||
private ICredentialsProvider fCredentialsProvider = new BasicCredentialsProvider(this);
|
|
||||||
|
|
||||||
public DaytimeConnectorService(IHost host) {
|
public DaytimeConnectorService(IHost host) {
|
||||||
super(DaytimeResources.Daytime_Connector_Name, DaytimeResources.Daytime_Connector_Description, host, 13);
|
super(DaytimeResources.Daytime_Connector_Name, DaytimeResources.Daytime_Connector_Description, host, 13);
|
||||||
|
@ -77,8 +74,4 @@ public class DaytimeConnectorService extends AbstractConnectorService {
|
||||||
fIsConnected = false;
|
fIsConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
return fCredentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,7 @@ package samples.subsystems;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
import org.eclipse.rse.core.subsystems.BasicConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.BasicCredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
|
|
||||||
import samples.RSESamplesPlugin;
|
import samples.RSESamplesPlugin;
|
||||||
|
|
||||||
|
@ -29,10 +27,9 @@ import samples.RSESamplesPlugin;
|
||||||
* Our system class that manages connecting to, and disconnecting from,
|
* Our system class that manages connecting to, and disconnecting from,
|
||||||
* our remote server-side code.
|
* our remote server-side code.
|
||||||
*/
|
*/
|
||||||
public class DeveloperConnectorService extends AbstractConnectorService {
|
public class DeveloperConnectorService extends BasicConnectorService {
|
||||||
|
|
||||||
private boolean connected = false;
|
private boolean connected = false;
|
||||||
private ICredentialsProvider credentialsProvider = new BasicCredentialsProvider(this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for DeveloperConnectorService.
|
* Constructor for DeveloperConnectorService.
|
||||||
|
@ -73,9 +70,4 @@ public class DeveloperConnectorService extends AbstractConnectorService {
|
||||||
// pretend. Normally, we'd disconnect from our remote server-side code here
|
// pretend. Normally, we'd disconnect from our remote server-side code here
|
||||||
connected=false;
|
connected=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
return credentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,15 +43,14 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener;
|
import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener;
|
||||||
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor;
|
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor;
|
||||||
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory;
|
import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.SystemBasePlugin;
|
import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
|
import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
|
||||||
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
|
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
|
||||||
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
|
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
|
||||||
import org.eclipse.rse.core.subsystems.IServerLauncher;
|
import org.eclipse.rse.core.subsystems.IServerLauncher;
|
||||||
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
||||||
|
@ -68,7 +67,7 @@ import org.eclipse.rse.ui.SystemPropertyResources;
|
||||||
import org.eclipse.rse.ui.actions.DisplayHidableSystemMessageAction;
|
import org.eclipse.rse.ui.actions.DisplayHidableSystemMessageAction;
|
||||||
import org.eclipse.rse.ui.actions.DisplaySystemMessageAction;
|
import org.eclipse.rse.ui.actions.DisplaySystemMessageAction;
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||||
import org.eclipse.rse.ui.subsystems.StandardCredentialsProvider;
|
import org.eclipse.rse.ui.subsystems.AbstractConnectorService;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
@ -83,7 +82,6 @@ import org.osgi.framework.Version;
|
||||||
*/
|
*/
|
||||||
public class DStoreConnectorService extends AbstractConnectorService implements IDataStoreProvider
|
public class DStoreConnectorService extends AbstractConnectorService implements IDataStoreProvider
|
||||||
{
|
{
|
||||||
private ICredentialsProvider credentialsProvider = null;
|
|
||||||
private ClientConnection clientConnection = null;
|
private ClientConnection clientConnection = null;
|
||||||
private ConnectionStatusListener _connectionStatusListener = null;
|
private ConnectionStatusListener _connectionStatusListener = null;
|
||||||
private IServerLauncher starter = null;
|
private IServerLauncher starter = null;
|
||||||
|
@ -252,13 +250,6 @@ public class DStoreConnectorService extends AbstractConnectorService implements
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
if (credentialsProvider == null) {
|
|
||||||
credentialsProvider = new DStoreCredentialsProvider(this);
|
|
||||||
}
|
|
||||||
return credentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Client IP that the RSE server is connected to. When connected,
|
* Return the Client IP that the RSE server is connected to. When connected,
|
||||||
* the client IP is obtained from the server-side. When not-connected,
|
* the client IP is obtained from the server-side. When not-connected,
|
||||||
|
@ -1349,4 +1340,30 @@ public class DStoreConnectorService extends AbstractConnectorService implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsPassword()
|
||||||
|
*/
|
||||||
|
public boolean supportsPassword() {
|
||||||
|
boolean result = super.supportsPassword();
|
||||||
|
IHost host = getHost();
|
||||||
|
String systemType = host.getSystemType();
|
||||||
|
if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsUserid()
|
||||||
|
*/
|
||||||
|
public boolean supportsUserId() {
|
||||||
|
boolean result = super.supportsUserId();
|
||||||
|
IHost host = getHost();
|
||||||
|
String systemType = host.getSystemType();
|
||||||
|
if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,48 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2007 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:
|
|
||||||
* David Dykstal (IBM) - 168977: refactoring IConnectorService
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.connectorservice.dstore;
|
|
||||||
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.ui.subsystems.StandardCredentialsProvider;
|
|
||||||
|
|
||||||
public class DStoreCredentialsProvider extends StandardCredentialsProvider {
|
|
||||||
|
|
||||||
public DStoreCredentialsProvider(DStoreConnectorService connectorService) {
|
|
||||||
super(connectorService);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsPassword()
|
|
||||||
*/
|
|
||||||
public boolean supportsPassword() {
|
|
||||||
boolean result = super.supportsPassword();
|
|
||||||
IHost host = getConnectorService().getHost();
|
|
||||||
String systemType = host.getSystemType();
|
|
||||||
if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsUserid()
|
|
||||||
*/
|
|
||||||
public boolean supportsUserId() {
|
|
||||||
boolean result = super.supportsUserId();
|
|
||||||
IHost host = getConnectorService().getHost();
|
|
||||||
String systemType = host.getSystemType();
|
|
||||||
if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,10 +17,8 @@
|
||||||
package org.eclipse.rse.internal.connectorservice.local;
|
package org.eclipse.rse.internal.connectorservice.local;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
import org.eclipse.rse.core.subsystems.BasicConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.BasicCredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System class required by the remote systems framework.
|
* System class required by the remote systems framework.
|
||||||
|
@ -28,11 +26,9 @@ import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
||||||
* Since we don't really have such a thing for local files, this
|
* Since we don't really have such a thing for local files, this
|
||||||
* is pretty well empty.
|
* is pretty well empty.
|
||||||
*/
|
*/
|
||||||
public class LocalConnectorService extends AbstractConnectorService
|
public class LocalConnectorService extends BasicConnectorService
|
||||||
{
|
{
|
||||||
|
|
||||||
private ICredentialsProvider credentialsProvider = new BasicCredentialsProvider(this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor when we don't have a subsystem yet.
|
* Constructor when we don't have a subsystem yet.
|
||||||
* Call setSubSystem after.
|
* Call setSubSystem after.
|
||||||
|
@ -45,7 +41,7 @@ public class LocalConnectorService extends AbstractConnectorService
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#disconnect(IProgressMonitor)
|
* @see org.eclipse.rse.ui.subsystems.AbstractConnectorService#disconnect(IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
protected void internalDisconnect(IProgressMonitor monitor) throws Exception
|
protected void internalDisconnect(IProgressMonitor monitor) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -98,8 +94,4 @@ public class LocalConnectorService extends AbstractConnectorService
|
||||||
return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
|
return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
return credentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -54,10 +54,8 @@ import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
|
||||||
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
||||||
import org.eclipse.rse.internal.services.ssh.ISshSessionProvider;
|
import org.eclipse.rse.internal.services.ssh.ISshSessionProvider;
|
||||||
import org.eclipse.rse.services.RemoteUtil;
|
import org.eclipse.rse.services.RemoteUtil;
|
||||||
|
@ -65,6 +63,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
import org.eclipse.rse.ui.ISystemMessages;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||||
|
import org.eclipse.rse.ui.subsystems.AbstractConnectorService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create SSH connections.
|
* Create SSH connections.
|
||||||
|
@ -76,7 +75,6 @@ public class SshConnectorService extends AbstractConnectorService implements ISs
|
||||||
private static JSch jsch=new JSch();
|
private static JSch jsch=new JSch();
|
||||||
private Session session;
|
private Session session;
|
||||||
private SessionLostHandler fSessionLostHandler;
|
private SessionLostHandler fSessionLostHandler;
|
||||||
private ICredentialsProvider credentialsProvider = null;
|
|
||||||
|
|
||||||
public SshConnectorService(IHost host) {
|
public SshConnectorService(IHost host) {
|
||||||
//TODO the port parameter doesnt really make sense here since
|
//TODO the port parameter doesnt really make sense here since
|
||||||
|
@ -706,11 +704,12 @@ public class SshConnectorService extends AbstractConnectorService implements ISs
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
public boolean requiresPassword() {
|
||||||
if (credentialsProvider == null) {
|
return false;
|
||||||
credentialsProvider = new SshCredentialsProvider(this);
|
|
||||||
}
|
}
|
||||||
return credentialsProvider;
|
|
||||||
|
public boolean requiresUserId() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2007 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:
|
|
||||||
* David Dykstal (IBM) - 168977: refactoring IConnectorService
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.connectorservice.ssh;
|
|
||||||
|
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
|
||||||
import org.eclipse.rse.ui.subsystems.StandardCredentialsProvider;
|
|
||||||
|
|
||||||
public class SshCredentialsProvider extends StandardCredentialsProvider {
|
|
||||||
|
|
||||||
public SshCredentialsProvider(IConnectorService connectorService) {
|
|
||||||
super(connectorService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean requiresPassword() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean requiresUserId() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -38,4 +38,20 @@ public abstract class AbstractCredentialsProvider implements ICredentialsProvide
|
||||||
this.suppressed = suppressed;
|
this.suppressed = suppressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final boolean supportsUserId() {
|
||||||
|
return connectorService.supportsUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final boolean requiresUserId() {
|
||||||
|
return connectorService.requiresUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final boolean supportsPassword() {
|
||||||
|
return connectorService.supportsPassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final boolean requiresPassword() {
|
||||||
|
return connectorService.requiresPassword();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,4 +539,22 @@ public abstract class AbstractDelegatingConnectorService implements IDelegatingC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean requiresPassword() {
|
||||||
|
IConnectorService conServ = getRealConnectorService();
|
||||||
|
if (conServ != null)
|
||||||
|
{
|
||||||
|
return conServ.requiresPassword();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresUserId() {
|
||||||
|
IConnectorService conServ = getRealConnectorService();
|
||||||
|
if (conServ != null)
|
||||||
|
{
|
||||||
|
return conServ.requiresUserId();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,8 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2002, 2007 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
|
|
||||||
*
|
|
||||||
* Initial Contributors:
|
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
|
||||||
********************************************************************************/
|
|
||||||
package org.eclipse.rse.core.subsystems;
|
package org.eclipse.rse.core.subsystems;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.rse.core.IRSEUserIdConstants;
|
import org.eclipse.rse.core.IRSEUserIdConstants;
|
||||||
import org.eclipse.rse.core.PasswordPersistenceManager;
|
import org.eclipse.rse.core.PasswordPersistenceManager;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
|
@ -26,38 +10,11 @@ import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||||
|
|
||||||
/**
|
public abstract class AuthenticatingConnectorService extends SuperAbstractConnectorService {
|
||||||
* This is a base class to make it easier to create connector service classes.
|
|
||||||
* <p>
|
protected ICredentialsProvider credentialsProvider = null;
|
||||||
* An {@link org.eclipse.rse.core.subsystems.IConnectorService} object
|
|
||||||
* is returned from a subsystem object via getConnectorService(), and
|
public AuthenticatingConnectorService(String name, String description, IHost host, int port) {
|
||||||
* it is used to represent the live connection to a particular subsystem.
|
|
||||||
* <p>
|
|
||||||
* You must override/implement
|
|
||||||
* <ul>
|
|
||||||
* <li>isConnected
|
|
||||||
* <li>internalConnect
|
|
||||||
* <li>internalDisconnect
|
|
||||||
* </ul>
|
|
||||||
* You should override:
|
|
||||||
* <ul>
|
|
||||||
* <li>reset
|
|
||||||
* <li>getVersionReleaseModification
|
|
||||||
* <li>getHomeDirectory
|
|
||||||
* <li>getTempDirectory
|
|
||||||
* </ul>
|
|
||||||
* You can override:
|
|
||||||
* <ul>
|
|
||||||
* <li>supportsUserId
|
|
||||||
* <li>requiresUserId
|
|
||||||
* <li>supportsPassword
|
|
||||||
* <li>requiresPassword
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
|
|
||||||
*/
|
|
||||||
public abstract class AbstractConnectorService extends SuperAbstractConnectorService implements IRSEUserIdConstants {
|
|
||||||
public AbstractConnectorService(String name, String description, IHost host, int port) {
|
|
||||||
super(name, description, host, port);
|
super(name, description, host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,26 +24,21 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
* If not it returns the userId for the primary subsystem ignoring the
|
* If not it returns the userId for the primary subsystem ignoring the
|
||||||
* cached userId.
|
* cached userId.
|
||||||
*/
|
*/
|
||||||
final public String getUserId() {
|
public final String getUserId() {
|
||||||
return getCredentialsProvider().getUserId();
|
return credentialsProvider.getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public final void setUserId(String newId) {
|
||||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#setUserId(java.lang.String)
|
String oldUserId = credentialsProvider.getUserId();
|
||||||
*/
|
|
||||||
final public void setUserId(String newId) {
|
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
|
||||||
String oldUserId = provider.getUserId();
|
|
||||||
if (oldUserId == null || oldUserId.equals(newId)) {
|
if (oldUserId == null || oldUserId.equals(newId)) {
|
||||||
updateDefaultUserId(getPrimarySubSystem(), getUserId());
|
updateDefaultUserId(getPrimarySubSystem(), getUserId());
|
||||||
provider.setUserId(newId);
|
credentialsProvider.setUserId(newId);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void saveUserId() {
|
public final void saveUserId() {
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
String userId = credentialsProvider.getUserId();
|
||||||
String userId = provider.getUserId();
|
|
||||||
updateDefaultUserId(getPrimarySubSystem(), userId);
|
updateDefaultUserId(getPrimarySubSystem(), userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,14 +54,13 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
* @param persist if this is true, clear the password from the disk cache as well
|
* @param persist if this is true, clear the password from the disk cache as well
|
||||||
* @see #clearCredentials()
|
* @see #clearCredentials()
|
||||||
*/
|
*/
|
||||||
final public void clearPassword(boolean persist, boolean propagate) {
|
public final void clearPassword(boolean persist, boolean propagate) {
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
credentialsProvider.clearPassword();
|
||||||
provider.clearPassword();
|
|
||||||
if (persist) {
|
if (persist) {
|
||||||
removePassword();
|
removePassword();
|
||||||
}
|
}
|
||||||
if (sharesCredentials() && propagate) {
|
if (sharesCredentials() && propagate) {
|
||||||
String userId = provider.getUserId();
|
String userId = credentialsProvider.getUserId();
|
||||||
clearPasswordForOtherSystemsInConnection(userId, false);
|
clearPasswordForOtherSystemsInConnection(userId, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +73,7 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
* false if the check should be made for a password in memory only.
|
* false if the check should be made for a password in memory only.
|
||||||
* @return true if the password is known, false otherwise.
|
* @return true if the password is known, false otherwise.
|
||||||
*/
|
*/
|
||||||
final public boolean hasPassword(boolean onDisk) {
|
public final boolean hasPassword(boolean onDisk) {
|
||||||
SystemSignonInformation signonInformation = getSignonInformation();
|
SystemSignonInformation signonInformation = getSignonInformation();
|
||||||
boolean cached = (signonInformation != null && signonInformation.getPassword() != null);
|
boolean cached = (signonInformation != null && signonInformation.getPassword() != null);
|
||||||
if (!cached && onDisk) {
|
if (!cached && onDisk) {
|
||||||
|
@ -149,11 +100,10 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
if (getPrimarySubSystem().forceUserIdToUpperCase()) {
|
if (getPrimarySubSystem().forceUserIdToUpperCase()) {
|
||||||
userId = userId.toUpperCase();
|
userId = userId.toUpperCase();
|
||||||
}
|
}
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
String myUserId = credentialsProvider.getUserId();
|
||||||
String myUserId = provider.getUserId();
|
|
||||||
IHost host = getHost();
|
IHost host = getHost();
|
||||||
if (host.compareUserIds(userId, myUserId)) {
|
if (host.compareUserIds(userId, myUserId)) {
|
||||||
provider.setPassword(password);
|
credentialsProvider.setPassword(password);
|
||||||
}
|
}
|
||||||
if (sharesCredentials() && propagate) {
|
if (sharesCredentials() && propagate) {
|
||||||
updatePasswordForOtherSystemsInConnection(userId, password, persist);
|
updatePasswordForOtherSystemsInConnection(userId, password, persist);
|
||||||
|
@ -166,8 +116,7 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void savePassword() {
|
public final void savePassword() {
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
ICredentials credentials = credentialsProvider.getCredentials();
|
||||||
ICredentials credentials = provider.getCredentials();
|
|
||||||
if (credentials instanceof SystemSignonInformation) {
|
if (credentials instanceof SystemSignonInformation) {
|
||||||
SystemSignonInformation signonInformation = (SystemSignonInformation) credentials;
|
SystemSignonInformation signonInformation = (SystemSignonInformation) credentials;
|
||||||
PasswordPersistenceManager.getInstance().add(signonInformation, true, true);
|
PasswordPersistenceManager.getInstance().add(signonInformation, true, true);
|
||||||
|
@ -175,61 +124,26 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removePassword() {
|
public final void removePassword() {
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
|
||||||
String systemType = getHostType();
|
String systemType = getHostType();
|
||||||
String hostName = getHostName();
|
String hostName = getHostName();
|
||||||
String userId = provider.getUserId();
|
String userId = credentialsProvider.getUserId();
|
||||||
PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId);
|
PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected final void postDisconnect() {
|
||||||
* 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 {
|
|
||||||
internalConnect(monitor);
|
|
||||||
intializeSubSystems(monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnects from the remote system.
|
|
||||||
* <p>
|
|
||||||
* You must override
|
|
||||||
* if <code>subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties</code>
|
|
||||||
* returns false.
|
|
||||||
* <p>
|
|
||||||
* If the subsystem supports server launch
|
|
||||||
* the default behavior is to use the same remote server
|
|
||||||
* launcher created in <code>connect()</code> and call <code>disconnect()</code>.
|
|
||||||
* <p>
|
|
||||||
* This is called, by default, from the <code>disconnect()</code>
|
|
||||||
* method of the subsystem.
|
|
||||||
* @see IServerLauncher#disconnect()
|
|
||||||
*/
|
|
||||||
public final void disconnect(IProgressMonitor monitor) throws Exception {
|
|
||||||
internalDisconnect(monitor);
|
|
||||||
unintializeSubSystems(monitor);
|
|
||||||
clearPassword(false, true);
|
clearPassword(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#isSuppressed()
|
|
||||||
*/
|
|
||||||
public final boolean isSuppressed() {
|
public final boolean isSuppressed() {
|
||||||
return getCredentialsProvider().isSuppressed();
|
return credentialsProvider.isSuppressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#setSuppressed(boolean)
|
|
||||||
*/
|
|
||||||
public final void setSuppressed(boolean suppressed) {
|
public final void setSuppressed(boolean suppressed) {
|
||||||
getCredentialsProvider().setSuppressed(suppressed);
|
credentialsProvider.setSuppressed(suppressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void acquireCredentials(boolean reacquire) throws InterruptedException {
|
public final void acquireCredentials(boolean reacquire) throws InterruptedException {
|
||||||
getCredentialsProvider().acquireCredentials(reacquire);
|
credentialsProvider.acquireCredentials(reacquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,8 +153,8 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
* the next call to getUserId() it is requeried from subsystem.
|
* the next call to getUserId() it is requeried from subsystem.
|
||||||
* Also clears the password.
|
* Also clears the password.
|
||||||
*/
|
*/
|
||||||
final public void clearCredentials() {
|
public final void clearCredentials() {
|
||||||
getCredentialsProvider().clearCredentials();
|
credentialsProvider.clearCredentials();
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,10 +164,9 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
* connector service. Assumes it has been set by the subsystem at the
|
* connector service. Assumes it has been set by the subsystem at the
|
||||||
* time the subsystem acquires the connector service.
|
* time the subsystem acquires the connector service.
|
||||||
*/
|
*/
|
||||||
final protected SystemSignonInformation getSignonInformation() {
|
protected final SystemSignonInformation getSignonInformation() {
|
||||||
SystemSignonInformation result = null;
|
SystemSignonInformation result = null;
|
||||||
ICredentialsProvider provider = getCredentialsProvider();
|
ICredentials credentials = credentialsProvider.getCredentials();
|
||||||
ICredentials credentials = provider.getCredentials();
|
|
||||||
result = (SystemSignonInformation) credentials;
|
result = (SystemSignonInformation) credentials;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -322,4 +235,35 @@ public abstract class AbstractConnectorService extends SuperAbstractConnectorSer
|
||||||
sr.updateHost(host, host.getSystemType(), host.getAliasName(), host.getHostName(), host.getDescription(), userId, whereToUpdate);
|
sr.updateHost(host, host.getSystemType(), host.getAliasName(), host.getHostName(), host.getDescription(), userId, whereToUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this connector service can share it's credentials
|
||||||
|
* with other connector services in this host.
|
||||||
|
* This default implementation will always return true.
|
||||||
|
* Override if necessary.
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
public boolean sharesCredentials() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this connector service can inherit the credentials of
|
||||||
|
* other connector services in this host.
|
||||||
|
* This default implementation always returns true.
|
||||||
|
* Override if necessary.
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
public boolean inheritsCredentials() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void setCredentialsProvider(ICredentialsProvider credentialsProvider) {
|
||||||
|
this.credentialsProvider = credentialsProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final ICredentialsProvider getCredentialsProvider() {
|
||||||
|
return credentialsProvider;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2002, 2007 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
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
||||||
|
********************************************************************************/
|
||||||
|
package org.eclipse.rse.core.subsystems;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 getConnectorService(), 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
|
||||||
|
* </ul>
|
||||||
|
* You should override:
|
||||||
|
* <ul>
|
||||||
|
* <li>reset
|
||||||
|
* <li>getVersionReleaseModification
|
||||||
|
* <li>getHomeDirectory
|
||||||
|
* <li>getTempDirectory
|
||||||
|
* </ul>
|
||||||
|
* You can override:
|
||||||
|
* <ul>
|
||||||
|
* <li>supportsUserId
|
||||||
|
* <li>requiresUserId
|
||||||
|
* <li>supportsPassword
|
||||||
|
* <li>requiresPassword
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
|
||||||
|
*/
|
||||||
|
public abstract class BasicConnectorService extends AuthenticatingConnectorService {
|
||||||
|
|
||||||
|
public BasicConnectorService(String name, String description, IHost host, int port) {
|
||||||
|
super(name, description, host, port);
|
||||||
|
setCredentialsProvider(new BasicCredentialsProvider(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supportsPassword() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresPassword() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supportsUserId() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresUserId() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -44,26 +44,10 @@ public class BasicCredentialsProvider extends AbstractCredentialsProvider {
|
||||||
public void repairCredentials(SystemMessage message) throws InterruptedException {
|
public void repairCredentials(SystemMessage message) throws InterruptedException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean requiresPassword() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean requiresUserId() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(String userId) {
|
public void setUserId(String userId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsPassword() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsUserId() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,4 +350,8 @@ public interface IConnectorService extends IRSEModelObject {
|
||||||
*/
|
*/
|
||||||
IServerLauncher getRemoteServerLauncher();
|
IServerLauncher getRemoteServerLauncher();
|
||||||
|
|
||||||
|
boolean requiresPassword();
|
||||||
|
|
||||||
|
boolean requiresUserId();
|
||||||
|
|
||||||
}
|
}
|
|
@ -15,32 +15,24 @@ public interface ICredentialsProvider {
|
||||||
|
|
||||||
void acquireCredentials(boolean reacquire) throws InterruptedException;
|
void acquireCredentials(boolean reacquire) throws InterruptedException;
|
||||||
|
|
||||||
|
void repairCredentials(SystemMessage message)throws InterruptedException;
|
||||||
|
|
||||||
void clearCredentials();
|
void clearCredentials();
|
||||||
|
|
||||||
|
ICredentials getCredentials();
|
||||||
|
|
||||||
void clearPassword();
|
void clearPassword();
|
||||||
|
|
||||||
ICredentials getCredentials();
|
void setPassword(String password);
|
||||||
|
|
||||||
|
void setUserId(String userId);
|
||||||
|
|
||||||
String getUserId();
|
String getUserId();
|
||||||
|
|
||||||
boolean isSuppressed();
|
boolean isSuppressed();
|
||||||
|
|
||||||
void repairCredentials(SystemMessage message)throws InterruptedException;
|
|
||||||
|
|
||||||
boolean requiresPassword();
|
|
||||||
|
|
||||||
boolean requiresUserId();
|
|
||||||
|
|
||||||
void setPassword(String password);
|
|
||||||
|
|
||||||
void setSuppressed(boolean suppressed);
|
void setSuppressed(boolean suppressed);
|
||||||
|
|
||||||
void setUserId(String userId);
|
|
||||||
|
|
||||||
boolean supportsPassword();
|
|
||||||
|
|
||||||
boolean supportsUserId();
|
|
||||||
|
|
||||||
IConnectorService getConnectorService();
|
IConnectorService getConnectorService();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,44 +333,42 @@ public abstract class SuperAbstractConnectorService extends RSEModelObject imple
|
||||||
return getPort();
|
return getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 {
|
||||||
|
internalConnect(monitor);
|
||||||
|
intializeSubSystems(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnects from the remote system.
|
||||||
|
* <p>
|
||||||
|
* You must override
|
||||||
|
* if <code>subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties</code>
|
||||||
|
* returns false.
|
||||||
|
* <p>
|
||||||
|
* If the subsystem supports server launch
|
||||||
|
* the default behavior is to use the same remote server
|
||||||
|
* launcher created in <code>connect()</code> and call <code>disconnect()</code>.
|
||||||
|
* <p>
|
||||||
|
* This is called, by default, from the <code>disconnect()</code>
|
||||||
|
* method of the subsystem.
|
||||||
|
* @see IServerLauncher#disconnect()
|
||||||
|
*/
|
||||||
|
public final void disconnect(IProgressMonitor monitor) throws Exception {
|
||||||
|
internalDisconnect(monitor);
|
||||||
|
unintializeSubSystems(monitor);
|
||||||
|
postDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void internalConnect(IProgressMonitor monitor) throws Exception;
|
protected abstract void internalConnect(IProgressMonitor monitor) throws Exception;
|
||||||
|
|
||||||
protected abstract void internalDisconnect(IProgressMonitor monitor) throws Exception;
|
protected abstract void internalDisconnect(IProgressMonitor monitor) throws Exception;
|
||||||
|
|
||||||
protected abstract ICredentialsProvider getCredentialsProvider();
|
protected abstract void postDisconnect();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this connector service can share it's credentials
|
|
||||||
* with other connector services in this host.
|
|
||||||
* This default implementation will always return true.
|
|
||||||
* Override if necessary.
|
|
||||||
* @return true
|
|
||||||
*/
|
|
||||||
public boolean sharesCredentials() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this connector service can inherit the credentials of
|
|
||||||
* other connector services in this host.
|
|
||||||
* This default implementation always returns true.
|
|
||||||
* Override if necessary.
|
|
||||||
* @return true
|
|
||||||
*/
|
|
||||||
public boolean inheritsCredentials() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final boolean supportsPassword() {
|
|
||||||
ICredentialsProvider cp = getCredentialsProvider();
|
|
||||||
boolean result = cp.supportsPassword();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final boolean supportsUserId() {
|
|
||||||
ICredentialsProvider cp = getCredentialsProvider();
|
|
||||||
boolean result = cp.supportsUserId();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,12 +26,10 @@ import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.IPropertySet;
|
import org.eclipse.rse.core.model.IPropertySet;
|
||||||
import org.eclipse.rse.core.model.PropertyType;
|
import org.eclipse.rse.core.model.PropertyType;
|
||||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
import org.eclipse.rse.internal.services.files.ftp.FTPService;
|
import org.eclipse.rse.internal.services.files.ftp.FTPService;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
import org.eclipse.rse.subsystems.files.core.SystemFileResources;
|
import org.eclipse.rse.subsystems.files.core.SystemFileResources;
|
||||||
import org.eclipse.rse.ui.subsystems.StandardCredentialsProvider;
|
import org.eclipse.rse.ui.subsystems.AbstractConnectorService;
|
||||||
import org.eclipse.ui.console.ConsolePlugin;
|
import org.eclipse.ui.console.ConsolePlugin;
|
||||||
import org.eclipse.ui.console.IConsole;
|
import org.eclipse.ui.console.IConsole;
|
||||||
import org.eclipse.ui.console.MessageConsole;
|
import org.eclipse.ui.console.MessageConsole;
|
||||||
|
@ -42,7 +40,6 @@ public class FTPConnectorService extends AbstractConnectorService
|
||||||
{
|
{
|
||||||
protected FTPService _ftpService;
|
protected FTPService _ftpService;
|
||||||
private IPropertySet _propertySet;
|
private IPropertySet _propertySet;
|
||||||
private ICredentialsProvider credentialsProvider = null;
|
|
||||||
|
|
||||||
public FTPConnectorService(IHost host, int port)
|
public FTPConnectorService(IHost host, int port)
|
||||||
{
|
{
|
||||||
|
@ -107,13 +104,6 @@ public class FTPConnectorService extends AbstractConnectorService
|
||||||
_ftpService.disconnect();
|
_ftpService.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
if (credentialsProvider == null) {
|
|
||||||
credentialsProvider = new StandardCredentialsProvider(this);
|
|
||||||
}
|
|
||||||
return credentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isConnected()
|
public boolean isConnected()
|
||||||
{
|
{
|
||||||
return (_ftpService != null && _ftpService.isConnected());
|
return (_ftpService != null && _ftpService.isConnected());
|
||||||
|
|
|
@ -22,12 +22,12 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
||||||
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
|
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
|
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
|
||||||
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
||||||
|
import org.eclipse.rse.core.subsystems.SuperAbstractConnectorService;
|
||||||
import org.eclipse.rse.ui.SystemMenuManager;
|
import org.eclipse.rse.ui.SystemMenuManager;
|
||||||
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
|
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
@ -54,7 +54,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
* This class is typically used together with:</p>
|
* This class is typically used together with:</p>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link org.eclipse.rse.core.servicesubsystem.ServiceSubSystem} for the subsystem
|
* <li>{@link org.eclipse.rse.core.servicesubsystem.ServiceSubSystem} for the subsystem
|
||||||
* <li>{@link AbstractConnectorService} for the connector service
|
* <li>{@link SuperAbstractConnectorService} for the connector service
|
||||||
* <li>{@link AbstractConnectorServiceManager} for the connector service manager
|
* <li>{@link AbstractConnectorServiceManager} for the connector service manager
|
||||||
* <li>{@link org.eclipse.rse.core.subsystems.AbstractResource} for the individual remote resources
|
* <li>{@link org.eclipse.rse.core.subsystems.AbstractResource} for the individual remote resources
|
||||||
* </ul>
|
* </ul>
|
||||||
|
@ -63,7 +63,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
* this class, and ignore the hundreds in {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration}
|
* this class, and ignore the hundreds in {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration}
|
||||||
*
|
*
|
||||||
* @see org.eclipse.rse.core.servicesubsystem.ServiceSubSystem
|
* @see org.eclipse.rse.core.servicesubsystem.ServiceSubSystem
|
||||||
* @see AbstractConnectorService
|
* @see SuperAbstractConnectorService
|
||||||
* @see AbstractConnectorServiceManager
|
* @see AbstractConnectorServiceManager
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2531,7 +2531,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
/**
|
/**
|
||||||
* Return the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system.
|
* Return the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system.
|
||||||
* This must return an object that implements {@link IConnectorService}. A good starting point for that
|
* This must return an object that implements {@link IConnectorService}. A good starting point for that
|
||||||
* is the base class {@link AbstractConnectorService}.
|
* is the base class {@link SuperAbstractConnectorService}.
|
||||||
* <p>If you only have a single subsystem class, you may override this method to return the
|
* <p>If you only have a single subsystem class, you may override this method to return the
|
||||||
* IConnectorService object that manages the connect/disconnect actions. If, on the other hand,
|
* IConnectorService object that manages the connect/disconnect actions. If, on the other hand,
|
||||||
* you have multiple subsystem classes that desire to share a single IConnectorService connection,
|
* you have multiple subsystem classes that desire to share a single IConnectorService connection,
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2002, 2007 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
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
||||||
|
********************************************************************************/
|
||||||
|
package org.eclipse.rse.ui.subsystems;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
import org.eclipse.rse.core.subsystems.AuthenticatingConnectorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 getConnectorService(), 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
|
||||||
|
* </ul>
|
||||||
|
* You should override:
|
||||||
|
* <ul>
|
||||||
|
* <li>reset
|
||||||
|
* <li>getVersionReleaseModification
|
||||||
|
* <li>getHomeDirectory
|
||||||
|
* <li>getTempDirectory
|
||||||
|
* </ul>
|
||||||
|
* You can override:
|
||||||
|
* <ul>
|
||||||
|
* <li>supportsUserId
|
||||||
|
* <li>requiresUserId
|
||||||
|
* <li>supportsPassword
|
||||||
|
* <li>requiresPassword
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
|
||||||
|
*/
|
||||||
|
public abstract class AbstractConnectorService extends AuthenticatingConnectorService {
|
||||||
|
|
||||||
|
public AbstractConnectorService(String name, String description, IHost host, int port) {
|
||||||
|
super(name, description, host, port);
|
||||||
|
setCredentialsProvider(new StandardCredentialsProvider(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supportsPassword() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresPassword() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supportsUserId() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresUserId() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,7 +18,6 @@ import org.eclipse.rse.core.subsystems.ICredentials;
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.SuperAbstractConnectorService;
|
|
||||||
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
|
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
|
||||||
import org.eclipse.rse.logging.Logger;
|
import org.eclipse.rse.logging.Logger;
|
||||||
import org.eclipse.rse.logging.LoggerFactory;
|
import org.eclipse.rse.logging.LoggerFactory;
|
||||||
|
@ -43,7 +42,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
* It uses a {@link PasswordPersistenceManager} to store the passwords in the
|
* It uses a {@link PasswordPersistenceManager} to store the passwords in the
|
||||||
* keychain keyed by {@link IHost} and possibly by {@link ISubSystemConfiguration}.
|
* keychain keyed by {@link IHost} and possibly by {@link ISubSystemConfiguration}.
|
||||||
* <p>
|
* <p>
|
||||||
* This is suitable for use by subclasses of {@link SuperAbstractConnectorService}
|
* This is suitable for use by subclasses of {@link AbstractConnectorService}
|
||||||
* that wish to provide prompting and persistence for userids and passwords when
|
* that wish to provide prompting and persistence for userids and passwords when
|
||||||
* connecting.
|
* connecting.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -231,14 +230,6 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
|
||||||
promptForNewPassword(prompt);
|
promptForNewPassword(prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean requiresPassword() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean requiresUserId() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
@ -275,14 +266,6 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsPassword() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsUserId() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <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 and password.
|
* Instantiates and returns the dialog to prompt for the userId and password.
|
||||||
|
|
|
@ -13,14 +13,11 @@ package org.eclipse.rse.tests.internal.testsubsystem;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
import org.eclipse.rse.core.subsystems.BasicConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.BasicCredentialsProvider;
|
|
||||||
import org.eclipse.rse.core.subsystems.ICredentialsProvider;
|
|
||||||
|
|
||||||
public class TestSubSystemConnectorService extends AbstractConnectorService {
|
public class TestSubSystemConnectorService extends BasicConnectorService {
|
||||||
|
|
||||||
private boolean connected = false;
|
private boolean connected = false;
|
||||||
private ICredentialsProvider credentialsProvider = new BasicCredentialsProvider(this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -54,10 +51,4 @@ public class TestSubSystemConnectorService extends AbstractConnectorService {
|
||||||
connected = false;
|
connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.rse.core.subsystems.SuperAbstractConnectorService#getCredentialsProvider()
|
|
||||||
*/
|
|
||||||
protected ICredentialsProvider getCredentialsProvider() {
|
|
||||||
return credentialsProvider;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue