RSE
Release 1.0

org.eclipse.rse.subsystems.processes.core.subsystem.impl
Class RemoteProcessSubSystemImpl

java.lang.Object
  extended byorg.eclipse.rse.core.model.PropertySetContainer
      extended byorg.eclipse.rse.core.model.RSEModelObject
          extended byorg.eclipse.rse.core.subsystems.SubSystem
              extended byorg.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl
All Implemented Interfaces:
IAdaptable, ICommunicationsListener, IPropertySetContainer, IRemoteObjectResolver, IRemoteProcessSubSystem, IRSEModelObject, org.eclipse.rse.core.persistance.IRSEPersistableContainer, ISchedulingRule, ISubSystem, ISystemFilterPoolReferenceManagerProvider, ISystemResourceChangeEvents
Direct Known Subclasses:
ProcessServiceSubSystem

public abstract class RemoteProcessSubSystemImpl
extends SubSystem
implements IRemoteProcessSubSystem, ICommunicationsListener


Nested Class Summary
 
Nested classes inherited from class org.eclipse.rse.core.subsystems.SubSystem
SubSystem.ChangeStatusJob, SubSystem.ConnectJob, SubSystem.DisconnectJob, SubSystem.DisplayErrorMessageJob, SubSystem.GetPropertiesJob, SubSystem.GetPropertyJob, SubSystem.ResolveAbsoluteJob, SubSystem.ResolveAbsolutesJob, SubSystem.ResolveRelativeJob, SubSystem.SetPropertiesJob, SubSystem.SetPropertyJob, SubSystem.SubSystemOperationJob
 
Field Summary
 
Fields inherited from class org.eclipse.rse.core.subsystems.SubSystem
_connectionError, _connectorService, _disconnecting, _hidden, _host, _name, _subsystemConfigurationId, cancelable, doConnection, filterPoolReferenceManager, OPERATION_CANCEL_SHELL, OPERATION_CONNECT, OPERATION_DISCONNECT, OPERATION_GET_PROPERTIES, OPERATION_GET_PROPERTY, OPERATION_REMOVE_SHELL, OPERATION_RESOLVE_ABSOLUTE, OPERATION_RESOLVE_ABSOLUTES, OPERATION_RESOLVE_RELATIVE, OPERATION_RUN_COMMAND, OPERATION_RUN_SHELL, OPERATION_SEND_COMMAND_TO_SHELL, OPERATION_SET_PROPERTIES, OPERATION_SET_PROPERTY, parentSubSystemConfiguration, pmDialog, previousUserIdKey, runInThread, saveFileName, shell, sortResults, SUBSYSTEM_FILE_NAME, supportsConnecting
 
Fields inherited from class org.eclipse.rse.core.model.RSEModelObject
_isDirty, _wasRestored
 
Fields inherited from interface org.eclipse.rse.model.ISystemResourceChangeEvents
EVENT_ADD, EVENT_ADD_FILTER_REFERENCE, EVENT_ADD_FILTERSTRING_REFERENCE, EVENT_ADD_MANY, EVENT_ADD_RELATIVE, EVENT_CHANGE_CHILDREN, EVENT_CHANGE_FILTER_REFERENCE, EVENT_CHANGE_FILTERSTRING_REFERENCE, EVENT_COLLAPSE_ALL, EVENT_COLLAPSE_SELECTED, EVENT_COMMAND_FINISHED, EVENT_COMMAND_HISTORY_UPDATE, EVENT_COMMAND_MESSAGE, EVENT_COMMAND_RUN, EVENT_COMMAND_SHELL_FINISHED, EVENT_COMMAND_SHELL_REMOVED, EVENT_COMPILE_COMMAND_RUN, EVENT_DELETE, EVENT_DELETE_FILTER_REFERENCE, EVENT_DELETE_FILTERSTRING_REFERENCE, EVENT_DELETE_MANY, EVENT_EXPAND_SELECTED, EVENT_ICON_CHANGE, EVENT_MOVE_FILTER_REFERENCES, EVENT_MOVE_FILTERSTRING_REFERENCES, EVENT_MOVE_MANY, EVENT_MUST_COLLAPSE, EVENT_PROPERTY_CHANGE, EVENT_PROPERTYSHEET_UPDATE, EVENT_REFRESH, EVENT_REFRESH_REMOTE, EVENT_REFRESH_SELECTED, EVENT_REFRESH_SELECTED_FILTER, EVENT_REFRESH_SELECTED_PARENT, EVENT_RENAME, EVENT_RENAME_FILTER_REFERENCE, EVENT_REPLACE_CHILDREN, EVENT_REVEAL_AND_SELECT, EVENT_SEARCH_FINISHED, EVENT_SELECT, EVENT_SELECT_EXPAND, EVENT_SELECT_REMOTE, PROPERTYSHEET_UPDATE_EVENT
 
