1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

[168977][api][refactor] - stage 1

1) Create new ICredentials, ICredentialsProvider, and SuperAbstractConnectorService (temporary)
2) Move most non-password methods to SuperAbstractConnectorService.
3) Rationalize the user of ServerLaunchers.
4) make internalConnect and internalDisconnect abstract.
This commit is contained in:
David Dykstal 2007-03-07 21:44:36 +00:00
parent decd4ea3e6
commit c2580e2844
20 changed files with 507 additions and 656 deletions

View file

@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - adapted template for daytime example.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.examples.daytime.connectorservice;
@ -71,19 +72,6 @@ public class DaytimeConnectorService extends AbstractConnectorService {
public void internalDisconnect(IProgressMonitor monitor) throws Exception {
fIsConnected = false;
super.internalDisconnect(monitor);
}
public boolean hasRemoteServerLauncherProperties() {
return false;
}
public boolean supportsRemoteServerLaunching() {
return false;
}
public boolean supportsServerLaunchProperties() {
return false;
}
/**

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation and others. 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
@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package samples.subsystems;
@ -57,7 +58,6 @@ public class DeveloperConnectorService extends AbstractConnectorService {
*/
protected void internalConnect(IProgressMonitor monitor) throws Exception
{
super.internalConnect(monitor);
// pretend. Normally, we'd connect to our remote server-side code here
connected=true;
}
@ -67,35 +67,10 @@ public class DeveloperConnectorService extends AbstractConnectorService {
*/
public void internalDisconnect(IProgressMonitor monitor) throws Exception
{
super.internalDisconnect(monitor);
// pretend. Normally, we'd disconnect from our remote server-side code here
connected=false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsRemoteServerLaunching()
*/
public boolean supportsRemoteServerLaunching()
{
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#hasRemoteServerLauncherProperties()
*/
public boolean hasRemoteServerLauncherProperties()
{
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsServerLaunchProperties()
*/
public boolean supportsServerLaunchProperties()
{
return false;
}
/**
* @return false
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsPassword()

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* 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
@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.connectorservice.dstore;
@ -85,6 +85,8 @@ public class DStoreConnectorService extends AbstractConnectorService implements
private ClientConnection clientConnection = null;
private ConnectionStatusListener _connectionStatusListener = null;
private IServerLauncher starter = null;
private IServerLauncherProperties _remoteServerLauncherProperties = null;
// Shortcut to sysInfo to save time
private transient DataElement sysInfo = null;
@ -93,10 +95,6 @@ public class DStoreConnectorService extends AbstractConnectorService implements
private static String DSTORE_PACKAGE = "org.eclipse.dstore.core"; //$NON-NLS-1$
private Exception connectException;
//private Hashtable restrictedTypes = null;
private IServerLauncher starter;
private class ShowConnectMessage implements Runnable
{
private SystemMessage _msg;
@ -448,6 +446,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
*/
public IServerLauncher getRemoteServerLauncher()
{
if (starter == null)
starter = new RexecDstoreServer();
((RexecDstoreServer)starter).setClientConnection(clientConnection);
@ -455,6 +454,22 @@ public class DStoreConnectorService extends AbstractConnectorService implements
return starter;
}
public IServerLauncherProperties getRemoteServerLauncherProperties() {
return _remoteServerLauncherProperties;
}
public void setRemoteServerLauncherProperties(IServerLauncherProperties newRemoteServerLauncher) {
if (_remoteServerLauncherProperties != newRemoteServerLauncher)
{
_remoteServerLauncherProperties = newRemoteServerLauncher;
setDirty(true);
}
}
public boolean hasRemoteServerLauncherProperties() {
return _remoteServerLauncherProperties != null;
}
/**
@ -1303,20 +1318,11 @@ public class DStoreConnectorService extends AbstractConnectorService implements
// }
// }
public boolean hasRemoteServerLauncherProperties()
{
return getRemoteServerLauncherProperties() != null;
}
public boolean supportsRemoteServerLaunching()
{
return true;
}
public boolean supportsServerLaunchProperties()
{
return true;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* 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
@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.internal.connectorservice.local;
@ -94,24 +94,6 @@ public class LocalConnectorService extends AbstractConnectorService
return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
}
public boolean hasRemoteServerLauncherProperties()
{
return false;
}
public boolean supportsRemoteServerLaunching()
{
return false;
}
public boolean supportsServerLaunchProperties()
{
return false;
}
/**
* @return false
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsPassword()

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
*******************************************************************************/
package org.eclipse.rse.internal.connectorservice.ssh;
@ -703,18 +704,6 @@ public class SshConnectorService extends AbstractConnectorService implements ISs
return false;
}
public boolean hasRemoteServerLauncherProperties() {
return false;
}
public boolean supportsRemoteServerLaunching() {
return false;
}
public boolean supportsServerLaunchProperties() {
return false;
}
/**
* @return false
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#requiresPassword()

View file

@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.model;
@ -33,6 +33,14 @@ public class RSEModelResources extends NLS {
public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION;
public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
public static String RESID_PROP_SERVERLAUNCHER_MEANS_LABEL;
public static String RESID_PROP_SERVERLAUNCHER_PATH;
public static String RESID_PROP_SERVERLAUNCHER_INVOCATION;
public static String RESID_CONNECTION_DAEMON_PORT_LABEL;
public static String RESID_CONNECTION_PORT_LABEL;
public static String RESID_SUBSYSTEM_AUTODETECT_LABEL;
static {
// load message values from bundle file

View file

@ -11,7 +11,7 @@
# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
#
# Contributors:
# {Name} (company) - description of contribution.
# David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
################################################################################
# NLS_MESSAGEFORMAT_VAR
@ -25,3 +25,10 @@ RESID_MODELOBJECTS_PROFILE_DESCRIPTION=Your profile is the object with which all
RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION=The Server Launcher is an object for storing configuration details about how to launch servers on the remote host.
RESID_MODELOBJECTS_FILTER_DESCRIPTION=A filter is a collection of filter strings that determines which files will pass through it.
RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION=A filter pool is a group of filters. There is one filter pool associated with each profile.
RESID_SUBSYSTEM_AUTODETECT_LABEL=Auto-detect SSL
RESID_PROP_SERVERLAUNCHER_MEANS_LABEL=Launcher
RESID_PROP_SERVERLAUNCHER_PATH=Path to installed server on host
RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command
RESID_CONNECTION_PORT_LABEL=Port
RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* 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
@ -11,11 +11,13 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.model;
import org.eclipse.rse.core.subsystems.ICredentials;
/**
* This class encapsulates the signon information required for a remote system. This class
* must be secure and never disclose the password for the remote system in its unencrypted form.
@ -24,7 +26,7 @@ package org.eclipse.rse.core.model;
*
* @author yantzi
*/
public final class SystemSignonInformation {
public final class SystemSignonInformation implements ICredentials {
private String _hostname;
private String _userid;

View file

@ -0,0 +1,13 @@
/********************************************************************************
* 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
*
* Initial Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public interface ICredentials {
}

View file

@ -0,0 +1,13 @@
/********************************************************************************
* 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
*
* Initial Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public interface ICredentialsProvider {
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2004, 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
@ -11,20 +11,19 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import java.util.Arrays;
import java.util.List;
import org.eclipse.rse.core.internal.subsystems.RemoteServerLauncherConstants;
import org.eclipse.rse.core.internal.subsystems.ServerLauncher;
import org.eclipse.rse.core.model.IProperty;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertyType;
import org.eclipse.rse.core.model.PropertyType;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.internal.core.subsystems.ServerLauncher;
/**
@ -36,7 +35,7 @@ import org.eclipse.rse.ui.SystemResources;
* user a number of ways to start that remote server from the client, as well to connect
* to it if it is already running. This class encapsulates the properties to support that.
* <p>
* Create instances via {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#createServerLauncher(IConnectorService)}
* Create instances via {@link ISubSystemConfiguration#createServerLauncher(IConnectorService)}
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
@ -97,7 +96,7 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
protected IPropertyType _serverLauncherEnumType;
protected RemoteServerLauncher(String name, IConnectorService connectorService)
public RemoteServerLauncher(String name, IConnectorService connectorService)
{
super(name, connectorService);
}
@ -140,14 +139,14 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
try
{
IProperty launchTypeProperty = set.getProperty(KEY_SERVER_LAUNCH_TYPE_NAME);
launchTypeProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL);
launchTypeProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL);
String launchTypeName = launchTypeProperty.getValue();
_serverLaunchType = ServerLaunchType.get(launchTypeName);
IProperty daemonPortProperty = set.getProperty(KEY_DAEMON_PORT);
boolean daemon = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.DAEMON;
daemonPortProperty.setEnabled(daemon);
daemonPortProperty.setLabel(SystemResources.RESID_CONNECTION_DAEMON_PORT_LABEL);
daemonPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_DAEMON_PORT_LABEL);
_daemonPort = Integer.parseInt(daemonPortProperty.getValue());
@ -156,7 +155,7 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
{
boolean autoDetect = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.REXEC;
autoDetectProperty.setEnabled(autoDetect);
autoDetectProperty.setLabel(SystemResources.RESID_SUBSYSTEM_AUTODETECT_LABEL);
autoDetectProperty.setLabel(RSEModelResources.RESID_SUBSYSTEM_AUTODETECT_LABEL);
_autoDetectSSL = Boolean.getBoolean(autoDetectProperty.getValue());
}
@ -164,18 +163,18 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
boolean usingRexec = _serverLaunchType != null && _serverLaunchType.getType() == ServerLaunchType.REXEC;
IProperty rexecPortProperty = set.getProperty(KEY_REXEC_PORT);
rexecPortProperty.setEnabled(usingRexec);
rexecPortProperty.setLabel(SystemResources.RESID_CONNECTION_PORT_LABEL);
rexecPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_PORT_LABEL);
_rexecPort = Integer.parseInt(rexecPortProperty.getValue());
IProperty serverPathProperty = set.getProperty(KEY_SERVER_PATH);
serverPathProperty.setEnabled(usingRexec);
serverPathProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_PATH);
serverPathProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_PATH);
_serverPath = serverPathProperty.getValue();
IProperty serverScriptProperty = set.getProperty(KEY_SERVER_SCRIPT);
serverScriptProperty.setEnabled(usingRexec);
serverScriptProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION);
serverScriptProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_INVOCATION);
_serverScript = serverScriptProperty.getValue();
_hasSetServerLaunchType = true;
@ -199,28 +198,28 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
if (_serverLaunchType == null)
_serverLaunchType = ServerLaunchType.get(ServerLaunchType.DAEMON);
IProperty launchTypeProperty = set.addProperty(KEY_SERVER_LAUNCH_TYPE_NAME, _serverLaunchType.getName(), getServerLauncherPropertyType());
launchTypeProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL);
launchTypeProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL);
IProperty daemonPortProperty = set.addProperty(KEY_DAEMON_PORT, ""+_daemonPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$
daemonPortProperty.setEnabled(_serverLaunchType.getType() == ServerLaunchType.DAEMON);
daemonPortProperty.setLabel(SystemResources.RESID_CONNECTION_DAEMON_PORT_LABEL);
daemonPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_DAEMON_PORT_LABEL);
IProperty rexecPortProperty = set.addProperty(KEY_REXEC_PORT, ""+_rexecPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$
boolean usingRexec = _serverLaunchType.getType() == ServerLaunchType.REXEC;
rexecPortProperty.setEnabled(usingRexec);
rexecPortProperty.setLabel(SystemResources.RESID_CONNECTION_PORT_LABEL);
rexecPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_PORT_LABEL);
IProperty autoDetectSSLProperty = set.addProperty(KEY_AUTODETECT_SSL, ""+_autoDetectSSL, PropertyType.getBooleanPropertyType()); //$NON-NLS-1$
autoDetectSSLProperty.setEnabled(usingRexec);
autoDetectSSLProperty.setLabel(SystemResources.RESID_SUBSYSTEM_AUTODETECT_LABEL);
autoDetectSSLProperty.setLabel(RSEModelResources.RESID_SUBSYSTEM_AUTODETECT_LABEL);
IProperty serverPathProperty = set.addProperty(KEY_SERVER_PATH, ""+_serverPath); //$NON-NLS-1$
serverPathProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_PATH);
serverPathProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_PATH);
serverPathProperty.setEnabled(usingRexec);
IProperty serverScriptProperty = set.addProperty(KEY_SERVER_SCRIPT, ""+_serverScript); //$NON-NLS-1$
serverScriptProperty.setEnabled(usingRexec);
serverScriptProperty.setLabel(SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION);
serverScriptProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_INVOCATION);
}
@ -430,7 +429,7 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
* If {@link #enableServerLaunchType(ServerLaunchType,boolean)} has not been
* called for this server launch type, then we defer to the subsystem factory's
* method:
* {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}.
* {@link ISubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType
*/
public boolean isEnabledServerLaunchType(ServerLaunchType serverLaunchType)

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 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
@ -11,10 +11,10 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.internal.subsystems;
package org.eclipse.rse.core.subsystems;
/**
* This interface defines constants for the Remote Server Launcher.

View file

@ -0,0 +1,365 @@
/********************************************************************************
* 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 java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.RSEModelObject;
public abstract class SuperAbstractConnectorService extends RSEModelObject implements IConnectorService {
private Vector commListeners = new Vector(5);
private ISubSystem _primarySubSystem = null;
private List _registeredSubSystems = new ArrayList();
private IHost _host;
private String _description;
private String _name;
private int _port;
private boolean _usingSSL;
/**
* The result of calling launch in the server launcher object, in the connect method
*/
protected Object launchResult;
/**
* The result of calling connect in the server launcher object, in the connect method
*/
protected Object connectResult;
public SuperAbstractConnectorService(String name, String description, IHost host, int port) {
_name = name;
_description = description;
_host = host;
_port = port;
}
public boolean supportsRemoteServerLaunching() {
return false;
}
public boolean supportsServerLaunchProperties() {
return false;
}
public IServerLauncherProperties getRemoteServerLauncherProperties() {
return null;
}
public void setRemoteServerLauncherProperties(IServerLauncherProperties newRemoteServerLauncher) {
}
public boolean hasRemoteServerLauncherProperties() {
return false;
}
/**
* <i>Fully implemented, no need to override.</i><br>
* @see IConnectorService#addCommunicationsListener(ICommunicationsListener)
*/
public void addCommunicationsListener(ICommunicationsListener listener) {
if (!commListeners.contains(listener)) {
commListeners.add(listener);
}
}
/**
* <i>Fully implemented, no need to override.</i><br>
* @see IConnectorService#removeCommunicationsListener(ICommunicationsListener)
*/
public void removeCommunicationsListener(ICommunicationsListener listener) {
commListeners.remove(listener);
}
/**
* <i><b>Private</b> - used internally.</i><br>
* Returns the count of active communication listeners (i.e. excludes
* passive listeners.)
*/
protected int getCommunicationListenerCount() {
int count = 0;
for (int i = 0; i < commListeners.size(); i++)
{
if (!((ICommunicationsListener) commListeners.get(i)).isPassiveCommunicationsListener())
{
count++;
}
}
return count;
}
/**
* <i><b>Private</b> - used internally.</i><br>
*/
protected void clearCommunicationListeners() {
commListeners.clear();
}
public final IHost getHost() {
return _host;
}
public final void setHost(IHost host) {
_host = host;
}
/**
* <i><b>Private</b> - used internally.</i><br>
* Helper method for firing communication events
*/
protected void fireCommunicationsEvent(int eventType) {
CommunicationsEvent e = new CommunicationsEvent(this, eventType);
Object[] items = commListeners.toArray();
for (int loop=0; loop < items.length; loop++) {
((ICommunicationsListener) items[loop]).communicationsStateChange(e);
}
}
public final String getDescription() {
return _description;
}
/**
*
*/
public final String getName() {
return _name;
}
public void setPort(int port) {
if (port != _port)
{
_port = port;
setDirty(true);
}
}
public int getPort() {
return _port;
}
public final ISubSystem getPrimarySubSystem() {
if (_primarySubSystem == null)
{
if (_registeredSubSystems.size() == 0)
{
}
else
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
_primarySubSystem = ss.getPrimarySubSystem();
}
}
return _primarySubSystem;
}
/**
* Set the subsystem, when its not known at constructor time
*/
public void registerSubSystem(ISubSystem ss) {
if (!_registeredSubSystems.contains(ss))
{
_registeredSubSystems.add(ss);
}
}
/**
* Removes the subsystem from teh list
* @param ss
*/
public final void deregisterSubSystem(ISubSystem ss) {
_registeredSubSystems.remove(ss);
}
public boolean commit() {
return RSECorePlugin.getThePersistenceManager().commit(getHost());
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the home directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getHomeDirectory() {
return ""; //$NON-NLS-1$
}
/**
* <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 final String getHostType() {
return getHost().getSystemType();
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the host name for the connection this system's subsystem is associated with:</br>
* <code>getSubSystem().getSystemConnection().getHostName()</code>
*/
public final String getHostName() {
return getHost().getHostName();
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the version, release, modification of the remote system,
* if connected, if applicable and if available. Else return null. It
* is up to each subsystem to decide how to interpret what is returned.<br>
* This is used to show the VRM in the property sheet, when the subsystem is selected.
* <p>
* Up to each implementer to decide if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getVersionReleaseModification() {
return ""; //$NON-NLS-1$
}
protected void intializeSubSystems(IProgressMonitor monitor) {
for (int i = 0; i < _registeredSubSystems.size(); i++)
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i);
ss.initializeSubSystem(monitor);
}
}
protected void unintializeSubSystems(IProgressMonitor monitor) {
for (int i = 0; i < _registeredSubSystems.size(); i++)
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i);
ss.uninitializeSubSystem(monitor);
}
}
/**
* <i>Optionally override if you add any instance variables.</i><br>
* The following is called whenever a system is redefined or disconnected.
* Each subsystem needs to be informed so it can clear out any expansions, etc.
* By default it does nothing. Override if you have an internal object that must be nulled out.
*/
public void reset() {
}
public void notifyDisconnection() {
// Fire comm event to signal state changed
if (!isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_DISCONNECT);
}
public void notifyConnection() {
if (isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_CONNECT);
}
public void notifyError() {
fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR);
}
public boolean isUsingSSL() {
return _usingSSL;
}
public void setIsUsingSSL(boolean flag) {
if (_usingSSL != flag)
{
_usingSSL = flag;
setDirty(true);
}
}
/**
* Return the port to use for connecting to the remote server, once it is running.
* By default, this is the subsystem's port property, via {@link #getPort()}.
* Override if appropriate.
* <br> This is called by the default implementation of {@link #connect(IProgressMonitor)}, if
* subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties() is true.
*/
protected int getConnectPort() {
return getPort();
}
public final ISubSystem[] getSubSystems() {
return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]);
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the temp directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getTempDirectory() {
return ""; //$NON-NLS-1$
}
/**
* This methods returns the enablement state per server launch type.
* If {@link RemoteServerLauncher#enableServerLaunchType(ServerLaunchType, boolean)} has not been
* called for this server launch type, then it is enabled by default.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType
*/
protected boolean isEnabledServerLaunchType(ISubSystem subsystem, ServerLaunchType serverLaunchType) {
IServerLauncherProperties sl = getRemoteServerLauncherProperties();
if (sl instanceof RemoteServerLauncher)
{
RemoteServerLauncher isl = (RemoteServerLauncher)sl;
return isl.isEnabledServerLaunchType(serverLaunchType);
}
else
return subsystem.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType);
}
/**
* Return the remote server launcher, which implements IServerLauncher.
* This is called by the default implementation of connect() and disconnect(), if
* subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties returns true.
* <p>This returns null be default!
*/
public IServerLauncher getRemoteServerLauncher() {
return null;
}
/**
* <i>You must override</i>
* unless subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties
* returns true.
* <p>
* Attempt to connect to the remote system.<br>
* If the subsystem supports server launch,
* 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.
*/
protected abstract void internalConnect(IProgressMonitor monitor) throws Exception;
protected abstract void internalDisconnect(IProgressMonitor monitor) throws Exception;
}

