net.sourceforge.ganttproject.document
Class URLDocument

java.lang.Object
  |
  +--net.sourceforge.ganttproject.document.AbstractDocument
        |
        +--net.sourceforge.ganttproject.document.URLDocument
All Implemented Interfaces:
Document

public class URLDocument
extends AbstractDocument

This class implements the interface Document for file access on HTTP-servers and WebDAV-enabled-servers.

Author:
Michael Haeusler (michael at akatose.de)

Constructor Summary
URLDocument(java.lang.String url, java.lang.String user, java.lang.String pass)
           
 
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.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.
 void setUserInfo(java.lang.String user, java.lang.String pass)
           
 
Methods inherited from class net.sourceforge.ganttproject.document.AbstractDocument
equals, getFilePath
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLDocument

public URLDocument(java.lang.String url,
                   java.lang.String user,
                   java.lang.String pass)
Method Detail

getDescription

public java.lang.String getDescription()
Description copied from interface: Document
Gets the description of the document (can be displayed in the application's titlebar).

Returns:
the description of the document

canRead

public boolean canRead()
Description copied from interface: Document
Checks, wether the document is readable.

Returns:
readability

canWrite

public boolean canWrite()
Description copied from interface: Document
Checks, wether the document is writable.

Returns:
writability

isValidForMRU

public boolean isValidForMRU()
Description copied from interface: Document
Checks, wether the document should appear in the MRU (list of most recently used files).

Returns:
validity for MRU

acquireLock

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

Specified by:
acquireLock in interface Document
Overrides:
acquireLock in class AbstractDocument
Returns:
wether a lock could be successfully acquired
See Also:
Document.releaseLock()

releaseLock

public void releaseLock()
Description copied from interface: Document
Releases a previously acquired lock.

Specified by:
releaseLock in interface Document
Overrides:
releaseLock in class AbstractDocument
See Also:
#acquireLock(String)

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: Document
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
Description copied from interface: Document
Gets an OutputStream, that allows to write to the document.

Returns:
OutputStream to write to
java.io.IOException

getPath

public java.lang.String getPath()
Description copied from interface: Document
Gets the path to the document.

Returns:
the path to the document

getURLPath

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

Specified by:
getURLPath in interface Document
Overrides:
getURLPath in class AbstractDocument
Returns:
the path, if the document is a server file; null, otherwise.

getUsername

public java.lang.String getUsername()
Description copied from interface: Document
Gets the username used to authenticate to the storage container

Specified by:
getUsername in interface Document
Overrides:
getUsername in class AbstractDocument
Returns:
username

getPassword

public java.lang.String getPassword()
Description copied from interface: Document
Gets the password used to authenticate to the storage container

Specified by:
getPassword in interface Document
Overrides:
getPassword in class AbstractDocument
Returns:
username

setUserInfo

public void setUserInfo(java.lang.String user,
                        java.lang.String pass)

getLastError

public java.lang.String getLastError()
Description copied from interface: Document
Gets the last error

Specified by:
getLastError in interface Document
Overrides:
getLastError in class AbstractDocument
Returns:
errormessage


Copyright © 2002 Alexandre THOMAS.