Constructor Summary
RemoteProcessSubSystemImpl(IHost host, IConnectorService connectorService)
           
 
Method Summary
 void communicationsStateChange(CommunicationsEvent e)
          This method is invoked whenever the communications state is invoked immediately before and after the state of the communications changes.
 Object getObjectWithAbsoluteName(String key)
          For drag and drop, clipboard, and other object retrieval mechanisms in support of remote objects.
 IRemoteProcess getParentProcess(IRemoteProcess process)
          Given a process, return its parent process object.
 IRemoteProcessSubSystemConfiguration getParentRemoteProcessSubSystemConfiguration()
          Return parent subsystem factory, cast to a RemoteProcessSubSystemConfiguration
abstract  IRemoteProcess getRemoteProcessObject(long pid)
          Given a pid, return an IRemoteProcess object for it.
abstract  String[] getSignalTypes()
          Returns a list of the types of signals that can be sent to a process on the remote system.
 void initializeSubSystem(IProgressMonitor monitor)
          Called on each subsystem associated with a particular IConnectorService after it connects
protected  Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString)
          Resolve an absolute filter string.
 boolean isCaseSensitive()
          Return true if names are case-sensitive.
 boolean isPassiveCommunicationsListener()
          This method determines if the communications listener is a passive or active listener.
abstract  boolean kill(IRemoteProcess process, String signal)
          Kill the given process.
abstract  IRemoteProcess[] listAllProcesses(IHostProcessFilter processNameFilter, IRemoteProcessContext context, IProgressMonitor monitor)
          Return a list of all processes on the remote system.
 IRemoteProcess[] listRoots(IRemoteProcessContext context, IProgressMonitor monitor)
          At this point there is only one root process, the 'init' process with pid 1
 void uninitializeSubSystem(IProgressMonitor monitor)
          Called on each subsystem associated with a particular IConnectorService after it disconnects
 
Methods inherited from class org.eclipse.rse.core.subsystems.SubSystem
addResolvedFilterStringObjects, checkIsConnected, clearLocalUserId, commit, connect, connect, contains, deletingConnection, disconnect, disconnect, displayAsyncMsg, doesFilterListContentsOf, doesFilterMatch, doesFilterStringListContentsOf, doesFilterStringMatch, doesFilterTypeMatch, filterEventFilterCreated, filterEventFilterPoolReferenceCreated, filterEventFilterPoolReferenceDeleted, filterEventFilterPoolReferenceRenamed, filterEventFilterPoolReferenceReset, filterEventFilterPoolReferencesRePositioned, filterEventFilterPoolReferencesReset, filterEventFilterStringCreated, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, forceUserIdToUpperCase, getActiveWorkbenchShell, getActiveWorkbenchWindow, getAdapter, getCacheManager, getChildren, getConfigurationId, getConnectionOwnedFilterPoolName, getConnectionPrivateFilterPool, getConnectorService, getExecutedCommands, getFilterPoolReferenceManager, getFilterReferenceWithAbsoluteName, getFirstParentFilterString, getHost, getHostAliasName, getHostName, getLocalUserId, getLocalUserId, getName, getPreferencesKey, getPreferencesKey, getPreferencesManager, getPrimarySubSystem, getProperties, getProperty, getPropertyPage, getQueryingMessage, getQueryingMessage, getRemoteAttribute, getResolvingMessage, getRunnableContext, getRunningMessage, getSettingMessage, getSettingMessage, getShell, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getSystemType, getTargetForFilter, getTargetsForFilter, getUniqueOwningSystemFilterPool, getUserId, getVendorAttribute, hasChildren, implicitConnect, internalConnect, internalDisconnect, internalGetProperties, internalGetProperty, internalResolveFilterString, internalResolveFilterStrings, internalSetProperties, internalSetProperty, isConflicting, isConnected, isConnectionError, isHidden, isOffline, isPrimarySubSystem, promptForPassword, promptForPassword, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterStrings, resolveFilterStrings, scheduleJob, selectCommandSubSystem, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setName, setProperties, setProperty, setRemoteAttribute, setSubSystemConfiguration, setVendorAttribute, showConnectCancelledMessage, showConnectErrorMessage, showDisconnectCancelledMessage, showDisconnectErrorMessage, showOperationCancelledMessage, showOperationErrorMessage, showOperationMessage, sortResolvedFilterStringObjects, supportsCaching
 
