From f662be4160f71bc81c73f86d883539869f3530b5 Mon Sep 17 00:00:00 2001 From: Anna Dushistova Date: Fri, 11 Jul 2008 17:51:34 +0000 Subject: [PATCH] [239159] Replaced IShellSubSystem with ISubSystem that provides an IService that is adaptable to an IShellService --- .../META-INF/MANIFEST.MF | 5 ++-- .../processes/shell/linux/Activator.java | 24 ++++++++++++------- ...elegatingShellProcessConnectorService.java | 9 ++++--- .../shell/linux/LinuxShellProcessService.java | 5 ++-- .../ShellProcessSubSystemConfiguration.java | 6 ++--- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/META-INF/MANIFEST.MF index b5cdc946f4a..9fc0e3bffe5 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/META-INF/MANIFEST.MF @@ -1,4 +1,4 @@ -Manifest-Version: 1.0 +Manifest-Version: 1.1.1.qualifier Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.rse.subsystems.processes.shell.linux;singleton:=true @@ -10,8 +10,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.subsystems.processes.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)" + org.eclipse.rse.subsystems.processes.core;bundle-version="[3.0.0,4.0.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-Vendor: %providerName diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/Activator.java b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/Activator.java index 09b555dcd0d..57d6ef3e013 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/Activator.java +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/Activator.java @@ -1,13 +1,14 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 MontaVista Software, Inc. and others. + * Copyright (c) 2006, 2008 MontaVista Software, Inc. 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 * * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation + * Yu-Fen Kuo (MontaVista) - initial API and implementation * Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere + * Anna Dushistova (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType *******************************************************************************/ package org.eclipse.rse.internal.subsystems.processes.shell.linux; @@ -22,9 +23,9 @@ import org.osgi.framework.BundleContext; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.services.IService; import org.eclipse.rse.services.shells.IShellService; import org.eclipse.rse.subsystems.processes.servicesubsystem.IProcessServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; /** * The activator class controls the plug-in life cycle @@ -159,9 +160,9 @@ public class Activator extends AbstractUIPlugin { * @return shell service object, or null if not found. */ public static IShellService getShellService(IHost host) { - IShellServiceSubSystem ss = getShellServiceSubSystem(host); + ISubSystem ss = getSuitableSubSystem(host); if (ss!=null) { - return ss.getShellService(); + return (IShellService)ss.getSubSystemConfiguration().getService(host).getAdapter(IShellService.class); } return null; } @@ -172,14 +173,19 @@ public class Activator extends AbstractUIPlugin { * @param host the connection * @return shell service subsystem, or null if not found. */ - public static IShellServiceSubSystem getShellServiceSubSystem(IHost host) { + public static ISubSystem getSuitableSubSystem(IHost host) { if (host == null) return null; ISubSystem[] subSystems = host.getSubSystems(); + IShellService ssvc = null; for (int i = 0; subSystems != null && i < subSystems.length; i++) { - if (subSystems[i] instanceof IShellServiceSubSystem) { - return (IShellServiceSubSystem)subSystems[i]; - } + IService svc = subSystems[i].getSubSystemConfiguration().getService(host); + if (svc!=null) { + ssvc = (IShellService)svc.getAdapter(IShellService.class); + if (ssvc != null) { + return subSystems[i]; + } + } } return null; } diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/DelegatingShellProcessConnectorService.java b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/DelegatingShellProcessConnectorService.java index 5e02ff1e28f..5f878c88409 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/DelegatingShellProcessConnectorService.java +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/DelegatingShellProcessConnectorService.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2007, 2008 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 @@ -9,16 +9,15 @@ * component that contains this file: David McKnight. * * Contributors: - * {Name} (company) - description of contribution. + * Anna Dushistova (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType ********************************************************************************/ package org.eclipse.rse.internal.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.core.subsystems.ISubSystem; import org.eclipse.rse.subsystems.processes.servicesubsystem.IProcessServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; /** * This class delegates the connector service requests for the linux process @@ -47,7 +46,7 @@ public class DelegatingShellProcessConnectorService extends AbstractDelegatingCo } else { - IShellServiceSubSystem ss = Activator.getShellServiceSubSystem(getHost()); + ISubSystem ss = Activator.getSuitableSubSystem(getHost()); if (ss != null) { _realService = ss.getConnectorService(); diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/LinuxShellProcessService.java b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/LinuxShellProcessService.java index 34c50d13c2c..3c3e7f713e4 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/LinuxShellProcessService.java +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/internal/subsystems/processes/shell/linux/LinuxShellProcessService.java @@ -12,6 +12,7 @@ * David McKnight (IBM) - [175308] Need to use a job to wait for shell to exit * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc * Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error + * Anna Dushistova (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType *******************************************************************************/ package org.eclipse.rse.internal.subsystems.processes.shell.linux; @@ -26,6 +27,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.processes.IHostProcess; import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter; @@ -34,7 +36,6 @@ import org.eclipse.rse.services.processes.AbstractProcessService; import org.eclipse.rse.services.shells.HostShellProcessAdapter; import org.eclipse.rse.services.shells.IHostShell; import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; /** * class to fetch remote linux target's process info @@ -106,7 +107,7 @@ public class LinuxShellProcessService extends AbstractProcessService { final IProgressMonitor monitor) throws SystemMessageException { // this is to workaround RSE bug 147531 if (filter.getUsername().equals("${user.id}") && host != null) { //$NON-NLS-1$ - IShellServiceSubSystem ss = Activator.getShellServiceSubSystem(host); + ISubSystem ss = Activator.getSuitableSubSystem(host); if (ss!=null) { // change filter username so the filter will filter out the right // process for my processes diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/subsystems/processes/shell/linux/ShellProcessSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/subsystems/processes/shell/linux/ShellProcessSubSystemConfiguration.java index c9dbc35a15d..11eb6aa2999 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/subsystems/processes/shell/linux/ShellProcessSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.shell.linux/src/org/eclipse/rse/subsystems/processes/shell/linux/ShellProcessSubSystemConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. + * Copyright (c) 2006, 2008 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 @@ * Yu-Fen Kuo (MontaVista) - adapted from RSE ProcessServiceSubSystemConfiguration * Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere * Martin Oberhuber (Wind River) - [186523] Move subsystemConfigurations from UI to core + * Anna Dushistova (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType *******************************************************************************/ package org.eclipse.rse.subsystems.processes.shell.linux; @@ -30,7 +31,6 @@ import org.eclipse.rse.services.shells.IShellService; import org.eclipse.rse.subsystems.processes.core.subsystem.IHostProcessToRemoteProcessAdapter; import org.eclipse.rse.subsystems.processes.servicesubsystem.ProcessServiceSubSystem; import org.eclipse.rse.subsystems.processes.servicesubsystem.ProcessServiceSubSystemConfiguration; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; /** * This class is used by org.eclipse.rse.core.subsystemConfigurations extension @@ -58,7 +58,7 @@ public class ShellProcessSubSystemConfiguration extends public IConnectorService getConnectorService(IHost host) { - IShellServiceSubSystem ss = Activator.getShellServiceSubSystem(host); + ISubSystem ss = Activator.getSuitableSubSystem(host); if (ss!=null) { return ss.getConnectorService();