View file

@ -11,16 +11,16 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.internal.subsystems;
package org.eclipse.rse.internal.core.subsystems;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.model.RSEModelResources;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.ui.RSEUIPlugin;
public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties
@ -101,7 +101,7 @@ public abstract class ServerLauncher extends RSEModelObject implements IServerLa
public boolean commit()
{
return RSEUIPlugin.getThePersistenceManager().commit(getConnectorService().getHost());
return RSECorePlugin.getThePersistenceManager().commit(getConnectorService().getHost());
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation and others. 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
@ -14,6 +14,7 @@
* Javier Montalvo Orus (Symbian) - Bug 140348 - FTP did not use port number
* Javier Montalvo Orus (Symbian) - Bug 161209 - Need a Log of ftp commands
* Javier Montalvo Orus (Symbian) - Bug 169680 - [ftp] FTP files subsystem and service should use passive mode
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.connectorservice;
@ -103,26 +104,9 @@ public class FTPConnectorService extends AbstractConnectorService
_ftpService.disconnect();
}
public boolean hasRemoteServerLauncherProperties()
{
return false;
}
public boolean supportsRemoteServerLaunching()
{
return false;
}
public boolean isConnected()
public boolean isConnected()
{
return (_ftpService != null && _ftpService.isConnected());
}
public boolean supportsServerLaunchProperties()
{
return false;
}
}