Methods inherited from class org.eclipse.rse.core.model.RSEModelObject
compareStrings, getDescription, isDirty, setDirty, setWasRestored, wasRestored
 
Methods inherited from class org.eclipse.rse.core.model.PropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem
listChildProcesses, listChildProcesses
 
Methods inherited from interface org.eclipse.rse.core.subsystems.ISubSystem
checkIsConnected, clearLocalUserId, connect, connect, deletingConnection, disconnect, disconnect, doesFilterListContentsOf, doesFilterMatch, doesFilterStringListContentsOf, doesFilterStringMatch, forceUserIdToUpperCase, getCacheManager, getChildren, getConfigurationId, getConnectorService, getFilterPoolReferenceManager, getHost, getHostAliasName, getLocalUserId, getName, getPrimarySubSystem, getProperties, getProperty, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getTargetForFilter, getUserId, getVendorAttribute, hasChildren, isConnected, isConnectionError, isHidden, isOffline, isPrimarySubSystem, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterStrings, resolveFilterStrings, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setName, setProperties, setProperty, setSubSystemConfiguration, setVendorAttribute, supportsCaching
 
Methods inherited from interface org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider
filterEventFilterCreated, filterEventFilterPoolReferenceCreated, filterEventFilterPoolReferenceDeleted, filterEventFilterPoolReferenceRenamed, filterEventFilterPoolReferenceReset, filterEventFilterPoolReferencesRePositioned, filterEventFilterPoolReferencesReset, filterEventFilterStringCreated, getUniqueOwningSystemFilterPool
 
Methods inherited from interface org.eclipse.core.runtime.jobs.ISchedulingRule
contains, isConflicting
 
Methods inherited from interface org.eclipse.rse.core.model.IRSEModelObject
getDescription
 
Methods inherited from interface org.eclipse.rse.core.model.IPropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from interface org.eclipse.rse.core.persistance.IRSEPersistableContainer
commit, isDirty, setDirty, setWasRestored, wasRestored
 

Constructor Detail

RemoteProcessSubSystemImpl

public RemoteProcessSubSystemImpl(IHost host,
                                  IConnectorService connectorService)
Method Detail

getParentRemoteProcessSubSystemConfiguration

public IRemoteProcessSubSystemConfiguration getParentRemoteProcessSubSystemConfiguration()
Description copied from interface: IRemoteProcessSubSystem
Return parent subsystem factory, cast to a RemoteProcessSubSystemConfiguration

Specified by:
getParentRemoteProcessSubSystemConfiguration in interface IRemoteProcessSubSystem

isCaseSensitive

public boolean isCaseSensitive()
Description copied from interface: IRemoteProcessSubSystem
Return true if names are case-sensitive. Used when doing name or type filtering

Specified by:
isCaseSensitive in interface IRemoteProcessSubSystem

communicationsStateChange

public void communicationsStateChange(CommunicationsEvent e)
Description copied from interface: ICommunicationsListener
This method is invoked whenever the communications state is invoked immediately before and after the state of the communications changes. The state field in CommunicationsEvent determines which state change is about to or has occured.

Specified by:
communicationsStateChange in interface ICommunicationsListener

initializeSubSystem

public void initializeSubSystem(IProgressMonitor monitor)
Description copied from interface: ISubSystem
Called on each subsystem associated with a particular IConnectorService after it connects

Specified by:
initializeSubSystem in interface ISubSystem
Specified by:
initializeSubSystem in class SubSystem

uninitializeSubSystem

public void uninitializeSubSystem(IProgressMonitor monitor)
Description copied from interface: ISubSystem
Called on each subsystem associated with a particular IConnectorService after it disconnects

Specified by:
uninitializeSubSystem in interface ISubSystem

getParentProcess

public IRemoteProcess getParentProcess(IRemoteProcess process)
Description copied from interface: IRemoteProcessSubSystem
Given a process, return its parent process object.

Specified by:
getParentProcess in interface IRemoteProcessSubSystem
Parameters:
process - the process to return parent of.

internalResolveFilterString

protected Object[] internalResolveFilterString(IProgressMonitor monitor,
                                               String filterString)
                                        throws InvocationTargetException,
                                               InterruptedException
Description copied from class: SubSystem
Resolve an absolute filter string. This is only applicable if the subsystem factory reports true for SubSystemConfiguration.supportsFilters(), which is the default. Otherwise, SubSystem.getChildren() is called when the subsystem itself is expanded.

