public class GenericFileCopier extends TypedAtomicActor
For copying files between two remote machines, connects to the source remote host using Ssh protocol and executes the command on a terminal. The actor org.kepler.ssh.SshExec is used for this
This actor uses the org.kepler.ssh package to have long lasting connections.
If the timeoutSeconds is set greater than zero, the command will be timed out after the specified amount of time (in seconds).
In case there is an ssh connection related error (or timeout) the exitcode will be -32767, errors will contain the error message, stdout and stderr will be empty string.
To ensure fixed rate of token production for SDF, the actor emits an empty string on errors if the command is executed without ssh related errors.
If cleanupAfterError is set, the remote process and its children will be killed (provided, we have the connection still alive). Very useful in case of timeout because that leaves remote processes running. Use only when connecting to a unix machine. In case of local or localhost, this flag is not used.
Streaming of output during the command execution is not implemented.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
cleanupAfterError
Enforce killing remote process(es) after an error or timeout.
|
Parameter |
cmdOptions
Additional command line options to be used for the selected protocol.
|
PortParameter |
connectFromDest |
PortParameter |
destination
destination machine information in user@host:port format.
|
PortParameter |
destinationFile
destination file/directory to which source should be copied.
|
TypedIOPort |
errors
The string representation of all the errors that happened during the
execution of the actor, if there are any.
|
TypedIOPort |
exitcode
The exit code of the command.
|
StringParameter |
protocol
Type of a protocol to be used to do file transfer.
|
Parameter |
protocolPathDest
Path where the protocol is installed in the destination machine
|
Parameter |
protocolPathSrc
Path where the protocol is installed in the source machine
|
Parameter |
recursive
Specifying whether directories can be copied recursively.
|
PortParameter |
source
source machine information in user@host:port format.
|
PortParameter |
sourceFile
source file/directory to be copied.
|
StringParameter |
srmProtocol
Protocol that srmlite should internally use.
|
Parameter |
timeoutSeconds
Timeout in seconds for the command to be executed. 0 means waiting
indefinitely for command termination.
|
TypedIOPort |
warnings
The string representation of all the warnings that happened during the
execution of the actor, if there are any.
|
_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 |
---|
GenericFileCopier(CompositeEntity container,
java.lang.String name)
Construct an FileCopierBetweenRemoteMachines actor with the given
container and name.
|
Modifier and Type | Method and Description |
---|---|
void |
fire()
Send the token in the value parameter to the output.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_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, stop, stopFire, terminate
addInitializable, initialize, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort exitcode
public TypedIOPort errors
public TypedIOPort warnings
public PortParameter source
public PortParameter sourceFile
public PortParameter destination
public PortParameter destinationFile
public StringParameter protocol
public Parameter protocolPathSrc
public Parameter protocolPathDest
public Parameter cmdOptions
public Parameter timeoutSeconds
public Parameter cleanupAfterError
public StringParameter srmProtocol
public PortParameter connectFromDest
public GenericFileCopier(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 fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If it is thrown by the send() method sending out the
token.