View file

@ -14,6 +14,7 @@
* David Dykstal (IBM) - moved SystemPreferencesManager to a new package
* - created and used RSEPreferencesManager
* Uwe Stieber (Wind River) - bugfixing and reworked new connection wizard
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.ui;
@ -911,14 +912,14 @@ public class SystemConnectionForm implements Listener, IRSEUserIdConstants, Sele
}
// ---------------------------------------------------
// connection name: Don't set during context creation!
// connection name
// ---------------------------------------------------
if (defaultConnectionName != null && contentsCreated)
if (defaultConnectionName != null)
textConnectionName.setText(defaultConnectionName);
textConnectionName.setTextLimit(connectionNameLength);
// -----------
// host name
// host name (address)
// -----------
if (defaultHostName != null) {
textHostName.setText(defaultHostName);

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* 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
@ -11,13 +11,13 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.ui.widgets;
import org.eclipse.rse.core.internal.subsystems.RemoteServerLauncherConstants;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.RemoteServerLauncherConstants;
import org.eclipse.rse.core.subsystems.ServerLaunchType;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBaseForm;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* 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
@ -11,13 +11,12 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.IRSEUserIdConstants;
@ -25,7 +24,6 @@ import org.eclipse.rse.core.PasswordPersistenceManager;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
import org.eclipse.rse.logging.Logger;
@ -75,41 +73,12 @@ import org.eclipse.ui.PlatformUI;
*
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
*/
public abstract class AbstractConnectorService extends RSEModelObject implements IConnectorService, IRSEUserIdConstants
public abstract class AbstractConnectorService extends SuperAbstractConnectorService implements IRSEUserIdConstants
{
private ISubSystem _primarySubSystem;
private List _registeredSubSystems;
private String _name, _description;
private int _port;
private String _userId;
private boolean _usingSSL;
private IHost _host;
/**
* The cached value of the '{@link #getRemoteServerLauncher() <em>Remote Server Launcher</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRemoteServerLauncher()
* @generated
* @ordered
*/
protected IServerLauncherProperties _remoteServerLauncherProperties = null;
private transient SystemSignonInformation _passwordInfo;
protected Shell shell;
private Vector commListeners = new Vector(5);
private IServerLauncher starter;
/**
* The result of calling launch in the server launcher object, in the connect method
*/
protected Object launchResult;
/**
* The result of calling connect in the server launcher object, in the connect method
*/
protected Object connectResult;
// dy: March 24, 2003 Added _suppressSignonPrompt flag to suppress prompting the
// user to signon if they already cancelled signon. Then intent is to allows tools
// writers to prevent multiple signon prompts during a "transaction" if the user cancel
@ -119,142 +88,10 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
public AbstractConnectorService(String name, String description, IHost host, int port)
{
super();
_name = name;
_description = description;
_port = port;
_host = host;
_registeredSubSystems = new ArrayList();
super(name, description, host, port);
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the version, release, modification of the remote system,
* if connected, if applicable and if available. Else return null. It
* is up to each subsystem to decide how to interpret what is returned.<br>
* This is used to show the VRM in the property sheet, when the subsystem is selected.
* <p>
* Up to each implementer to decide if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getVersionReleaseModification()
{
return ""; //$NON-NLS-1$
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the home directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getHomeDirectory()
{
return ""; //$NON-NLS-1$
}
/**
* <i>Not implemented, you should override if possible.</i><br>
* Return the temp directory of the remote system for the current user, if available.
* <p>
* Up to each implementer to decide how to implement, and if this will be cached.
* <p>
* Returns an empty string by default, override if possible
*/
public String getTempDirectory()
{
return ""; //$NON-NLS-1$
}
/**
* Set the subsystem, when its not known at constructor time
*/
public void registerSubSystem(ISubSystem ss)
{
if (!_registeredSubSystems.contains(ss))
{
_registeredSubSystems.add(ss);
}
}
/**
* Removes the subsystem from teh list
* @param ss
*/
public void deregisterSubSystem(ISubSystem ss)
{
_registeredSubSystems.remove(ss);
}
// ------------------
// Utility methods...
// ------------------
final public ISubSystem[] getSubSystems()
{
return (ISubSystem[])_registeredSubSystems.toArray(new ISubSystem[_registeredSubSystems.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#getPrimarySubSystem()
*/
final public ISubSystem getPrimarySubSystem()
{
if (_primarySubSystem == null)
{
if (_registeredSubSystems.size() == 0)
{
}
else
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
_primarySubSystem = ss.getPrimarySubSystem();
}
}
return _primarySubSystem;
}
final public IHost getHost()
{
return _host;
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the system type for this connection:<br> <code>getSubSystem().getSystemConnection().getSystemType()</code>
*/
final public String getHostType()
{
return getHost().getSystemType();
}
/**
*
*/
final public String getName()
{
return _name;
}
final public String getDescription()
{
return _description;
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the host name for the connection this system's subsystem is associated with:</br>
* <code>getSubSystem().getSystemConnection().getHostName()</code>
*/
final public String getHostName()
{
return getHost().getHostName();
}
/**
* <i>Useful utility method. Fully implemented, do not override.</i><br>
* Returns the active userId if we are connected.
@ -302,13 +139,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
}
}
/* (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>
* Clear internal userId cache. Called when user uses the property dialog to
@ -431,27 +261,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
return true;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsRemoteServerLaunching()
*/
public boolean supportsRemoteServerLaunching() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#hasRemoteServerLauncherProperties()
*/
public boolean hasRemoteServerLauncherProperties() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsServerLaunchProperties()
*/
public boolean supportsServerLaunchProperties() {
return false;
}
/**
* Return true if this connector service can share it's uid and password
* with other connector services in this host (connection).
@ -836,73 +645,30 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
intializeSubSystems(monitor);
}
protected void intializeSubSystems(IProgressMonitor monitor)
{
for (int i = 0; i < _registeredSubSystems.size(); i++)
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i);
ss.initializeSubSystem(monitor);
}
}
protected void unintializeSubSystems(IProgressMonitor monitor)
{
for (int i = 0; i < _registeredSubSystems.size(); i++)
{
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(i);
ss.uninitializeSubSystem(monitor);
}
}
/**
* <i>You must override</i>
* unless subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties
* returns true.
* <p>
* Attempt to connect to the remote system.<br>
* If the subsystem supports server launch,
* 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.
*/
protected void internalConnect(IProgressMonitor monitor) throws Exception
{
if (supportsServerLaunchProperties())
{
starter = getRemoteServerLauncher();
starter.setSignonInformation(getPasswordInformation());
starter.setServerLauncherProperties(getRemoteServerLauncherProperties());
launchResult = null;
if (!starter.isLaunched())
{
try {
launchResult = starter.launch(monitor);
} catch (Exception exc) {
throw new java.lang.reflect.InvocationTargetException(exc);
}
}
connectResult = null;
try {
connectResult = starter.connect(monitor, getConnectPort());
} catch (Exception exc) {
throw new java.lang.reflect.InvocationTargetException(exc);
}
}
}
/**
* Return the port to use for connecting to the remote server, once it is running.
* By default, this is the subsystem's port property, via {@link #getPort()}.
* Override if appropriate.
* <br> This is called by the default implementation of {@link #connect(IProgressMonitor)}, if
* subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties() is true.
*/
protected int getConnectPort()
{
return getPort();
}
// protected void internalConnect(IProgressMonitor monitor) throws Exception
// {
// if (supportsServerLaunchProperties())
// {
// IServerLauncher starter = getRemoteServerLauncher();
// starter.setSignonInformation(getPasswordInformation());
// starter.setServerLauncherProperties(getRemoteServerLauncherProperties());
// launchResult = null;
// if (!starter.isLaunched())
// {
// try {
// launchResult = starter.launch(monitor);
// } catch (Exception exc) {
// throw new java.lang.reflect.InvocationTargetException(exc);
// }
// }
// connectResult = null;
// try {
// connectResult = starter.connect(monitor, getConnectPort());
// } catch (Exception exc) {
// throw new java.lang.reflect.InvocationTargetException(exc);
// }
// }
// }
/**
* Disconnects from the remote system.
* <p>
@ -925,109 +691,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
clearPasswordCache();
}
public void internalDisconnect(IProgressMonitor monitor) throws Exception
{
if (supportsServerLaunchProperties() &&(starter != null))
{
try {
starter.disconnect();
starter = null; // for now, to be safe. Maybe we could optimize.
} catch (Exception exc) {
throw new java.lang.reflect.InvocationTargetException(exc);
}
}
}
// -----------------------------------------------------
// Methods that should be overridden by child classes...
// -----------------------------------------------------
/**
* Return the remote server launcher, which implements IServerLauncher.
* This is called by the default implementation of connect() and disconnect(), if
* subsystem.getParentSubSystemConfiguration().supportsServerLaunchProperties returns true.
* <p>This returns null be default!
*/
public IServerLauncher getRemoteServerLauncher()
{
return null;
}
/**
* <i>Optionally override if you add any instance variables.</i><br>
* The following is called whenever a system is redefined or disconnected.
* Each subsystem needs to be informed so it can clear out any expansions, etc.
* By default it does nothing. Override if you have an internal object that must be nulled out.
*/
public void reset()
{
}
/**
* <i>Fully implemented, no need to override.</i><br>
* @see IConnectorService#addCommunicationsListener(ICommunicationsListener)
*/
public void addCommunicationsListener(ICommunicationsListener listener)
{
if (!commListeners.contains(listener)) {
commListeners.add(listener);
}
}
/**
* <i>Fully implemented, no need to override.</i><br>
* @see IConnectorService#removeCommunicationsListener(ICommunicationsListener)
*/
public void removeCommunicationsListener(ICommunicationsListener listener)
{
commListeners.remove(listener);
}
/**
* <i><b>Private</b> - used internally.</i><br>
* Helper method for firing communication events
*/
protected void fireCommunicationsEvent(int eventType)
{
CommunicationsEvent e = new CommunicationsEvent(this, eventType);
Object[] items = commListeners.toArray();
for (int loop=0; loop < items.length; loop++) {
((ICommunicationsListener) items[loop]).communicationsStateChange(e);
}
}
/**
* <i><b>Private</b> - used internally.</i><br>
* Returns the count of active communication listeners (i.e. excludes
* passive listeners.)
*/
protected int getCommunicationListenerCount()
{
int count = 0;
for (int i = 0; i < commListeners.size(); i++)
{
if (!((ICommunicationsListener) commListeners.get(i)).isPassiveCommunicationsListener())
{
count++;
}
}
return count;
}
/**
* <i><b>Private</b> - used internally.</i><br>
*/
protected void clearCommunicationListeners()
{
commListeners.clear();
}
/**
/**
* Returns the suppressSignonPrompt flag. If this is set to true then the user
* will not be prompted to signon, instead an InterruptedException will be thrown
* by the promptForPassword method.
@ -1056,129 +720,6 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
_suppressSignonPrompt = suppressSignonPrompt;
}
// -------------------------
// PRIVATE HELPER METHODS...
// -------------------------
// /**
// * Call this method to identify specific server launch types that are not to be permitted.
// * <p>
// * You normally do not call this! Rather, your subsystem factory class will override
// * {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchType(ServerLaunchType)}.
// * However, this method is needed by ISVs that re-use predefined subsystem factories,
// * and merely supply their own IConnectorService object via the "systemClass" attribute of the
// * subsystemConfigurations extension point.
// *
// * @see org.eclipse.rse.core.subsystems.ServerLaunchType
// */
// protected void enableServerLaunchType(ISubSystem subsystem, ServerLaunchType serverLaunchType, boolean enable)
// {
// IServerLauncherProperties sl =getRemoteServerLauncherProperties();
// if (sl instanceof RemoteServerLauncher)
// {
// RemoteServerLauncher isl = (RemoteServerLauncher)sl;
// isl.enableServerLaunchType(serverLaunchType, enable);
// }
// }
/**
* This methods returns the enablement state per server launch type.
* If {@link RemoteServerLauncher#enableServerLaunchType(ServerLaunchType, boolean)} has not been
* called for this server launch type, then it is enabled by default.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType
*/
protected boolean isEnabledServerLaunchType(ISubSystem subsystem, ServerLaunchType serverLaunchType)
{
IServerLauncherProperties sl = getRemoteServerLauncherProperties();
if (sl instanceof RemoteServerLauncher)
{
RemoteServerLauncher isl = (RemoteServerLauncher)sl;
return isl.isEnabledServerLaunchType(serverLaunchType);
}
else
return subsystem.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType);
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#notifyDisconnection()
*/
public void notifyDisconnection()
{
// Fire comm event to signal state changed
if (!isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_DISCONNECT);
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#notifyConnection()
*/
public void notifyConnection()
{
if (isConnected()) fireCommunicationsEvent(CommunicationsEvent.AFTER_CONNECT);
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IConnectorService#notifyError()
*/
public void notifyError()
{
fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR);
}
public void setPort(int port)
{
if (port != _port)
{
_port = port;
setDirty(true);
}
}
public int getPort()
{
return _port;
}
public boolean isUsingSSL()
{
return _usingSSL;
}
public void setIsUsingSSL(boolean flag)
{
if (_usingSSL != flag)
{
_usingSSL = flag;
setDirty(true);
}
}
public IServerLauncherProperties getRemoteServerLauncherProperties()
{
return _remoteServerLauncherProperties;
}
public void setRemoteServerLauncherProperties(IServerLauncherProperties newRemoteServerLauncher)
{
if (_remoteServerLauncherProperties != newRemoteServerLauncher)
{
_remoteServerLauncherProperties = newRemoteServerLauncher;
setDirty(true);
}
}
public boolean hasRemoteSearchLauncherProperties()
{
return _remoteServerLauncherProperties != null;
}
public boolean commit()
{
return RSEUIPlugin.getThePersistenceManager().commit(getHost());
}
private void logException(Throwable t) {
Logger log = LoggerFactory.getLogger(RSEUIPlugin.getDefault());
log.logError("Unexpected exception", t); //$NON-NLS-1$

View file

@ -12,6 +12,7 @@
*
* Contributors:
* David Dykstal (IBM) - 168870: moved SystemPreferencesManager to a new package
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
********************************************************************************/
package org.eclipse.rse.core.subsystems;
@ -41,7 +42,6 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterSavePolicies;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.filters.SystemFilterPoolManager;
import org.eclipse.rse.core.internal.subsystems.RemoteServerLauncherConstants;
import org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemModelChangeEvents;

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Tobias Schwarz (Wind River) - initial API and implementation
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
*******************************************************************************/
package org.eclipse.rse.tests.internal.testsubsystem;
@ -40,7 +41,6 @@ public class TestSubSystemConnectorService extends AbstractConnectorService {
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor)
*/
protected void internalConnect(IProgressMonitor monitor) throws Exception {
super.internalConnect(monitor);
connected = true;
}
@ -48,31 +48,9 @@ public class TestSubSystemConnectorService extends AbstractConnectorService {
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalDisconnect(org.eclipse.core.runtime.IProgressMonitor)
*/
public void internalDisconnect(IProgressMonitor monitor) throws Exception {
super.internalDisconnect(monitor);
connected = false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsRemoteServerLaunching()
*/
public boolean supportsRemoteServerLaunching() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#hasRemoteServerLauncherProperties()
*/
public boolean hasRemoteServerLauncherProperties() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsServerLaunchProperties()
*/
public boolean supportsServerLaunchProperties() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsPassword()
*/