1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[Bug 226262] [api][breaking] RSE IService should be IAdaptable

This commit is contained in:
Martin Oberhuber 2008-04-09 19:28:07 +00:00
parent 98ffeae46e
commit e3b82f8326
27 changed files with 1116 additions and 947 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc.
* Copyright (c) 2006, 2008 Wind River Systems, 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
@ -8,6 +8,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.examples.daytime.service;
@ -18,16 +19,15 @@ import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.examples.daytime.DaytimeResources;
import org.eclipse.rse.services.AbstractService;
/**
* The DaytimeService implements the UI-less protocol for accessing the
* daytime TCP service on a remote host. Other implementations of the
* same interface might use other methods for retrieving the time of day.
*/
public class DaytimeService implements IDaytimeService {
public class DaytimeService extends AbstractService implements IDaytimeService {
private String fHostname;
@ -43,11 +43,6 @@ public class DaytimeService implements IDaytimeService {
return DaytimeResources.Daytime_Service_Description;
}
public void initService(IProgressMonitor monitor) {
//nothing to do
}
public void setHostName(String hostname) {
fHostname = hostname;
}
@ -61,8 +56,4 @@ public class DaytimeService implements IDaytimeService {
return result;
}
public void uninitService(IProgressMonitor monitor) {
//nothing to do
}
}

View file

@ -40,6 +40,7 @@
* Radoslav Gerganov (ProSyst) - [216195] [dstore] Saving empty file fails
* David McKnight (IBM) - [220379] [api] Provide a means for contributing custom BIDI encodings
* David McKnight (IBM) - [225573] [dstore] client not falling back to single operation when missing batch descriptors (due to old server)
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.files;
@ -133,14 +134,12 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
public void uninitService(IProgressMonitor monitor)
{
super.uninitService(monitor);
_fileElementMap.clear();
_dstoreFileMap.clear();
_uploadLogElement = null;
super.uninitService(monitor);
}
public String getName()
{
return ServiceResources.DStore_File_Service_Label;

View file

@ -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
@ -15,6 +15,7 @@
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
* David McKnight (IBM) - [159092] For to use correct process miner id
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.internal.services.dstore.processes;
@ -37,10 +38,9 @@ import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
import org.eclipse.rse.services.clientserver.processes.ISystemProcessRemoteConstants;
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
import org.eclipse.rse.services.processes.AbstractProcessService;
import org.eclipse.rse.services.processes.IProcessService;
public class DStoreProcessService extends AbstractProcessService implements IProcessService
public class DStoreProcessService extends AbstractProcessService
// TODO implements IDStoreService ?
{
protected IDataStoreProvider _provider;
protected DataElement _minerElement = null;
@ -274,6 +274,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
public void initService(IProgressMonitor monitor)
{
super.initService(monitor);
initMiner(monitor);
}
@ -283,6 +284,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
_procMinerStatus = null;
_minerElement = null;
_statusMonitor = null;
super.uninitService(monitor);
}
public boolean isInitialized()

View file

@ -16,6 +16,7 @@
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.shells;
@ -169,9 +170,9 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
public void uninitService(IProgressMonitor monitor)
{
super.uninitService(monitor);
_envMinerElement = null;
_envMinerStatus = null;
super.uninitService(monitor);
}
protected void initMiner(IProgressMonitor monitor)

View file

@ -17,6 +17,7 @@
* David McKnight (IBM) - [207095] check for null datastore
* David McKnight (IBM) - [209593] [api] check for existing query to avoid duplicates
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.services.dstore;
@ -31,10 +32,11 @@ import org.eclipse.dstore.core.model.DataElement;
import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.core.model.IDataStoreProvider;
import org.eclipse.rse.internal.services.dstore.ServiceResources;
import org.eclipse.rse.services.AbstractService;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
public abstract class AbstractDStoreService implements IDStoreService
public abstract class AbstractDStoreService extends AbstractService implements IDStoreService
{
protected IDataStoreProvider _dataStoreProvider;
protected DataElement _minerElement;
@ -405,6 +407,7 @@ public abstract class AbstractDStoreService implements IDStoreService
public void initService(IProgressMonitor monitor)
{
super.initService(monitor);
initMiner(monitor);
}
@ -414,6 +417,7 @@ public abstract class AbstractDStoreService implements IDStoreService
_cmdDescriptorMap.clear();
_minerElement = null;
_statusMonitor = null;
super.uninitService(monitor);
}
protected void initMiner(IProgressMonitor monitor)

View file

@ -72,6 +72,7 @@
* Martin Oberhuber (Wind River) - [216351] Improve cancellation of SystemFetchOperation for files
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp;
@ -1382,14 +1383,6 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
return hasSucceeded;
}
public void initService(IProgressMonitor monitor)
{
}
public void uninitService(IProgressMonitor monitor)
{
}
public boolean isCaseSensitive()
{
//TODO find out whether remote is case sensitive or not

View file

@ -35,6 +35,7 @@
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* David McKnight (IBM) - [220241] JJ: IRemoteFileSubSystem.list() on the Local file subsystem does not return correct results
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.local.files;
@ -1545,15 +1546,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
return (rc == 0);
}
public void initService(IProgressMonitor monitor)
{
}
public void uninitService(IProgressMonitor monitor)
{
}
public boolean isCaseSensitive()
{
return !isWindows();

View file

@ -14,6 +14,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Kevin Doyle (IBM) - [199871] LocalProcessService needs to implement getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
*******************************************************************************/
package org.eclipse.rse.internal.services.local.processes;
@ -32,9 +33,8 @@ import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
import org.eclipse.rse.services.clientserver.processes.handlers.ProcessHandler;
import org.eclipse.rse.services.clientserver.processes.handlers.ProcessHandlerManager;
import org.eclipse.rse.services.processes.AbstractProcessService;
import org.eclipse.rse.services.processes.IProcessService;
public class LocalProcessService extends AbstractProcessService implements ILocalService, IProcessService
public class LocalProcessService extends AbstractProcessService implements ILocalService
{
protected String[] _statusTypes;
protected ProcessHandler handler;
@ -152,13 +152,4 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
}
}
public void initService(IProgressMonitor monitor)
{
}
public void uninitService(IProgressMonitor monitor)
{
}
}

