org.eclipse.rse.core.subsystems
Class AbstractConnectorService
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.AbstractConnectorService
-
All Implemented Interfaces:
-
IPropertySetContainer,
IRSEModelObject,
IRSEPersistableContainer,
IConnectorService
-
Direct Known Subclasses:
-
AuthenticatingConnectorService,
BasicConnectorService
-
public abstract class AbstractConnectorService
- extends
RSEModelObject
- implements
IConnectorService
This is a base class to make it easier to create connector services.
An
IConnectorService
object
is returned from a subsystem object via getConnectorService(), and
it is used to maintain the connection to a particular set of subsystems.
This class implements the protocol for much of the
standard bookkeeping for connector services including
server launchers (if none are required), event handling,
hosts, ports, addresses, descriptions, and registered subsystems.
Subclasses must concern themselves with actually authenticating and connecting.
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.core.subsystems.
IConnectorService
|
acquireCredentials,
clearCredentials,
clearPassword,
getUserId,
hasPassword,
inheritsCredentials,
isConnected,
isSuppressed,
removePassword,
removeUserId,
requiresPassword,
requiresUserId,
savePassword,
saveUserId,
setPassword,
setSuppressed,
setUserId,
sharesCredentials,
supportsPassword,
supportsUserId
|
AbstractConnectorService
public AbstractConnectorService(
String name,
String description,
IHost host,
int port)
- Construct a new connector service. This should be called during the construction
of any subclasses.
-
Parameters:
-
name
- The name of the connector service. -
description
- A description of the connector service. -
host
- The host associated with this connector service. A host may have multiple
connector services. -
port
- The port associated with this connector service if this connector service
is IP based. If not IP based this can be used for some other purpose.
isServerLaunchTypeEnabled
public final boolean isServerLaunchTypeEnabled(
ISubSystem subsystem,
ServerLaunchType serverLaunchType)
-
Description copied from interface:
IConnectorService
- This methods returns the enablement state of a server launch type.
If
RemoteServerLauncher.enableServerLaunchType(ServerLaunchType, boolean)
has not been
called for this server launch type, then it is enabled by default.
-
-
Specified by:
-
isServerLaunchTypeEnabled
in interface
IConnectorService
-
-
Parameters:
-
subsystem
- the subystem for which this may be enabled. -
serverLaunchType
- the type to check for enabledment.
-
Returns:
- true if the connector service supports server launching and
this launch type is enabled.
-
See Also:
-
ServerLaunchType
getRemoteServerLauncher
public
IServerLauncher getRemoteServerLauncher()
-
-
Specified by:
-
getRemoteServerLauncher
in interface
IConnectorService
-
-
Returns:
- null, may be overriden
-
See Also:
-
IConnectorService.getRemoteServerLauncher()
supportsRemoteServerLaunching
public boolean supportsRemoteServerLaunching()
-
-
Specified by:
-
supportsRemoteServerLaunching
in interface
IConnectorService
-
-
Returns:
- false, may be overridden
-
See Also:
-
IConnectorService.supportsRemoteServerLaunching()
supportsServerLaunchProperties
public boolean supportsServerLaunchProperties()
-
-
Specified by:
-
supportsServerLaunchProperties
in interface
IConnectorService
-
-
Returns:
- false, may be overridden
-
See Also:
-
IConnectorService.supportsServerLaunchProperties()
getRemoteServerLauncherProperties
public
IServerLauncherProperties getRemoteServerLauncherProperties()
-
Description copied from interface:
IConnectorService
- Gets the properties associated with a remote server launcher.
These may be null.
This an optional object containing
properties used to launch the remote server that
communicates with this client.
-
-
Specified by:
-
getRemoteServerLauncherProperties
in interface
IConnectorService
-
-
Returns:
- null, may be overridden
-
See Also:
-
IConnectorService.getRemoteServerLauncherProperties()
setRemoteServerLauncherProperties
public void setRemoteServerLauncherProperties(
IServerLauncherProperties newRemoteServerLauncher)
- Do nothing, may be overridden
-
-
Specified by:
-
setRemoteServerLauncherProperties
in interface
IConnectorService
-
-
Parameters:
-
newRemoteServerLauncher
- the server launcher properties -
See Also:
-
IConnectorService.setRemoteServerLauncherProperties(IServerLauncherProperties)
hasRemoteServerLauncherProperties
public final boolean hasRemoteServerLauncherProperties()
-
-
Specified by:
-
hasRemoteServerLauncherProperties
in interface
IConnectorService
-
-
Returns:
- true if the connector service has server launcher properties.
addCommunicationsListener
public final void addCommunicationsListener(
ICommunicationsListener listener)
-
Description copied from interface:
IConnectorService
- Register a communications listener. These listeners will be informed
of connect and disconnect events.
-
-
Specified by:
-
addCommunicationsListener
in interface
IConnectorService
-
-
Parameters:
-
listener
- a listener for the communications event.
removeCommunicationsListener
public final void removeCommunicationsListener(
ICommunicationsListener listener)
-
Description copied from interface:
IConnectorService
- Remove a communications listener.
-
-
Specified by:
-
removeCommunicationsListener
in interface
IConnectorService
-
-
Parameters:
-
listener
- a listener for the communications event.
fireCommunicationsEvent
protected final void fireCommunicationsEvent(int eventType)
- Fires the communication event mentioned in the eventType.
-
-
-
Parameters:
-
eventType
- the communications event to fire.
getHost
public final
IHost getHost()
-
-
Specified by:
-
getHost
in interface
IConnectorService
-
-
Returns:
- the host used by this connector service.
setHost
public final void setHost(
IHost host)
-
Description copied from interface:
IConnectorService
- Sets the host used by this connector service.
-
-
Specified by:
-
setHost
in interface
IConnectorService
-
-
Parameters:
-
host
- the host to be used for this connector service
getDescription
public final
String getDescription()
-
-
Specified by:
-
getDescription
in interface
IRSEModelObject
-
Overrides:
-
getDescription
in class
RSEModelObject
-
getName
public final
String getName()
-
-
Specified by:
-
getName
in interface
IRSEModelObject
-
setPort
public final void setPort(int port)
-
Description copied from interface:
IConnectorService
- Set the port for this connector. Usually only used by IP based
connections.
-
-
Specified by:
-
setPort
in interface
IConnectorService
-
-
Parameters:
-
port
- the IP port used by this connector service.
getPort
public final int getPort()
-
-
Specified by:
-
getPort
in interface
IConnectorService
-
-
Returns:
- the port for this connector service. Usually only used for
IP based connections.
getPrimarySubSystem
public final
ISubSystem getPrimarySubSystem()
-
-
Specified by:
-
getPrimarySubSystem
in interface
IConnectorService
-
-
Returns:
- the primary subsystem object this connector service is associated
with. This is usually the subsystem that first established this
connector service.
registerSubSystem
public final void registerSubSystem(
ISubSystem ss)
-
Description copied from interface:
IConnectorService
- Adds a subsystem to this connector service. Does nothing if the
subsystem is already known to this connector service.
-
-
Specified by:
-
registerSubSystem
in interface
IConnectorService
-
-
Parameters:
-
ss
- a subsystem that is using this connector service.
deregisterSubSystem
public final void deregisterSubSystem(
ISubSystem ss)
-
Description copied from interface:
IConnectorService
- Deregister the subsystem. Does nothing if the subsystem is not present.
-
-
Specified by:
-
deregisterSubSystem
in interface
IConnectorService
-
-
Parameters:
-
ss
- the subsystem to remove from this connector service.
commit
public final 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 final
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
.
getHostName
public final
String getHostName()
-
-
Specified by:
-
getHostName
in interface
IConnectorService
-
-
Returns:
- the host name for the connection associated with this
connector service.
getVersionReleaseModification
public
String getVersionReleaseModification()
-
-
Specified by:
-
getVersionReleaseModification
in interface
IConnectorService
-
-
Returns:
- the version, release, modification of the remote system,
if connected, if applicable, and if available. Return null if
this information is not available.
getSubSystems
public final
ISubSystem[] getSubSystems()
-
Description copied from interface:
IConnectorService
- Return all the subsystems that use this connector service
-
-
Specified by:
-
getSubSystems
in interface
IConnectorService
-
-
Returns:
- the subsystems that use this service
initializeSubSystems
protected final void initializeSubSystems(
IProgressMonitor monitor)
throws
SystemMessageException
- Initialize any subsystems just after connecting to the host.
-
-
-
Parameters:
-
monitor
- a progress monitor to report progress of initialization.
-
Throws:
-
SystemMessageException
uninitializeSubSystems
protected final void uninitializeSubSystems(
IProgressMonitor monitor)
- Uninitialize any subsystem just after disconnecting from the host.
-
-
-
Parameters:
-
monitor
- a progress monitor used to track uninitialization progress.
notifyDisconnection
protected final void notifyDisconnection()
- Send the event to notify listeners of a disconnection.
Used by the framework and should
usually not be invoked by concrete subclasses.
-
-
notifyConnection
protected final void notifyConnection()
- Send the event to notify listeners of a connection.
Used by the framework and should
usually not be invoked by concrete subclasses.
-
-
notifyError
protected final void notifyError()
- Send the event to notify listeners of a connection establishment error.
Used by the framework and should
usually not be invoked by concrete subclasses.
-
-
isUsingSSL
public final boolean isUsingSSL()
-
-
Specified by:
-
isUsingSSL
in interface
IConnectorService
-
-
Returns:
- true if this connector service will attempt to
use SSL when establishing its connection.
setIsUsingSSL
public final void setIsUsingSSL(boolean flag)
-
-
Specified by:
-
setIsUsingSSL
in interface
IConnectorService
-
-
Parameters:
-
flag
- true if the connector service should attempt to use SSL when
establishing the connection.
getTempDirectory
public
String getTempDirectory()
- Returns the temp directory of the remote system for the current user,
if available. This implementation returns the empty string.
-
-
Specified by:
-
getTempDirectory
in interface
IConnectorService
-
-
Returns:
- an empty string
-
See Also:
-
IConnectorService.getTempDirectory()
getHomeDirectory
public
String getHomeDirectory()
- Returns the home directory of the remote system for the current user,
if available. This implementation returns the empty string.
-
-
Specified by:
-
getHomeDirectory
in interface
IConnectorService
-
-
Returns:
- an empty string
-
See Also:
-
IConnectorService.getHomeDirectory()
reset
public void reset()
- Reset the connector service state if a connector service is redefined
or disconnected.
Each subsystem needs to be informed so it can clear out any expansions.
This implementation does nothing.
Implementations should override and call
reset()
if there is internal state to reset.
-
-
Specified by:
-
reset
in interface
IConnectorService
-
-
See Also:
-
IConnectorService.reset()
getConnectPort
protected int getConnectPort()
- This implementation returns the connector service's port property.
Override if appropriate.
This is called by the default implementation of
connect(IProgressMonitor)
,
if #supportsServerLaunchProperties() is true.
-
-
-
Returns:
- the port used for connecting to the target
connect
public final void connect(
IProgressMonitor monitor)
throws
Exception
-
Description copied from interface:
IConnectorService
- Connect to the remote system.
-
-
Specified by:
-
connect
in interface
IConnectorService
-
-
Parameters:
-
monitor
- a monitor for tracking the progress and canceling a
connect operation.
-
Throws:
-
OperationCanceledException
- if the connect was cancelled by the
user
-
Exception
- if there is a failure connecting. Typically, this will
be a
SystemMessageException
.
disconnect
public final void disconnect(
IProgressMonitor monitor)
throws
Exception
- Disconnects from the target system.
Calls
internalDisconnect(IProgressMonitor)
and
postDisconnect()
-
-
Specified by:
-
disconnect
in interface
IConnectorService
-
-
Parameters:
-
monitor
- a monitor for tracking the progress and canceling a
disconnect operation.
-
Throws:
-
Exception
- if the disconnect fails
internalConnect
protected abstract void internalConnect(
IProgressMonitor monitor)
throws
Exception
- Performs the actual connection to the target system.
-
-
-
Parameters:
-
monitor
- for cancellation and progress reporting
-
Throws:
-
Exception
- if connection does not succeed
internalDisconnect
protected abstract void internalDisconnect(
IProgressMonitor monitor)
throws
Exception
- Performs the actual disconnection from the target system.
-
-
-
Parameters:
-
monitor
- for cancellation and progress reporting
-
Throws:
-
Exception
- if disconnection does not succeed
postDisconnect
protected void postDisconnect()
- Performs any cleanup required after disconnecting.
This implementation does nothing.
May be overridden.
If overridden, invoke via super.
-
-
preDisconnect
protected void preDisconnect()
- Performs any tasks required immediately prior to disconnecting.
This implementation does nothing.
May be overridden.
If overridden, invoke via super.
-
-
preConnect
protected void preConnect()
- Performs any tasks required immediately prior to connecting.
This implementation does nothing.
May be overridden.
If overridden, invoke via super.
-
-
postConnect
protected void postConnect()
- Performs any tasks required immediately after connecting.
This implementation does nothing.
May be overridden.
If overridden, invoke via super.
-
-
setDenyPasswordSave
public final int setDenyPasswordSave(boolean deny)
- Sets the attribute for this connector service instance that denies a
password to be saved. If the attribute has never been set it defaults to
false. If set to true, it will clear any saved passwords for this system
and not allow any further passwords to be stored. This property of a
system is persistent from session to session, but is not sharable.
-
-
Specified by:
-
setDenyPasswordSave
in interface
IConnectorService
-
-
Parameters:
-
deny
- If true, forget any saved passwords and do not allow any
others to be saved. If false, allow passwords to be saved in
the keyring.
-
Returns:
- the number of saved passwords removed by this operation. This
will always be zero if "deny" is false.
-
Since:
- org.eclipse.rse.core 3.0
-
See Also:
-
IConnectorService.setDenyPasswordSave(boolean)
getDenyPasswordSave
public final boolean getDenyPasswordSave()
- Retrieves the value of the "DENY_PASSWORD_SAVE" property of this
connector service. If the value has never been set, this will return
false.
-
-
Specified by:
-
getDenyPasswordSave
in interface
IConnectorService
-
-
Returns:
- true if password saving is denied.
-
Since:
- org.eclipse.rse.core 3.0
-
See Also:
-
IConnectorService.getDenyPasswordSave()
hasActiveCommunicationListeners
public boolean hasActiveCommunicationListeners()
- Check if there are any active communication listeners listening to
this connector service.
-
-
-
Returns:
- true if there are any active communication listeners
-
Since:
- 3.1
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.