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:
parent
98ffeae46e
commit
e3b82f8326
27 changed files with 1116 additions and 947 deletions
|
@ -1,13 +1,14 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - initial API and implementation
|
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.examples.daytime.service;
|
package org.eclipse.rse.examples.daytime.service;
|
||||||
|
@ -18,17 +19,16 @@ import java.io.InputStreamReader;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
|
|
||||||
import org.eclipse.rse.examples.daytime.DaytimeResources;
|
import org.eclipse.rse.examples.daytime.DaytimeResources;
|
||||||
|
import org.eclipse.rse.services.AbstractService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DaytimeService implements the UI-less protocol for accessing the
|
* The DaytimeService implements the UI-less protocol for accessing the
|
||||||
* daytime TCP service on a remote host. Other implementations of the
|
* daytime TCP service on a remote host. Other implementations of the
|
||||||
* same interface might use other methods for retrieving the time of day.
|
* 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;
|
private String fHostname;
|
||||||
|
|
||||||
public DaytimeService() {
|
public DaytimeService() {
|
||||||
|
@ -43,11 +43,6 @@ public class DaytimeService implements IDaytimeService {
|
||||||
return DaytimeResources.Daytime_Service_Description;
|
return DaytimeResources.Daytime_Service_Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor) {
|
|
||||||
//nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setHostName(String hostname) {
|
public void setHostName(String hostname) {
|
||||||
fHostname = hostname;
|
fHostname = hostname;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +56,4 @@ public class DaytimeService implements IDaytimeService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor) {
|
|
||||||
//nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,20 +1,21 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
|
* 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) - [159092] For to use correct process miner id
|
||||||
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
* 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;
|
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.clientserver.processes.ISystemProcessRemoteConstants;
|
||||||
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
|
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
|
||||||
import org.eclipse.rse.services.processes.AbstractProcessService;
|
import org.eclipse.rse.services.processes.AbstractProcessService;
|
||||||
import org.eclipse.rse.services.processes.IProcessService;
|
|
||||||
|
|
||||||
|
public class DStoreProcessService extends AbstractProcessService
|
||||||
public class DStoreProcessService extends AbstractProcessService implements IProcessService
|
// TODO implements IDStoreService ?
|
||||||
{
|
{
|
||||||
protected IDataStoreProvider _provider;
|
protected IDataStoreProvider _provider;
|
||||||
protected DataElement _minerElement = null;
|
protected DataElement _minerElement = null;
|
||||||
|
@ -48,23 +48,23 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
protected DataElement _procMinerStatus;
|
protected DataElement _procMinerStatus;
|
||||||
protected String[] _statusTypes;
|
protected String[] _statusTypes;
|
||||||
protected String _userName;
|
protected String _userName;
|
||||||
|
|
||||||
public DStoreProcessService(IDataStoreProvider provider)
|
public DStoreProcessService(IDataStoreProvider provider)
|
||||||
{
|
{
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return ServiceResources.DStore_Process_Service_Label;
|
return ServiceResources.DStore_Process_Service_Label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return ServiceResources.DStore_Process_Service_Description;
|
return ServiceResources.DStore_Process_Service_Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
if (!isInitialized())
|
if (!isInitialized())
|
||||||
{
|
{
|
||||||
|
@ -74,12 +74,12 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
|
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
DataElement universaltemp = getMinerElement();
|
DataElement universaltemp = getMinerElement();
|
||||||
|
|
||||||
// create filter descriptor
|
// create filter descriptor
|
||||||
DataElement deObj;
|
DataElement deObj;
|
||||||
deObj = ds.find(universaltemp, DE.A_NAME, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_ROOT, 1);
|
deObj = ds.find(universaltemp, DE.A_NAME, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_ROOT, 1);
|
||||||
if (deObj == null) deObj = ds.createObject(universaltemp, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_FILTER, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_ROOT, "", "", false); //$NON-NLS-1$ //$NON-NLS-2$
|
if (deObj == null) deObj = ds.createObject(universaltemp, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_FILTER, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_ROOT, "", "", false); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
deObj.setAttribute(DE.A_SOURCE, filter.toString());
|
deObj.setAttribute(DE.A_SOURCE, filter.toString());
|
||||||
|
|
||||||
// query
|
// query
|
||||||
DataElement queryCmd = ds.localDescriptorQuery(deObj.getDescriptor(), IUniversalProcessDataStoreConstants.C_PROCESS_FILTER_QUERY_ALL);
|
DataElement queryCmd = ds.localDescriptorQuery(deObj.getDescriptor(), IUniversalProcessDataStoreConstants.C_PROCESS_FILTER_QUERY_ALL);
|
||||||
|
@ -102,13 +102,13 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
if (nested != null)
|
if (nested != null)
|
||||||
{
|
{
|
||||||
Object[] results = nested.toArray();
|
Object[] results = nested.toArray();
|
||||||
|
|
||||||
String message = status.getAttribute(DE.A_VALUE);
|
String message = status.getAttribute(DE.A_VALUE);
|
||||||
if (!message.equals(ISystemProcessRemoteConstants.PROCESS_MINER_SUCCESS))
|
if (!message.equals(ISystemProcessRemoteConstants.PROCESS_MINER_SUCCESS))
|
||||||
{
|
{
|
||||||
throw new SystemMessageException(getMessage("RSEPG1301")); //$NON-NLS-1$
|
throw new SystemMessageException(getMessage("RSEPG1301")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert objects to remote files
|
// convert objects to remote files
|
||||||
String userName = getRemoteUserName();
|
String userName = getRemoteUserName();
|
||||||
if (userName != null && filter.getUsername().equals("${user.id}")) //$NON-NLS-1$
|
if (userName != null && filter.getUsername().equals("${user.id}")) //$NON-NLS-1$
|
||||||
|
@ -123,7 +123,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
|
|
||||||
return processes;
|
return processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to convert DataElement objects to IRemoteClientProcess objects.
|
* Helper method to convert DataElement objects to IRemoteClientProcess objects.
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +131,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
if (objs == null)
|
if (objs == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ArrayList list = new ArrayList(objs.length);
|
ArrayList list = new ArrayList(objs.length);
|
||||||
|
|
||||||
for (int idx = 0; idx < objs.length; idx++)
|
for (int idx = 0; idx < objs.length; idx++)
|
||||||
|
@ -141,9 +141,9 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
if (processFilter == null || processFilter.allows(de.getValue()))
|
if (processFilter == null || processFilter.allows(de.getValue()))
|
||||||
{
|
{
|
||||||
DStoreHostProcess newProcess = new DStoreHostProcess(de);
|
DStoreHostProcess newProcess = new DStoreHostProcess(de);
|
||||||
list.add(newProcess);
|
list.add(newProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
|
|
||||||
return processes;
|
return processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to return the DataStore object needed by comm layer.
|
* Helper method to return the DataStore object needed by comm layer.
|
||||||
*/
|
*/
|
||||||
|
@ -164,18 +164,18 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
return _provider.getDataStore();
|
return _provider.getDataStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement getMinerElement()
|
protected DataElement getMinerElement()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_minerElement == null || _minerElement.getDataStore() != getDataStore())
|
if (_minerElement == null || _minerElement.getDataStore() != getDataStore())
|
||||||
{
|
{
|
||||||
_minerElement = getDataStore()
|
_minerElement = getDataStore()
|
||||||
.findMinerInformation(IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID);
|
.findMinerInformation(IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID);
|
||||||
}
|
}
|
||||||
return _minerElement;
|
return _minerElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DStoreStatusMonitor getStatusMonitor(DataStore dataStore)
|
public DStoreStatusMonitor getStatusMonitor(DataStore dataStore)
|
||||||
{
|
{
|
||||||
if (_statusMonitor == null || _statusMonitor.getDataStore() != dataStore)
|
if (_statusMonitor == null || _statusMonitor.getDataStore() != dataStore)
|
||||||
|
@ -185,31 +185,31 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
return _statusMonitor;
|
return _statusMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean kill(long PID, String signal, IProgressMonitor monitor) throws SystemMessageException
|
public boolean kill(long PID, String signal, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
|
|
||||||
// run kill command on host
|
// run kill command on host
|
||||||
DStoreHostProcess process = (DStoreHostProcess) getProcess(PID, monitor);
|
DStoreHostProcess process = (DStoreHostProcess) getProcess(PID, monitor);
|
||||||
|
|
||||||
// if there is no process, simply return true
|
// if there is no process, simply return true
|
||||||
if (process == null) {
|
if (process == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataElement deObj = (DataElement) process.getObject();
|
DataElement deObj = (DataElement) process.getObject();
|
||||||
DataElement killCmd = ds.localDescriptorQuery(deObj.getDescriptor(), IUniversalProcessDataStoreConstants.C_PROCESS_KILL);
|
DataElement killCmd = ds.localDescriptorQuery(deObj.getDescriptor(), IUniversalProcessDataStoreConstants.C_PROCESS_KILL);
|
||||||
deObj.setAttribute(DE.A_SOURCE, signal);
|
deObj.setAttribute(DE.A_SOURCE, signal);
|
||||||
|
|
||||||
if (killCmd != null)
|
if (killCmd != null)
|
||||||
{
|
{
|
||||||
DataElement status = ds.command(killCmd, deObj, true);
|
DataElement status = ds.command(killCmd, deObj, true);
|
||||||
|
|
||||||
DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
|
DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
|
||||||
smon.waitForUpdate(status);
|
smon.waitForUpdate(status);
|
||||||
|
|
||||||
// get results
|
// get results
|
||||||
String message = status.getAttribute(DE.A_VALUE);
|
String message = status.getAttribute(DE.A_VALUE);
|
||||||
if (message.equals(ISystemProcessRemoteConstants.PROCESS_MINER_SUCCESS)) return true;
|
if (message.equals(ISystemProcessRemoteConstants.PROCESS_MINER_SUCCESS)) return true;
|
||||||
|
@ -229,10 +229,10 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$
|
throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSignalTypes()
|
public String[] getSignalTypes()
|
||||||
{
|
{
|
||||||
if (_statusTypes != null)
|
if (_statusTypes != null)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
}
|
}
|
||||||
return _statusTypes;
|
return _statusTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of the types of signals that can be sent to
|
* Returns a list of the types of signals that can be sent to
|
||||||
* a process on the remote system.
|
* a process on the remote system.
|
||||||
|
@ -266,7 +266,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement getSignalTypesMinerElement()
|
protected DataElement getSignalTypesMinerElement()
|
||||||
{
|
{
|
||||||
return getDataStore().find(_minerElement, DE.A_NAME, "universal.killinfo"); //$NON-NLS-1$
|
return getDataStore().find(_minerElement, DE.A_NAME, "universal.killinfo"); //$NON-NLS-1$
|
||||||
|
@ -274,17 +274,19 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
public void initService(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
|
super.initService(monitor);
|
||||||
initMiner(monitor);
|
initMiner(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
public void uninitService(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
_minerElement = null;
|
_minerElement = null;
|
||||||
_procMinerStatus = null;
|
_procMinerStatus = null;
|
||||||
_minerElement = null;
|
_minerElement = null;
|
||||||
_statusMonitor = null;
|
_statusMonitor = null;
|
||||||
|
super.uninitService(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized()
|
public boolean isInitialized()
|
||||||
{
|
{
|
||||||
if (_procMinerStatus != null)
|
if (_procMinerStatus != null)
|
||||||
|
@ -294,7 +296,7 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForInitialize(IProgressMonitor monitor)
|
protected void waitForInitialize(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (_procMinerStatus!= null)
|
if (_procMinerStatus!= null)
|
||||||
|
@ -311,14 +313,14 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
getMinerElement();
|
getMinerElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void initMiner(IProgressMonitor monitor)
|
protected void initMiner(IProgressMonitor monitor)
|
||||||
|
@ -328,30 +330,30 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
{
|
{
|
||||||
if (getServerVersion() >= 8)
|
if (getServerVersion() >= 8)
|
||||||
{
|
{
|
||||||
String minerId = getMinerId();
|
String minerId = getMinerId();
|
||||||
String message = SystemMessage.sub(ServiceResources.DStore_Service_ProgMon_Initializing_Message, "&1", minerId); //$NON-NLS-1$
|
String message = SystemMessage.sub(ServiceResources.DStore_Service_ProgMon_Initializing_Message, "&1", minerId); //$NON-NLS-1$
|
||||||
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
if (_minerElement == null || _minerElement.getDataStore() != ds)
|
if (_minerElement == null || _minerElement.getDataStore() != ds)
|
||||||
{
|
{
|
||||||
if (ds != null && _procMinerStatus == null)
|
if (ds != null && _procMinerStatus == null)
|
||||||
{
|
{
|
||||||
_procMinerStatus = ds.activateMiner(minerId);
|
_procMinerStatus = ds.activateMiner(minerId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username used to connect to the remote machine
|
* Get the username used to connect to the remote machine
|
||||||
*/
|
*/
|
||||||
public String getRemoteUserName()
|
public String getRemoteUserName()
|
||||||
{
|
{
|
||||||
if (_userName == null)
|
if (_userName == null)
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
|
|
||||||
DataElement encodingElement = ds.createObject(null, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_TEMP, ""); //$NON-NLS-1$
|
DataElement encodingElement = ds.createObject(null, IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_TEMP, ""); //$NON-NLS-1$
|
||||||
|
@ -364,29 +366,29 @@ public class DStoreProcessService extends AbstractProcessService implements IPro
|
||||||
monitor.waitForUpdate(status);
|
monitor.waitForUpdate(status);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_userName = encodingElement.getValue();
|
_userName = encodingElement.getValue();
|
||||||
}
|
}
|
||||||
return _userName;
|
return _userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getMinerId()
|
protected String getMinerId()
|
||||||
{
|
{
|
||||||
return IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID;
|
return IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getServerVersion()
|
public int getServerVersion()
|
||||||
{
|
{
|
||||||
return getDataStore().getServerVersion();
|
return getDataStore().getServerVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getServerMinor()
|
public int getServerMinor()
|
||||||
{
|
{
|
||||||
return getDataStore().getServerMinor();
|
return getDataStore().getServerMinor();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getProcessMinerId()
|
protected String getProcessMinerId()
|
||||||
{
|
{
|
||||||
return IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID;
|
return IUniversalDataStoreConstants.UNIVERSAL_PROCESS_MINER_ID;
|
||||||
|
|
|
@ -7,15 +7,16 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
|
* 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) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* 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;
|
package org.eclipse.rse.internal.services.dstore.shells;
|
||||||
|
@ -41,24 +42,24 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
protected String[] _envVars;
|
protected String[] _envVars;
|
||||||
protected DataElement _envMinerElement;
|
protected DataElement _envMinerElement;
|
||||||
protected DataElement _envMinerStatus;
|
protected DataElement _envMinerStatus;
|
||||||
|
|
||||||
public DStoreShellService(IDataStoreProvider dataStoreProvider)
|
public DStoreShellService(IDataStoreProvider dataStoreProvider)
|
||||||
{
|
{
|
||||||
super(dataStoreProvider);
|
super(dataStoreProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return ServiceResources.DStore_Shell_Service_Label;
|
return ServiceResources.DStore_Shell_Service_Label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return ServiceResources.DStore_Shell_Service_Description;
|
return ServiceResources.DStore_Shell_Service_Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor)
|
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (!isInitialized())
|
if (!isInitialized())
|
||||||
|
@ -120,7 +121,7 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
}
|
}
|
||||||
return _envVars;
|
return _envVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getMinerId()
|
protected String getMinerId()
|
||||||
{
|
{
|
||||||
return IUniversalDataStoreConstants.UNIVERSAL_COMMAND_MINER_ID;
|
return IUniversalDataStoreConstants.UNIVERSAL_COMMAND_MINER_ID;
|
||||||
|
@ -130,8 +131,8 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
{
|
{
|
||||||
return IUniversalDataStoreConstants.UNIVERSAL_ENVIRONMENT_MINER_ID;
|
return IUniversalDataStoreConstants.UNIVERSAL_ENVIRONMENT_MINER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isInitialized()
|
public boolean isInitialized()
|
||||||
{
|
{
|
||||||
if (_initializeStatus != null)
|
if (_initializeStatus != null)
|
||||||
|
@ -141,7 +142,7 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForInitialize(IProgressMonitor monitor)
|
protected void waitForInitialize(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (_envMinerStatus!= null)
|
if (_envMinerStatus!= null)
|
||||||
|
@ -158,7 +159,7 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
|
@ -166,28 +167,28 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
}
|
}
|
||||||
super.waitForInitialize(monitor);
|
super.waitForInitialize(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
public void uninitService(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
super.uninitService(monitor);
|
|
||||||
_envMinerElement = null;
|
_envMinerElement = null;
|
||||||
_envMinerStatus = null;
|
_envMinerStatus = null;
|
||||||
|
super.uninitService(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initMiner(IProgressMonitor monitor)
|
protected void initMiner(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
// init env miner first
|
// init env miner first
|
||||||
|
|
||||||
if (getServerVersion() >= 8)
|
if (getServerVersion() >= 8)
|
||||||
{
|
{
|
||||||
String minerId = getEnvSystemMinerId();
|
String minerId = getEnvSystemMinerId();
|
||||||
String message = SystemMessage.sub(ServiceResources.DStore_Service_ProgMon_Initializing_Message, "&1", minerId); //$NON-NLS-1$
|
String message = SystemMessage.sub(ServiceResources.DStore_Service_ProgMon_Initializing_Message, "&1", minerId); //$NON-NLS-1$
|
||||||
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
if (_envMinerElement == null || _envMinerElement.getDataStore() != ds)
|
if (_envMinerElement == null || _envMinerElement.getDataStore() != ds)
|
||||||
{
|
{
|
||||||
if (ds != null && _envMinerStatus == null)
|
if (ds != null && _envMinerStatus == null)
|
||||||
{
|
{
|
||||||
_envMinerStatus = ds.activateMiner(minerId);
|
_envMinerStatus = ds.activateMiner(minerId);
|
||||||
/*
|
/*
|
||||||
DStoreStatusMonitor smon = getStatusMonitor(ds);
|
DStoreStatusMonitor smon = getStatusMonitor(ds);
|
||||||
|
@ -199,15 +200,15 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
getMinerElement(getEnvSystemMinerId());
|
getMinerElement(getEnvSystemMinerId());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.initMiner(monitor);
|
super.initMiner(monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,17 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
|
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
|
||||||
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
|
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
|
||||||
* David McKnight (IBM) - [207095] check for null datastore
|
* David McKnight (IBM) - [207095] check for null datastore
|
||||||
* David McKnight (IBM) - [209593] [api] check for existing query to avoid duplicates
|
* David McKnight (IBM) - [209593] [api] check for existing query to avoid duplicates
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.dstore;
|
package org.eclipse.rse.services.dstore;
|
||||||
|
@ -31,23 +32,24 @@ import org.eclipse.dstore.core.model.DataElement;
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||||
import org.eclipse.rse.internal.services.dstore.ServiceResources;
|
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.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
|
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 IDataStoreProvider _dataStoreProvider;
|
||||||
protected DataElement _minerElement;
|
protected DataElement _minerElement;
|
||||||
protected DStoreStatusMonitor _statusMonitor;
|
protected DStoreStatusMonitor _statusMonitor;
|
||||||
protected Map _cmdDescriptorMap;
|
protected Map _cmdDescriptorMap;
|
||||||
protected DataElement _initializeStatus;
|
protected DataElement _initializeStatus;
|
||||||
|
|
||||||
public AbstractDStoreService(IDataStoreProvider dataStoreProvider)
|
public AbstractDStoreService(IDataStoreProvider dataStoreProvider)
|
||||||
{
|
{
|
||||||
_dataStoreProvider = dataStoreProvider;
|
_dataStoreProvider = dataStoreProvider;
|
||||||
_cmdDescriptorMap = new HashMap();
|
_cmdDescriptorMap = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DStoreStatusMonitor getStatusMonitor(DataStore dataStore)
|
public DStoreStatusMonitor getStatusMonitor(DataStore dataStore)
|
||||||
{
|
{
|
||||||
if (_statusMonitor == null || _statusMonitor.getDataStore() != dataStore)
|
if (_statusMonitor == null || _statusMonitor.getDataStore() != dataStore)
|
||||||
|
@ -56,12 +58,12 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
return _statusMonitor;
|
return _statusMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataStore getDataStore()
|
public DataStore getDataStore()
|
||||||
{
|
{
|
||||||
return _dataStoreProvider.getDataStore();
|
return _dataStoreProvider.getDataStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement getMinerElement()
|
protected DataElement getMinerElement()
|
||||||
{
|
{
|
||||||
if (_minerElement == null || _minerElement.getDataStore() != getDataStore())
|
if (_minerElement == null || _minerElement.getDataStore() != getDataStore())
|
||||||
|
@ -70,20 +72,20 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
return _minerElement;
|
return _minerElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement getMinerElement(String id)
|
protected DataElement getMinerElement(String id)
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
if (ds != null)
|
if (ds != null)
|
||||||
{
|
{
|
||||||
return ds.findMinerInformation(id);
|
return ds.findMinerInformation(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement[] dsQueryCommand(DataElement subject, String command, IProgressMonitor monitor)
|
protected DataElement[] dsQueryCommand(DataElement subject, String command, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
return dsQueryCommand(subject, null, command, monitor);
|
return dsQueryCommand(subject, null, command, monitor);
|
||||||
|
@ -103,7 +105,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
DataElement queryCmd = getCommandDescriptor(subject, command);
|
DataElement queryCmd = getCommandDescriptor(subject, command);
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
||||||
|
|
||||||
if (queryCmd != null && ds != null)
|
if (queryCmd != null && ds != null)
|
||||||
{
|
{
|
||||||
// check if there already is an active command for this query
|
// check if there already is an active command for this query
|
||||||
|
@ -119,7 +121,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
smonitor.waitForUpdate(status, monitor);
|
smonitor.waitForUpdate(status, monitor);
|
||||||
|
|
||||||
int resultSize = subject.getNestedSize();
|
int resultSize = subject.getNestedSize();
|
||||||
|
|
||||||
checkHostJVM();
|
checkHostJVM();
|
||||||
|
@ -131,26 +133,26 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
// cancel monitor if it's still not canceled
|
// cancel monitor if it's still not canceled
|
||||||
if (monitor != null && !monitor.isCanceled())
|
if (monitor != null && !monitor.isCanceled())
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataElement[0];
|
return new DataElement[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List dsQueryCommandMulti(DataElement[] subjects, String[] commands, IProgressMonitor monitor)
|
protected List dsQueryCommandMulti(DataElement[] subjects, String[] commands, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
return dsQueryCommandMulti(subjects, null, commands, monitor);
|
return dsQueryCommandMulti(subjects, null, commands, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query multiple subjects in one shot
|
* Query multiple subjects in one shot
|
||||||
* @param subjects the subjects to query
|
* @param subjects the subjects to query
|
||||||
|
@ -162,20 +164,20 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
protected List dsQueryCommandMulti(DataElement[] subjects, ArrayList[] argses, String[] commands, IProgressMonitor monitor)
|
protected List dsQueryCommandMulti(DataElement[] subjects, ArrayList[] argses, String[] commands, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
List statuses = new ArrayList();
|
List statuses = new ArrayList();
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < subjects.length && !monitor.isCanceled(); i++)
|
for (int i = 0; i < subjects.length && !monitor.isCanceled(); i++)
|
||||||
{
|
{
|
||||||
DataElement subject = subjects[i];
|
DataElement subject = subjects[i];
|
||||||
|
|
||||||
DataElement queryCmd = getCommandDescriptor(subject, commands[i]);
|
DataElement queryCmd = getCommandDescriptor(subject, commands[i]);
|
||||||
if (queryCmd != null && ds != null)
|
if (queryCmd != null && ds != null)
|
||||||
{
|
{
|
||||||
// check if there already is an active command for this query
|
// check if there already is an active command for this query
|
||||||
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
||||||
|
|
||||||
if (status == null){
|
if (status == null){
|
||||||
if (argses != null){
|
if (argses != null){
|
||||||
status = ds.command(queryCmd, argses[i], subject, true);
|
status = ds.command(queryCmd, argses[i], subject, true);
|
||||||
|
@ -184,65 +186,65 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
status = ds.command(queryCmd, subject, true);
|
status = ds.command(queryCmd, subject, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statuses.add(status);
|
statuses.add(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List consolidatedResults = new ArrayList();
|
List consolidatedResults = new ArrayList();
|
||||||
|
|
||||||
// wait for each command to complete
|
// wait for each command to complete
|
||||||
for (int i = 0; i < statuses.size() && !monitor.isCanceled(); i++)
|
for (int i = 0; i < statuses.size() && !monitor.isCanceled(); i++)
|
||||||
{
|
{
|
||||||
DataElement status = (DataElement)statuses.get(i);
|
DataElement status = (DataElement)statuses.get(i);
|
||||||
DataElement deObj = subjects[i];
|
DataElement deObj = subjects[i];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
smonitor.waitForUpdate(status, monitor);
|
smonitor.waitForUpdate(status, monitor);
|
||||||
|
|
||||||
if (!monitor.isCanceled() && smonitor.determineStatusDone(status))
|
if (!monitor.isCanceled() && smonitor.determineStatusDone(status))
|
||||||
{
|
{
|
||||||
List nested = deObj.getNestedData();
|
List nested = deObj.getNestedData();
|
||||||
if (nested != null)
|
if (nested != null)
|
||||||
{
|
{
|
||||||
consolidatedResults.add(nested.toArray(new DataElement[nested.size()]));
|
consolidatedResults.add(nested.toArray(new DataElement[nested.size()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
// cancel monitor if it's still not canceled
|
// cancel monitor if it's still not canceled
|
||||||
if (monitor != null && !monitor.isCanceled())
|
if (monitor != null && !monitor.isCanceled())
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return consolidatedResults;
|
return consolidatedResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected DataElement dsStatusCommand(DataElement subject, ArrayList args, String command, IProgressMonitor monitor)
|
protected DataElement dsStatusCommand(DataElement subject, ArrayList args, String command, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
||||||
|
|
||||||
DataElement queryCmd = getCommandDescriptor(subject, command);
|
DataElement queryCmd = getCommandDescriptor(subject, command);
|
||||||
|
|
||||||
if (queryCmd != null && ds != null)
|
if (queryCmd != null && ds != null)
|
||||||
{
|
{
|
||||||
// check if there already is an active command for this query
|
// check if there already is an active command for this query
|
||||||
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
||||||
|
|
||||||
if (status == null){
|
if (status == null){
|
||||||
status = ds.command(queryCmd, args, subject, true);
|
status = ds.command(queryCmd, args, subject, true);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@ -250,35 +252,35 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
smonitor.waitForUpdate(status, monitor);
|
smonitor.waitForUpdate(status, monitor);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
// cancel monitor if it's still not canceled
|
// cancel monitor if it's still not canceled
|
||||||
if (monitor != null && !monitor.isCanceled())
|
if (monitor != null && !monitor.isCanceled())
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected DataElement dsStatusCommand(DataElement subject, String command, IProgressMonitor monitor)
|
protected DataElement dsStatusCommand(DataElement subject, String command, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
DStoreStatusMonitor smonitor = getStatusMonitor(ds);
|
||||||
|
|
||||||
DataElement queryCmd = getCommandDescriptor(subject, command);
|
DataElement queryCmd = getCommandDescriptor(subject, command);
|
||||||
|
|
||||||
if (queryCmd != null && ds != null)
|
if (queryCmd != null && ds != null)
|
||||||
{
|
{
|
||||||
// check if there already is an active command for this query
|
// check if there already is an active command for this query
|
||||||
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
DataElement status = smonitor.getCommandStatus(queryCmd, subject);
|
||||||
|
|
||||||
if (status == null){
|
if (status == null){
|
||||||
status = ds.command(queryCmd, subject, true);
|
status = ds.command(queryCmd, subject, true);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@ -286,13 +288,13 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
smonitor.waitForUpdate(status, monitor);
|
smonitor.waitForUpdate(status, monitor);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
// cancel monitor if it's still not canceled
|
// cancel monitor if it's still not canceled
|
||||||
if (monitor != null && !monitor.isCanceled())
|
if (monitor != null && !monitor.isCanceled())
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
|
|
||||||
|
@ -301,7 +303,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataElement getCommandDescriptor(DataElement subject, String command)
|
protected DataElement getCommandDescriptor(DataElement subject, String command)
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
|
@ -316,7 +318,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getServerVersion()
|
public int getServerVersion()
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
|
@ -324,7 +326,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
return ds.getServerVersion();
|
return ds.getServerVersion();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getServerMinor()
|
public int getServerMinor()
|
||||||
{
|
{
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
|
@ -332,25 +334,25 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
return ds.getServerMinor();
|
return ds.getServerMinor();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkHostJVM()
|
protected void checkHostJVM()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
DataElement status = getDataStore().queryHostJVM();
|
DataElement status = getDataStore().queryHostJVM();
|
||||||
String source = status.getSource();
|
String source = status.getSource();
|
||||||
String[] tokens = source.split(",");
|
String[] tokens = source.split(",");
|
||||||
|
|
||||||
long freeMem = Long.parseLong(tokens[0]);
|
long freeMem = Long.parseLong(tokens[0]);
|
||||||
long totalMem = Long.parseLong(tokens[1]);
|
long totalMem = Long.parseLong(tokens[1]);
|
||||||
|
|
||||||
int numElements = Integer.parseInt(tokens[3]);
|
int numElements = Integer.parseInt(tokens[3]);
|
||||||
|
|
||||||
System.out.println("Host JVM Stats:");
|
System.out.println("Host JVM Stats:");
|
||||||
System.out.println("\tfreeMem="+freeMem);
|
System.out.println("\tfreeMem="+freeMem);
|
||||||
System.out.println("\ttotalMem="+totalMem);
|
System.out.println("\ttotalMem="+totalMem);
|
||||||
|
|
||||||
System.out.println("\tnumber of elements="+numElements);
|
System.out.println("\tnumber of elements="+numElements);
|
||||||
|
|
||||||
String[] lastCreated = tokens[4].split(";");
|
String[] lastCreated = tokens[4].split(";");
|
||||||
System.out.println("\tlast created:");
|
System.out.println("\tlast created:");
|
||||||
for (int i = 0; i < lastCreated.length; i++)
|
for (int i = 0; i < lastCreated.length; i++)
|
||||||
|
@ -359,7 +361,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized()
|
public boolean isInitialized()
|
||||||
{
|
{
|
||||||
if (_initializeStatus != null)
|
if (_initializeStatus != null)
|
||||||
|
@ -373,7 +375,7 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForInitialize(IProgressMonitor monitor)
|
protected void waitForInitialize(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (_initializeStatus != null)
|
if (_initializeStatus != null)
|
||||||
|
@ -393,27 +395,29 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
{
|
{
|
||||||
monitor.setCanceled(true);
|
monitor.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//InterruptedException is used to report user cancellation, so no need to log
|
//InterruptedException is used to report user cancellation, so no need to log
|
||||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||||
}
|
}
|
||||||
|
|
||||||
getMinerElement();
|
getMinerElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
public void initService(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
|
super.initService(monitor);
|
||||||
initMiner(monitor);
|
initMiner(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
public void uninitService(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
_initializeStatus = null;
|
_initializeStatus = null;
|
||||||
_cmdDescriptorMap.clear();
|
_cmdDescriptorMap.clear();
|
||||||
_minerElement = null;
|
_minerElement = null;
|
||||||
_statusMonitor = null;
|
_statusMonitor = null;
|
||||||
|
super.uninitService(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initMiner(IProgressMonitor monitor)
|
protected void initMiner(IProgressMonitor monitor)
|
||||||
|
@ -428,9 +432,9 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
monitor.beginTask(message, IProgressMonitor.UNKNOWN);
|
||||||
DataStore ds = getDataStore();
|
DataStore ds = getDataStore();
|
||||||
if (_minerElement == null || _minerElement.getDataStore() != ds)
|
if (_minerElement == null || _minerElement.getDataStore() != ds)
|
||||||
{
|
{
|
||||||
if (ds != null && _initializeStatus == null)
|
if (ds != null && _initializeStatus == null)
|
||||||
{
|
{
|
||||||
_initializeStatus = ds.activateMiner(minerId);
|
_initializeStatus = ds.activateMiner(minerId);
|
||||||
/*
|
/*
|
||||||
DStoreStatusMonitor smon = getStatusMonitor(ds);
|
DStoreStatusMonitor smon = getStatusMonitor(ds);
|
||||||
|
@ -442,16 +446,16 @@ public abstract class AbstractDStoreService implements IDStoreService
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
getMinerElement();
|
getMinerElement();
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getMinerId();
|
protected abstract String getMinerId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [216351] Improve cancellation of SystemFetchOperation for files
|
* 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
|
* 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
|
* 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;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -1382,14 +1383,6 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
return hasSucceeded;
|
return hasSucceeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCaseSensitive()
|
public boolean isCaseSensitive()
|
||||||
{
|
{
|
||||||
//TODO find out whether remote is case sensitive or not
|
//TODO find out whether remote is case sensitive or not
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* 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) - [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
|
* 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;
|
package org.eclipse.rse.internal.services.local.files;
|
||||||
|
@ -1545,15 +1546,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
||||||
return (rc == 0);
|
return (rc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCaseSensitive()
|
public boolean isCaseSensitive()
|
||||||
{
|
{
|
||||||
return !isWindows();
|
return !isWindows();
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* Kevin Doyle (IBM) - [199871] LocalProcessService needs to implement getMessage()
|
* 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;
|
package org.eclipse.rse.internal.services.local.processes;
|
||||||
|
@ -32,30 +33,29 @@ 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.ProcessHandler;
|
||||||
import org.eclipse.rse.services.clientserver.processes.handlers.ProcessHandlerManager;
|
import org.eclipse.rse.services.clientserver.processes.handlers.ProcessHandlerManager;
|
||||||
import org.eclipse.rse.services.processes.AbstractProcessService;
|
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 String[] _statusTypes;
|
||||||
protected ProcessHandler handler;
|
protected ProcessHandler handler;
|
||||||
|
|
||||||
public LocalProcessService()
|
public LocalProcessService()
|
||||||
{
|
{
|
||||||
handler = ProcessHandlerManager.getInstance().getNewProcessHandler();
|
handler = ProcessHandlerManager.getInstance().getNewProcessHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return LocalServiceResources.Local_Process_Service_Name;
|
return LocalServiceResources.Local_Process_Service_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return LocalServiceResources.Local_Process_Service_Description;
|
return LocalServiceResources.Local_Process_Service_Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
IHostProcess[] processes = null;
|
IHostProcess[] processes = null;
|
||||||
|
|
||||||
|
@ -72,18 +72,18 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
return processes;
|
return processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean kill(long PID, String signal, IProgressMonitor monitor) throws SystemMessageException
|
public boolean kill(long PID, String signal, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
IHostProcess process = null;
|
IHostProcess process = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
process = getProcess(PID, monitor);
|
process = getProcess(PID, monitor);
|
||||||
|
|
||||||
// if there is no process, simply return true
|
// if there is no process, simply return true
|
||||||
if (process == null) {
|
if (process == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.kill(process, signal);
|
handler.kill(process, signal);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -97,14 +97,14 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
if (process != null) name += process.getName();
|
if (process != null) name += process.getName();
|
||||||
String pid = ""; //$NON-NLS-1$
|
String pid = ""; //$NON-NLS-1$
|
||||||
if (process != null) pid += process.getPid();
|
if (process != null) pid += process.getPid();
|
||||||
|
|
||||||
SystemMessage msg = getMessage("RSEPG1300"); //$NON-NLS-1$
|
SystemMessage msg = getMessage("RSEPG1300"); //$NON-NLS-1$
|
||||||
msg.makeSubstitution(name + " (" + pid + ")", e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
msg.makeSubstitution(name + " (" + pid + ")", e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
throw new SystemMessageException(msg);
|
throw new SystemMessageException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSignalTypes()
|
public String[] getSignalTypes()
|
||||||
{
|
{
|
||||||
if (_statusTypes != null)
|
if (_statusTypes != null)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
}
|
}
|
||||||
return _statusTypes;
|
return _statusTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of the signal types supported by the 'kill' command on this system
|
* Returns a list of the signal types supported by the 'kill' command on this system
|
||||||
* @return a list of the signal types or null if there are none or there is an error in
|
* @return a list of the signal types or null if there are none or there is an error in
|
||||||
|
@ -152,13 +152,4 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.internal.services.local.shells;
|
||||||
|
@ -25,34 +26,27 @@ import java.util.List;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.internal.services.local.ILocalService;
|
import org.eclipse.rse.internal.services.local.ILocalService;
|
||||||
import org.eclipse.rse.internal.services.local.LocalServiceResources;
|
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.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 static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
|
||||||
private String[] _envVars;
|
private String[] _envVars;
|
||||||
|
|
||||||
public LocalShellService()
|
public LocalShellService()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return LocalServiceResources.Local_Shell_Service_Name;
|
return LocalServiceResources.Local_Shell_Service_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return LocalServiceResources.Local_Shell_Service_Description;
|
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)
|
public IHostShell launchShell(String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
|
@ -61,12 +55,6 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
return hostShell;
|
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)
|
public IHostShell runCommand(String initialWorkingDirectory, String command, String encoding, String[] environment, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
LocalHostShell hostShell = new LocalHostShell(initialWorkingDirectory,command, encoding, environment);
|
LocalHostShell hostShell = new LocalHostShell(initialWorkingDirectory,command, encoding, environment);
|
||||||
|
@ -81,7 +69,7 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
List envVars = new ArrayList();
|
List envVars = new ArrayList();
|
||||||
|
|
||||||
String[] envCommand = new String[3];
|
String[] envCommand = new String[3];
|
||||||
//If we're on windows, change the envCommand.
|
//If we're on windows, change the envCommand.
|
||||||
if (System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$
|
if (System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
{
|
{
|
||||||
envCommand[0] = "cmd"; //$NON-NLS-1$
|
envCommand[0] = "cmd"; //$NON-NLS-1$
|
||||||
|
@ -132,17 +120,4 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
return _envVars;
|
return _envVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public SystemMessage getMessage(String messageID)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -24,6 +24,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [216343] immediate link targets and canonical paths for Sftp
|
* 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
|
* 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) - [224799] Fix JSch encoding problems with Arabic filenames
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.ssh.files;
|
package org.eclipse.rse.internal.services.ssh.files;
|
||||||
|
@ -1068,6 +1069,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor) {
|
public void initService(IProgressMonitor monitor) {
|
||||||
Activator.trace("SftpFileService.initService"); //$NON-NLS-1$
|
Activator.trace("SftpFileService.initService"); //$NON-NLS-1$
|
||||||
|
super.initService(monitor);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
|
@ -1080,6 +1082,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
||||||
public void uninitService(IProgressMonitor monitor) {
|
public void uninitService(IProgressMonitor monitor) {
|
||||||
Activator.trace("SftpFileService.uninitService"); //$NON-NLS-1$
|
Activator.trace("SftpFileService.uninitService"); //$NON-NLS-1$
|
||||||
disconnect();
|
disconnect();
|
||||||
|
super.uninitService(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCaseSensitive() {
|
public boolean isCaseSensitive() {
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,15 +7,16 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Adapted from LocalHostShell.
|
* Martin Oberhuber (Wind River) - Adapted from LocalHostShell.
|
||||||
* David McKnight (IBM) - [191599] Use the remote encoding specified in the host property page
|
* 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
|
* 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) - [204744] Honor encoding in SSH command input field
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.ssh.shell;
|
package org.eclipse.rse.internal.services.ssh.shell;
|
||||||
|
@ -53,7 +54,7 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
private SshShellOutputReader fStdoutHandler;
|
private SshShellOutputReader fStdoutHandler;
|
||||||
private SshShellOutputReader fStderrHandler;
|
private SshShellOutputReader fStderrHandler;
|
||||||
private SshShellWriterThread fShellWriter;
|
private SshShellWriterThread fShellWriter;
|
||||||
|
|
||||||
public SshHostShell(ISshSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) {
|
public SshHostShell(ISshSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) {
|
||||||
try {
|
try {
|
||||||
fSessionProvider = sessionProvider;
|
fSessionProvider = sessionProvider;
|
||||||
|
@ -66,7 +67,7 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
//if(commandToRun!=null && !commandToRun.equals(SHELL_INVOCATION) & (fChannel instanceof ChannelShell)) {
|
//if(commandToRun!=null && !commandToRun.equals(SHELL_INVOCATION) & (fChannel instanceof ChannelShell)) {
|
||||||
// ((ChannelShell)fChannel).setPty(false);
|
// ((ChannelShell)fChannel).setPty(false);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//Try to set the user environment. On most sshd configurations, this will
|
//Try to set the user environment. On most sshd configurations, this will
|
||||||
//not work since in sshd_config, PermitUserEnvironment and AcceptEnv
|
//not work since in sshd_config, PermitUserEnvironment and AcceptEnv
|
||||||
//settings are disabled. Still, it's worth a try.
|
//settings are disabled. Still, it's worth a try.
|
||||||
|
@ -91,6 +92,9 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
}
|
}
|
||||||
else
|
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);
|
fStdoutHandler = new SshShellOutputReader(this, new BufferedReader(new InputStreamReader(fChannel.getInputStream())), false);
|
||||||
}
|
}
|
||||||
fStderrHandler = new SshShellOutputReader(this, null,true);
|
fStderrHandler = new SshShellOutputReader(this, null,true);
|
||||||
|
@ -106,10 +110,10 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
fShellWriter = new SshShellWriterThread(outputWriter);
|
fShellWriter = new SshShellWriterThread(outputWriter);
|
||||||
}
|
}
|
||||||
fChannel.connect();
|
fChannel.connect();
|
||||||
if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0
|
if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0
|
||||||
&& !initialWorkingDirectory.equals(".") //$NON-NLS-1$
|
&& !initialWorkingDirectory.equals(".") //$NON-NLS-1$
|
||||||
&& !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047
|
&& !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047
|
||||||
) {
|
) {
|
||||||
writeToShell("cd "+PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$
|
writeToShell("cd "+PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$
|
||||||
} else if (SHELL_INVOCATION.equals(commandToRun)) {
|
} else if (SHELL_INVOCATION.equals(commandToRun)) {
|
||||||
writeToShell(getPromptCommand());
|
writeToShell(getPromptCommand());
|
||||||
|
@ -135,9 +139,9 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to remote system and launch Threads for the
|
* Connect to remote system and launch Threads for the shell as needed.
|
||||||
* shell as needed.
|
*
|
||||||
* @param monitor
|
* @param monitor progress monitor for long-running operation
|
||||||
*/
|
*/
|
||||||
protected void start(IProgressMonitor monitor)
|
protected void start(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
|
@ -162,11 +166,11 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern cdCommands = Pattern.compile("\\A\\s*(cd|chdir|ls)\\b"); //$NON-NLS-1$
|
private static final Pattern cdCommands = Pattern.compile("\\A\\s*(cd|chdir|ls)\\b"); //$NON-NLS-1$
|
||||||
|
|
||||||
public String getPromptCommand() {
|
public String getPromptCommand() {
|
||||||
return "echo $PWD'>'"; //$NON-NLS-1$
|
return "echo $PWD'>'"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToShell(String command) {
|
public void writeToShell(String command) {
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
if ("#break".equals(command)) { //$NON-NLS-1$
|
if ("#break".equals(command)) { //$NON-NLS-1$
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,13 +7,14 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
|
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.internal.services.ssh.shell;
|
||||||
|
@ -23,29 +24,21 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.internal.services.ssh.ISshService;
|
import org.eclipse.rse.internal.services.ssh.ISshService;
|
||||||
import org.eclipse.rse.internal.services.ssh.ISshSessionProvider;
|
import org.eclipse.rse.internal.services.ssh.ISshSessionProvider;
|
||||||
import org.eclipse.rse.internal.services.ssh.SshServiceResources;
|
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.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IShellService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Shell Services for ssh.
|
* A Shell Services for ssh.
|
||||||
* Adapted from LocalShellService.
|
* Adapted from LocalShellService.
|
||||||
*/
|
*/
|
||||||
public class SshShellService implements ISshService, IShellService {
|
public class SshShellService extends AbstractShellService implements ISshService {
|
||||||
|
|
||||||
private ISshSessionProvider fSessionProvider;
|
private ISshSessionProvider fSessionProvider;
|
||||||
|
|
||||||
public SshShellService(ISshSessionProvider sessionProvider) {
|
public SshShellService(ISshSessionProvider sessionProvider) {
|
||||||
fSessionProvider = sessionProvider;
|
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,
|
public IHostShell launchShell(String initialWorkingDirectory,
|
||||||
String encoding, String[] environment,
|
String encoding, String[] environment,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
@ -53,13 +46,6 @@ public class SshShellService implements ISshService, IShellService {
|
||||||
return hostShell;
|
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,
|
public IHostShell runCommand(String initialWorkingDirectory,
|
||||||
String command, String encoding, String[] environment,
|
String command, String encoding, String[] environment,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
@ -80,16 +66,4 @@ public class SshShellService implements ISshService, IShellService {
|
||||||
return SshServiceResources.SshShellService_Description;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,13 +7,14 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
|
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
|
||||||
* Sheldon D'souza (Celunite) - Adapted from SshShellService.
|
* Sheldon D'souza (Celunite) - Adapted from SshShellService.
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.services.telnet.shell;
|
package org.eclipse.rse.internal.services.telnet.shell;
|
||||||
|
|
||||||
|
@ -21,46 +22,32 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.internal.services.telnet.ITelnetService;
|
import org.eclipse.rse.internal.services.telnet.ITelnetService;
|
||||||
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
|
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
|
||||||
import org.eclipse.rse.internal.services.telnet.TelnetServiceResources;
|
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.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IShellService;
|
|
||||||
|
|
||||||
public class TelnetShellService implements ITelnetService, IShellService {
|
public class TelnetShellService extends AbstractShellService implements ITelnetService {
|
||||||
|
|
||||||
|
|
||||||
private ITelnetSessionProvider fTelnetSessionProvider;
|
private ITelnetSessionProvider fTelnetSessionProvider;
|
||||||
|
|
||||||
public TelnetShellService( ITelnetSessionProvider sessionProvider) {
|
public TelnetShellService( ITelnetSessionProvider sessionProvider) {
|
||||||
this.fTelnetSessionProvider = sessionProvider;
|
this.fTelnetSessionProvider = sessionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getHostEnvironment() {
|
public String[] getHostEnvironment() {
|
||||||
return new String[0];
|
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,
|
public IHostShell launchShell(String initialWorkingDirectory,
|
||||||
String encoding, String[] environment,
|
String encoding, String[] environment,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
||||||
return hostShell;
|
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,
|
public IHostShell runCommand(String initialWorkingDirectory,
|
||||||
String command, String encoding, String[] environment,
|
String command, String encoding, String[] environment,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
||||||
return hostShell;
|
return hostShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,23 +55,8 @@ public class TelnetShellService implements ITelnetService, IShellService {
|
||||||
return TelnetServiceResources.TelnetShellService_Description;
|
return TelnetServiceResources.TelnetShellService_Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SystemMessage getMessage(String messageID) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return TelnetServiceResources.TelnetShellService_Name;
|
return TelnetServiceResources.TelnetShellService_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#Wed Apr 09 15:34:43 CEST 2008
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=ISO-8859-1
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,22 +7,74 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services;
|
package org.eclipse.rse.services;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
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();
|
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();
|
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);
|
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);
|
public void uninitService(IProgressMonitor monitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
* Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND
|
* Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND
|
||||||
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* 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;
|
package org.eclipse.rse.services.files;
|
||||||
|
@ -36,15 +37,16 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
import org.eclipse.rse.services.AbstractService;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
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;
|
protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor)
|
public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor)
|
||||||
throws SystemMessageException
|
throws SystemMessageException
|
||||||
{
|
{
|
||||||
List results = new ArrayList();
|
List results = new ArrayList();
|
||||||
|
@ -55,12 +57,12 @@ public abstract class AbstractFileService implements IFileService
|
||||||
return (IHostFile[])results.toArray(new IHostFile[results.size()]);
|
return (IHostFile[])results.toArray(new IHostFile[results.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostFile[] list(String remoteParent, String fileFilter,
|
public IHostFile[] list(String remoteParent, String fileFilter,
|
||||||
int fileType, IProgressMonitor monitor) throws SystemMessageException
|
int fileType, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
return internalFetch(remoteParent, fileFilter, fileType, monitor);
|
return internalFetch(remoteParent, fileFilter, fileType, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostFile[] listMultiple(String[] remoteParents,
|
public IHostFile[] listMultiple(String[] remoteParents,
|
||||||
String[] fileFilters, int fileTypes[], IProgressMonitor monitor)
|
String[] fileFilters, int fileTypes[], IProgressMonitor monitor)
|
||||||
throws SystemMessageException {
|
throws SystemMessageException {
|
||||||
|
@ -74,7 +76,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
files.add(result[j]);
|
files.add(result[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +93,10 @@ public abstract class AbstractFileService implements IFileService
|
||||||
files.add(result[j]);
|
files.add(result[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isRightType(int fileType, IHostFile node)
|
protected boolean isRightType(int fileType, IHostFile node)
|
||||||
{
|
{
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
|
@ -104,12 +106,12 @@ public abstract class AbstractFileService implements IFileService
|
||||||
case IFileService.FILE_TYPE_FILES:
|
case IFileService.FILE_TYPE_FILES:
|
||||||
if (node.isFile())
|
if (node.isFile())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case IFileService.FILE_TYPE_FOLDERS:
|
case IFileService.FILE_TYPE_FOLDERS:
|
||||||
if (node.isDirectory())
|
if (node.isDirectory())
|
||||||
{
|
{
|
||||||
|
@ -121,7 +123,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +142,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
*/
|
*/
|
||||||
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
||||||
File[] localFiles, boolean[] isBinaries, String[] hostEncodings,
|
File[] localFiles, boolean[] isBinaries, String[] hostEncodings,
|
||||||
IProgressMonitor monitor) throws SystemMessageException
|
IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
for (int i = 0; i < remoteParents.length && result == true; i++)
|
for (int i = 0; i < remoteParents.length && result == true; i++)
|
||||||
|
@ -161,7 +163,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
public boolean uploadMultiple(File[] localFiles, String[] remoteParents,
|
public boolean uploadMultiple(File[] localFiles, String[] remoteParents,
|
||||||
String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings,
|
String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings,
|
||||||
String[] hostEncodings, IProgressMonitor monitor)
|
String[] hostEncodings, IProgressMonitor monitor)
|
||||||
throws SystemMessageException
|
throws SystemMessageException
|
||||||
{
|
{
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
for (int i = 0; i < localFiles.length && result == true; i++)
|
for (int i = 0; i < localFiles.length && result == true; i++)
|
||||||
|
@ -169,7 +171,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
File localFile = localFiles[i];
|
File localFile = localFiles[i];
|
||||||
String remoteParent = remoteParents[i];
|
String remoteParent = remoteParents[i];
|
||||||
String remoteFile = remoteFiles[i];
|
String remoteFile = remoteFiles[i];
|
||||||
|
|
||||||
boolean isBinary = isBinaries[i];
|
boolean isBinary = isBinaries[i];
|
||||||
String srcEncoding = srcEncodings[i];
|
String srcEncoding = srcEncodings[i];
|
||||||
String hostEncoding = hostEncodings[i];
|
String hostEncoding = hostEncodings[i];
|
||||||
|
@ -177,7 +179,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the local platform encoding by default. Subclasses should override to return the actual remote encoding.
|
* Returns the local platform encoding by default. Subclasses should override to return the actual remote encoding.
|
||||||
* @see org.eclipse.rse.services.files.IFileService#getEncoding(org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.rse.services.files.IFileService#getEncoding(org.eclipse.core.runtime.IProgressMonitor)
|
||||||
|
@ -196,15 +198,18 @@ public abstract class AbstractFileService implements IFileService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the output stream to write/append to a remote file.
|
* Gets the output stream to write/append to a remote file. The default
|
||||||
* The default implementation returns <code>null</code>.
|
* implementation returns <code>null</code>. Clients can override to
|
||||||
* Clients can override to return an output stream to the file.
|
* return an output stream to the file.
|
||||||
* @deprecated
|
*
|
||||||
|
* @deprecated use
|
||||||
|
* {@link #getOutputStream(String, String, int, IProgressMonitor)}
|
||||||
|
* instead
|
||||||
*/
|
*/
|
||||||
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
|
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the output stream to write/append to a remote file.
|
* Gets the output stream to write/append to a remote file.
|
||||||
* The default implementation returns <code>null</code>.
|
* The default implementation returns <code>null</code>.
|
||||||
|
@ -219,7 +224,7 @@ public abstract class AbstractFileService implements IFileService
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default implementation returns false. Clients should override this method if they make use
|
* The default implementation returns false. Clients should override this method if they make use
|
||||||
* of IFileServiceCodePageConverter to do conversion during download and upload.
|
* of IFileServiceCodePageConverter to do conversion during download and upload.
|
||||||
|
|
|
@ -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>
|
|
@ -1,31 +1,37 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.services.processes;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
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.SystemMessage;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl;
|
import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl;
|
||||||
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
|
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
|
||||||
import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
|
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
|
public IHostProcess[] listAllProcesses(String exeNameFilter, String userNameFilter, String stateFilter, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setName(exeNameFilter);
|
rpfs.setName(exeNameFilter);
|
||||||
|
@ -34,7 +40,7 @@ public abstract class AbstractProcessService implements IProcessService
|
||||||
return listAllProcesses(rpfs, monitor);
|
return listAllProcesses(rpfs, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess[] listAllProcesses(IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listAllProcesses(IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
return listAllProcesses(rpfs, monitor);
|
return listAllProcesses(rpfs, monitor);
|
||||||
|
@ -42,51 +48,53 @@ public abstract class AbstractProcessService implements IProcessService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a single IHostProcess object for the 'init' process with pid 1.
|
* Return a single IHostProcess object for the 'init' process with pid 1.
|
||||||
|
*
|
||||||
* @param monitor Progress monitor
|
* @param monitor Progress monitor
|
||||||
* @return Array with 1 element, the IHostProcess object for the root process
|
* @return Array with 1 element, the IHostProcess object for the root
|
||||||
* @throws SystemMessageException
|
* process
|
||||||
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
* @see org.eclipse.rse.services.processes.IProcessService#listRootProcesses(org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.rse.services.processes.IProcessService#listRootProcesses(org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
IHostProcess[] roots = new IHostProcess[1];
|
IHostProcess[] roots = new IHostProcess[1];
|
||||||
roots[0] = getProcess(1, monitor);
|
roots[0] = getProcess(1, monitor);
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess[] listChildProcesses(long parentPID, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listChildProcesses(long parentPID, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
String pPidString = "" + parentPID; //$NON-NLS-1$
|
String pPidString = "" + parentPID; //$NON-NLS-1$
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setPpid(pPidString);
|
rpfs.setPpid(pPidString);
|
||||||
|
|
||||||
return listAllProcesses(rpfs, monitor);
|
return listAllProcesses(rpfs, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess[] listChildProcesses(long parentPID, IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess[] listChildProcesses(long parentPID, IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
String pPidString = "" + parentPID; //$NON-NLS-1$
|
String pPidString = "" + parentPID; //$NON-NLS-1$
|
||||||
filter.setPpid(pPidString);
|
filter.setPpid(pPidString);
|
||||||
|
|
||||||
return listAllProcesses(filter, monitor);
|
return listAllProcesses(filter, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess getParentProcess(long pid, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess getParentProcess(long pid, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
return getProcess(getProcess(pid, monitor).getPPid(), monitor);
|
return getProcess(getProcess(pid, monitor).getPPid(), monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostProcess getProcess(long pid, IProgressMonitor monitor) throws SystemMessageException
|
public IHostProcess getProcess(long pid, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
String pidString = "" + pid; //$NON-NLS-1$
|
String pidString = "" + pid; //$NON-NLS-1$
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setPid(pidString);
|
rpfs.setPid(pidString);
|
||||||
|
|
||||||
IHostProcess[] results = listAllProcesses(rpfs, monitor);
|
IHostProcess[] results = listAllProcesses(rpfs, monitor);
|
||||||
if ((results == null) || (results.length == 0)) return null;
|
if ((results == null) || (results.length == 0)) return null;
|
||||||
else return results[0];
|
else return results[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public SystemMessage getMessage(String messageID)
|
public SystemMessage getMessage(String messageID)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,121 +1,144 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.services.processes;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.rse.services.IService;
|
import org.eclipse.rse.services.IService;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
|
import org.eclipse.rse.services.clientserver.processes.IHostProcess;
|
||||||
import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
|
import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An IProcessService is an abstraction of a process service that runs over some sort of connection.
|
* An IProcessService is an abstraction of a process service that runs over some
|
||||||
* It can be shared among multiple instances of a subsystem. Each
|
* sort of connection. It can be shared among multiple instances of a subsystem.
|
||||||
* subsystem is currently responsible for layering an abstraction over whatever it
|
* Each subsystem is currently responsible for layering an abstraction over
|
||||||
* wants to construct as a service.
|
* whatever it wants to construct as a service.
|
||||||
* <p>
|
* <p>
|
||||||
* Implementers of this interface will have to either be instantiated, initialized, or
|
* Implementers of this interface will have to either be instantiated,
|
||||||
* somehow derive a connection as part of its state.
|
* 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
|
public interface IProcessService extends IService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Return a list of all processes on the remote system.
|
* Return a list of all processes on the remote system.
|
||||||
|
*
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return List of all processes
|
* @return List of all processes
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess[] listAllProcesses(IProgressMonitor monitor) throws SystemMessageException;
|
public IHostProcess[] listAllProcesses(IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a filtered list of all processes on the remote system.
|
* Return a filtered list of all processes on the remote system.
|
||||||
|
*
|
||||||
* @param filter An object to filter results by
|
* @param filter An object to filter results by
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return Filtered list of processes
|
* @return Filtered list of processes
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException;
|
public IHostProcess[] listAllProcesses(IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a filtered list of all processes on the remote system.
|
* 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 exeNameFilter The executable name to filter results by, or null if
|
||||||
* @param stateFilter The state code to filter results by, or null if no state filtering
|
* 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
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return Filtered list of processes
|
* @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;
|
public IHostProcess[] listAllProcesses(String exeNameFilter, String userNameFilter, String stateFilter, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns root processes on the remote system
|
* Returns root processes on the remote system
|
||||||
|
*
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return List of root processes
|
* @return List of root processes
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException;
|
public IHostProcess[] listRootProcesses(IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of all remote child processes of the given parent process on the remote system
|
* Return a list of all remote child processes of the given parent process
|
||||||
* @param parentPID The ID of the parent process whose children are to be listed
|
* 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
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return List of child processes
|
* @return List of child processes
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess[] listChildProcesses(long parentPID, IProgressMonitor monitor) throws SystemMessageException;
|
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
|
* Return a filtered list of remote child processes of the given parent
|
||||||
* @param parentPID The ID of the parent process whose children are to be listed
|
* 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 filter A filter to narrow results by
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return Filtered list of child processes
|
* @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;
|
public IHostProcess[] listChildProcesses(long parentPID, IHostProcessFilter filter, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a process, return its parent process object.
|
* Given a process, return its parent process object.
|
||||||
|
*
|
||||||
* @param pid the ID of the process to return parent of.
|
* @param pid the ID of the process to return parent of.
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return The parent process
|
* @return The parent process
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess getParentProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
|
public IHostProcess getParentProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a pid, return an IHostProcess object for it.
|
* Given a pid, return an IHostProcess object for it.
|
||||||
|
*
|
||||||
* @param pid The process ID of the desired process
|
* @param pid The process ID of the desired process
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @param monitor A progress monitor to which progress will be reported
|
||||||
* @return IHostProcess object for the given pid
|
* @return IHostProcess object for the given pid
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public IHostProcess getProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
|
public IHostProcess getProcess(long pid, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kills a process.
|
* Kills a process.
|
||||||
|
*
|
||||||
* @param pid the ID of the process to be killed.
|
* @param pid the ID of the process to be killed.
|
||||||
* @param signal the signal to send to the process
|
* @param signal the signal to send to the process
|
||||||
* @param monitor A progress monitor to which progress will be reported
|
* @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>.
|
* @return <code>false</code> if the given process doesn't exist, else
|
||||||
* Throws an exception if anything fails.
|
* <code>true</code>. Throws an exception if anything fails.
|
||||||
* @throws SystemMessageException
|
* @throws SystemMessageException in case anything goes wrong
|
||||||
*/
|
*/
|
||||||
public boolean kill(long pid, String signal, IProgressMonitor monitor) throws SystemMessageException;
|
public boolean kill(long pid, String signal, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of the types of signals that can be sent to
|
* Returns a list of the types of signals that can be sent to
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.services.search;
|
||||||
|
@ -20,26 +21,31 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
import org.eclipse.rse.services.AbstractService;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base class for RSE Search Service. A useful implementation should
|
||||||
public abstract class AbstractSearchService implements ISearchService
|
* 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;
|
protected Map _searches;
|
||||||
|
|
||||||
public AbstractSearchService()
|
public AbstractSearchService()
|
||||||
{
|
{
|
||||||
_searches = new HashMap();
|
_searches = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void search(IHostSearchResultConfiguration searchConfig, IFileService fileService, IProgressMonitor monitor)
|
public final void search(IHostSearchResultConfiguration searchConfig, IFileService fileService, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
ISearchHandler handler = internalSearch(searchConfig, fileService, monitor);
|
ISearchHandler handler = internalSearch(searchConfig, fileService, monitor);
|
||||||
_searches.put(searchConfig, handler);
|
_searches.put(searchConfig, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final void cancelSearch(IHostSearchResultConfiguration searchConfig, IProgressMonitor monitor)
|
public final void cancelSearch(IHostSearchResultConfiguration searchConfig, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
ISearchHandler handler = (ISearchHandler)_searches.get(searchConfig);
|
ISearchHandler handler = (ISearchHandler)_searches.get(searchConfig);
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.search;
|
package org.eclipse.rse.services.search;
|
||||||
|
@ -24,18 +24,18 @@ import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A remote search result set represents a page in the Remote Search view.
|
* A remote search result set represents a page in the Remote Search view.
|
||||||
* A search result set contains multiple search configurations and their results.
|
* A search result set contains multiple search configurations and their results.
|
||||||
* This allows it to contain results from multiple connections, filters, and folders
|
* This allows it to contain results from multiple connections, filters, and folders
|
||||||
* (from different systems).
|
* (from different systems).
|
||||||
*/
|
*/
|
||||||
public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
public class HostSearchResultSet extends PlatformObject implements IHostSearchResultSet, IAdaptable
|
||||||
{
|
{
|
||||||
|
|
||||||
protected Vector configurations;
|
protected Vector configurations;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
@ -106,48 +106,48 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#getAllResults()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#getAllResults()
|
||||||
*/
|
*/
|
||||||
public Object[] getAllResults() {
|
public Object[] getAllResults() {
|
||||||
|
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
|
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
list.addAll(Arrays.asList(config.getResults()));
|
list.addAll(Arrays.asList(config.getResults()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.toArray();
|
return list.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#removeAllResults()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#removeAllResults()
|
||||||
*/
|
*/
|
||||||
public void removeAllResults() {
|
public void removeAllResults() {
|
||||||
|
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
config.removeResults();
|
config.removeResults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#getNumOfResults()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#getNumOfResults()
|
||||||
*/
|
*/
|
||||||
public int getNumOfResults() {
|
public int getNumOfResults() {
|
||||||
|
|
||||||
int resultSize = 0;
|
int resultSize = 0;
|
||||||
|
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
resultSize += config.getResultsSize();
|
resultSize += config.getResultsSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultSize;
|
return resultSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,13 +155,13 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#cancel()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#cancel()
|
||||||
*/
|
*/
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
|
||||||
// cancel each config that is running
|
// cancel each config that is running
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
if (config.getStatus() == IHostSearchConstants.RUNNING) {
|
if (config.getStatus() == IHostSearchConstants.RUNNING) {
|
||||||
config.cancel();
|
config.cancel();
|
||||||
}
|
}
|
||||||
|
@ -173,60 +173,60 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
*/
|
*/
|
||||||
public void removeResult(Object result) {
|
public void removeResult(Object result) {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
config.removeResult(result);
|
config.removeResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#removeAndAddResult(java.lang.Object, java.lang.Object)
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#removeAndAddResult(java.lang.Object, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void removeAndAddResult(Object oldResult, Object newResult) {
|
public void removeAndAddResult(Object oldResult, Object newResult) {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
config.removeAndAddResult(oldResult, newResult);
|
config.removeAndAddResult(oldResult, newResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#dispose()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
// first cancel all configs that are still running
|
// first cancel all configs that are still running
|
||||||
cancel();
|
cancel();
|
||||||
|
|
||||||
// now dispose each configuration
|
// now dispose each configuration
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
config.dispose();
|
config.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove all the configurations
|
// remove all the configurations
|
||||||
configurations.removeAllElements();
|
configurations.removeAllElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.services.search.IHostSearchResultSet#isCancelled()
|
* @see org.eclipse.rse.services.search.IHostSearchResultSet#isCancelled()
|
||||||
*/
|
*/
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
// if a config is not cancelled, the search is not cancelled
|
// if a config is not cancelled, the search is not cancelled
|
||||||
if (config.getStatus() != IHostSearchConstants.CANCELED) {
|
if (config.getStatus() != IHostSearchConstants.CANCELED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,16 +235,16 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
*/
|
*/
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
// if a config is not finished, the search is not finished
|
// if a config is not finished, the search is not finished
|
||||||
if (config.getStatus() != IHostSearchConstants.FINISHED) {
|
if (config.getStatus() != IHostSearchConstants.FINISHED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,16 +253,16 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
*/
|
*/
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
// if a config is running, the search is running
|
// if a config is running, the search is running
|
||||||
if (config.getStatus() == IHostSearchConstants.RUNNING) {
|
if (config.getStatus() == IHostSearchConstants.RUNNING) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,23 +271,17 @@ public class HostSearchResultSet implements IHostSearchResultSet, IAdaptable
|
||||||
*/
|
*/
|
||||||
public boolean isDisconnected() {
|
public boolean isDisconnected() {
|
||||||
Iterator iter = getSearchConfigurations();
|
Iterator iter = getSearchConfigurations();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)iter.next();
|
||||||
|
|
||||||
// if a config is not disconnected, the search is not disconnected
|
// if a config is not disconnected, the search is not disconnected
|
||||||
if (config.getStatus() != IHostSearchConstants.DISCONNECTED) {
|
if (config.getStatus() != IHostSearchConstants.DISCONNECTED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
|
||||||
*/
|
|
||||||
public Object getAdapter(Class adapter) {
|
|
||||||
return Platform.getAdapterManager().getAdapter(this, adapter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,34 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.services.search;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
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 interface ISearchService
|
||||||
{
|
{
|
||||||
public void search(IHostSearchResultConfiguration searchConfig, IFileService fileService, IProgressMonitor monitor);
|
public void search(IHostSearchResultConfiguration searchConfig, IFileService fileService, IProgressMonitor monitor);
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,77 +1,122 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* 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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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;
|
package org.eclipse.rse.services.shells;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.rse.services.IService;
|
import org.eclipse.rse.services.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IShellService is an abstraction for running shells and
|
* IShellService is an abstraction for running shells and shell commands.
|
||||||
* 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
|
public interface IShellService extends IService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Launch a new shell in the specified directory
|
* Launch a new shell in the specified directory with a default encoding.
|
||||||
* @param initialWorkingDirectory
|
*
|
||||||
* @param environment Array of environment variable Strings of the form "var=text"
|
* This is a convenience method, passing <code>null</code> as encoding
|
||||||
* @param monitor
|
* into {@link #launchShell(String, String, String[], IProgressMonitor)}.
|
||||||
* @return the shell object
|
|
||||||
*/
|
*/
|
||||||
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor);
|
public IHostShell launchShell(String initialWorkingDirectory, String[] environment, IProgressMonitor monitor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch a new shell in the specified directory
|
* Launch a new shell in the specified directory.
|
||||||
* @param initialWorkingDirectory
|
*
|
||||||
* @param encoding
|
* @param initialWorkingDirectory initial working directory or
|
||||||
* @param environment Array of environment variable Strings of the form "var=text"
|
* <code>null</code> if not relevant. The remote shell will
|
||||||
* @param monitor
|
* launch in a directory of its own choice in that case
|
||||||
* @return the shell object
|
* (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);
|
public IHostShell launchShell(String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a command in it's own shell
|
*
|
||||||
* @param initialWorkingDirectory
|
* Run a single command in it's own shell with a default encoding.
|
||||||
* @param command
|
*
|
||||||
* @param environment Array of environment variable Strings of the form "var=text"
|
* This is a convenience method, passing <code>null</code> as encoding
|
||||||
* @param monitor
|
* into
|
||||||
* @return the shell object for getting output and error streams
|
* {@link #runCommand(String, String, String, String[], IProgressMonitor)}.
|
||||||
*/
|
*/
|
||||||
public IHostShell runCommand(String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor);
|
public IHostShell runCommand(String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a command in it's own shell
|
* Run a single command in it's own shell.
|
||||||
* @param initialWorkingDirectory
|
*
|
||||||
* @param command
|
* This method is similar to
|
||||||
* @param encoding
|
* {@link #launchShell(String, String, String[], IProgressMonitor)} but
|
||||||
* @param environment Array of environment variable Strings of the form "var=text"
|
* immediately executes a specified command rather than just opening a
|
||||||
* @param monitor
|
* shell. There is no guarantee that after the host shell will accept any
|
||||||
* @return the shell object for getting output and error streams
|
* 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);
|
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.
|
* Return an array of environment variables that describe the environment on
|
||||||
* Each String returned is of the format "var=text": Everything up to the
|
* the remote system. Each String returned is of the format "var=text":
|
||||||
* first equals sign is the name of the given environment variable, everything
|
* Everything up to the first equals sign is the name of the given
|
||||||
* after the equals sign is its contents.
|
* environment variable, everything after the equals sign is its contents.
|
||||||
* @return Array of environment variable Strings of the form "var=text"
|
*
|
||||||
|
* @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();
|
public String[] getHostEnvironment();
|
||||||
}
|
}
|
|
@ -1,15 +1,16 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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
|
* Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* 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
|
* 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;
|
package org.eclipse.rse.internal.subsystems.processes.shell.linux;
|
||||||
|
@ -36,7 +37,7 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShell
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class to fetch remote linux target's process info
|
* class to fetch remote linux target's process info
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LinuxShellProcessService extends AbstractProcessService {
|
public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
* @param host the connection to work on
|
* @param host the connection to work on
|
||||||
*/
|
*/
|
||||||
public LinuxShellProcessService(final IHost host) {
|
public LinuxShellProcessService(final IHost host) {
|
||||||
|
@ -167,11 +168,11 @@ public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for remote process to exit.
|
// Wait for remote process to exit.
|
||||||
WaiterJob waiter = new WaiterJob(p);
|
WaiterJob waiter = new WaiterJob(p);
|
||||||
waiter.schedule();
|
waiter.schedule();
|
||||||
|
|
||||||
return (IHostProcess[]) hostProcessList
|
return (IHostProcess[]) hostProcessList
|
||||||
.toArray(new IHostProcess[hostProcessList.size()]);
|
.toArray(new IHostProcess[hostProcessList.size()]);
|
||||||
}
|
}
|
||||||
|
@ -185,14 +186,12 @@ public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(final IProgressMonitor monitor) {
|
public void initService(final IProgressMonitor monitor) {
|
||||||
|
super.initService(monitor);
|
||||||
linuxProcessHelper = new LinuxProcessHelper();
|
linuxProcessHelper = new LinuxProcessHelper();
|
||||||
// initialize username /uid hashmap before getting any process
|
// initialize username /uid hashmap before getting any process
|
||||||
linuxProcessHelper.populateUsernames(host);
|
linuxProcessHelper.populateUsernames(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninitService(final IProgressMonitor monitor) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean progressWorked(final IProgressMonitor monitor,
|
private boolean progressWorked(final IProgressMonitor monitor,
|
||||||
final int work) {
|
final int work) {
|
||||||
boolean cancelRequested = false;
|
boolean cancelRequested = false;
|
||||||
|
@ -207,7 +206,7 @@ public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
* Returns a list of the signal types supported by the 'kill' command on
|
* Returns a list of the signal types supported by the 'kill' command on
|
||||||
* this system. Signal Types will be used in the Kill dialog for user to
|
* this system. Signal Types will be used in the Kill dialog for user to
|
||||||
* choose which signal they want to use for killing a process.
|
* choose which signal they want to use for killing a process.
|
||||||
*
|
*
|
||||||
* @return a list of the signal types or null if there are none or there is
|
* @return a list of the signal types or null if there are none or there is
|
||||||
* an error in executing the kill command.
|
* an error in executing the kill command.
|
||||||
*/
|
*/
|
||||||
|
@ -253,7 +252,7 @@ public class LinuxShellProcessService extends AbstractProcessService {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for remote process to exit.
|
// Wait for remote process to exit.
|
||||||
WaiterJob waiter = new WaiterJob(p);
|
WaiterJob waiter = new WaiterJob(p);
|
||||||
waiter.schedule();
|
waiter.schedule();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Radoslav Gerganov - derived from SftpFileService and LocalFileService
|
* Radoslav Gerganov - derived from SftpFileService and LocalFileService
|
||||||
|
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.services.wince.files;
|
package org.eclipse.rse.internal.services.wince.files;
|
||||||
|
|
||||||
|
@ -41,11 +42,11 @@ import org.eclipse.tm.rapi.RapiFindData;
|
||||||
public class WinCEFileService extends AbstractFileService implements IWinCEService {
|
public class WinCEFileService extends AbstractFileService implements IWinCEService {
|
||||||
|
|
||||||
IRapiSessionProvider sessionProvider;
|
IRapiSessionProvider sessionProvider;
|
||||||
|
|
||||||
public WinCEFileService(IRapiSessionProvider sessionProvider) {
|
public WinCEFileService(IRapiSessionProvider sessionProvider) {
|
||||||
this.sessionProvider = sessionProvider;
|
this.sessionProvider = sessionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
String concat(String parentDir, String fileName) {
|
String concat(String parentDir, String fileName) {
|
||||||
String result = parentDir;
|
String result = parentDir;
|
||||||
if (!result.endsWith("\\")) { //$NON-NLS-1$
|
if (!result.endsWith("\\")) { //$NON-NLS-1$
|
||||||
|
@ -54,7 +55,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
result += fileName;
|
result += fileName;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IHostFile[] internalFetch(String parentPath, String fileFilter,
|
protected IHostFile[] internalFetch(String parentPath, String fileFilter,
|
||||||
int fileType, IProgressMonitor monitor) throws SystemMessageException {
|
int fileType, IProgressMonitor monitor) throws SystemMessageException {
|
||||||
if (fileFilter == null) {
|
if (fileFilter == null) {
|
||||||
|
@ -71,7 +72,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
try {
|
try {
|
||||||
IRapiSession session = sessionProvider.getSession();
|
IRapiSession session = sessionProvider.getSession();
|
||||||
RapiFindData[] foundFiles = session.findAllFiles(concat(parentPath,"*"), //$NON-NLS-1$
|
RapiFindData[] foundFiles = session.findAllFiles(concat(parentPath,"*"), //$NON-NLS-1$
|
||||||
Rapi.FAF_NAME | Rapi.FAF_ATTRIBUTES | Rapi.FAF_LASTWRITE_TIME |
|
Rapi.FAF_NAME | Rapi.FAF_ATTRIBUTES | Rapi.FAF_LASTWRITE_TIME |
|
||||||
Rapi.FAF_SIZE_HIGH | Rapi.FAF_SIZE_LOW);
|
Rapi.FAF_SIZE_HIGH | Rapi.FAF_SIZE_LOW);
|
||||||
for (int i = 0 ; i < foundFiles.length ; i++) {
|
for (int i = 0 ; i < foundFiles.length ; i++) {
|
||||||
String fileName = foundFiles[i].fileName;
|
String fileName = foundFiles[i].fileName;
|
||||||
|
@ -104,11 +105,11 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
}
|
}
|
||||||
return (attr & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0;
|
return (attr & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean exist(IRapiSession session, String fileName) {
|
private boolean exist(IRapiSession session, String fileName) {
|
||||||
return session.getFileAttributes(fileName) != -1;
|
return session.getFileAttributes(fileName) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copy(String srcParent, String srcName, String tgtParent,
|
public boolean copy(String srcParent, String srcName, String tgtParent,
|
||||||
String tgtName, IProgressMonitor monitor) throws SystemMessageException {
|
String tgtName, IProgressMonitor monitor) throws SystemMessageException {
|
||||||
String srcFullPath = concat(srcParent, srcName);
|
String srcFullPath = concat(srcParent, srcName);
|
||||||
|
@ -158,7 +159,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
String fullPath = concat(remoteParent, fileName);
|
String fullPath = concat(remoteParent, fileName);
|
||||||
IRapiSession session = sessionProvider.getSession();
|
IRapiSession session = sessionProvider.getSession();
|
||||||
try {
|
try {
|
||||||
int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE, Rapi.FILE_SHARE_READ,
|
int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE, Rapi.FILE_SHARE_READ,
|
||||||
Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL);
|
Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL);
|
||||||
session.closeHandle(handle);
|
session.closeHandle(handle);
|
||||||
RapiFindData findData = new RapiFindData();
|
RapiFindData findData = new RapiFindData();
|
||||||
|
@ -203,14 +204,14 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
}
|
}
|
||||||
} catch (RapiException e) {
|
} catch (RapiException e) {
|
||||||
//FIXME error handling
|
//FIXME error handling
|
||||||
throw new RemoteFileException(e.getMessage());
|
throw new RemoteFileException(e.getMessage());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding,
|
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding,
|
||||||
IProgressMonitor monitor) throws SystemMessageException {
|
IProgressMonitor monitor) throws SystemMessageException {
|
||||||
|
|
||||||
if (!localFile.exists()) {
|
if (!localFile.exists()) {
|
||||||
File localParentFile = localFile.getParentFile();
|
File localParentFile = localFile.getParentFile();
|
||||||
if (!localParentFile.exists()) {
|
if (!localParentFile.exists()) {
|
||||||
|
@ -222,7 +223,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
int handle = Rapi.INVALID_HANDLE_VALUE;
|
int handle = Rapi.INVALID_HANDLE_VALUE;
|
||||||
BufferedOutputStream bos = null;
|
BufferedOutputStream bos = null;
|
||||||
try {
|
try {
|
||||||
handle = session.createFile(fullPath, Rapi.GENERIC_READ,
|
handle = session.createFile(fullPath, Rapi.GENERIC_READ,
|
||||||
Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL);
|
Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL);
|
||||||
bos = new BufferedOutputStream(new FileOutputStream(localFile));
|
bos = new BufferedOutputStream(new FileOutputStream(localFile));
|
||||||
// don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work
|
// don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work
|
||||||
|
@ -288,14 +289,14 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName,
|
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName,
|
||||||
IProgressMonitor monitor) throws SystemMessageException {
|
IProgressMonitor monitor) throws SystemMessageException {
|
||||||
boolean ok = copy(srcParent, srcName, tgtParent, tgtName, monitor);
|
boolean ok = copy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||||
ok = ok && delete(srcParent, srcName, monitor);
|
ok = ok && delete(srcParent, srcName, monitor);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean rename(String remoteParent, String oldName, String newName,
|
public boolean rename(String remoteParent, String oldName, String newName,
|
||||||
IProgressMonitor monitor) throws SystemMessageException {
|
IProgressMonitor monitor) throws SystemMessageException {
|
||||||
String oldFullPath = concat(remoteParent, oldName);
|
String oldFullPath = concat(remoteParent, oldName);
|
||||||
String newFullPath = concat(remoteParent, newName);
|
String newFullPath = concat(remoteParent, newName);
|
||||||
|
@ -309,7 +310,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile,
|
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile,
|
||||||
IProgressMonitor monitor) throws SystemMessageException {
|
IProgressMonitor monitor) throws SystemMessageException {
|
||||||
boolean retVal = rename(remoteParent, oldName, newName, monitor);
|
boolean retVal = rename(remoteParent, oldName, newName, monitor);
|
||||||
String newFullPath = concat(remoteParent, newName);
|
String newFullPath = concat(remoteParent, newName);
|
||||||
|
@ -332,7 +333,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
String fullPath = concat(remoteParent, remoteFile);
|
String fullPath = concat(remoteParent, remoteFile);
|
||||||
int handle = Rapi.INVALID_HANDLE_VALUE;
|
int handle = Rapi.INVALID_HANDLE_VALUE;
|
||||||
try {
|
try {
|
||||||
handle = session.createFile(fullPath, Rapi.GENERIC_WRITE,
|
handle = session.createFile(fullPath, Rapi.GENERIC_WRITE,
|
||||||
Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL);
|
Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL);
|
||||||
// don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work
|
// don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work
|
||||||
byte[] buffer = new byte[4 * 1024];
|
byte[] buffer = new byte[4 * 1024];
|
||||||
|
@ -366,7 +367,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary,
|
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary,
|
||||||
String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException {
|
String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException {
|
||||||
FileInputStream fis = null;
|
FileInputStream fis = null;
|
||||||
try {
|
try {
|
||||||
|
@ -384,7 +385,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
String fullPath = concat(remoteParent, remoteFile);
|
String fullPath = concat(remoteParent, remoteFile);
|
||||||
IRapiSession session = sessionProvider.getSession();
|
IRapiSession session = sessionProvider.getSession();
|
||||||
try {
|
try {
|
||||||
int handle = session.createFile(fullPath, Rapi.GENERIC_READ,
|
int handle = session.createFile(fullPath, Rapi.GENERIC_READ,
|
||||||
Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL);
|
Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL);
|
||||||
return new BufferedInputStream(new WinCEInputStream(session, handle));
|
return new BufferedInputStream(new WinCEInputStream(session, handle));
|
||||||
} catch (RapiException e) {
|
} catch (RapiException e) {
|
||||||
|
@ -404,7 +405,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
} else {
|
} else {
|
||||||
cd = Rapi.OPEN_EXISTING;
|
cd = Rapi.OPEN_EXISTING;
|
||||||
}
|
}
|
||||||
int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE,
|
int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE,
|
||||||
Rapi.FILE_SHARE_READ, cd, Rapi.FILE_ATTRIBUTE_NORMAL);
|
Rapi.FILE_SHARE_READ, cd, Rapi.FILE_ATTRIBUTE_NORMAL);
|
||||||
return new BufferedOutputStream(new WinCEOutputStream(session, handle));
|
return new BufferedOutputStream(new WinCEOutputStream(session, handle));
|
||||||
} catch (RapiException e) {
|
} catch (RapiException e) {
|
||||||
|
@ -421,22 +422,16 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
return Messages.WinCEFileService_1;
|
return Messages.WinCEFileService_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initService(IProgressMonitor monitor) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uninitService(IProgressMonitor monitor) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class WinCEInputStream extends InputStream {
|
private static class WinCEInputStream extends InputStream {
|
||||||
|
|
||||||
private int handle;
|
private int handle;
|
||||||
private IRapiSession session;
|
private IRapiSession session;
|
||||||
|
|
||||||
public WinCEInputStream(IRapiSession session, int handle) {
|
public WinCEInputStream(IRapiSession session, int handle) {
|
||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
byte[] b = new byte[1];
|
byte[] b = new byte[1];
|
||||||
try {
|
try {
|
||||||
|
@ -462,19 +457,19 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
throw new IOException(e.getMessage());
|
throw new IOException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class WinCEOutputStream extends OutputStream {
|
private static class WinCEOutputStream extends OutputStream {
|
||||||
|
|
||||||
private int handle;
|
private int handle;
|
||||||
private IRapiSession session;
|
private IRapiSession session;
|
||||||
|
|
||||||
public WinCEOutputStream(IRapiSession session, int handle) {
|
public WinCEOutputStream(IRapiSession session, int handle) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
try {
|
try {
|
||||||
session.writeFile(handle, new byte[] {(byte)b});
|
session.writeFile(handle, new byte[] {(byte)b});
|
||||||
|
@ -490,7 +485,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi
|
||||||
throw new IOException(e.getMessage());
|
throw new IOException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
try {
|
try {
|
||||||
session.closeHandle(handle);
|
session.closeHandle(handle);
|
||||||
|
|
Loading…
Add table
Reference in a new issue