View file

@ -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
@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
********************************************************************************/
package org.eclipse.rse.internal.services.local.shells;
@ -25,11 +26,10 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.internal.services.local.ILocalService;
import org.eclipse.rse.internal.services.local.LocalServiceResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.shells.AbstractShellService;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IShellService;
public class LocalShellService implements IShellService, ILocalService
public class LocalShellService extends AbstractShellService implements ILocalService
{
private static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
private String[] _envVars;
@ -48,12 +48,6 @@ public class LocalShellService implements IShellService, ILocalService
return LocalServiceResources.Local_Shell_Service_Description;
}
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor)
{
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return launchShell(initialWorkingDirectory, defaultEncoding, environment, monitor);
}
public IHostShell launchShell(String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor)
{
LocalHostShell hostShell = new LocalHostShell(initialWorkingDirectory,SHELL_INVOCATION, encoding, environment);
@ -61,12 +55,6 @@ public class LocalShellService implements IShellService, ILocalService
return hostShell;
}
public IHostShell runCommand(String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor)
{
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return runCommand(initialWorkingDirectory, command, defaultEncoding, environment, monitor);
}
public IHostShell runCommand(String initialWorkingDirectory, String command, String encoding, String[] environment, IProgressMonitor monitor)
{
LocalHostShell hostShell = new LocalHostShell(initialWorkingDirectory,command, encoding, environment);
@ -132,17 +120,4 @@ public class LocalShellService implements IShellService, ILocalService
return _envVars;
}
public void initService(IProgressMonitor monitor)
{
}
public void uninitService(IProgressMonitor monitor)
{
}
public SystemMessage getMessage(String messageID)
{
return null;
}
}

