net.sourceforge.ganttproject.document
Interface Document

All Known Implementing Classes:
AbstractDocument

public interface Document

This interface abstracts the details of file access. Implementations of this interface provide methods to open streams to a project file, indepent of storage location (filesystem / WebDAV).

Author:
Michael Haeusler (michael at akatose.de)

Method Summary
 boolean acquireLock()
          Tries to acquire a lock.
 boolean canRead()
          Checks, wether the document is readable.
 boolean canWrite()
          Checks, wether the document is writable.
 java.lang.String getDescription()
          Gets the description of the document (can be displayed in the application's titlebar).
 java.lang.String getFilePath()
          Gets the path to the document, if it is a file on a local file system (can be used to initialize a JFileChooser).
 java.io.InputStream getInputStream()
          Gets an InputStream, that allows to read from the document.
 java.lang.String getLastError()
          Gets the last error
 java.io.OutputStream getOutputStream()
          Gets an OutputStream, that allows to write to the document.
 java.lang.String getPassword()
          Gets the password used to authenticate to the storage container
 java.lang.String getPath()
          Gets the path to the document.
 java.lang.String getURLPath()
          Gets the path to the document, if it is a file on a server (can be used to initialize an UrlChooser).
 java.lang.String getUsername()
          Gets the username used to authenticate to the storage container
 boolean isValidForMRU()
          Checks, wether the document should appear in the MRU (list of most recently used files).
 void releaseLock()
          Releases a previously acquired lock.
 

Method Detail

getDescription

public java.lang.String getDescription()
Gets the description of the document (can be displayed in the application's titlebar).

Returns:
the description of the document

canRead

public boolean canRead()
Checks, wether the document is readable.

Returns:
readability

canWrite

public boolean canWrite()
Checks, wether the document is writable.

Returns:
writability

isValidForMRU

public boolean isValidForMRU()
Checks, wether the document should appear in the MRU (list of most recently used files).

Returns:
validity for MRU

acquireLock

public boolean acquireLock()
Tries to acquire a lock.
This method is optional. Storage containers, for which locking is inappropriate, should always return true.

Returns:
wether a lock could be successfully acquired
See Also:
releaseLock()

releaseLock

public void releaseLock()
Releases a previously acquired lock.

See Also:
#acquireLock(String)

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets an InputStream, that allows to read from the document.

Returns:
InputStream to read from
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Gets an OutputStream, that allows to write to the document.

Returns:
OutputStream to write to
java.io.IOException

getPath

public java.lang.String getPath()
Gets the path to the document.

Returns:
the path to the document

getFilePath

public java.lang.String getFilePath()
Gets the path to the document, if it is a file on a local file system (can be used to initialize a JFileChooser).

Returns:
the path, if the document is a local file; null, otherwise.

getURLPath

public java.lang.String getURLPath()
Gets the path to the document, if it is a file on a server (can be used to initialize an UrlChooser).

Returns:
the path, if the document is a server file; null, otherwise.

getUsername

public java.lang.String getUsername()
Gets the username used to authenticate to the storage container

Returns:
username

getPassword

public java.lang.String getPassword()
Gets the password used to authenticate to the storage container

Returns:
username

getLastError

public java.lang.String getLastError()
Gets the last error

Returns:
errormessage


Copyright © 2002 Alexandre THOMAS.