org.das2.fsm.FileStorageModel

Represents a method for storing data sets in a set of files by time. The client provides a regex for the files and how each group of the regex is interpreted as a time digit. The model can then be used to provide the set of files that cover a time range, etc. This new implementation uses a TimeParser object to more quickly process file names.


cacheCleanup

cacheCleanup( ) → void

remove files that have been identified as old versions.

Returns:

void (returns nothing)

search for examples view on GitHub view source


containsFile

containsFile( java.io.File file ) → boolean

return true if the file came (or could come) from this FileStorageModel.

Parameters

file - the file

Returns:

true if the file came (or could come) from this FileStorageModel.

search for examples view on GitHub view source


generateNamesFor

generateNamesFor( DatumRange range ) → String

generate the names of the files that would cover this range. This was taken from Autoplot's org.virbo.jythonsupport.Util. TODO: versioning, etc.

Parameters

range - the time range to cover.

Returns:

the string names, each in the context of the filesystem.

search for examples view on GitHub view source


getBestFilesFor

getBestFilesFor( DatumRange targetRange ) → File

return the best files found for the range, without progress feedback.

Parameters

targetRange -

Returns:

java.io.File[]

search for examples view on GitHub view source


getBestNamesFor

getBestNamesFor( DatumRange targetRange, ProgressMonitor monitor ) → String

return the names in the range, minding version numbers, or all available names if the range is null. This will list directories.

Parameters

targetRange - range limit, or null.
monitor -

Returns:

array of names within the system.

search for examples view on GitHub view source


getChildFileSystem

getChildFileSystem( org.das2.util.filesystem.FileSystem root, String child, ProgressMonitor monitor ) → FileSystem

return a child filesystem, with special code for LocalFileSystems to support Windows. TODO: look into .zip child.

Parameters

root -
child -
monitor -

Returns:

the FileSystem

See Also:

https://sourceforge.net/p/autoplot/bugs/2132


search for examples view on GitHub view source


getField

getField( String field, String name ) → String

return the field value for the given name. For example, if the spec is $Y/$m/$d/$Y$m$d_v$(v,sep).dat and the name matched is 2014/04/04/20140404_v2.3.dat then calling this for the field "v" would result in "2.3" This should not be used to retrieve fields that are components of the time range, such as $Y or $m.

Parameters

field - field, for example "v"
name - name, for example 2014/04/04/20140404_v2.3.dat

Returns:

the field value, for example, "2.3" when the spec is $Y/$m/$d/$Y$m$d_v$v.dat

search for examples view on GitHub view source


getFileFor

getFileFor( String name ) → File

download the file for the given name within the filesystem.

Parameters

name - the name within the filesystem.

Returns:

null or a local file which can be opened.

search for examples view on GitHub view source


getFileSystem

getFileSystem( ) → FileSystem

return the filesystem used to implement this.

Returns:

filesystem

search for examples view on GitHub view source


getFilenameFor

getFilenameFor( Datum start, Datum end ) → String

return a filename that would intersect the range. Note this file may not actually exist. This may be used to quantize the range. The template may not contain versions.

Parameters

start -
end -

Returns:

java.lang.String

search for examples view on GitHub view source


getFilesFor

getFilesFor( DatumRange targetRange ) → File

Returns:

java.io.File[]

search for examples view on GitHub view source


getNameFor

getNameFor( java.io.File file ) → String

Provides a way to recover the model name of a file. The returned File from getFilesFor can be anywhere, so it would be good to provide a way to get it back into a FSM name. For example, a filesystem might download the remote file to a cache directory, which is the File that is provided to the client, sometimes the client will need to recover the name of the corresponding FileObject, so this maps the File back to the name.

Parameters

file - the file

Returns:

the canonical name of the file.

search for examples view on GitHub view source


getNamesFor

getNamesFor( DatumRange targetRange ) → String

return the names in the range, or all names if the range is null.

Parameters

targetRange - range limit, or null.

Returns:

array of names within the system.

search for examples view on GitHub view source


getRangeFor

getRangeFor( String name ) → DatumRange

return the time range represented by this name.

Parameters

name - like 2013-10-31

Returns:

the timerange representing the day 2013-10-31

search for examples view on GitHub view source


getRepresentativeFile

getRepresentativeFile( ProgressMonitor monitor ) → String

return a random file from the FSM, which can be used to represent a typical file. For example, we need to look at metadata to see what is available.

Parameters

monitor - progress monitor in case a file must be downloaded.

Returns:

a reference to the file within the FileSystem, or null if one is not found.

search for examples view on GitHub view source


hasField

hasField( String field ) → boolean

returns true if the parser has the field.

Parameters

field - e.g. "x"

Returns:

true if the parser has the field.

search for examples view on GitHub view source


quantize

quantize( DatumRange timeRange ) → DatumRange

return the timerange that contains the given timerange and exactly contains a set of granules. This needs to be synchronized because the timeParser.

Parameters

timeRange - arbitrary time range

Returns:

list of file timeranges covering file input timeRange.

search for examples view on GitHub view source