public class SshSession extends TypedAtomicActor
Creates an ssh session to a remote host. If requested, the session will not
be opened at first firing of this actor but postponed to the first actor that
uses ssh (e.g.ExecuteCmd.) This actor is useful for three things:
- to provide a private-key for public-key authentication.
- to connect to a remote machine at a certain point of the workflow and thus
ask for password (e.g. at the very beginning) not sometime during execution.
- to forward local ports and/or remote ports.
This actor uses the org.kepler.ssh package to have longlasting connections
Its output is the input target, which can be used to identify the created SshSession object anywhere (all ssh related classes use a session factory to create/retrieve sessions based on the target name) and thus use the connection.
If the host is empty string or equals "local", nothing happens within this actor. All related actors will use the Java Runtime for local execution instead of ssh.
If the parameter postpone is true, the establishment of connection is postponed until the first remote operation to be executed. One of the main purpose of this actor is, however, to make the connection and thus ask for password at the beginning of the workflow. The default is false.
If the parameter closeAtEnd is true, the session will be closed at the end of the workflow. If it is false, the session will be kept open. The latter is good for authentication to a host secured with one-time-password, so that all workflows can share the same connection. Be careful, however, as the underlyting ssh package has only one session (within Kepler) to a given user@host:port. If you have two workflows running at once connecting to the same host, and the session is closed at the end of one of the workflows, the other will likely experience a broken operation. Therefore, by default, this parameter is false.
On the failed output port, the actor emits a BooleanToken indicating whether the connection opening failed. It emits 'true' only if the postpone flag is false and the connection failed. Otherwise it emits a 'false' token. This can be used to throw an exception or stop the workflow that cannot work without a connection, or to successively try out other hosts.
Port forwarding is supported. The 'portforwarding' parameter should have the format "-L port:host:hostport -R port:host:hostport ...". Many local and/or remote forwarding specification can be given.
Reference: Ant version 1.6.2.Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
closeAtEnd
Specifying whether actual connection to the host should be closed when
the workflow terminates.
|
TypedIOPort |
failed
Boolean output to indicate whether the connection opening failed.
|
TypedIOPort |
gridcert
The string representation of the file path for the Grid Certificate file if
the user wants to connect to an GSI-SSH server without having to enter the
password all the time (the passphrase for the certificate will be asked once).
|
TypedIOPort |
gridproxy
The string representation of the file path for the Grid Certificate Proxy file if
the user wants to connect to an GSI-SSH server without having to enter the
password all the time.
|
TypedIOPort |
identity
The string representation of the file path for the ssh identity file if
the user wants to connect without having to enter the password all the
time.
|
FileParameter |
paramGridCert
The file path for the Grid Certificate file if the user wants to connect
to an GSI-SSH server without having to enter the password all the time
(the passphrase for the certificate will be asked once).
|
FileParameter |
paramGridProxy
The file path for the Grid Certificate Proxy file if the user wants to connect
to an GSI-SSH server without having to enter the password all the time.
|
FileParameter |
paramIdentity
The file path for the ssh identity file if the user wants to connect
without having to enter the password all the time.
|
PortParameter |
portforwarding
Port forwarding specification.
|
Parameter |
postpone
Specifying whether actual connection to the host should be postponed
until the first usage somewhere in the workflow.
|
PortParameter |
target
Target in user@host:port format.
|
TypedIOPort |
target_out
String output: same as input target.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
SshSession(CompositeEntity container,
java.lang.String name)
Construct an SshSession actor with the given container and name.
|
Modifier and Type | Method and Description |
---|---|
void |
fire()
fire.
|
void |
initialize()
initialize() runs once before first exec
|
void |
stop()
Close all sessions.
|
void |
wrapup()
Close all sessions.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stopFire, terminate
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stopFire, terminate
addInitializable, preinitialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public PortParameter target
public FileParameter paramIdentity
public TypedIOPort identity
public FileParameter paramGridCert
public TypedIOPort gridcert
public FileParameter paramGridProxy
public TypedIOPort gridproxy
public PortParameter portforwarding
public TypedIOPort target_out
public TypedIOPort failed
public Parameter postpone
public Parameter closeAtEnd
public SshSession(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.IllegalActionException
- If the entity cannot be contained by the proposed
container.NameDuplicationException
- If the container already has an actor with this name.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the parent class throws it.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- is thrown if the session cannot be opened.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public void stop()
stop
in interface Executable
stop
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.