When a user expands a filter this method is invoked for each filter string and the results are concatenated and displayed to the user. You can affect the post-concatenated result by overriding SubSystem.sortResolvedFilterStringObjects(Object[]) if you desire to sort the result, say, or pick our redundancies.

The resulting objects are displayed in the tree in the Remote System view. There are two requirements on the returned objects:

  1. They must implement IAdaptable.
  2. Their must be an RSE remote-adapter registered for the object's class or interface type. Further, if this subsystem is visible in the RSE, which is the default, then there must also be an RSE GUI-adapter registered with the platform. The base class implementation of this interface is AbstractSystemViewAdapter.

A good place to start with your remote-resource classes to subclasss AbstractResource, as it already implements IAdaptable, and maintains a reference to this owning subsystem, which helps when implementing the remote-adapter.

Be sure to register your adapter factory in your plugin's startup method.

Actually resolve an absolute filter string. This is called by the run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.

As per IRunnableWithProgress rules:

YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS!

Overrides:
internalResolveFilterString in class SubSystem
Throws:
InvocationTargetException
InterruptedException

listRoots

public IRemoteProcess[] listRoots(IRemoteProcessContext context,
                                  IProgressMonitor monitor)
At this point there is only one root process, the 'init' process with pid 1

Specified by:
listRoots in interface IRemoteProcessSubSystem
Parameters:
context - A context object that will be associated with each returned process
monitor - the progress monitor

listAllProcesses

public abstract IRemoteProcess[] listAllProcesses(IHostProcessFilter processNameFilter,
                                                  IRemoteProcessContext context,
                                                  IProgressMonitor monitor)
                                           throws InterruptedException,
                                                  SystemMessageException
Description copied from interface: IRemoteProcessSubSystem
Return a list of all processes on the remote system. This version is called directly by users.

Specified by:
listAllProcesses in interface IRemoteProcessSubSystem
Parameters:
processNameFilter - filter the results according to this object
context - A context object that will be associated with each returned process
monitor - the progress monitor
Returns:
the list of all processes running on the host machine that correspond to the filter, or null if there are none.
Throws:
InterruptedException
SystemMessageException

getRemoteProcessObject

public abstract IRemoteProcess getRemoteProcessObject(long pid)
                                               throws SystemMessageException
Description copied from interface: IRemoteProcessSubSystem
Given a pid, return an IRemoteProcess object for it.

Specified by:
getRemoteProcessObject in interface IRemoteProcessSubSystem
Parameters:
pid - The pid of the desired process
Throws:
SystemMessageException

kill

public abstract boolean kill(IRemoteProcess process,
                             String signal)
                      throws SystemMessageException
Description copied from interface: IRemoteProcessSubSystem
Kill the given process.

Specified by:
kill in interface IRemoteProcessSubSystem
Parameters:
process - represents the object to be killed.
Returns:
false if the given process doesn't exist, else true. Throws an exception if anything fails.
Throws:
SystemMessageException

getSignalTypes

public abstract String[] getSignalTypes()
                                 throws SystemMessageException
Description copied from interface: IRemoteProcessSubSystem
Returns a list of the types of signals that can be sent to a process on the remote system.

Specified by:
getSignalTypes in interface IRemoteProcessSubSystem
Returns:
the signal types, or null if there are none, or they cannot be found.
Throws:
SystemMessageException

isPassiveCommunicationsListener

public boolean isPassiveCommunicationsListener()
Description copied from interface: ICommunicationsListener
This method determines if the communications listener is a passive or active listener. Typically a passive listener registers with the communications system and responds to events as they occur. An active listener typically registeres with the communications system only for the duration of the task (i.e. user editing a file, or outstanding communications request.) The user will be prompted on a disconnect if there are any active communication listeners registered.

Specified by:
isPassiveCommunicationsListener in interface ICommunicationsListener
Returns:
false if the communications listener is an active listener, true if the communications listener is a passive listener.

getObjectWithAbsoluteName

public Object getObjectWithAbsoluteName(String key)
                                 throws Exception
Description copied from interface: IRemoteObjectResolver
For drag and drop, clipboard, and other object retrieval mechanisms in support of remote objects.

Return the remote object within the subsystem that corresponds to the specified unique ID.

This is the functional opposite of ISystemRemoteElementAdapter.getAbsoluteName(Object).

Specified by:
getObjectWithAbsoluteName in interface IRemoteObjectResolver
Overrides:
getObjectWithAbsoluteName in class SubSystem
Throws:
Exception

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.