org.das2.util.filesystem.WebFileSystem

Base class for HTTP and FTP-based filesystems. A local cache is kept of the files.


LISTING_TIMEOUT_MS

we keep a cached listing in on disk. This is backed by the website.


MEMORY_LISTING_TIMEOUT_MS

we keep a cached listing in memory for performance. This is backed by the .listing file.


HTTP_CHECK_TIMESTAMP_LIMIT_MS

timestamp checks will occur no more often than this.


PROP_READ_ONLY_CACHE

alternate location to check for file before downloading.


cacheListing

cacheListing( String directory, org.das2.util.filesystem.FileSystem.DirectoryEntry[] listing ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source


getDownloadDirectory

getDownloadDirectory( ) → File

Returns:

java.io.File

search for examples view on GitHub view source


getFileObject

getFileObject( String filename ) → FileObject

Return the handle for this file. This is not the file itself, and accessing this object does not necessarily download the resource. This will be a container for file metadata, in addition to providing access to the data file itself.

Parameters

filename - the name of the file within the filesystem.

Returns:

a FileObject for the file

search for examples view on GitHub view source


getLocalName

getLocalName( java.io.File file ) → String

return the name of the File within the FileSystem, where File is a local file within the local copy of the filesystem.

Parameters

file -

Returns:

the name within the filesystem

search for examples view on GitHub view source


getLocalRoot

getLocalRoot( ) → File

Returns:

java.io.File

search for examples view on GitHub view source


getLocalRootAbsPath

Deprecated: use getLocalRoot().getAbsolutePath()

getOfflineMessage

getOfflineMessage( ) → String

return the reason (if any provided) why the filesystem is offline,

Returns:

the message for the response code

search for examples view on GitHub view source


getOfflineResponseCode

getOfflineResponseCode( ) → int

if non-zero, the response code (e.g. 403) why the filesystem is offline.

Returns:

the response code.

search for examples view on GitHub view source


getPartFile

getPartFile( java.io.File localFile ) → File

return a name where the download is to be staged. This will be unique for any process. We make the following assumptions:

See https://sourceforge.net/p/autoplot/bugs/1301/

Parameters

localFile -

Returns:

the temporary filename to use.

search for examples view on GitHub view source


getProtocol

getProtocol( ) → WebProtocol

return the protocol object, which allows access to the metadata. This may go away, so do not depend on this for production code.

Returns:

the protocol object.

search for examples view on GitHub view source


getReadOnlyCache

getReadOnlyCache( ) → File

Returns:

java.io.File

search for examples view on GitHub view source


getRootURL

getRootURL( ) → URL

return the root of the filesystem as a URL. Since the root is stored as a URI and "ftp://jbf@mysite.com:@ftpproxy.net/temp/" is a legal address, check for this case.

Returns:

the root of the filesystem as a URL.

search for examples view on GitHub view source


isAppletMode

isAppletMode( ) → boolean

Returns:

boolean

search for examples view on GitHub view source


isListingCached

isListingCached( String directory ) → boolean

return true if the listing file (.listing) is available in the file system cache, and is still fresh. LISTING_TIMEOUT_MS controls the freshness, where files older than LISTING_TIMEOUT_MS milliseconds will not be used. Note the timestamp on the file comes from the server providing the listing, so the age may be negative when clocks are not synchronized.

Parameters

directory -

Returns:

true if the listing is cached.

search for examples view on GitHub view source


localRoot

localRoot( java.net.URI root ) → File

return the local root for the URI.

Parameters

root - the URI such as http://das2.org/data/

Returns:

/home/jbf/autoplot_data/fscache/http/das2.org/data/

search for examples view on GitHub view source


maybeUpdateDirectoryEntry

maybeUpdateDirectoryEntry( String filename, boolean force ) → DirectoryEntry

trigger an update of the in-memory listing, or check to see if it is in memory.

Parameters

filename - the particular file for which we need a listing.
force - if true, then list if it isn't available.

Returns:

null if the listing is not available, or if the element is not in the folder, the DirectoryEntry otherwise.

search for examples view on GitHub view source


resetListCache

resetListCache( String directory ) → void

From FTPBeanFileSystem.

Parameters

directory -

Returns:

void (returns nothing)

search for examples view on GitHub view source


resetListingCache

resetListingCache( ) → void

reset the .listing files and the ram-memory caches.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setAppletMode

setAppletMode( boolean applet ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source


setReadOnlyCache

setReadOnlyCache( java.io.File f ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source