Class URLDirectoryReader
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
@Deprecated public class URLDirectoryReader extends URLReader
Deprecated.Use DirectoryListing instead.This actor reads a URL and if the URL names a directory, it outputs the name of each file or subdirectory contained in the directory. If the URL names a file, then it outputs the name of that file.If the repeat flag is true, then the sequence of file names is repeated indefinitely. If the refresh flag is true, and the repeat flag is true, then the directory is re-read before repeating the sequence of files and subdirectories.
If the endsWith String parameter is non-null and non-empty, then only file names or subdirectories that end with the value of the endsWith parameter are output.
One alternative implementation would be that if the URL named a file, then the actor would output the names of the files and subdirectories in the directory that contains the file.
Another alternative implementation would output the names of the files and subdirectories in an array.
An extension would be to include a filter parameter that could be a regular expression that would allow us to filter the file names.
Should this actor extend URLReader or SequenceActor?- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Christopher Hylands
- Pt.AcceptedRating:
- Red (liuj)
- Pt.ProposedRating:
- Red (liuj)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
endsWith
Deprecated.If non-null and non-empty, then only output file names and sub directories that end with this String value.Parameter
repeat
Deprecated.Repeat after outputting all elements of the directory.-
Fields inherited from class ptolemy.actor.lib.URLReader
_reader, _refreshFlag, _source, _stdIn, refresh, sourceURL
-
Fields inherited from class ptolemy.actor.lib.Source
_triggered, output, trigger
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description URLDirectoryReader(CompositeEntity container, java.lang.String name)
Deprecated.Construct an actor with the given container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
Deprecated.If the specified attribute is URL, then close the current file (if there is one) and open the new one.void
fire()
Deprecated.Output the data read in the prefire.void
initialize()
Deprecated.Open the file at the URL, and set the width of the output.boolean
postfire()
Deprecated.Update the iteration counter until it exceeds the number of elements in the directory.boolean
prefire()
Deprecated.Read one row from the input and prepare for output them.-
Methods inherited from class ptolemy.actor.lib.URLReader
_setURLReader, wrapup
-
Methods inherited from class ptolemy.actor.lib.Source
_customTypeConstraints
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, 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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
endsWith
public Parameter endsWith
Deprecated.If non-null and non-empty, then only output file names and sub directories that end with this String value. The default value of this parameter is the empty String "".
-
repeat
public Parameter repeat
Deprecated.Repeat after outputting all elements of the directory. The default value of this parameter is a false BooleanToken.
-
-
Constructor Detail
-
URLDirectoryReader
public URLDirectoryReader(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Deprecated.Construct an actor with the given container and name.- Parameters:
container
- The container.name
- The name of this actor.- Throws:
IllegalActionException
- If the actor cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
Deprecated.If the specified attribute is URL, then close the current file (if there is one) and open the new one.- Overrides:
attributeChanged
in classURLReader
- Parameters:
attribute
- The attribute that has changed.- Throws:
IllegalActionException
- If the specified attribute is URL and the file cannot be opened.
-
fire
public void fire() throws IllegalActionException
Deprecated.Output the data read in the prefire.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classSource
- Throws:
IllegalActionException
- If there's no director.
-
initialize
public void initialize() throws IllegalActionException
Deprecated.Open the file at the URL, and set the width of the output.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classURLReader
- Throws:
IllegalActionException
- Not thrown in this base class
-
postfire
public boolean postfire() throws IllegalActionException
Deprecated.Update the iteration counter until it exceeds the number of elements in the directory. If the repeat parameter is true, then repeat the same sequence of directory elements again. If the repeat and refresh parameters are both true, then reread the directory before repeating the sequence of directory elements- Specified by:
postfire
in interfaceExecutable
- Overrides:
postfire
in classAtomicActor<TypedIOPort>
- Returns:
- True if execution can continue into the next iteration.
- Throws:
IllegalActionException
- If the sourceURL is not valid.
-
prefire
public boolean prefire() throws IllegalActionException
Deprecated.Read one row from the input and prepare for output them.- Specified by:
prefire
in interfaceExecutable
- Overrides:
prefire
in classSource
- Returns:
- True, unless the trigger input is connected and has no input.
- Throws:
IllegalActionException
- If the sourceURL is invalid.
-
-