ptolemy.actor.lib
Class URLDirectoryReader
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
ptolemy.actor.lib.URLReader
ptolemy.actor.lib.URLDirectoryReader
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Deprecated. Use DirectoryListing instead.
public class URLDirectoryReader
- extends URLReader
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: URLDirectoryReader.java,v 1.34 2005/07/08 19:56:10 cxh Exp $
- Author:
- Christopher Hylands
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
|
Field Summary |
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.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Method Summary |
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.AtomicActor |
_actorFiring, _actorFiring, _createReceivers, addActorFiringListener, addInitializable, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, 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 |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
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.
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.
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 class URLReader
- 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 interface Executable- Overrides:
fire in class Source
- 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 interface Initializable- Overrides:
initialize in class URLReader
- 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 interface Executable- Overrides:
postfire in class AtomicActor
- 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 interface Executable- Overrides:
prefire in class Source
- Returns:
- True, unless the trigger input is connected
and has no input.
- Throws:
IllegalActionException - If the sourceURL is invalid.