View file

@ -24,6 +24,7 @@
* Martin Oberhuber (Wind River) - [216343] immediate link targets and canonical paths for Sftp
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Martin Oberhuber (Wind River) - [224799] Fix JSch encoding problems with Arabic filenames
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.ssh.files;
@ -1068,6 +1069,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
public void initService(IProgressMonitor monitor) {
Activator.trace("SftpFileService.initService"); //$NON-NLS-1$
super.initService(monitor);
try
{
connect();
@ -1080,6 +1082,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
public void uninitService(IProgressMonitor monitor) {
Activator.trace("SftpFileService.uninitService"); //$NON-NLS-1$
disconnect();
super.uninitService(monitor);
}
public boolean isCaseSensitive() {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* 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
@ -16,6 +16,7 @@
* David McKnight (IBM) - [191599] Use the remote encoding specified in the host property page
* David McKnight (IBM) - [196301] Check that the remote encoding isn't null before using it
* Martin Oberhuber (Wind River) - [204744] Honor encoding in SSH command input field
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.ssh.shell;
@ -91,6 +92,9 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
}
else
{
// default encoding - same as
// System.getProperty("file.encoding")
// TODO should try to determine remote encoding if possible
fStdoutHandler = new SshShellOutputReader(this, new BufferedReader(new InputStreamReader(fChannel.getInputStream())), false);
}
fStderrHandler = new SshShellOutputReader(this, null,true);
@ -135,9 +139,9 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
}
/**
* Connect to remote system and launch Threads for the
* shell as needed.
* @param monitor
* Connect to remote system and launch Threads for the shell as needed.
*
* @param monitor progress monitor for long-running operation
*/
protected void start(IProgressMonitor monitor)
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* 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
@ -14,6 +14,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.ssh.shell;
@ -23,15 +24,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.internal.services.ssh.ISshService;
import org.eclipse.rse.internal.services.ssh.ISshSessionProvider;
import org.eclipse.rse.internal.services.ssh.SshServiceResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.shells.AbstractShellService;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IShellService;
/**
* A Shell Services for ssh.
* Adapted from LocalShellService.
*/
public class SshShellService implements ISshService, IShellService {
public class SshShellService extends AbstractShellService implements ISshService {
private ISshSessionProvider fSessionProvider;
@ -39,13 +39,6 @@ public class SshShellService implements ISshService, IShellService {
fSessionProvider = sessionProvider;
}
//TODO abstract base class should handle default encodings
public IHostShell launchShell(String initialWorkingDirectory,
String[] environment, IProgressMonitor monitor) {
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return launchShell(initialWorkingDirectory, defaultEncoding, environment, monitor);
}
public IHostShell launchShell(String initialWorkingDirectory,
String encoding, String[] environment,
IProgressMonitor monitor) {
@ -53,13 +46,6 @@ public class SshShellService implements ISshService, IShellService {
return hostShell;
}
//TODO abstract base class should handle default encodings
public IHostShell runCommand(String initialWorkingDirectory,
String command, String[] environment, IProgressMonitor monitor) {
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return runCommand(initialWorkingDirectory, command, defaultEncoding, environment, monitor);
}
public IHostShell runCommand(String initialWorkingDirectory,
String command, String encoding, String[] environment,
IProgressMonitor monitor) {
@ -80,16 +66,4 @@ public class SshShellService implements ISshService, IShellService {
return SshServiceResources.SshShellService_Description;
}
public void initService(IProgressMonitor monitor) {
// nothing to do
}
public void uninitService(IProgressMonitor monitor) {
// nothing to do
}
public SystemMessage getMessage(String messageID) {
return null;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* 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
@ -14,6 +14,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
* Sheldon D'souza (Celunite) - Adapted from SshShellService.
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.telnet.shell;
@ -21,12 +22,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.internal.services.telnet.ITelnetService;
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
import org.eclipse.rse.internal.services.telnet.TelnetServiceResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.shells.AbstractShellService;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IShellService;
public class TelnetShellService implements ITelnetService, IShellService {
public class TelnetShellService extends AbstractShellService implements ITelnetService {
private ITelnetSessionProvider fTelnetSessionProvider;
@ -38,12 +37,6 @@ public class TelnetShellService implements ITelnetService, IShellService {
return new String[0];
}
public IHostShell launchShell(String initialWorkingDirectory,
String[] environment, IProgressMonitor monitor) {
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return launchShell(initialWorkingDirectory, defaultEncoding, environment, monitor);
}
public IHostShell launchShell(String initialWorkingDirectory,
String encoding, String[] environment,
IProgressMonitor monitor) {
@ -51,12 +44,6 @@ public class TelnetShellService implements ITelnetService, IShellService {
return hostShell;
}
public IHostShell runCommand(String initialWorkingDirectory,
String command, String[] environment, IProgressMonitor monitor) {
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
return runCommand(initialWorkingDirectory, command, defaultEncoding, environment, monitor);
}
public IHostShell runCommand(String initialWorkingDirectory,
String command, String encoding, String[] environment,
IProgressMonitor monitor) {
@ -68,23 +55,8 @@ public class TelnetShellService implements ITelnetService, IShellService {
return TelnetServiceResources.TelnetShellService_Description;
}
public SystemMessage getMessage(String messageID) {
// TODO Auto-generated method stub
return null;
}
public String getName() {
return TelnetServiceResources.TelnetShellService_Name;
}
public void initService(IProgressMonitor monitor) {
// TODO Auto-generated method stub
}
public void uninitService(IProgressMonitor monitor) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,3 @@
#Wed Apr 09 15:34:43 CEST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, 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:
* Martin Oberhuber (Wind River) - initial API and implementation
*******************************************************************************/
package org.eclipse.rse.services;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
/**
* Abstract default implementation of an RSE Service. Clients are expected to
* extend this class.
*
* @see IService
* @since org.eclipse.rse.core 3.0
*/
public abstract class AbstractService extends PlatformObject implements IService {
public String getDescription() {
return getName();
}
public String getName() {
return this.getClass().getName();
}
/**
* Default implementation of initService. Extenders who override this method
* must call <code>super.initService(monitor)</code> as the first call in
* their implementation.
*/
public void initService(IProgressMonitor monitor) {
// Do nothing by default
}
/**
* Default implementation of uninitService. Extenders who override this
* method must call <code>super.uninitService(monitor)</code> as the last
* call in their implementation.
*/
public void uninitService(IProgressMonitor monitor) {
// Do nothing by default
}
}

View file

@ -12,17 +12,69 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
*******************************************************************************/
package org.eclipse.rse.services;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
public interface IService
/**
* IService is the base interface for any non-UI service contributions to RSE.
*
* An actual Service is free to perform any operations at all - the only
* commonality between services is that they have a name, can be initialized,
* and are adaptable for future extension.
*
* @noimplement This interface is not intended to be implemented by clients.
* Service implementations must subclass
* {@link AbstractService} rather than implementing this
* interface directly.
*/
public interface IService extends IAdaptable
{
/**
* Get the name of this Service as a translated, UI-visible String.
* Extenders are expected to override this method.
*
* @return the name of this Service.
*/
public String getName();
/**
* Get the description of this Service as a translated, UI-visible String.
* Extenders are expected to override this method.
*
* @return the description of this Service.
*/
public String getDescription();
/**
* Initialize this Service to make it ready for operation. This method may
* be long-running, but is not yet expected to open a connection to a
* particular remote system.
*
* Extenders are expected to override this method.
*
* @param monitor A progress monitor to provide progress of long-running
* operation. There is no guarantee that cancellation is actually
* supported by a Service since it would leave the service in a
* potentially inconsistent, partially initialized state.
*/
public void initService(IProgressMonitor monitor);
/**
* Clean up this Service. This method is called by clients as part of a
* disconnect operation and should clean up any local status that the
* Service might have.
*
* Extenders are expected to override this method.
*
* @param monitor A progress monitor to provide progress of long-running
* operation. There is no guarantee that cancellation is actually
* supported by a Service since it would leave the service in a
* potentially inconsistent, partially initialized state.
*/
public void uninitService(IProgressMonitor monitor);
}

View file

@ -24,6 +24,7 @@
* Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
*******************************************************************************/
package org.eclipse.rse.services.files;
@ -36,10 +37,11 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.AbstractService;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
public abstract class AbstractFileService implements IFileService
public abstract class AbstractFileService extends AbstractService implements IFileService
{
protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
@ -196,10 +198,13 @@ public abstract class AbstractFileService implements IFileService
}
/**
* Gets the output stream to write/append to a remote file.
* The default implementation returns <code>null</code>.
* Clients can override to return an output stream to the file.
* @deprecated
* Gets the output stream to write/append to a remote file. The default
* implementation returns <code>null</code>. Clients can override to
* return an output stream to the file.
*
* @deprecated use
* {@link #getOutputStream(String, String, int, IProgressMonitor)}
* instead
*/
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
return null;

View file

@ -0,0 +1,32 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Martin Oberhuber (Wind River)">
<meta name="Copyright" content="Copyright (c) 2008 Wind River Systems, Inc. and others.">
<meta name="License" content="Made available under the terms of the Eclipse Public License v1.0.">
<title>Package-level Javadoc</title>
</head>
<body>
Application programming interface for the RSE Services Layer.
<h2>
Package Specification</h2>
<p>
The RSE Services layer provides interfaces and basic utility classes
for remote operations. There is no restriction whatsoever about the
kind of those operations, and actually there isn't even a need for
remote systems to be involved. The Services defined here provide
basic functionality for RSE to operate on.
</p><p>
The RSE Services layer is designed to have only minimal dependency into
Eclipse core APIs, such that Services can eventually be re-used in
environments outside Eclipse. This can be done today by providing a library
with mock objects for the few Eclipse interfaces that Services currently use:
<code>IAdaptable</code>, <code>IProgressMonitor</code>,
<code>IStatus</code>, <code>NLS</code>, <code>PlatformObject</code>
and few others related to the Eclipse Extension Registry, which are only
used in the Activator and can thus be replaced easily by a different
mechanisms for providing extensions.
</p>
</body>
</html>

View file

@ -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
@ -12,18 +12,24 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.services.processes;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.AbstractService;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl;
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
public abstract class AbstractProcessService implements IProcessService
/**
* Abstract base class for RSE Process Service.
*/
public abstract class AbstractProcessService extends AbstractService implements IProcessService
{
public IHostProcess[] listAllProcesses(String exeNameFilter, String userNameFilter, String stateFilter, IProgressMonitor monitor) throws SystemMessageException
{
@ -42,9 +48,11 @@ public abstract class AbstractProcessService implements IProcessService
/**
* Return a single IHostProcess object for the 'init' process with pid 1.
*
* @param monitor Progress monitor
* @return Array with 1 element, the IHostProcess object for the root process
* @throws SystemMessageException
* @return Array with 1 element, the IHostProcess object for the root
* process
* @throws SystemMessageException in case anything goes wrong
* @see org.eclipse.rse.services.processes.IProcessService#listRootProcesses(org.eclipse.core.runtime.IProgressMonitor)
*/
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException

View file

@ -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
@ -12,108 +12,131 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.services.processes;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.IService;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
/**
* An IProcessService is an abstraction of a process service that runs over some sort of connection.
* It can be shared among multiple instances of a subsystem. Each
* subsystem is currently responsible for layering an abstraction over whatever it
* wants to construct as a service.
* An IProcessService is an abstraction of a process service that runs over some
* sort of connection. It can be shared among multiple instances of a subsystem.
* Each subsystem is currently responsible for layering an abstraction over
* whatever it wants to construct as a service.
* <p>
* Implementers of this interface will have to either be instantiated, initialized, or
* somehow derive a connection as part of its state.
* Implementers of this interface will have to either be instantiated,
* initialized, or somehow derive a connection as part of its state.
*
* @noimplement This interface is not intended to be implemented by clients.
* Process service implementations must subclass
* {@link AbstractProcessService} rather than implementing this
* interface directly.
*/
public interface IProcessService extends IService
{
/**
* Return a list of all processes on the remote system.
*
* @param monitor A progress monitor to which progress will be reported
* @return List of all processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listAllProcesses(IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a filtered list of all processes on the remote system.
*
* @param filter An object to filter results by
* @param monitor A progress monitor to which progress will be reported
* @return Filtered list of processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a filtered list of all processes on the remote system.
* @param exeNameFilter The executable name to filter results by, or null if no exeName filtering
* @param userNameFilter The user name to filter results by, or null if no userName filtering
* @param stateFilter The state code to filter results by, or null if no state filtering
*
* @param exeNameFilter The executable name to filter results by, or null if
* no exeName filtering
* @param userNameFilter The user name to filter results by, or null if no
* userName filtering
* @param stateFilter The state code to filter results by, or null if no
* state filtering
* @param monitor A progress monitor to which progress will be reported
* @return Filtered list of processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listAllProcesses(String exeNameFilter, String userNameFilter, String stateFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Returns root processes on the remote system
*
* @param monitor A progress monitor to which progress will be reported
* @return List of root processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote child processes of the given parent process on the remote system
* @param parentPID The ID of the parent process whose children are to be listed
* Return a list of all remote child processes of the given parent process
* on the remote system
*
* @param parentPID The ID of the parent process whose children are to be
* listed
* @param monitor A progress monitor to which progress will be reported
* @return List of child processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listChildProcesses(long parentPID, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a filtered list of remote child processes of the given parent process on the remote system
* @param parentPID The ID of the parent process whose children are to be listed
* Return a filtered list of remote child processes of the given parent
* process on the remote system
*
* @param parentPID The ID of the parent process whose children are to be
* listed
* @param filter A filter to narrow results by
* @param monitor A progress monitor to which progress will be reported
* @return Filtered list of child processes
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess[] listChildProcesses(long parentPID, IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Given a process, return its parent process object.
*
* @param pid the ID of the process to return parent of.
* @param monitor A progress monitor to which progress will be reported
* @return The parent process
* @throws SystemMessageException
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess getParentProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
/**
* Given a pid, return an IHostProcess object for it.
*
* @param pid The process ID of the desired process
* @param monitor A progress monitor to which progress will be reported
* @return IHostProcess object for the given pid
* @throws SystemMessageException
* @return IHostProcess object for the given pid
* @throws SystemMessageException in case anything goes wrong
*/
public IHostProcess getProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
/**
* Kills a process.
*
* @param pid the ID of the process to be killed.
* @param signal the signal to send to the process
* @param monitor A progress monitor to which progress will be reported
* @return <code>false</code> if the given process doesn't exist, else <code>true</code>.
* Throws an exception if anything fails.
* @throws SystemMessageException
* @return <code>false</code> if the given process doesn't exist, else
* <code>true</code>. Throws an exception if anything fails.
* @throws SystemMessageException in case anything goes wrong
*/
public boolean kill(long pid, String signal, IProgressMonitor monitor) throws SystemMessageException;

View file

@ -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
@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.services.search;
@ -20,11 +21,16 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.AbstractService;
import org.eclipse.rse.services.files.IFileService;
public abstract class AbstractSearchService implements ISearchService
/**
* Abstract base class for RSE Search Service. A useful implementation should
* ensure that only minimal data transfer is required between the remote system
* and the local client.
*/
public abstract class AbstractSearchService extends AbstractService implements ISearchService
{
protected Map _searches;

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
*******************************************************************************/
package org.eclipse.rse.services.search;
@ -24,7 +24,7 @@ import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
/**
@ -33,7 +33,7 @@ import org.eclipse.core.runtime.Platform;
* This allows it to contain results from multiple connections, filters, and folders
* (from different systems).
*/
public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
public class HostSearchResultSet extends PlatformObject implements IHostSearchResultSet, IAdaptable
{
protected Vector configurations;
@ -284,10 +284,4 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
return true;
}
/**
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter);
}
}

View file

@ -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
@ -12,13 +12,23 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.services.search;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.files.IFileService;
/**
* RSE Search Service Interface.
*
* @noimplement This interface is not intended to be implemented by clients.
* Search service implementations must subclass
* {@link AbstractSearchService} rather than implementing this
* interface directly.
*/
public interface ISearchService
{
public void search(IHostSearchResultConfiguration searchConfig, IFileService fileService, IProgressMonitor monitor);

View file

@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, 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:
* Martin Oberhuber (Wind River) - initial API and implementation
*******************************************************************************/
package org.eclipse.rse.services.shells;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.AbstractService;
/**
* Abstract base class for RSE Shell Service implementations.
*/
public abstract class AbstractShellService extends AbstractService implements IShellService {
/* (non-Javadoc)
* @see org.eclipse.rse.services.shells.IShellService#getHostEnvironment()
*/
public String[] getHostEnvironment() {
// not implemented by default
return null;
}
/* (non-Javadoc)
* @see org.eclipse.rse.services.shells.IShellService#launchShell(java.lang.String, java.lang.String[], org.eclipse.core.runtime.IProgressMonitor)
*/
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor) {
return launchShell(initialWorkingDirectory, null, environment, monitor);
}
/* (non-Javadoc)
* @see org.eclipse.rse.services.shells.IShellService#runCommand(java.lang.String, java.lang.String, java.lang.String[], org.eclipse.core.runtime.IProgressMonitor)
*/
public IHostShell runCommand(String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor) {
return runCommand(initialWorkingDirectory, command, null, environment, monitor);
}
}

View file

@ -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
@ -12,66 +12,111 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
********************************************************************************/
package org.eclipse.rse.services.shells;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.IService;
/**
* IShellService is an abstraction for running shells and
* shell commands
* IShellService is an abstraction for running shells and shell commands.
*
* @noimplement This interface is not intended to be implemented by clients.
* Search service implementations must subclass
* {@link AbstractShellService} rather than implementing this
* interface directly.
*/
public interface IShellService extends IService
{
/**
* Launch a new shell in the specified directory
* @param initialWorkingDirectory
* @param environment Array of environment variable Strings of the form "var=text"
* @param monitor
* @return the shell object
* Launch a new shell in the specified directory with a default encoding.
*
* This is a convenience method, passing <code>null</code> as encoding
* into {@link #launchShell(String, String, String[], IProgressMonitor)}.
*/
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor);
/**
* Launch a new shell in the specified directory
* @param initialWorkingDirectory
* @param encoding
* @param environment Array of environment variable Strings of the form "var=text"
* @param monitor
* @return the shell object
* Launch a new shell in the specified directory.
*
* @param initialWorkingDirectory initial working directory or
* <code>null</code> if not relevant. The remote shell will
* launch in a directory of its own choice in that case
* (typically a user's home directory).
* @param encoding Stream encoding to use, or <code>null</code> to fall
* back to a default encoding. The Shell Service will make
* efforts to determine a proper default encoding on the remote
* side but this is not guaranteed to be correct.
* @param environment Array of environment variable Strings of the form
* "var=text". Since not all shell implementations support the
* passing of environment variables, there is no guarantee that
* the created shell will actually have the specified environment
* set.
* @param monitor Progress Monitor for monitoring and cancellation
* @return the shell object. Note that the shell may not actually be usable
* in case an error occurred or the operation was canceled. In this
* case, {@link IHostShell#isActive()} returns <code>false</code>
* on the created Shell object.
*/
public IHostShell launchShell(String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor);
/**
* Run a command in it's own shell
* @param initialWorkingDirectory
* @param command
* @param environment Array of environment variable Strings of the form "var=text"
* @param monitor
* @return the shell object for getting output and error streams
*
* Run a single command in it's own shell with a default encoding.
*
* This is a convenience method, passing <code>null</code> as encoding
* into
* {@link #runCommand(String, String, String, String[], IProgressMonitor)}.
*/
public IHostShell runCommand(String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor);
/**
* Run a command in it's own shell
* @param initialWorkingDirectory
* @param command
* @param encoding
* @param environment Array of environment variable Strings of the form "var=text"
* @param monitor
* @return the shell object for getting output and error streams
* Run a single command in it's own shell.
*
* This method is similar to
* {@link #launchShell(String, String, String[], IProgressMonitor)} but
* immediately executes a specified command rather than just opening a
* shell. There is no guarantee that after the host shell will accept any
* subsequent commands after the initial command has been executed; there
* is, however, also no guarantee that the host shell will terminate the
* connection automatically. Clients need to call {@link IHostShell#exit()}
* in case the shell remains active after the initial command is completed.
*
* @param initialWorkingDirectory initial working directory or
* <code>null</code> if not relevant. The remote shell will
* launch in a directory of its own choice in that case
* (typically a user's home directory).
* @param encoding Stream encoding to use, or <code>null</code> to fall
* back to a default encoding. The Shell Service will make
* efforts to determine a proper default encoding on the remote
* side but this is not guaranteed to be correct.
* @param environment Array of environment variable Strings of the form
* "var=text". Since not all shell implementations support the
* passing of environment variables, there is no guarantee that
* the created shell will actually have the specified environment
* set.
* @param monitor Progress Monitor for monitoring and cancellation
* @return the shell object for getting output and error streams. Note that
* the shell may not actually be usable in case an error occurred or
* the operation was canceled. In this case,
* {@link IHostShell#isActive()} returns <code>false</code> on the
* created Shell object.
*/
public IHostShell runCommand(String initialWorkingDirectory, String command, String encoding, String[] environment, IProgressMonitor monitor);
/**
* Return an array of environment variables that describe the environment on the host.
* Each String returned is of the format "var=text": Everything up to the
* first equals sign is the name of the given environment variable, everything
* after the equals sign is its contents.
* @return Array of environment variable Strings of the form "var=text"
* Return an array of environment variables that describe the environment on
* the remote system. Each String returned is of the format "var=text":
* Everything up to the first equals sign is the name of the given
* environment variable, everything after the equals sign is its contents.
*
* @return Array of environment variable Strings of the form "var=text" if
* supported by a shell service implementation. May return
* <code>null</code> in case environment variable retrieval is not
* supported on a particular shell service implementation.
*/
public String[] getHostEnvironment();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* 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
@ -10,6 +10,7 @@
* Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* 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
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.processes.shell.linux;
@ -185,14 +186,12 @@ public class LinuxShellProcessService extends AbstractProcessService {
}
public void initService(final IProgressMonitor monitor) {
super.initService(monitor);
linuxProcessHelper = new LinuxProcessHelper();
// initialize username /uid hashmap before getting any process
linuxProcessHelper.populateUsernames(host);
}
public void uninitService(final IProgressMonitor monitor) {
}
private boolean progressWorked(final IProgressMonitor monitor,
final int work) {
boolean cancelRequested = false;

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Radoslav Gerganov - derived from SftpFileService and LocalFileService
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
*******************************************************************************/
package org.eclipse.rse.internal.services.wince.files;
@ -421,12 +422,6 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
return Messages.WinCEFileService_1;
}
public void initService(IProgressMonitor monitor) {
}
public void uninitService(IProgressMonitor monitor) {
}
private static class WinCEInputStream extends InputStream {
private int handle;