1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +02:00

[175142] added delegating connector service interface, abstract impl and concrete impl for shell processes

This commit is contained in:
David McKnight 2007-02-22 21:04:29 +00:00
parent de001b3b7d
commit 2cbfd023fe
5 changed files with 661 additions and 12 deletions

View file

@ -0,0 +1,19 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
public interface IDelegatingConnectorService extends IConnectorService
{
public IConnectorService getRealConnectorService();
}

View file

@ -0,0 +1,42 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.subsystems.processes.shell.linux;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.AbstractDelegatingConnectorService;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.internal.subsystems.processes.shell.linux.Activator;
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
public class DelegatingShellProcessConnectorService extends AbstractDelegatingConnectorService
{
public DelegatingShellProcessConnectorService(IHost host) {
super(host);
}
public IConnectorService getRealConnectorService()
{
IShellServiceSubSystem ss = Activator.getShellServiceSubSystem(getHost());
if (ss != null)
{
return ss.getConnectorService();
}
else
{
return null;
}
}
}

View file

@ -54,12 +54,17 @@ public class ShellProcessSubSystemConfiguration extends
return hostProcessAdapter;
}
public IConnectorService getConnectorService(IHost host) {
public IConnectorService getConnectorService(IHost host)
{
IShellServiceSubSystem ss = Activator.getShellServiceSubSystem(host);
if (ss!=null) {
if (ss!=null)
{
return ss.getConnectorService();
}
return null;
else
{
return new DelegatingShellProcessConnectorService(host);
}
}
public Class getServiceImplType() {

View file

@ -18,6 +18,7 @@ package org.eclipse.rse.ui.widgets.services;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IDelegatingConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
import org.eclipse.rse.model.DummyHost;
@ -73,20 +74,30 @@ public class FactoryServiceElement extends ServiceElement
if (_children == null)
{
IHost host = getHost();
_children = new ServiceElement[2];
_children[0] = new ServiceServiceElement(host, this, getService());
ServiceServiceElement serviceElement = new ServiceServiceElement(host, this, getService());
IConnectorService connectorService = getConnectorService();
_children[1] = new ConnectorServiceElement(host, this, connectorService);
if (host instanceof DummyHost)
if (connectorService != null && !(connectorService instanceof IDelegatingConnectorService))
{
IServerLauncherProperties sl = connectorService.getRemoteServerLauncherProperties();
if (sl == null)
_children = new ServiceElement[2];
_children[0] = serviceElement;
_children[1] = new ConnectorServiceElement(host, this, connectorService);
if (host instanceof DummyHost)
{
sl = _factory.createServerLauncher(connectorService);
connectorService.setRemoteServerLauncherProperties(sl);
IServerLauncherProperties sl = connectorService.getRemoteServerLauncherProperties();
if (sl == null)
{
sl = _factory.createServerLauncher(connectorService);
connectorService.setRemoteServerLauncherProperties(sl);
}
}
}
else
{
_children = new ServiceElement[1];
_children[0] = serviceElement;
}
}
return _children;
@ -119,10 +130,14 @@ public class FactoryServiceElement extends ServiceElement
public void commit()
{
if (_isSelected)
{
ServiceElement[] children = getChildren();
for (int i = 0; i < children.length; i++)
{
children[i].commit();
//if (children[i].isSelected())
children[i].commit();
}
}
}

View file

@ -0,0 +1,568 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ISubSystem;
public abstract class AbstractDelegatingConnectorService implements IDelegatingConnectorService
{
protected IHost _host;
public AbstractDelegatingConnectorService(IHost host)
{
_host = host;
}
public abstract IConnectorService getRealConnectorService();
public void addCommunicationsListener(ICommunicationsListener listener)
{
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.addCommunicationsListener(listener);
}
}
public void clearPasswordCache()
{
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.clearPasswordCache();
}
}
public void clearPasswordCache(boolean clearDiskCache) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.clearPasswordCache(clearDiskCache);
}
}
public void clearUserIdCache() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.clearUserIdCache();
}
}
public void connect(IProgressMonitor monitor) throws Exception {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.connect(monitor);
}
}
public void deregisterSubSystem(ISubSystem ss) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.deregisterSubSystem(ss);
}
}
public void disconnect(IProgressMonitor monitor) throws Exception {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.disconnect(monitor);
}
}
public String getHomeDirectory()
{
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getHomeDirectory();
}
return null;
}
public IHost getHost()
{
return _host;
}
public String getHostName() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getHostName();
}
return null;
}
public String getHostType() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getHostType();
}
return null;
}
public String getName() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getName();
}
return null;
}
public int getPort() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getPort();
}
return 0;
}
public ISubSystem getPrimarySubSystem() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getPrimarySubSystem();
}
return null;
}
public IServerLauncherProperties getRemoteServerLauncherProperties() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getRemoteServerLauncherProperties();
}
return null;
}
public ISubSystem[] getSubSystems() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getSubSystems();
}
return null;
}
public String getTempDirectory() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getTempDirectory();
}
return null;
}
public String getUserId() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getUserId();
}
return null;
}
public String getVersionReleaseModification() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getVersionReleaseModification();
}
return null;
}
public boolean hasRemoteServerLauncherProperties() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.hasRemoteServerLauncherProperties();
}
return false;
}
public boolean inheritConnectionUserPassword() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.inheritConnectionUserPassword();
}
return false;
}
public boolean isConnected() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isConnected();
}
return false;
}
public boolean isPasswordCached() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isPasswordCached();
}
return false;
}
public boolean isPasswordCached(boolean onDisk) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isPasswordCached(onDisk);
}
return false;
}
public boolean isSuppressSignonPrompt() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isSuppressSignonPrompt();
}
return false;
}
public boolean isUsingSSL() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isUsingSSL();
}
return false;
}
public void notifyConnection() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.notifyConnection();
}
}
public void notifyDisconnection() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.notifyDisconnection();
}
}
public void notifyError() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.notifyError();
}
}
public void promptForPassword(boolean forcePrompt)
throws InterruptedException {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.promptForPassword(forcePrompt);
}
}
public void registerSubSystem(ISubSystem ss) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.registerSubSystem(ss);
}
}
public void removeCommunicationsListener(ICommunicationsListener listener) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.removeCommunicationsListener(listener);
}
}
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;
}
public void reset() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.reset();
}
}
public void setHost(IHost host) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setHost(host);
}
}
public void setIsUsingSSL(boolean flag) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setIsUsingSSL(flag);
}
}
public void setPassword(String matchingUserId, String password) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setPassword(matchingUserId, password);
}
}
public void setPassword(String matchingUserId, String password,
boolean persist) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setPassword(matchingUserId, password, persist);
}
}
public void setPort(int port) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setPort(port);
}
}
public void setRemoteServerLauncherProperties(
IServerLauncherProperties value) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setRemoteServerLauncherProperties(value);
}
}
public void setSuppressSignonPrompt(boolean suppressSignonPrompt) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setSuppressSignonPrompt(suppressSignonPrompt);
}
}
public void setUserId(String userId) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setUserId(userId);
}
}
public boolean shareUserPasswordWithConnection() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.shareUserPasswordWithConnection();
}
return false;
}
public boolean supportsPassword() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.supportsPassword();
}
return false;
}
public boolean supportsRemoteServerLaunching() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.supportsRemoteServerLaunching();
}
return false;
}
public boolean supportsServerLaunchProperties() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.supportsServerLaunchProperties();
}
return false;
}
public boolean supportsUserId() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.supportsUserId();
}
return false;
}
public String getDescription() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getDescription();
}
return null;
}
public boolean addPropertySet(IPropertySet set) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.addPropertySet(set);
}
return false;
}
public boolean addPropertySets(IPropertySet[] sets) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.addPropertySets(sets);
}
return false;
}
public IPropertySet createPropertySet(String name) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.createPropertySet(name);
}
return null;
}
public IPropertySet createPropertySet(String name, String description) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.createPropertySet(name, description);
}
return null;
}
public IPropertySet getPropertySet(String name) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getPropertySet(name);
}
return null;
}
public IPropertySet[] getPropertySets() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.getPropertySets();
}
return null;
}
public boolean removePropertySet(String name) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.removePropertySet(name);
}
return false;
}
public boolean commit() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.commit();
}
return false;
}
public boolean isDirty() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.isDirty();
}
return false;
}
public void setDirty(boolean flag) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setDirty(flag);
}
}
public void setWasRestored(boolean flag) {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
conServ.setWasRestored(flag);
}
}
public boolean wasRestored() {
IConnectorService conServ = getRealConnectorService();
if (conServ != null)
{
return conServ.wasRestored();
}
return false;
}
}