com.borland.primetime.vfs
Class NewFilesystem

java.lang.Object
  |
  +--com.borland.primetime.vfs.AbstractFilesystem
        |
        +--com.borland.primetime.vfs.NewFilesystem

public class NewFilesystem
extends AbstractFilesystem
implements Filesystem

The NewFilesystem provides an artificial Url source for new files. No actual information can be read from or written to the new filesystem, though it will allow any Url with a "new" protocol to be 'read' as a zero-length file.

New files are typically generated using the new filesystem by requesting a node via Project.getNewProject or Project.getNewFileNode until the file is actually saved, at which time a real name should be chosen and the contents copied to a buffer representing real physical storage.

See Also:
Project

Field Summary
static NewFilesystem FILESYSTEM
           
static java.lang.String PROTOCOL
           
 
Fields inherited from interface com.borland.primetime.vfs.Filesystem
TYPE_BOTH, TYPE_DIRECTORY, TYPE_FILE
 
Method Summary
 void delete(Url url)
          Nothing actually exists in a new filesystem, so delete attempts are ignored.
 boolean exists(Url url)
          Nothing actually exists in a new filesystem.
 Url getCanonicalUrl(Url url)
          The canonical Url in the new filesystem is always identical to the specified Url.
 Url[] getChildren(Url url, RegularExpression[] patterns, int type)
          Nothing actually exists in a new filesystem.
 java.io.InputStream getInputStream(Url url)
          Always fails since the filesystem doesn't actually contain any files.
 long getLastModified(Url url)
          No entry in a new filesystem really exists, so all entries are described as having never been modified.
 java.lang.String getName(Url url)
          Returns a short name for the Url enclosed in angle braces to indiciate that it represents temporary storage.
 java.io.OutputStream getOutputStream(Url url, boolean makeBackup)
          Always fails since files created from the new filesystem are designed to be redirected to a real filesystem before being written.
 java.lang.String getProtocol()
          Returns the name of the new filesystem protocol.
static void initOpenTool(byte majorVersion, byte minorVersion)
          OpenTool initialization
 boolean isDirectory(Url url)
          No entries in a new filesystem represent containers.
 boolean isReadOnly(Url url)
          All entries that come from a new filesystem are read/write, though they are designed to be saved elsewhere.
 
Methods inherited from class com.borland.primetime.vfs.AbstractFilesystem
fileEquals, fileHashCode, getAbsoluteUrl, getChild, getFileObject, getParent, getRelativePath, getRelativeUrl, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL

public static final java.lang.String PROTOCOL

FILESYSTEM

public static final NewFilesystem FILESYSTEM
Method Detail

initOpenTool

public static void initOpenTool(byte majorVersion,
                                byte minorVersion)
OpenTool initialization

getProtocol

public java.lang.String getProtocol()
Returns the name of the new filesystem protocol.
Specified by:
getProtocol in interface Filesystem
Returns:
The value of NewFilesystem.PROTOCOL.

getInputStream

public java.io.InputStream getInputStream(Url url)
                                   throws java.io.FileNotFoundException
Always fails since the filesystem doesn't actually contain any files.
Specified by:
getInputStream in interface Filesystem
Parameters:
url - The resource to be read.
Returns:
This method never returns.
Throws:
java.io.FileNotFoundException - Always.

getOutputStream

public java.io.OutputStream getOutputStream(Url url,
                                            boolean makeBackup)
                                     throws java.io.IOException
Always fails since files created from the new filesystem are designed to be redirected to a real filesystem before being written.
Specified by:
getOutputStream in interface Filesystem
Parameters:
url - Ignored.
makeBackup - Ignored.
Returns:
This method never returns.
Throws:
java.io.IOException - Always.

isReadOnly

public boolean isReadOnly(Url url)
All entries that come from a new filesystem are read/write, though they are designed to be saved elsewhere. If the new filesystem described files as read-only, new file buffers could not be edited!
Specified by:
isReadOnly in interface Filesystem
Parameters:
url - Ignored.
Returns:
True.

getLastModified

public long getLastModified(Url url)
No entry in a new filesystem really exists, so all entries are described as having never been modified.
Specified by:
getLastModified in interface Filesystem
Parameters:
url - Ignored.
Returns:
Buffer.MODIFIED_NEVER.

getCanonicalUrl

public Url getCanonicalUrl(Url url)
The canonical Url in the new filesystem is always identical to the specified Url.
Specified by:
getCanonicalUrl in interface Filesystem
Overrides:
getCanonicalUrl in class AbstractFilesystem
Parameters:
url - The new resource.
Returns:
The new resource, unchanged.

exists

public boolean exists(Url url)
Nothing actually exists in a new filesystem.
Specified by:
exists in interface Filesystem
Parameters:
url - Ignored.
Returns:
False.

delete

public void delete(Url url)
Nothing actually exists in a new filesystem, so delete attempts are ignored.
Specified by:
delete in interface Filesystem
Parameters:
url - Ignored.

isDirectory

public boolean isDirectory(Url url)
No entries in a new filesystem represent containers.
Specified by:
isDirectory in interface Filesystem
Parameters:
url - Ignored.
Returns:
False.

getChildren

public Url[] getChildren(Url url,
                         RegularExpression[] patterns,
                         int type)
Nothing actually exists in a new filesystem.
Specified by:
getChildren in interface Filesystem
Parameters:
url - Ignored.
pattern - Ignored.
type - Ignored.
Returns:
The empty Url array.

getName

public java.lang.String getName(Url url)
Returns a short name for the Url enclosed in angle braces to indiciate that it represents temporary storage.
Specified by:
getName in interface Filesystem
Overrides:
getName in class AbstractFilesystem
Returns:
The last subpath in the file portion of the Url.