|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.core.model.RSEPersistableObject
org.eclipse.rse.core.model.PropertySetContainer
org.eclipse.rse.core.model.RSEModelObject
org.eclipse.rse.core.subsystems.SubSystem
org.eclipse.rse.subsystems.shells.core.subsystems.RemoteCmdSubSystem
public abstract class RemoteCmdSubSystem
This is the abstraction of a subsystem specialized for remote execution of commands.
Nested Class Summary | |
---|---|
protected class |
RemoteCmdSubSystem.CancelShellJob
Represents the subsystem operation of cancelling a remote shell. |
class |
RemoteCmdSubSystem.Refresh
|
class |
RemoteCmdSubSystem.RefreshRemovedShell
|
class |
RemoteCmdSubSystem.RefreshSubSystem
|
protected class |
RemoteCmdSubSystem.RemoveShellJob
Represents the subsystem operation of cancelling and removing a remote shell from the view. |
protected class |
RemoteCmdSubSystem.RunCommandJob
Represents the subsystem operation of running a remote command. |
protected class |
RemoteCmdSubSystem.RunShellJob
Represents the subsystem operation of running a remote shell. |
protected class |
RemoteCmdSubSystem.SendCommandToShellJob
Represents the subsystem operation of sending a command to a remote shell. |
Nested classes/interfaces 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, SubSystem.SystemMessageDialogRunnable |
Field Summary | |
---|---|
protected ArrayList |
_cmdShells
|
protected IRemoteCommandShell |
_defaultShell
|
protected IRemoteFileSubSystem |
_fileSubSystem
|
Fields inherited from interface org.eclipse.rse.core.model.IRSEPersistableContainer |
---|
NO_CHILDREN |
Constructor Summary | |
---|---|
RemoteCmdSubSystem(IHost host,
IConnectorService connectorService)
|
Method Summary | |
---|---|
void |
addEnvironmentVariable(IRemoteSystemEnvVar rsev)
Add environment variable entry, given a RemoteSystemEnvVar object |
void |
addEnvironmentVariable(String name,
String value)
Add environment variable entry, given a name and value |
void |
cancelAllShells()
|
void |
cancelShell(Object commandObject)
Cancel a shell or running command. |
void |
cancelShell(Object commandObject,
IProgressMonitor monitor)
Cancel a shell or running command. |
boolean |
canRunCommand()
Determine whether the command subsystem can run a command |
boolean |
canRunShell()
Determine whether the command subsystem can run a shell |
boolean |
checkForCancel(IProgressMonitor monitor)
Long running list processing calls this method to check for a user-cancel event. |
void |
communicationsStateChange(CommunicationsEvent e)
This method is invoked whenever the communications state is invoked immediately before and after the state of the communications changes. |
IPropertySet |
createPropertySet(String name)
Creates a new property set of a particular name in this container. |
ICandidateCommand[] |
getCandidateCommands(Object context)
Lists the possible commands for the given context |
Object[] |
getChildren()
Return the children of this subsystem, to populate the GUI subtree of this subsystem. |
IRemoteCmdSubSystem |
getCommandSubSystem()
Return the associated command subsystem. |
IRemoteCommandShell |
getDefaultShell()
Get the default running command shell for this command subsystem. |
IRemoteSystemEnvVar |
getEnvironmentVariable(String name)
Given an environment variable name, find its RemoteSystemEnvVar object. |
IRemoteSystemEnvVar[] |
getEnvironmentVariableList()
Get the initial environment variable list as a string of RemoteSystemEnvVar objects. |
String |
getEnvironmentVariableValue(String name)
Given an environment variable name, find its value. |
protected String[] |
getEnvVarsAsStringArray()
|
IRemoteFileSubSystem |
getFileSubSystem()
|
String |
getInvalidEnvironmentVariableNameCharacters()
Default implementation of getInvalidEnvironmentVariableNameCharacters. |
Object |
getObjectWithAbsoluteName(String key,
IProgressMonitor monitor)
Return the object within the subsystem that corresponds to the specified unique ID. |
IRemoteCmdSubSystemConfiguration |
getParentRemoteCmdSubSystemConfiguration()
Return parent subsystem factory, cast to a RemoteCmdSubSystemConfiguration |
IRemoteCommandShell[] |
getShells()
Get all command shells and transient commands that have been run or are running for this command subsystem. |
protected String[] |
getUserAndHostEnvVarsAsStringArray()
|
boolean |
hasChildren()
CHILD CLASSES MAY OVERRIDE THIS. |
void |
initializeSubSystem(IProgressMonitor monitor)
Initialize this subsystem instance after the corresponding IConnectorService connect method finishes. |
protected void |
internalCancelShell(Object command,
IProgressMonitor monitor)
Cancels a running shell. |
protected void |
internalRemoveShell(Object command)
|
protected Object[] |
internalResolveFilterString(String filterString,
IProgressMonitor monitor)
Actually resolve an absolute filter string. |
protected Object[] |
internalRunCommand(String cmd,
Object context,
boolean interpretOutput,
IProgressMonitor monitor)
Runs a remote command and interprets any resulting output. |
protected Object[] |
internalRunCommand(String cmd,
Object context,
IProgressMonitor monitor)
Runs a remote command. |
protected IRemoteCommandShell |
internalRunShell(Object context,
IProgressMonitor monitor)
Establishes a new shell. |
protected void |
internalSendCommandToShell(String cmd,
Object command,
IProgressMonitor monitor)
Sends a command to a shell for execution. |
boolean |
isPassiveCommunicationsListener()
This method determines if the communications listener is a passive or active listener. |
protected boolean |
isUniqueVariable(List variables,
String varName)
|
boolean |
isWindows()
|
protected List |
parsePathEnvironmentVariable(String path)
|
void |
removeEnvironmentVariable(IRemoteSystemEnvVar rsev)
Remove environment variable entry given its RemoteSystemEnvVar object |
void |
removeEnvironmentVariable(String name)
Remove environment variable entry given only its environment variable name |
void |
removeShell(Object commandObject)
Remove and Cancel a shell or running command. |
IRemoteCommandShell[] |
restoreShellState(Shell shellWindow)
Restore all the command shells that were open before disconnecting during the previous session |
Object[] |
runCommand(String command,
Object context)
Deprecated. use runCommand(String, Object, IProgressMonitor) |
Object[] |
runCommand(String command,
Object context,
boolean interpretOutput)
Deprecated. use runCommand(String, Object, boolean, IProgressMonitor) |
Object[] |
runCommand(String command,
Object context,
boolean interpretOutput,
IProgressMonitor monitor)
overridden so that for universal we don't need to do in modal thread |
Object[] |
runCommand(String command,
Object context,
IProgressMonitor monitor)
Execute a remote command. |
IRemoteCommandShell |
runShell(Object context)
Deprecated. use runShell(Object, IProgressMonitor) |
IRemoteCommandShell |
runShell(Object context,
IProgressMonitor monitor)
overridden so that for universal we don't need to do in modal thread |
protected void |
saveShellState(List cmdShells)
|
void |
sendCommandToShell(String input,
Object commandObject,
IProgressMonitor monitor)
Send a command as input to a running command shell. |
void |
setEnvironmentVariableList(String[] names,
String[] values)
Set the initial environment variable list entries, all in one shot, using a pair of String arrays: the first is the environment variable names, the second is the corresponding environment variable values. |
Methods inherited from class org.eclipse.rse.core.model.RSEModelObject |
---|
getDescription |
Methods inherited from class org.eclipse.rse.core.model.PropertySetContainer |
---|
addPropertySet, addPropertySets, clonePropertySets, createPropertySet, getPropertySet, getPropertySets, removePropertySet |
Methods inherited from class org.eclipse.rse.core.model.RSEPersistableObject |
---|
compareStrings, isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored |
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.shells.core.subsystems.IRemoteCmdSubSystem |
---|
getExecutedCommands, getHostEnvironmentVariables |
Methods inherited from interface org.eclipse.rse.core.subsystems.IRemoteObjectResolver |
---|
getObjectWithAbsoluteName |
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, clonePropertySets, createPropertySet, getPropertySet, getPropertySets, removePropertySet |
Methods inherited from interface org.eclipse.rse.core.model.IRSEPersistableContainer |
---|
commit, getPersistableChildren, getPersistableParent, isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored |
Field Detail |
---|
protected ArrayList _cmdShells
protected IRemoteCommandShell _defaultShell
protected IRemoteFileSubSystem _fileSubSystem
Constructor Detail |
---|
public RemoteCmdSubSystem(IHost host, IConnectorService connectorService)
Method Detail |
---|
public void initializeSubSystem(IProgressMonitor monitor) throws SystemMessageException
SubSystem
IConnectorService
connect method finishes. This method should be
overridden if any initialization for the subsystem needs to occur at this
time.
The default implementation currently does nothing, but overriding methods should call super before doing any other work.
initializeSubSystem
in interface ISubSystem
initializeSubSystem
in class SubSystem
monitor
- a progress monitor that can be used to show progress
during long-running operation. Cancellation is typically not
supported since it might leave the system in an inconsistent
state.
SystemMessageException
- if an error occurs during initialization.public IRemoteCmdSubSystemConfiguration getParentRemoteCmdSubSystemConfiguration()
getParentRemoteCmdSubSystemConfiguration
in interface IRemoteCmdSubSystem
public boolean checkForCancel(IProgressMonitor monitor)
public IRemoteSystemEnvVar[] getEnvironmentVariableList()
getEnvironmentVariableList
in interface IRemoteCmdSubSystem
public void setEnvironmentVariableList(String[] names, String[] values)
setEnvironmentVariableList
in interface IRemoteCmdSubSystem
names
- the array of namesvalues
- the array of string valuespublic void addEnvironmentVariable(String name, String value)
addEnvironmentVariable
in interface IRemoteCmdSubSystem
public void addEnvironmentVariable(IRemoteSystemEnvVar rsev)
addEnvironmentVariable
in interface IRemoteCmdSubSystem
public void removeEnvironmentVariable(IRemoteSystemEnvVar rsev)
removeEnvironmentVariable
in interface IRemoteCmdSubSystem
rsev
- the remote system environment variable to removepublic void removeEnvironmentVariable(String name)
removeEnvironmentVariable
in interface IRemoteCmdSubSystem
public IRemoteSystemEnvVar getEnvironmentVariable(String name)
getEnvironmentVariable
in interface IRemoteCmdSubSystem
public String getEnvironmentVariableValue(String name)
getEnvironmentVariableValue
in interface IRemoteCmdSubSystem
protected String[] getEnvVarsAsStringArray()
protected boolean isUniqueVariable(List variables, String varName)
protected String[] getUserAndHostEnvVarsAsStringArray()
public boolean isWindows()
public ICandidateCommand[] getCandidateCommands(Object context)
getCandidateCommands
in interface IRemoteCmdSubSystem
context
- the context for a command
protected List parsePathEnvironmentVariable(String path)
public IRemoteFileSubSystem getFileSubSystem()
public String getInvalidEnvironmentVariableNameCharacters()
getInvalidEnvironmentVariableNameCharacters
in interface IRemoteCmdSubSystem
IRemoteCmdSubSystem.getInvalidEnvironmentVariableNameCharacters()
public IRemoteCmdSubSystem getCommandSubSystem()
protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
internalResolveFilterString
in class SubSystem
InvocationTargetException
InterruptedException
SubSystem.internalResolveFilterString(String,IProgressMonitor)
public Object[] getChildren()
SubSystem
SubSystem.initializeSubSystem(IProgressMonitor)
is not called in that
case. Similarly, if your subsystem declares custom images for filters or
filter pools, overriding the getChildren() call here to first load your
filter adapters and THEN super.getChildren() is a good idea.
getChildren
in interface ISubSystem
getChildren
in class SubSystem
public boolean hasChildren()
SubSystem
hasChildren
in interface ISubSystem
hasChildren
in class SubSystem
public IRemoteCommandShell getDefaultShell() throws Exception
getDefaultShell
in interface IRemoteCmdSubSystem
Exception
public IRemoteCommandShell[] getShells()
getShells
in interface IRemoteCmdSubSystem
public boolean canRunShell()
canRunShell
in interface IRemoteCmdSubSystem
public boolean canRunCommand()
canRunCommand
in interface IRemoteCmdSubSystem
public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
getObjectWithAbsoluteName
in interface IRemoteObjectResolver
getObjectWithAbsoluteName
in class SubSystem
key
- the unique id of the remote object. Must not be
null
.monitor
- the progress monitor
null
if no object is
found with the given id.
Exception
- in case an error occurs contacting the remote system
while retrieving the requested remote object. Extenders are
encouraged to throw SystemMessageException
in order to
support good user feedback in case of errors. Since exceptions
should only occur while retrieving new remote objects during
startup, clients are typically allowed to ignore these exceptions
and treat them as if the remote object were simply not there.IRemoteObjectResolver.getObjectWithAbsoluteName(String, IProgressMonitor)
protected void saveShellState(List cmdShells)
protected void internalRemoveShell(Object command) throws InvocationTargetException, InterruptedException
InvocationTargetException
InterruptedException
public IRemoteCommandShell[] restoreShellState(Shell shellWindow)
IRemoteCmdSubSystem
restoreShellState
in interface IRemoteCmdSubSystem
shellWindow
- a window used for notification
public void cancelAllShells()
public boolean isPassiveCommunicationsListener()
ICommunicationsListener
isPassiveCommunicationsListener
in interface ICommunicationsListener
ICommunicationsListener.isPassiveCommunicationsListener()
public void communicationsStateChange(CommunicationsEvent e)
ICommunicationsListener
communicationsStateChange
in interface ICommunicationsListener
public IPropertySet createPropertySet(String name)
IPropertySetContainer
IRSEPersistableContainer
. The
IRSEPersistableContainer.commit()
method must then be used to
commit any changes into persistent storage.
createPropertySet
in interface IPropertySetContainer
createPropertySet
in class PropertySetContainer
name
- the name of the property set.
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
runCommand(String, Object, boolean, IProgressMonitor)
Exception
public Object[] runCommand(String command, Object context, boolean interpretOutput, IProgressMonitor monitor) throws Exception
runCommand
in interface IRemoteCmdSubSystem
command
- Command to be executed remotely.context
- context of a command (i.e. working directory). Null is valid and means to run the
command as a shell command in the default shell.interpretOutput
- whether to interpret the output or notmonitor
- the progress monitor
Exception
public IRemoteCommandShell runShell(Object context) throws Exception
runShell(Object, IProgressMonitor)
Exception
public IRemoteCommandShell runShell(Object context, IProgressMonitor monitor) throws Exception
runShell
in interface IRemoteCmdSubSystem
context
- context of a shell (i.e. working directory). Null is valid and means to use the default context.monitor
- the progress monitor
Exception
public Object[] runCommand(String command, Object context) throws Exception
runCommand(String, Object, IProgressMonitor)
command
- Command to be executed remotely.context
- context of a command (i.e. working directory).
null
is valid and means to use the default
context.
Exception
public Object[] runCommand(String command, Object context, IProgressMonitor monitor) throws Exception
runCommand
in interface IRemoteCmdSubSystem
command
- Command to be executed remotely.context
- context of a command (i.e. working directory). null
is
valid and means to use the default context.monitor
- the progress monitor
Exception
public void sendCommandToShell(String input, Object commandObject, IProgressMonitor monitor) throws Exception
sendCommandToShell
in interface IRemoteCmdSubSystem
input
- the command to invoke in the shell.commandObject
- the shell or command to send the invocation to.monitor
- the progress monitor
Exception
public void cancelShell(Object commandObject) throws Exception
commandObject
- the shell or command to cancel.
Exception
public void cancelShell(Object commandObject, IProgressMonitor monitor) throws Exception
cancelShell
in interface IRemoteCmdSubSystem
commandObject
- the shell or command to cancel.monitor
- the progress monitor
Exception
public void removeShell(Object commandObject) throws Exception
removeShell
in interface IRemoteCmdSubSystem
commandObject
- the shell or command to cancel.
Exception
protected Object[] internalRunCommand(String cmd, Object context, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, SystemMessageException
cmd
- The command to execute.context
- The IServiceCommandShell that provides the context in which to run this command.monitor
- a monitor for progress and cancellation, the caller is expected to call monitor.done()
InterruptedException
- if the user cancels the operation
SystemMessageException
- if the command results in an error on the target system
InvocationTargetException
- if something else bad happensprotected Object[] internalRunCommand(String cmd, Object context, boolean interpretOutput, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, SystemMessageException
cmd
- The command to execute.context
- The IServiceCommandShell that provides the context in which to run this command.monitor
- a monitor for progress and cancellation, the caller is expected to call monitor.done()
InterruptedException
- if the user cancels the operation
SystemMessageException
- if the command results in an error on the target system
InvocationTargetException
- if something else bad happensprotected IRemoteCommandShell internalRunShell(Object context, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, SystemMessageException
context
- the current directory for this shell. Can be a String containing a path
name to be used as the current directory or an IRemoteFile representing
a directory. If null or "null", the home directory is used.monitor
- a monitor for progress and cancellation, the caller is expected to call monitor.done()
InterruptedException
- if the user cancels the operation
SystemMessageException
- if the command results in an error on the target system
InvocationTargetException
- if something else bad happensprotected void internalCancelShell(Object command, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
command
- the IServiceCommandShell to cancel.monitor
- a monitor for progress and cancellation, the caller is expected to call monitor.done()
InterruptedException
- if the user cancels the operation
InvocationTargetException
- if something else bad happensprotected void internalSendCommandToShell(String cmd, Object command, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
cmd
- the command to execute.command
- the IServiceCommandShell that provides the context in which to execute the command.monitor
- a monitor for progress and cancellation, the caller is expected to call monitor.done()
InterruptedException
- if the user cancels the operation
InvocationTargetException
- if something else bad happens
|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |