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_OFFLINE

if true, then the remote filesystem is not accessible, but local cache copies may be accessed. See FileSystemSettings.allowOffline


PROP_READ_ONLY_CACHE

alternate location to check for file before downloading.


addPropertyChangeListener

addPropertyChangeListener( java.beans.PropertyChangeListener listener ) → void

Parameters

listener - a PropertyChangeListener

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


cacheListing

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

Parameters

directory - a String
listing - an org.das2.util.filesystem.FileSystem.DirectoryEntry[]

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


consumeStream

Deprecated: see HtmlUtil.consumeStream.

getDownloadDirectory

getDownloadDirectory( ) → File

Returns:

java.io.File

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 - a File

Returns:

the name within the filesystem

[search for examples] [view on GitHub] [view on old javadoc] [view source]

getLocalName( java.net.URL url ) → String

getLocalRoot

getLocalRoot( ) → File

Returns:

java.io.File

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 - a File

Returns:

the temporary filename to use.

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


getReadOnlyCache

getReadOnlyCache( ) → File

Returns:

java.io.File

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


getURI

getURI( String filename ) → URI

return the URI for the internal filename

Parameters

filename - internal filename

Returns:

a java.net.URI

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getURL

getURL( String filename ) → URL

return the URL for the internal filename, encoding the characters if necessary.

Parameters

filename - internal filename

Returns:

a java.net.URL

See Also:

DefaultHttpProtocol#urlEncodeSansSlash(java.lang.String)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


isAppletMode

isAppletMode( ) → boolean

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isDirectory

isDirectory( String filename ) → boolean

return true if the name refers to a directory, not a file.

Parameters

filename - a String

Returns:

a boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isGitClone

isGitClone( java.io.File root, String path ) → String

return the canonical path for the path, if it is part of a git clone.

Parameters

root - a directory which is a clone of some path, possibly
path - the path within the path.

Returns:

the canonical path, or null if it is not a git clone.

[search for examples] [view on GitHub] [view on old javadoc] [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 - a String

Returns:

true if the listing is cached.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isOffline

isOffline( ) → boolean

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


listDirectory

listDirectory( String directory ) → String

return the directory listing for the name.

Parameters

directory - a String

Returns:

a java.lang.String[]

[search for examples] [view on GitHub] [view on old javadoc] [view source]

listDirectory( String directory, String regex ) → String

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 on old javadoc] [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 on old javadoc] [view source]


removePropertyChangeListener

removePropertyChangeListener( java.beans.PropertyChangeListener listener ) → void

Parameters

listener - a PropertyChangeListener

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


resetListCache

resetListCache( String directory ) → void

From FTPBeanFileSystem.

Parameters

directory - a String

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


setAppletMode

setAppletMode( boolean applet ) → void

Parameters

applet - a boolean

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setOffline

setOffline( boolean offline ) → void

Parameters

offline - a boolean

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setReadOnlyCache

setReadOnlyCache( java.io.File f ) → void

Parameters

f - a File

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( ) → String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc] [view source]