pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.vfs.providers
Class SingleFileSystemProvider

java.lang.Object
  extended by org.torweg.pulse.vfs.providers.SingleFileSystemProvider
All Implemented Interfaces:
VFSProvider

public final class SingleFileSystemProvider
extends java.lang.Object
implements VFSProvider

a VFSProvider working directly on a single file system.

Version:
$Revision: 1996 $
Author:
Thomas Weber

Constructor Summary
SingleFileSystemProvider()
          Constructs a new SingleFileSystemProvider.
 
Method Summary
 void createNewFile(VirtualFile file)
          creates a new file in the file system.
 boolean delete(java.net.URI f)
          deletes the file at the given URI.
 boolean delete(VirtualFile f)
          deletes the given VirtualFile.
 boolean distribute(VirtualFile f)
          distributes the VirtualFile.
 long getFileSize(VirtualFile file)
          returns the size of the file.
 java.net.URI getHttpBasePath()
          access to the HTTP base path.
 java.lang.String getHttpBasePathString()
          returns the HTTP base path as an ASCII string.
 java.io.InputStream getInputStream(VirtualFile f)
          provides an InputStream to read from the given VirtualFile.
 java.io.OutputStream getOutputStream(VirtualFile f)
          provides an OutputStream to write to the given VirtualFile.
 void init(org.jdom.Element conf)
          initialises the provider.
 boolean mkdir(VirtualFile dir)
          creates a new directory in the underlying file system.
 java.net.URI resolveHTTPPath(VirtualFile f)
          resolves the HTTP path to the given VirtualFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleFileSystemProvider

public SingleFileSystemProvider()
Constructs a new SingleFileSystemProvider.

Note: The provider has still to be initialised properly by calling init(Element).

Method Detail

resolveHTTPPath

public java.net.URI resolveHTTPPath(VirtualFile f)
resolves the HTTP path to the given VirtualFile.

Specified by:
resolveHTTPPath in interface VFSProvider
Parameters:
f - the VirtualFile to be resolved
Returns:
the URI to the VirtualFile or null, if the VirtualFile is private

getHttpBasePath

public java.net.URI getHttpBasePath()
access to the HTTP base path.

Specified by:
getHttpBasePath in interface VFSProvider
Returns:
the HTTP base path

getHttpBasePathString

public java.lang.String getHttpBasePathString()
returns the HTTP base path as an ASCII string.

Specified by:
getHttpBasePathString in interface VFSProvider
Returns:
the HTTP base path as an ASCII string

delete

public boolean delete(VirtualFile f)
Description copied from interface: VFSProvider
deletes the given VirtualFile.

Specified by:
delete in interface VFSProvider
Parameters:
f - the VirtualFile to delete
Returns:
true, if the VirtualFile has been deleted; otherwise false
See Also:
VFSProvider.delete(org.torweg.pulse.vfs.VirtualFile)

delete

public boolean delete(java.net.URI f)
deletes the file at the given URI. Is used during to move process.

Specified by:
delete in interface VFSProvider
Parameters:
f - the URI
Returns:
true, if the file could be deleted on the underlying file system or if no such file exists. Otherwise false.

createNewFile

public void createNewFile(VirtualFile file)
                   throws java.io.IOException
creates a new file in the file system.

Specified by:
createNewFile in interface VFSProvider
Parameters:
file - the file to create
Throws:
java.io.IOException - on errors creating the file
See Also:
VFSProvider.createNewFile(org.torweg.pulse.vfs.VirtualFile)

mkdir

public boolean mkdir(VirtualFile dir)
creates a new directory in the underlying file system.

Specified by:
mkdir in interface VFSProvider
Parameters:
dir - the directory to be created
Returns:
true, if and only if the directory has been created. Otherwise false.
See Also:
VFSProvider.mkdir(org.torweg.pulse.vfs.VirtualFile)

distribute

public boolean distribute(VirtualFile f)
Description copied from interface: VFSProvider
distributes the VirtualFile.

Specified by:
distribute in interface VFSProvider
Parameters:
f - the VirtualFile to be distributed
Returns:
true, if the VirtualFile has been distributed; otherwise false
See Also:
VFSProvider.distribute(org.torweg.pulse.vfs.VirtualFile)

getInputStream

public java.io.InputStream getInputStream(VirtualFile f)
                                   throws java.io.IOException
Description copied from interface: VFSProvider
provides an InputStream to read from the given VirtualFile.

Specified by:
getInputStream in interface VFSProvider
Parameters:
f - the VirtualFile to be read from
Returns:
an InputStream to read from the given VirtualFile
Throws:
java.io.IOException - on errors aquiring the InputStream
See Also:
VFSProvider.getInputStream(org.torweg.pulse.vfs.VirtualFile)

getOutputStream

public java.io.OutputStream getOutputStream(VirtualFile f)
                                     throws java.io.IOException
Description copied from interface: VFSProvider
provides an OutputStream to write to the given VirtualFile.

Specified by:
getOutputStream in interface VFSProvider
Parameters:
f - the VirtualFile to be read from
Returns:
an OutputStream to read from the given VirtualFile
Throws:
java.io.IOException - on errors aquiring the OutputStream
See Also:
VFSProvider.getOutputStream(org.torweg.pulse.vfs.VirtualFile)

getFileSize

public long getFileSize(VirtualFile file)
returns the size of the file.

Specified by:
getFileSize in interface VFSProvider
Parameters:
file - the VirtualFile
Returns:
the size of the file

init

public void init(org.jdom.Element conf)
initialises the provider.

Specified by:
init in interface VFSProvider
Parameters:
conf - the configuration element for the provider