org.eclipse.rse.core.subsystems
Class SubSystem
java.lang.Object
org.eclipse.rse.core.model.RSEPersistableObject
org.eclipse.rse.core.model.PropertySetContainer
org.eclipse.rse.core.model.RSEModelObject
org.eclipse.rse.core.subsystems.SubSystem
-
All Implemented Interfaces:
-
IAdaptable,
ISchedulingRule,
ISystemFilterPoolReferenceManagerProvider,
IPropertySetContainer,
IRSEModelObject,
IRSEPersistableContainer,
IRemoteObjectResolver,
ISubSystem
-
Direct Known Subclasses:
-
RemoteCmdSubSystem,
RemoteFileSubSystem,
RemoteProcessSubSystemImpl,
TerminalServiceSubSystem
-
public abstract class SubSystem
- extends
RSEModelObject
- implements
IAdaptable,
ISubSystem,
ISystemFilterPoolReferenceManagerProvider
This class is designed to be subclassed. Its role is three-fold:
- Storing of tool-specific persistent properties per connection.
- Accessing of an IConnectorService object to enable the subsystem's connect and disconnect actions.
- Doing actual remote accessing. This usually just involves overriding the
internalResolveFilterString
methods to
populate the remote resources shown when the subsystem's filters are expanded.
This is the base class that subsystem suppliers subclass.
Each instance of this class represents a subsystem instance for a particular connection.
When a
IHost
is created, this subsystem's factory will be asked to create an
instance of its subsystem. If desired, your GUI may also allow users to create additional
instances.
There are only a handful of methods to implement in child classes (and indeed most of these
are supplied as empty, so you only override those you want to support).
These are required:
These are optional:
-
getObjectWithAbsoluteName(String)
-
internalResolveFilterString(String filterString, IProgressMonitor monitor)
-
internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor)
-
internalGetProperty(Object subject, String key, IProgressMonitor monitor)
-
internalSetProperty(Object subject, String key, String value, IProgressMonitor monitor)
-
internalGetProperties(Object subject, String[] keys, IProgressMonitor monitor)
-
internalSetProperties(Object subject, String[] keys, String[] values, IProgressMonitor monitor)
Method Summary
|
protected void
|
addResolvedFilterStringObjects
(
Vector allChildrenSoFar,
Object[] childrenForThisFilterString,
String[] allFilterStrings,
int currFilterStringIndex)
Overridable extension point for adding the results of a filter string
to the overall list of results. |
boolean
|
canSwitchTo
(
ISubSystemConfiguration configuration)
Determine if a service subsystem is capable of switching to this new
configuration. |
void
|
checkIsConnected
(
IProgressMonitor monitor)
Check if the subsystem is connected, and connect if it's not. |
void
|
clearLocalUserId
()
Called to clear the local user Id such that subsequent requests to getUserId() will
return the parent connection's default user Id. |
boolean
|
commit
()
Request a persistence manager to persist this object. |
void
|
connect
(boolean forcePrompt,
IRSECallback callback)
Asynchronously connect to the remote system, optionally forcing a signon prompt
even if the password is cached in memory or on disk. |
void
|
connect
(
IProgressMonitor monitor,
boolean forcePrompt)
Synchronously connect to the remote system. |
boolean
|
contains
(
ISchedulingRule rule)
|
void
|
deletingConnection
()
Private method called when the parent connection is being deleted, so
the subsystem can do any pre-death cleanup it needs to. |
void
|
disconnect
()
Disconnect from the remote system
You do not need to override this, as it does the progress monitor and error message
displaying for you. |
void
|
disconnect
(boolean collapseTree)
Disconnect from the remote system
You do not need to override this, as it does the progress monitor and error message
displaying for you. |
protected void
|
displayAsyncMsg
(
SystemMessageException msg)
Display message on message thread |
boolean
|
doesFilterListContentsOf
(
ISystemFilter filter,
String remoteObjectAbsoluteName)
Return true if the given filter lists the contents of the given remote object. |
boolean
|
doesFilterMatch
(
ISystemFilter filter,
String remoteObjectAbsoluteName)
Return true if the given remote object name will pass the filtering criteria for any of
the filter strings in this filter. |
boolean
|
doesFilterStringListContentsOf
(
ISystemFilterString filterString,
String remoteObjectAbsoluteName)
Return true if the given filter string lists the contents of the given remote object. |
boolean
|
doesFilterStringMatch
(
String filterString,
String remoteObjectAbsoluteName,
boolean caseSensitive)
Return true if the given remote object name will pass the filtering criteria for
the given filter string. |
protected boolean
|
doesFilterTypeMatch
(
ISystemFilter filter,
String remoteObjectAbsoluteName)
Override this method if you support typed filters. |
void
|
filterEventFilterCreated
(
Object selectedObject,
ISystemFilter newFilter)
A new filter has been created. |
void
|
filterEventFilterPoolReferenceCreated
(
ISystemFilterPoolReference newPoolRef)
A new filter pool reference has been created. |
void
|
filterEventFilterPoolReferenceDeleted
(
ISystemFilterPoolReference filterPoolRef)
A filter pool reference has been deleted |
void
|
filterEventFilterPoolReferenceRenamed
(
ISystemFilterPoolReference poolRef,
String oldName)
A filter pool reference has been renamed (ie, its reference filter pool renamed) |
void
|
filterEventFilterPoolReferenceReset
(
ISystemFilterPoolReference filterPoolRef)
A single filter pool reference has been reset to reference a new pool |
void
|
filterEventFilterPoolReferencesRePositioned
(
ISystemFilterPoolReference[] poolRefs,
int delta)
One or more filter pool references have been re-ordered within their manager |
void
|
filterEventFilterPoolReferencesReset
()
All filter pool references has been reset. |
void
|
filterEventFilterStringCreated
(
Object selectedObject,
ISystemFilterString newFilterString)
A new filter string has been created. |
protected void
|
fireEvent
(
Object[] multiSrc,
int eventId,
Object parent)
|
protected void
|
fireEvent
(
Object[] src,
int eventId,
Object parent,
int position)
|
protected void
|
fireEvent
(
Object src,
int eventId,
Object parent)
|
protected void
|
fireEvent
(
Object src,
int eventId,
Object parent,
Object grandParent)
|
protected void
|
fireEvent
(
SystemResourceChangeEvent event)
|
protected void
|
fireEvent
(
SystemResourceChangeEvent event,
Object grandParent)
|
boolean
|
forceUserIdToUpperCase
()
Return true if userId and password should be forced to uppercase. |
Object
|
getAdapter
(
Class adapterType)
This is the method required by the IAdaptable interface. |
ICacheManager
|
getCacheManager
()
Return the CacheManager for this subsystem. |
Object[]
|
getChildren
()
Return the children of this subsystem, to populate the GUI subtree of
this subsystem. |
String
|
getConfigurationId
()
Private. |
String
|
getConnectionOwnedFilterPoolName
(
String profileName,
String connectionName)
Constructs the name of a connection specific filter pool from its parts. |
ISystemFilterPool
|
getConnectionPrivateFilterPool
(boolean createIfNotFound)
Find or create a new filter pool, unique to this subsystem's connection. |
IConnectorService
|
getConnectorService
()
Return the
IConnectorService object that represents the live connection for this system. |
String[]
|
getExecutedCommands
()
Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports
true for supportsCommands(). |
ISystemFilterPoolReferenceManager
|
getFilterPoolReferenceManager
()
Private. |
protected
Object
|
getFilterReferenceWithAbsoluteName
(
String key)
Return the filter reference that corresponds to the specified key. |
protected
String
|
getFirstParentFilterString
(
Object parent)
Called by resolveFilterString when given null for the filter string, meaning we defer
getting a filter string until later, where we query it from the parent. |
IHost
|
getHost
()
Return the connection object this subsystem is associated with. |
String
|
getHostAliasName
()
Return the name of system connection object this subsystem is associated with. |
String
|
getHostName
()
Return the host name for the connection this system's subsystem is associated with |
IRSEInteractionProvider
|
getInteractionProvider
()
Get the current Interaction Provider. |
String
|
getLocalUserId
()
Alternative to getUserId when we don't want to resolve it from parent connection. |
protected
String
|
getLocalUserId
(
String key)
Internal-use method for getting the local user ID, without resolution. |
String
|
getName
()
Private. |
Object
|
getObjectWithAbsoluteName
(
String key)
Deprecated. use getObjectWithAbsoluteName(String key, IProgressMonitor monitor)
|
Object
|
getObjectWithAbsoluteName
(
String key,
IProgressMonitor monitor)
Return the remote object that corresponds to the specified unique ID. |
IRSEPersistableContainer[]
|
getPersistableChildren
()
Retrieves the children of this object in the persistence containment hierarchy. |
IRSEPersistableContainer
|
getPersistableParent
()
Retrieve the parent of this object in the persistence containment hierarchy. |
protected
String
|
getPreferencesKey
()
Helper method to compute a unique name for a given subsystem instance |
protected
String
|
getPreferencesKey
(
String profileName,
String connectionName)
Helper method to compute a unique name for a given subsystem instance, given a profile and connection name |
ISubSystem
|
getPrimarySubSystem
()
Return the primary subsystem associated with this subsystem's IConnectorService |
String[]
|
getProperties
(
Object subject,
String[] keys)
Deprecated. this shouldn't be used
|
String
|
getProperty
(
Object subject,
String key)
Deprecated. this shouldn't be used
|
PropertyPage
|
getPropertyPage
(
Composite parent)
Return the single property page to show in the tabbed notebook for the
for SubSystem property of the parent Connection. |
protected static
String
|
getQueryingMessage
()
Helper method to return the message "Querying properties..." |
protected static
String
|
getQueryingMessage
(
String key)
Helper method to return the message "Querying &1..." |
String
|
getRemoteAttribute
(
String attributeName)
Deprecated.
|
protected static
String
|
getResolvingMessage
(
String filterString)
Helper method to return the message "Resolving to &1..." |
protected
IRunnableContext
|
getRunnableContext
()
Deprecated. this is scheduled to be removed since we want to
avoid UI components in SubSystem.
|
protected static
String
|
getRunningMessage
(
String cmd)
Helper method to return the message "Running command &1..." |
Class
|
getServiceType
()
Return the service type for this subsystem. |
protected static
String
|
getSettingMessage
()
Helper method to return the message "Setting properties..." |
protected static
String
|
getSettingMessage
(
String key)
Helper method to return the message "Setting &1..." |
protected
Shell
|
getShell
()
Return the shell for the current operation |
ISubSystemConfiguration
|
getSubSystemConfiguration
()
Return the parent subsystem factory that owns this subsystem. |
ISystemFilterPoolReferenceManager
|
getSystemFilterPoolReferenceManager
()
Return the system filter pool reference manager, as per the
interface SystemFilterPoolReferenceManagerProvider |
ISystemProfile
|
getSystemProfile
()
Return the system profile object this subsystem is associated with. |
String
|
getSystemProfileName
()
Return the name of system profile object this subsystem is associated with. |
Object
|
getTargetForFilter
(
ISystemFilterReference filterRef)
Returns the parent object associated with a filter reference. |
Object[]
|
getTargetsForFilter
(
ISystemFilterReference filterRef)
|
ISystemFilterPool
|
getUniqueOwningSystemFilterPool
(boolean createIfNotFound)
Return the owning filter pool that is unique to this provider. |
String
|
getUserId
()
Returns the value of this subsystem's local user id if it is not null. |
String
|
getVendorAttribute
(
String vendor,
String attributeName)
Deprecated. use property sets directly now
|
boolean
|
hasChildren
()
CHILD CLASSES MAY OVERRIDE THIS. |
protected boolean
|
implicitConnect
(boolean isConnectOperation,
IProgressMonitor mon,
String msg,
int totalWorkUnits)
|
void
|
initializeSubSystem
(
IProgressMonitor monitor)
Initialize this subsystem instance after the corresponding
IConnectorService connect method finishes. |
protected void
|
internalDisconnect
(
IProgressMonitor monitor)
Actually disconnect from the remote host. |
protected
String[]
|
internalGetProperties
(
Object subject,
String[] keys,
IProgressMonitor monitor)
Actually get multiple remote properties. |
protected
String
|
internalGetProperty
(
Object subject,
String key,
IProgressMonitor monitor)
Actually get a remote property. |
protected
Object[]
|
internalResolveFilterString
(
Object parent,
String filterString,
IProgressMonitor monitor)
Resolve a relative filter string. |
protected
Object[]
|
internalResolveFilterString
(
String filterString,
IProgressMonitor monitor)
Resolve an absolute filter string. |
Object[]
|
internalResolveFilterStrings
(
String[] filterStrings,
IProgressMonitor monitor)
Resolve multiple absolute filter strings. |
protected
Object
|
internalSetProperties
(
Object subject,
String[] keys,
String[] values,
IProgressMonitor monitor)
Actually set multiple remote properties. |
protected
Object
|
internalSetProperty
(
Object subject,
String key,
String value,
IProgressMonitor monitor)
Actually set a remote property. |
protected void
|
internalSwitchSubSystemConfiguration
(
ISubSystemConfiguration newConfiguration)
Perform the subsystem specific processing required to complete a
subsystem configuration switch for a service subsystem. |
boolean
|
isConflicting
(
ISchedulingRule rule)
|
boolean
|
isConnected
()
Return true if this subsystem is currently connected to its remote system. |
boolean
|
isConnectionError
()
Return true if the last attempt to connect this subsystem to its remote system failed. |
boolean
|
isHidden
()
Private. |
boolean
|
isOffline
()
Returns the offline property for this subsystem's System Connection. |
boolean
|
isPrimarySubSystem
()
|
boolean
|
promptForPassword
()
A convenience method, fully equivalent to promptForPassword(false). |
boolean
|
promptForPassword
(boolean force)
Prompt the user for a password to the remote system. |
void
|
renamingConnection
(
String newName)
The connection is being renamed, so we are called to do our thing with
any information stored that is keyed by the connection name. |
void
|
renamingProfile
(
String oldName,
String newName)
The profile is being renamed, so we are called to do our thing with
any information stored that is keyed by the profile name. |
Object[]
|
resolveFilterString
(
Object parent,
String filterString,
IProgressMonitor monitor)
Resolve a relative filter string. |
Object[]
|
resolveFilterString
(
String filterString,
IProgressMonitor monitor)
Resolve an absolute filter string. |
Object[]
|
resolveFilterStrings
(
String[] filterStrings,
IProgressMonitor monitor)
Resolve multiple absolute filter strings. |
protected void
|
scheduleJob
(
SubSystem.SubSystemOperationJob job,
ISchedulingRule rule)
|
protected
ISubSystem
|
selectCommandSubSystem
(
ISubSystem[] allCmdSubSystems)
Internal method to select the appropriate command subsystem when there are multiple defined for this connection. |
void
|
setConfigurationId
(
String newConfigurationId)
Private. |
void
|
setConnectionError
(boolean error)
Sets whether the last attempt to connect this subsystem to its remote system failed. |
void
|
setConnectorService
(
IConnectorService connectorService)
Sets the
IConnectorService object that represents the live connection for this system. |
void
|
setFilterPoolReferenceManager
(
ISystemFilterPoolReferenceManager newFilterPoolReferenceManager)
Generated persistent property method
Set the object that manages the list of
filter pools referenced by this subsystem. |
void
|
setHidden
(boolean newHidden)
Private. |
void
|
setHost
(
IHost conn)
Set the parent connection that owns this subsystem. |
void
|
setInteractionProvider
(
IRSEInteractionProvider p)
Set an Interaction Provider specific for this subsystem. |
void
|
setName
(
String newName)
Private. |
Object
|
setProperties
(
Object subject,
String[] keys,
String[] values)
Deprecated. this shouldn't be used
|
Object
|
setProperty
(
Object subject,
String key,
String value)
Deprecated. this shouldn't be used
|
void
|
setRemoteAttribute
(
String attributeName,
String attributeValue)
Deprecated.
|
void
|
setSubSystemConfiguration
(
ISubSystemConfiguration ssf)
Return the parent subsystem factory that owns this subsystem. |
void
|
setVendorAttribute
(
String vendor,
String attributeName,
String attributeValue)
Deprecated. use property sets directly now
|
protected void
|
showConnectCancelledMessage
(
Shell shell,
String hostName,
int port)
Show an error message when the user cancels the connection. |
protected void
|
showConnectErrorMessage
(
Shell shell,
String hostName,
int port,
Throwable exc)
Show an error message when the connection fails. |
protected void
|
showDisconnectCancelledMessage
(
Shell shell,
String hostName,
int port)
Show an error message when the user cancels the disconnection. |
protected void
|
showDisconnectErrorMessage
(
Shell shell,
String hostName,
int port,
Exception exc)
Show an error message when the disconnection fails. |
protected void
|
showOperationCancelledMessage
(
Shell shell)
Show an error message when the user cancels the operation. |
protected void
|
showOperationErrorMessage
(
Shell shell,
Throwable exc)
Show an error message when the operation fails. |
protected void
|
showOperationMessage
(
Exception exc,
Shell shell)
|
protected
Object[]
|
sortResolvedFilterStringObjects
(
Object[] input)
Sort the concatenated list of all objects returned by resolving one or more
filter strings. |
boolean
|
supportsCaching
()
Check if the SubSystem supports caching. |
void
|
switchServiceFactory
(
ISubSystemConfiguration config)
Switch to use another subsystem configuration. |
void
|
uninitializeSubSystem
(
IProgressMonitor monitor)
Uninitialize this subsystem just after disconnect. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
SUBSYSTEM_FILE_NAME
protected static final
String SUBSYSTEM_FILE_NAME
-
See Also:
-
Constant Field Values
OPERATION_RESOLVE_ABSOLUTE
protected static final int OPERATION_RESOLVE_ABSOLUTE
-
See Also:
-
Constant Field Values
OPERATION_RESOLVE_ABSOLUTES
protected static final int OPERATION_RESOLVE_ABSOLUTES
-
See Also:
-
Constant Field Values
OPERATION_RESOLVE_RELATIVE
protected static final int OPERATION_RESOLVE_RELATIVE
-
See Also:
-
Constant Field Values
OPERATION_RUN_COMMAND
protected static final int OPERATION_RUN_COMMAND
-
See Also:
-
Constant Field Values
OPERATION_GET_PROPERTY
protected static final int OPERATION_GET_PROPERTY
-
See Also:
-
Constant Field Values
OPERATION_SET_PROPERTY
protected static final int OPERATION_SET_PROPERTY
-
See Also:
-
Constant Field Values
OPERATION_GET_PROPERTIES
protected static final int OPERATION_GET_PROPERTIES
-
See Also:
-
Constant Field Values
OPERATION_SET_PROPERTIES
protected static final int OPERATION_SET_PROPERTIES
-
See Also:
-
Constant Field Values
OPERATION_CONNECT
protected static final int OPERATION_CONNECT
-
See Also:
-
Constant Field Values
OPERATION_DISCONNECT
protected static final int OPERATION_DISCONNECT
-
See Also:
-
Constant Field Values
OPERATION_RUN_SHELL
protected static final int OPERATION_RUN_SHELL
-
See Also:
-
Constant Field Values
OPERATION_SEND_COMMAND_TO_SHELL
protected static final int OPERATION_SEND_COMMAND_TO_SHELL
-
See Also:
-
Constant Field Values
OPERATION_CANCEL_SHELL
protected static final int OPERATION_CANCEL_SHELL
-
See Also:
-
Constant Field Values
OPERATION_REMOVE_SHELL
protected static final int OPERATION_REMOVE_SHELL
-
See Also:
-
Constant Field Values
parentSubSystemConfiguration
protected
ISubSystemConfiguration parentSubSystemConfiguration
previousUserIdKey
protected
String previousUserIdKey
shell
protected
Shell shell
supportsConnecting
protected boolean supportsConnecting
sortResults
protected boolean sortResults
runInThread
protected boolean runInThread
cancelable
protected boolean cancelable
doConnection
protected boolean doConnection
pmDialog
protected
ProgressMonitorDialog pmDialog
saveFileName
protected
String saveFileName
_connectorService
protected
IConnectorService _connectorService
_connectionError
protected boolean _connectionError
_disconnecting
protected boolean _disconnecting
_host
protected
IHost _host
_name
protected
String _name
_subsystemConfigurationId
protected
String _subsystemConfigurationId
_hidden
protected boolean _hidden
filterPoolReferenceManager
protected
ISystemFilterPoolReferenceManager filterPoolReferenceManager
SubSystem
protected SubSystem(
IHost host,
IConnectorService connectorService)
setInteractionProvider
public void setInteractionProvider(
IRSEInteractionProvider p)
- Set an Interaction Provider specific for this subsystem.
EXPERIMENTAL. This class or interface has been added as
part of a work in progress. There is no guarantee that this API will work
or that it will remain the same. Please do not use this API without
consulting with the
Target
Management team.
-
-
-
Parameters:
-
p
- the new interaction provider to use, or null
to
fall back to the default interaction provider (from
RSECorePlugin). -
Since:
- 3.0
getInteractionProvider
public
IRSEInteractionProvider getInteractionProvider()
- Get the current Interaction Provider. Returns a specific one for this
subsystem if it has been set, or falls back to the default one from
RSECorePlugin otherwise.
EXPERIMENTAL. This class or interface has been added as
part of a work in progress. There is no guarantee that this API will work
or that it will remain the same. Please do not use this API without
consulting with the
Target
Management team.
-
-
-
Returns:
- the interaction provider to use.
-
Since:
- 3.0
selectCommandSubSystem
protected
ISubSystem selectCommandSubSystem(
ISubSystem[] allCmdSubSystems)
- Internal method to select the appropriate command subsystem when there are multiple defined for this connection.
The default implementation is to return the first, but child classes can refine this. Input is always an array of
length greater than one.
-
-
getSubSystemConfiguration
public
ISubSystemConfiguration getSubSystemConfiguration()
- Return the parent subsystem factory that owns this subsystem.
-
-
Specified by:
-
getSubSystemConfiguration
in interface
ISubSystem
-
setSubSystemConfiguration
public void setSubSystemConfiguration(
ISubSystemConfiguration ssf)
- Return the parent subsystem factory that owns this subsystem.
-
-
Specified by:
-
setSubSystemConfiguration
in interface
ISubSystem
-
setHost
public void setHost(
IHost conn)
- Set the parent connection that owns this subsystem.
-
-
Specified by:
-
setHost
in interface
ISubSystem
-
forceUserIdToUpperCase
public boolean forceUserIdToUpperCase()
- Return true if userId and password should be forced to uppercase.
INTERACTIVEcut to calling same method in parent connection.
-
-
Specified by:
-
forceUserIdToUpperCase
in interface
ISubSystem
-
renamingProfile
public void renamingProfile(
String oldName,
String newName)
- The profile is being renamed, so we are called to do our thing with
any information stored that is keyed by the profile name.
This is called AFTER the profile is renamed!
-
-
Specified by:
-
renamingProfile
in interface
ISubSystem
-
renamingConnection
public void renamingConnection(
String newName)
- The connection is being renamed, so we are called to do our thing with
any information stored that is keyed by the connection name.
-
-
Specified by:
-
renamingConnection
in interface
ISubSystem
-
deletingConnection
public void deletingConnection()
- Private method called when the parent connection is being deleted, so
the subsystem can do any pre-death cleanup it needs to.
What we need to do is delete our entry in the preference store for our userId.
-
-
Specified by:
-
deletingConnection
in interface
ISubSystem
-
getUserId
public
String getUserId()
- Returns the value of this subsystem's local user id if it is not null. If it
is null, it returns the parent connection object's default user Id. It in turn
queries the preferences if its local value is null.
In fact, we now don't store the user Id in the subsystem object itself, but rather store it in the
user preferences, so that such things are not shared among the team on a synchronize operation.
This is transparent to callers of this method however, as this method resolves from the preferences.
-
-
Specified by:
-
getUserId
in interface
ISubSystem
-
-
Returns:
- The value of the UserId attribute
-
See Also:
-
IHost.getDefaultUserId()
,
getLocalUserId()
,
clearLocalUserId()
getPreferencesKey
protected
String getPreferencesKey()
- Helper method to compute a unique name for a given subsystem instance
-
-
getPreferencesKey
protected
String getPreferencesKey(
String profileName,
String connectionName)
- Helper method to compute a unique name for a given subsystem instance, given a profile and connection name
-
-
getLocalUserId
protected
String getLocalUserId(
String key)
- Internal-use method for getting the local user ID, without resolution.
-
-
getLocalUserId
public
String getLocalUserId()
- Alternative to getUserId when we don't want to resolve it from parent connection.
This is used when showing the properties.
Unlike getUserId() this one does not defer to the connection's default user Id if
the subsystem's userId attribute is null.
To set the local user Id, simply call setUserId(String id). To clear it, call
clearLocalUserId()
.
-
-
Specified by:
-
getLocalUserId
in interface
ISubSystem
-
-
See Also:
-
IHost.getDefaultUserId()
,
clearLocalUserId()
,
getUserId()
clearLocalUserId
public void clearLocalUserId()
- Called to clear the local user Id such that subsequent requests to getUserId() will
return the parent connection's default user Id. Sets the user Id attribute for this
subsystem to null.
-
-
Specified by:
-
clearLocalUserId
in interface
ISubSystem
-
-
See Also:
-
IHost.getDefaultUserId()
,
getUserId()
,
getLocalUserId()
checkIsConnected
public void checkIsConnected(
IProgressMonitor monitor)
throws
SystemMessageException
-
Description copied from interface:
ISubSystem
- Check if the subsystem is connected, and connect if it's not.
This is a convenience method which first checks whether the subsystem is
already connected. If not, it automatically checks if it's running on the
dispatch thread or not, and calls the right
connect()
method
as appropriate. It also performs some exception parsing, converting
Exceptions from connect() into SystemMessageException that can be
displayed to the user by using a method in it.
If the subsystem is marked offline, or supports caching and is currently
restoring from its memento, no connect will be performed.
-
-
Specified by:
-
checkIsConnected
in interface
ISubSystem
-
-
Throws:
-
SystemMessageException
- in case of an error connecting -
Since:
- 3.0
getAdapter
public
Object getAdapter(
Class adapterType)
- This is the method required by the IAdaptable interface.
Given an adapter class type, return an object castable to the type, or
null if this is not possible.
By default this returns Platform.getAdapterManager().getAdapter(this, adapterType);
This in turn results in the default subsystem adapter SystemViewSubSystemAdapter,
in package org.eclipse.rse.ui.view.
-
-
Specified by:
-
getAdapter
in interface
IAdaptable
-
getSystemProfile
public
ISystemProfile getSystemProfile()
- Return the system profile object this subsystem is associated with.
-
-
Specified by:
-
getSystemProfile
in interface
ISubSystem
-
-
See Also:
-
ISubSystem.getName()
getSystemProfileName
public
String getSystemProfileName()
- Return the name of system profile object this subsystem is associated with.
-
-
Specified by:
-
getSystemProfileName
in interface
ISubSystem
-
-
Returns:
- The value of the profile that owns the connection that owns this subsystem. Fastpath.
getHost
public
IHost getHost()
- Return the connection object this subsystem is associated with.
-
-
Specified by:
-
getHost
in interface
ISubSystem
-
getHostAliasName
public
String getHostAliasName()
- Return the name of system connection object this subsystem is associated with.
-
-
Specified by:
-
getHostAliasName
in interface
ISubSystem
-
-
Returns:
- The name of the connection that owns this. Same as getSystemConnection().getAliasName()
getUniqueOwningSystemFilterPool
public
ISystemFilterPool getUniqueOwningSystemFilterPool(boolean createIfNotFound)
- Return the owning filter pool that is unique to this provider.
From SystemFilterPoolReferenceManagerProvider interface. We map to
a call to
getConnectionPrivateFilterPool(boolean)
.
-
-
Specified by:
-
getUniqueOwningSystemFilterPool
in interface
ISystemFilterPoolReferenceManagerProvider
-
getConnectionPrivateFilterPool
public
ISystemFilterPool getConnectionPrivateFilterPool(boolean createIfNotFound)
- Find or create a new filter pool, unique to this subsystem's connection. This will be
in the same profile as the connection and it will follow a naming convention that ties
it to the connection.
-
-
-
Parameters:
-
createIfNotFound
- - true to create the pool if it doesn't exist
-
Returns:
- the filter pool that was found or created
getConnectionOwnedFilterPoolName
public
String getConnectionOwnedFilterPoolName(
String profileName,
String connectionName)
- Constructs the name of a connection specific filter pool from its parts.
-
-
-
Parameters:
-
profileName
- the name of the profile that contains this filter pool. -
connectionName
- the name of the connection the "owns" this filter pool.
-
Returns:
- the name for the connection-owned filter pool.
doesFilterTypeMatch
protected boolean doesFilterTypeMatch(
ISystemFilter filter,
String remoteObjectAbsoluteName)
- Override this method if you support typed filters. Given an absolute remote object name,
you can test if this filter's type matches that of the remote object. This is called as
a pre-test in the following methods.
-
-
doesFilterListContentsOf
public boolean doesFilterListContentsOf(
ISystemFilter filter,
String remoteObjectAbsoluteName)
- Return true if the given filter lists the contents of the given remote object.
For example, if given a folder, return true if any of the filter strings in this filter
lists the contents of that folder. Used in impact analysis when a remote object is
created, deleted, renamed, copied or moved, so as to establish which filters need to be
refreshed or collapsed (if the folder is deleted, say).
Subclasses do not need to override this method. Rather, this method walks each
filter string and calls doesFilterStringListContentsOf(...), and that is the method
that child classes must override.
-
-
Specified by:
-
doesFilterListContentsOf
in interface
ISubSystem
-
doesFilterStringListContentsOf
public boolean doesFilterStringListContentsOf(
ISystemFilterString filterString,
String remoteObjectAbsoluteName)
- Return true if the given filter string lists the contents of the given remote object.
For example, if given a folder, return true if the given filter string
lists the contents of that folder. Used in impact analysis when a remote object is
created, deleted, renamed, copied or moved, so as to establish which filters need to be
refreshed or collapsed (if the folder is deleted, say).
This should only return true if the filter string directly lists the contents of the given
object, versus indirectly.
Subclasses should override this.
-
-
Specified by:
-
doesFilterStringListContentsOf
in interface
ISubSystem
-
doesFilterMatch
public boolean doesFilterMatch(
ISystemFilter filter,
String remoteObjectAbsoluteName)
- Return true if the given remote object name will pass the filtering criteria for any of
the filter strings in this filter.
Subclasses do not need to override this method. Rather, this method walks each
filter string and calls doesFilterStringMatch(...), and that is the method
that child classes must override.
-
-
Specified by:
-
doesFilterMatch
in interface
ISubSystem
-
doesFilterStringMatch
public boolean doesFilterStringMatch(
String filterString,
String remoteObjectAbsoluteName,
boolean caseSensitive)
- Return true if the given remote object name will pass the filtering criteria for
the given filter string.
Subclasses need to override this.
If in doubt, return true.
-
-
Specified by:
-
doesFilterStringMatch
in interface
ISubSystem
-
getPropertyPage
public
PropertyPage getPropertyPage(
Composite parent)
- Return the single property page to show in the tabbed notebook for the
for SubSystem property of the parent Connection. Return null if no
page is to be contributed for this. You are limited to a single page,
so you may have to compress. It is recommended you prompt for the port
if applicable since the common base subsystem property page is not shown
To help with this you can use the SystemPortPrompt widget.
-
-
getObjectWithAbsoluteName
public
Object getObjectWithAbsoluteName(
String key,
IProgressMonitor monitor)
throws
Exception
- Return the remote object that corresponds to the specified unique ID.
Since the abstract subsystem implementation does not know anything about
the specific kinds of resources managed by concrete implementations, this
method can only resolve filter references.
subsystem implementations must override this method in order to
resolve IDs for the remote objects they manage, to support drag and drop,
clipboard copy and other remote object resolving schemes.
Extenders that want to support filters should call
super.getObjectWithAbsoluteName(key)
when they do not find a
reference for the key themselves.
-
-
Specified by:
-
getObjectWithAbsoluteName
in interface
IRemoteObjectResolver
-
-
Parameters:
-
key
- the unique id of the remote object. Must not be
null
. -
monitor
- the progress monitor
-
Returns:
- the remote object instance, or
null
if no object is
found with the given id.
-
Throws:
-
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. -
Since:
- 3.0
-
See Also:
-
getObjectWithAbsoluteName(String, IProgressMonitor)
getObjectWithAbsoluteName
public
Object getObjectWithAbsoluteName(
String key)
throws
Exception
-
Deprecated. use getObjectWithAbsoluteName(String key, IProgressMonitor monitor)
-
Description copied from interface:
IRemoteObjectResolver
- Return the remote object that corresponds to the specified unique ID.
-
-
Specified by:
-
getObjectWithAbsoluteName
in interface
IRemoteObjectResolver
-
-
Parameters:
-
key
- the unique id of the remote object. Must not be
null
.
-
Returns:
- the remote object instance, or
null
if no object
is found with the given id.
-
Throws:
-
Exception
- in case an error occurs contacting the remote system
while retrieving the requested remote object.
getFilterReferenceWithAbsoluteName
protected
Object getFilterReferenceWithAbsoluteName(
String key)
- Return the filter reference that corresponds to the specified key. If there
-
-
-
Parameters:
-
key
- the absolute name for an object.
-
Returns:
- a filter reference if there is one matching the key,
or
null
if no such filter is found.
setVendorAttribute
public void setVendorAttribute(
String vendor,
String attributeName,
String attributeValue)
-
Deprecated. use property sets directly now
-
Description copied from interface:
ISubSystem
- For business partners defining their own subsystems.
This method allows an attribute to be persisted in this
subsystem, given the following information:
- Vendor name. This name should uniquely differentiate one
vendor's attributes from anothers.
- Attribute name. The name of the attribute to set.
- attribute value. The value to give the named attribute. It must
be resolved into a string to use this. Eg, for boolean use
something like "true" or "false". To clear the attribute
value pass null for the value.
Warning do not use any of the following characters in any of
given parameters, or it will cause problems with parsing:
- Pound sign ('#')
- Three underscores ("___")
- Three equals signs ("===")
- Three semicolons (";;;")
-
-
Specified by:
-
setVendorAttribute
in interface
ISubSystem
-
getVendorAttribute
public
String getVendorAttribute(
String vendor,
String attributeName)
-
Deprecated. use property sets directly now
-
Description copied from interface:
ISubSystem
- For business partners defining their own subsystems.
This method allows retrieval of a persisted attribute in this
subsystem, given the following information:
- Vendor name. This name should uniquely differentiate one
vendor's attributes from anothers.
- Attribute name. The name of the attribute whose value is being queried.
-
-
Specified by:
-
getVendorAttribute
in interface
ISubSystem
-
-
Returns:
- value of the attribute being queried, or null if not found
setRemoteAttribute
public void setRemoteAttribute(
String attributeName,
String attributeValue)
-
Deprecated.
-
-
getRemoteAttribute
public
String getRemoteAttribute(
String attributeName)
-
Deprecated.
-
-
getHostName
public
String getHostName()
- Return the host name for the connection this system's subsystem is associated with
-
-
displayAsyncMsg
protected void displayAsyncMsg(
SystemMessageException msg)
- Display message on message thread
-
-
getSystemFilterPoolReferenceManager
public
ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager()
- Return the system filter pool reference manager, as per the
interface SystemFilterPoolReferenceManagerProvider
-
-
Specified by:
-
getSystemFilterPoolReferenceManager
in interface
ISystemFilterPoolReferenceManagerProvider
-
Specified by:
-
getSystemFilterPoolReferenceManager
in interface
ISubSystem
-
fireEvent
protected void fireEvent(
SystemResourceChangeEvent event)
-
-
fireEvent
protected void fireEvent(
SystemResourceChangeEvent event,
Object grandParent)
-
-
fireEvent
protected void fireEvent(
Object src,
int eventId,
Object parent)
-
-
fireEvent
protected void fireEvent(
Object[] multiSrc,
int eventId,
Object parent)
-
-
fireEvent
protected void fireEvent(
Object[] src,
int eventId,
Object parent,
int position)
-
-
fireEvent
protected void fireEvent(
Object src,
int eventId,
Object parent,
Object grandParent)
-
-
filterEventFilterPoolReferenceCreated
public void filterEventFilterPoolReferenceCreated(
ISystemFilterPoolReference newPoolRef)
- A new filter pool reference has been created. Fire the appropriate events for this.
-
-
Specified by:
-
filterEventFilterPoolReferenceCreated
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterPoolReferenceDeleted
public void filterEventFilterPoolReferenceDeleted(
ISystemFilterPoolReference filterPoolRef)
- A filter pool reference has been deleted
-
-
Specified by:
-
filterEventFilterPoolReferenceDeleted
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterPoolReferenceReset
public void filterEventFilterPoolReferenceReset(
ISystemFilterPoolReference filterPoolRef)
- A single filter pool reference has been reset to reference a new pool
-
-
Specified by:
-
filterEventFilterPoolReferenceReset
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterPoolReferencesReset
public void filterEventFilterPoolReferencesReset()
- All filter pool references has been reset. Happens after SelectFilterPools dialog
-
-
Specified by:
-
filterEventFilterPoolReferencesReset
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterPoolReferenceRenamed
public void filterEventFilterPoolReferenceRenamed(
ISystemFilterPoolReference poolRef,
String oldName)
- A filter pool reference has been renamed (ie, its reference filter pool renamed)
-
-
Specified by:
-
filterEventFilterPoolReferenceRenamed
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterPoolReferencesRePositioned
public void filterEventFilterPoolReferencesRePositioned(
ISystemFilterPoolReference[] poolRefs,
int delta)
- One or more filter pool references have been re-ordered within their manager
-
-
Specified by:
-
filterEventFilterPoolReferencesRePositioned
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterCreated
public void filterEventFilterCreated(
Object selectedObject,
ISystemFilter newFilter)
- A new filter has been created. This is called when a filter pool reference is selected and a new filter
is created, so that the provider can expand the selected filter pool reference and reveal the new filter
within the selected pool reference.
Only the selected node should be expanded if not already. All other references to this pool will already
have been informed of the new addition, and will have refreshed their children but not expanded them.
-
-
Specified by:
-
filterEventFilterCreated
in interface
ISystemFilterPoolReferenceManagerProvider
-
filterEventFilterStringCreated
public void filterEventFilterStringCreated(
Object selectedObject,
ISystemFilterString newFilterString)
- A new filter string has been created. This is called when a filter reference is selected and a new filter
string is created, so that the provider can expand the selected filter reference and reveal the new filter
string within the selected filter reference.
Only the selected node should be expanded if not already. All other references to this filter will already
have been informed of the new addition, and will have refreshed their children but not expanded them.
-
-
Specified by:
-
filterEventFilterStringCreated
in interface
ISystemFilterPoolReferenceManagerProvider
-
implicitConnect
protected boolean implicitConnect(boolean isConnectOperation,
IProgressMonitor mon,
String msg,
int totalWorkUnits)
throws
SystemMessageException,
InvocationTargetException,
OperationCanceledException
-
-
-
Throws:
-
SystemMessageException
-
InvocationTargetException
-
OperationCanceledException
showOperationMessage
protected void showOperationMessage(
Exception exc,
Shell shell)
-
-
showConnectErrorMessage
protected void showConnectErrorMessage(
Shell shell,
String hostName,
int port,
Throwable exc)
- Show an error message when the connection fails.
Shows a common message by default.
Overridable.
-
-
showConnectCancelledMessage
protected void showConnectCancelledMessage(
Shell shell,
String hostName,
int port)
- Show an error message when the user cancels the connection.
Shows a common message by default.
Overridable.
-
-
showDisconnectErrorMessage
protected void showDisconnectErrorMessage(
Shell shell,
String hostName,
int port,
Exception exc)
- Show an error message when the disconnection fails.
Shows a common message by default.
Overridable.
-
-
showDisconnectCancelledMessage
protected void showDisconnectCancelledMessage(
Shell shell,
String hostName,
int port)
- Show an error message when the user cancels the disconnection.
Shows a common message by default.
Overridable.
-
-
getResolvingMessage
protected static
String getResolvingMessage(
String filterString)
- Helper method to return the message "Resolving to &1..."
-
-
getRunningMessage
protected static
String getRunningMessage(
String cmd)
- Helper method to return the message "Running command &1..."
-
-
getQueryingMessage
protected static
String getQueryingMessage(
String key)
- Helper method to return the message "Querying &1..."
-
-
getSettingMessage
protected static
String getSettingMessage(
String key)
- Helper method to return the message "Setting &1..."
-
-
getQueryingMessage
protected static
String getQueryingMessage()
- Helper method to return the message "Querying properties..."
-
-
getSettingMessage
protected static
String getSettingMessage()
- Helper method to return the message "Setting properties..."
-
-
showOperationErrorMessage
protected void showOperationErrorMessage(
Shell shell,
Throwable exc)
- Show an error message when the operation fails.
Shows a common message by default, unless the exception is of type SystemMessageException,
in which case the message is retrieved via getSystemMessage() and it is shown.
Overridable.
-
-
showOperationCancelledMessage
protected void showOperationCancelledMessage(
Shell shell)
- Show an error message when the user cancels the operation.
Shows a common message by default.
Overridable.
-
-
isConnected
public boolean isConnected()
- Return true if this subsystem is currently connected to its remote system.
If the subsystem configuration indicates its subsystems support connecting, then
this method will call getSystem().isConnect().
-
-
Specified by:
-
isConnected
in interface
ISubSystem
-
isOffline
public boolean isOffline()
- Returns the offline property for this subsystem's System Connection.
-
-
Specified by:
-
isOffline
in interface
ISubSystem
-
hasChildren
public boolean hasChildren()
- CHILD CLASSES MAY OVERRIDE THIS.
By default it returns true iff we support filters and there are filter pool references.
-
-
Specified by:
-
hasChildren
in interface
ISubSystem
-
getChildren
public
Object[] getChildren()
- Return the children of this subsystem, to populate the GUI subtree of
this subsystem. By default, this method:
- Returns the filter pool references of this subsystem, if
supportsFilters() is true for our factory.
- If supportsFilters() is false from our factory, returns null
So, be sure to override this method IF you do not support filters.
Lazy Loading: Note that if your subsystem does not support connecting,
and you do not support filters, here is a good point to ensure that the
bundles which declare your UI adapters get loaded, since the default code
which overriders usually place in
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.
-
-
Specified by:
-
getChildren
in interface
ISubSystem
-
scheduleJob
protected void scheduleJob(
SubSystem.SubSystemOperationJob job,
ISchedulingRule rule)
throws
InterruptedException
-
-
-
Throws:
-
InterruptedException
sortResolvedFilterStringObjects
protected
Object[] sortResolvedFilterStringObjects(
Object[] input)
- Sort the concatenated list of all objects returned by resolving one or more
filter strings.
The default implementation does nothing. Child classes can override if they wish
to show their resulting objects sorted.
-
-
resolveFilterString
public
Object[] resolveFilterString(
String filterString,
IProgressMonitor monitor)
throws
Exception
- Resolve an absolute filter string.
This is only applicable if the subsystem
factory reports true for
SubSystemConfiguration.supportsFilters()
,
which is the default. Otherwise,
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
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:
- They must implement
IAdaptable
.
- 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.
You do not need to override this, as it does the progress monitor and error message
displaying for you. Just override internalResolveFilterString.
-
-
Specified by:
-
resolveFilterString
in interface
ISubSystem
-
-
Parameters:
-
filterString
- filter pattern for objects to return. -
monitor
- the process monitor associated with this operation
-
Returns:
- Array of objects that are the result of this filter string
-
Throws:
-
Exception
resolveFilterStrings
public
Object[] resolveFilterStrings(
String[] filterStrings,
IProgressMonitor monitor)
throws
Exception
- Resolve multiple absolute filter strings. This is only applicable if the subsystem
factory reports true for supportsFilters().
This is the same as
resolveFilterString(String, IProgressMonitor)
but takes an array of
filter strings versus a single filter string.
The default implementation of this simply calls
internalResolveFilterStrings(String[], IProgressMonitor)
.
After successful resolve, the sort method is called to sort the concatenated results before
returning them.
-
-
Specified by:
-
resolveFilterStrings
in interface
ISubSystem
-
-
Parameters:
-
filterStrings
- array of filter patterns for objects to return. -
monitor
- the process monitor associated with this operation
-
Returns:
- Array of objects that are the result of this filter string
-
Throws:
-
Exception
resolveFilterString
public
Object[] resolveFilterString(
Object parent,
String filterString,
IProgressMonitor monitor)
throws
Exception
- Resolve a relative filter string.
When a user expands a remote resource this method is invoked and the
results are potentially sorted and displayed to the user. You can affect the sorting
behaviour by overriding
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:
- They must implement
IAdaptable
.
- 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.
You do not need to override this, as it does the progress monitor and error message
displaying for you. Override internalResolveFilterString instead.
-
-
Specified by:
-
resolveFilterString
in interface
ISubSystem
-
-
Parameters:
-
parent
- Object that is being expanded. -
filterString
- filter pattern for children of parent. Typically just "*". -
monitor
- the process monitor associated with this operation
-
Returns:
- Array of objects that are the result of this filter string
-
Throws:
-
Exception
getExecutedCommands
public
String[] getExecutedCommands()
- Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports
true for supportsCommands().
-
-
setProperty
public
Object setProperty(
Object subject,
String key,
String value)
throws
Exception
-
Deprecated. this shouldn't be used
- Set a remote property. Subsystems interpret as they wish. Eg, this might be to set
a remote environment variable. This is only applicable if the subsystem factory reports
true for supportsProperties().
-
-
Specified by:
-
setProperty
in interface
ISubSystem
-
-
Parameters:
-
subject
- Identifies which object to get the properties of -
key
- Identifies property to set -
value
- Value to set property to
-
Returns:
- Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
-
Throws:
-
Exception
getProperty
public
String getProperty(
Object subject,
String key)
throws
Exception
-
Deprecated. this shouldn't be used
- Get a remote property. Subsystems interpret as they wish. Eg, this might be to get
a remote environment variable. This is only applicable if the subsystem factory reports
true for supportsProperties().
-
-
Specified by:
-
getProperty
in interface
ISubSystem
-
-
Parameters:
-
subject
- Identifies which object to get the properties of -
key
- Identifies property to get value of
-
Returns:
- String The value of the requested key.
-
Throws:
-
Exception
setProperties
public
Object setProperties(
Object subject,
String[] keys,
String[] values)
throws
Exception
-
Deprecated. this shouldn't be used
- Set multiple remote properties. Subsystems interpret as they wish. Eg, this might be to set
a number of remote environment variables. This is only applicable if the subsystem factory reports
true for supportsProperties().
-
-
Specified by:
-
setProperties
in interface
ISubSystem
-
-
Parameters:
-
subject
- identifies which object to get the properties of. -
keys
- the array of propertie keys to set. -
values
- the array of values to set. The value at a certain index corresponds to the property key at the same index.
-
Returns:
- Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
-
Throws:
-
Exception
initializeSubSystem
public void initializeSubSystem(
IProgressMonitor monitor)
throws
SystemMessageException
- Initialize this subsystem instance after the corresponding
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.
-
-
Specified by:
-
initializeSubSystem
in interface
ISubSystem
-
-
Parameters:
-
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.
-
Throws:
-
SystemMessageException
- if an error occurs during initialization.
uninitializeSubSystem
public void uninitializeSubSystem(
IProgressMonitor monitor)
- Uninitialize this subsystem just after disconnect. The default
implementation currently does nothing. Overriding methods should call
super after doing their own work.
-
-
Specified by:
-
uninitializeSubSystem
in interface
ISubSystem
-
-
Parameters:
-
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.
connect
public void connect(
IProgressMonitor monitor,
boolean forcePrompt)
throws
Exception
-
Description copied from interface:
ISubSystem
- Synchronously connect to the remote system.
Clients are expected to call this method on a background
thread with an existing progress monitor. A signon prompt
may optionally be forced even if the password is cached
in memory or on disk.
The framework will take care of switching to the UI thread
for requesting a password from the user if necessary.
-
-
Specified by:
-
connect
in interface
ISubSystem
-
-
Parameters:
-
monitor
- the progress monitor. Must not be null
. -
forcePrompt
- forces the prompt dialog to be displayed
even if the password is currently in memory.
-
Throws:
-
Exception
- an exception if there is a failure to connect.
Typically, this will be a
SystemMessageException
.
An
OperationCanceledException
will be thrown if the user cancels the connect.
connect
public void connect(boolean forcePrompt,
IRSECallback callback)
throws
Exception
-
Description copied from interface:
ISubSystem
- Asynchronously connect to the remote system, optionally forcing a signon prompt
even if the password is cached in memory or on disk.
This method must be called on the UI Thread! An Eclipse background job with a
progress monitor will be created automatically. If the optional callback is
given, it will be called when the connect is complete.
You do not need to override this, as it does the progress monitor reporting
for you.
Override internalConnect if you want, but by default it calls
getConnectorService().connect(IProgressMonitor)
.
-
-
Specified by:
-
connect
in interface
ISubSystem
-
-
Parameters:
-
forcePrompt
- forces the prompt dialog even if the password is in mem -
callback
- to call after connect is complete.
May be null
.
-
Throws:
-
Exception
- an exception if there is a failure to connect.
Typically, this will be a
SystemMessageException
.
An
OperationCanceledException
will be thrown if the user cancels the connect.
promptForPassword
public boolean promptForPassword()
throws
Exception
- A convenience method, fully equivalent to promptForPassword(false).
-
-
-
Throws:
-
Exception
promptForPassword
public boolean promptForPassword(boolean force)
throws
Exception
- Prompt the user for a password to the remote system. The primary request was something else,
but we have detected the user is not connected so we prompt for password outside
of the progress monitor, then set a flag to do the connection within the progress
monitor.
-
-
-
Parameters:
-
force
- true if the prompting should be forced, false if prompting can be skipped if credentials have been stored.
-
Returns:
- true if the credentials are obtained
-
Throws:
-
Exception
disconnect
public void disconnect()
throws
Exception
- Disconnect from the remote system
You do not need to override this, as it does the progress monitor and error message
displaying for you.
Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
-
-
Specified by:
-
disconnect
in interface
ISubSystem
-
-
Throws:
-
Exception
disconnect
public void disconnect(boolean collapseTree)
throws
Exception
- Disconnect from the remote system
You do not need to override this, as it does the progress monitor and error message
displaying for you.
Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
-
-
Specified by:
-
disconnect
in interface
ISubSystem
-
-
Parameters:
-
collapseTree
- collapse the tree in the system view
-
Throws:
-
Exception
getProperties
public
String[] getProperties(
Object subject,
String[] keys)
throws
Exception
-
Deprecated. this shouldn't be used
- Get a remote property. Subsystems interpret as they wish. Eg, this might be to get
a remote environment variable. This is only applicable if the subsystem factory reports
true for supportsProperties().
-
-
Specified by:
-
getProperties
in interface
ISubSystem
-
-
Parameters:
-
subject
- Identifies which object to get the properties of -
keys
- the array of property keys.
-
Returns:
- the values for the given property keys.
-
Throws:
-
Exception
getConnectorService
public
IConnectorService getConnectorService()
- Return the
IConnectorService
object that represents the live connection for this system.
This must return an object that implements
IConnectorService
. A good starting point for that
is the base class
AbstractConnectorService
.
The connector service gets passed in to the constructor for the subsystem so there's normally no reason
to override this method.
-
-
Specified by:
-
getConnectorService
in interface
ISubSystem
-
setConnectorService
public void setConnectorService(
IConnectorService connectorService)
- Sets the
IConnectorService
object that represents the live connection for this system.
-
-
Specified by:
-
setConnectorService
in interface
ISubSystem
-
-
Parameters:
-
connectorService
- the connector service
supportsCaching
public boolean supportsCaching()
- Check if the SubSystem supports caching. This is the default implementation
which returns false. Subclasses must override to support caching.
-
-
Specified by:
-
supportsCaching
in interface
ISubSystem
-
getCacheManager
public
ICacheManager getCacheManager()
- Return the CacheManager for this subsystem. This is the default implementation
which just returns null.
-
-
Specified by:
-
getCacheManager
in interface
ISubSystem
-
-
See Also:
-
supportsCaching()
internalDisconnect
protected void internalDisconnect(
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Actually disconnect from the remote host. This is called by the run(IProgressMonitor monitor) method.
You DO NOT OVERRIDE THIS. Rather, this calls connect(IProgressMonitor) in your
IConnectorService class that is returned from getConnectorService(). That is where your code to disconnect should go!
Your disconnect method in your IConnectorService class must follow these IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if the host is unknown, throw new java.lang.reflect.InvocationTargetException(new java.net.UnknownHostException));
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- well, actually you can throw anything and we'll wrap it here in an InvocationTargetException
- do not worry about calling monitor.done() ... caller will do that!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
internalResolveFilterString
protected
Object[] internalResolveFilterString(
String filterString,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Resolve an absolute filter string. This is only applicable if the subsystem
factory reports true for
SubSystemConfiguration.supportsFilters()
,
which is the default. Otherwise,
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
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:
- They must implement
IAdaptable
.
- 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:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
internalResolveFilterStrings
public
Object[] internalResolveFilterStrings(
String[] filterStrings,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Resolve multiple absolute filter strings. This is only applicable if the subsystem
factory reports true for supportsFilters().
This is the same as
internalResolveFilterString(Object, String, IProgressMonitor)
but takes an array of
filter strings versus a single filter string.
The default implementation of this simply calls
internalResolveFilterString(String, IProgressMonitor)
once for each filter string, and concatenates the result. The method sortResolvedFilterStringObject
is called on the concatenated result, given subclasses an opportunity to sort the result.
After successful resolve, the sort method is called to sort the concatenated results before
returning them.
-
-
-
Parameters:
-
filterStrings
- array of filter patterns for objects to return. -
monitor
- the progress monitor we are running under
-
Returns:
- Array of objects that are the result of resolving all the filter strings
-
Throws:
-
InvocationTargetException
-
InterruptedException
addResolvedFilterStringObjects
protected void addResolvedFilterStringObjects(
Vector allChildrenSoFar,
Object[] childrenForThisFilterString,
String[] allFilterStrings,
int currFilterStringIndex)
- Overridable extension point for adding the results of a filter string
to the overall list of results.
Can be used to filter out redundant entries in the concatenated list, if this
is desired.
-
-
internalResolveFilterString
protected
Object[] internalResolveFilterString(
Object parent,
String filterString,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Resolve a relative filter string.
When a user expands a remote resource this method is invoked and the
results are potentially sorted and displayed to the user. You can affect the sorting
behaviour by overriding
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:
- They must implement
IAdaptable
.
- 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.
This is called by the run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.
As per IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
getFirstParentFilterString
protected
String getFirstParentFilterString(
Object parent)
- Called by resolveFilterString when given null for the filter string, meaning we defer
getting a filter string until later, where we query it from the parent. In this case
we need the first filter string for the progress monitor msg.
Override if needed. By default we return "*";
-
-
internalGetProperty
protected
String internalGetProperty(
Object subject,
String key,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Actually get a remote property. This is called by the
run(IProgressMonitor monitor) method, which in turn is called by getProperty(...).
As per IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
internalSetProperty
protected
Object internalSetProperty(
Object subject,
String key,
String value,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Actually set a remote property. This is called by the
run(IProgressMonitor monitor) method, which in turn is called by setProperty(...).
As per IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
internalGetProperties
protected
String[] internalGetProperties(
Object subject,
String[] keys,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Actually get multiple remote properties. This is called by the
run(IProgressMonitor monitor) method, which in turn is called by getProperties(...).
As per IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
internalSetProperties
protected
Object internalSetProperties(
Object subject,
String[] keys,
String[] values,
IProgressMonitor monitor)
throws
InvocationTargetException,
InterruptedException
- Actually set multiple remote properties. This is called by the
run(IProgressMonitor monitor) method, which in turn is called by setProperties(...).
As per IRunnableWithProgress rules:
- if the user cancels (monitor.isCanceled()), throw new InterruptedException()
- if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
- do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT PROPERTIES!
-
-
-
Throws:
-
InvocationTargetException
-
InterruptedException
getRunnableContext
protected
IRunnableContext getRunnableContext()
-
Deprecated. this is scheduled to be removed since we want to
avoid UI components in SubSystem.
- Get the progress monitor dialog for this operation. We try to
use one for all phases of a single operation, such as connecting
and resolving.
-
-
getShell
protected
Shell getShell()
- Return the shell for the current operation
-
-
getName
public
String getName()
-
Private. Do not override.
-
-
Specified by:
-
getName
in interface
IRSEModelObject
-
Specified by:
-
getName
in interface
ISubSystem
-
-
Returns:
- The value of the Name attribute
setName
public void setName(
String newName)
-
Private. Do not override.
-
-
Specified by:
-
setName
in interface
ISubSystem
-
-
Parameters:
-
newName
- The new value of the Name attribute
getConfigurationId
public
String getConfigurationId()
-
Private. Do not override.
-
-
Specified by:
-
getConfigurationId
in interface
ISubSystem
-
-
Returns:
- The value of the ConfigurationId attribute
Ties this subsystem to its owning subsystem configuration, via the
id key string of the configuration.
setConfigurationId
public void setConfigurationId(
String newConfigurationId)
-
Private. Do not override.
-
-
Specified by:
-
setConfigurationId
in interface
ISubSystem
-
-
Parameters:
-
newConfigurationId
- The new value of the ConfigurationId attribute
isHidden
public boolean isHidden()
-
Private. Do not override.
-
-
Specified by:
-
isHidden
in interface
ISubSystem
-
-
Returns:
- The value of the Hidden attribute
setHidden
public void setHidden(boolean newHidden)
-
Private. Do not override.
-
-
Specified by:
-
setHidden
in interface
ISubSystem
-
-
Parameters:
-
newHidden
- The new value of the Hidden attribute
getFilterPoolReferenceManager
public
ISystemFilterPoolReferenceManager getFilterPoolReferenceManager()
-
Private. Do not override.
-
-
Specified by:
-
getFilterPoolReferenceManager
in interface
ISubSystem
-
-
Returns:
- The FilterPoolReferenceManager reference
setFilterPoolReferenceManager
public void setFilterPoolReferenceManager(
ISystemFilterPoolReferenceManager newFilterPoolReferenceManager)
-
Description copied from interface:
ISubSystem
-
Generated persistent property method
Set the object that manages the list of
filter pools referenced by this subsystem. This is called by the subsystem factory
when creating or restoring subsystems.
-
-
Specified by:
-
setFilterPoolReferenceManager
in interface
ISubSystem
-
isPrimarySubSystem
public boolean isPrimarySubSystem()
-
-
Specified by:
-
isPrimarySubSystem
in interface
ISubSystem
-
-
Returns:
- true if this subsystem's properties should take precedence over other
subsystems that share the same
IConnectorService
getPrimarySubSystem
public
ISubSystem getPrimarySubSystem()
-
Description copied from interface:
ISubSystem
- Return the primary subsystem associated with this subsystem's IConnectorService
-
-
Specified by:
-
getPrimarySubSystem
in interface
ISubSystem
-
getTargetForFilter
public
Object getTargetForFilter(
ISystemFilterReference filterRef)
-
Description copied from interface:
ISubSystem
- Returns the parent object associated with a filter reference. It's up to the
subsystem implementation to decide what "parent object" means for a filter reference.
-
-
Specified by:
-
getTargetForFilter
in interface
ISubSystem
-
-
Parameters:
-
filterRef
- the filter reference to determine a target object from.
-
Returns:
- An object representing the parent
isConnectionError
public boolean isConnectionError()
-
Description copied from interface:
ISubSystem
- Return true if the last attempt to connect this subsystem to its remote system failed.
-
-
Specified by:
-
isConnectionError
in interface
ISubSystem
-
setConnectionError
public void setConnectionError(boolean error)
-
Description copied from interface:
ISubSystem
- Sets whether the last attempt to connect this subsystem to its remote system failed.
-
-
Specified by:
-
setConnectionError
in interface
ISubSystem
-
getTargetsForFilter
public
Object[] getTargetsForFilter(
ISystemFilterReference filterRef)
-
-
contains
public boolean contains(
ISchedulingRule rule)
-
-
Specified by:
-
contains
in interface
ISchedulingRule
-
-
See Also:
-
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
isConflicting
public boolean isConflicting(
ISchedulingRule rule)
-
-
Specified by:
-
isConflicting
in interface
ISchedulingRule
-
-
See Also:
-
ISchedulingRule.isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule)
commit
public boolean commit()
-
Description copied from interface:
IRSEPersistableContainer
- Request a persistence manager to persist this object.
-
-
Specified by:
-
commit
in interface
IRSEPersistableContainer
-
-
Returns:
- true if the object was persisted.
getPersistableParent
public
IRSEPersistableContainer getPersistableParent()
-
Description copied from interface:
IRSEPersistableContainer
- Retrieve the parent of this object in the persistence containment hierarchy.
This is related to, but not necessarily the same as, the model hierarchy.
-
-
Specified by:
-
getPersistableParent
in interface
IRSEPersistableContainer
-
-
Returns:
- the parent persistent object. This is null if there is no parent.
getPersistableChildren
public
IRSEPersistableContainer[] getPersistableChildren()
-
Description copied from interface:
IRSEPersistableContainer
- Retrieves the children of this object in the persistence containment hierarchy.
This is related to, but not necessarily the same as, the model hierarchy.
-
-
Specified by:
-
getPersistableChildren
in interface
IRSEPersistableContainer
-
-
Returns:
- the array of persistent children in the order they are to be stored in the
persistent form. This is an empty array if there are no children.
See
IRSEPersistableContainer.NO_CHILDREN
.
internalSwitchSubSystemConfiguration
protected void internalSwitchSubSystemConfiguration(
ISubSystemConfiguration newConfiguration)
- Perform the subsystem specific processing required to complete a
subsystem configuration switch for a service subsystem. The subsystem
will typically query this configuration for interesting properties or
policies. It should also reset any state to a fresh start. This supplied
implementation does nothing. Subclasses may override if they implement a
service subsystem.
-
-
-
Parameters:
-
newConfiguration
- the configuration this subsystem should use from
this point. -
Since:
- 3.0
canSwitchTo
public boolean canSwitchTo(
ISubSystemConfiguration configuration)
- Determine if a service subsystem is capable of switching to this new
configuration. This is usually a test of this configuration's type
against the type expected by this subsystem. This supplied implementation
returns false. Subclasses should override if they implement a service
subsystem.
-
-
Specified by:
-
canSwitchTo
in interface
ISubSystem
-
-
Parameters:
-
configuration
- the configuration to which this subsystem may switch
-
Returns:
- true if this subsystem is capable of switching to this
configuration, false otherwise. This implementation returns false.
-
Since:
- 3.0
-
See Also:
-
ISubSystem.canSwitchTo(ISubSystemConfiguration)
switchServiceFactory
public void switchServiceFactory(
ISubSystemConfiguration config)
- Switch to use another subsystem configuration. This default
implementation will test if the subsystem is a service subsystem and if
the subsystem is compatible with the suggested configuration. If it is
the switch will be performed and internalSwitchSubSystemConfiguration
will be called.
-
-
Specified by:
-
switchServiceFactory
in interface
ISubSystem
-
-
Parameters:
-
config
- the configuration to which to switch. -
Since:
- 3.0
-
See Also:
-
ISubSystem.switchServiceFactory(ISubSystemConfiguration)
,
internalSwitchSubSystemConfiguration(ISubSystemConfiguration)
getServiceType
public
Class getServiceType()
- Return the service type for this subsystem.
-
-
Specified by:
-
getServiceType
in interface
ISubSystem
-
-
Returns:
- the default implementation returns null. Subclasses that
implement service subsystems should return a type as specified in the
interface.
-
Since:
- 3.0
-
See Also:
-
ISubSystem.getServiceType()
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.