|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a custom file system. This includes information needed by Stylus Studio to create an entry in the button bar in the Open File dialog. In addition, it provides information for connecting to data servers if necessary.
Stylus Studio has a list of known custom file systems. Some are built-in,
while others can be implemented by users.
To implement a custom file system, you must create a class that implements StylusFileSystem
and a class that implements StylusFile
. You then declare thoses classes to Stylus Studio
through the menu:
Tools->Options->Application Settings->Custom File Systems.
For more information, see the Stylus Studio online documention section: Custom File Systems.
Stylus Studio uses custom file systems to read and write files in two contexts:
The File->Open and File->Save As dialogs create one instance of the StylusFileSystem
object
for each custom file system. The StylusFileSystem
object is used to connect to a server
(if applicable), and browse the files available through that custom file system.
The dialog uses the StylusFileSystem
method listRoots() to find the top of the file
system, and the StylusFile
method listFiles() to browse the rest of the directories and files.
As soon as the user dismisses the dialog, all references to all the StylusFileSystem
objects
and StylusFile
objects are deleted, so the StylusFileSystem
and StylusFile
objects are subject
to garbage collection.
Finally, Stylus Studio creates a new StylusFileSystem
object and a new StylusFile
object, and it
uses them to read the data from
or to write the data to the selected file.
A non-interactive read or write is the same as the last step of an interactive operation.
Stylus Studio creates a StylusFileSystem
object and a StylusFile
object and uses them to read or write
the data.
StylusFileSystem File Naming Conventions
Stylus Studio
accesses all external files using a URL:
scheme://server/pathname
getURLForPathName(String path)
, which
should return the complete URL: scheme://server/pathname.
Method Summary | |
void |
buildDirectoryStructure(String path)
Create a hierarchy of directories as specified by the parameter path. |
boolean |
canChangeServers()
|
boolean |
canCreateDirectories()
Check whether this custom file system can create directories. |
boolean |
connectServer(String bindString)
|
boolean |
disconnectServer()
|
boolean |
exists(String path)
Check whether a file exists. |
String |
getCurrentDirectory()
Retrieve the name of the last directory the user visited in a File->Open or File->Save As dialog. |
String |
getFileClassName()
Get the class name of the StylusFile class for this file system. |
String |
getName()
Get the name of this custom file system. |
String |
getScheme()
Return the character string scheme name that this file system supports. |
String |
getSeparator()
Get the separator character used to separate element names in a pathname. |
String |
getServerName()
|
String |
getURLForPathName(String path)
Return the complete URL scheme://server/pathname. |
int |
getVersion()
Get the current version number of this custom file system. |
boolean |
isAbsolute(String path)
Check whether a pathname is an absolute or relative pathname. |
boolean |
isDirectory(String path)
Check whether a file is a directory. |
boolean |
isPathValid(String path)
Check whether a pathname is a valid pathname. |
StylusFile[] |
listRoots()
List all the roots of the file system. |
boolean |
matchesScheme(String scheme)
Check whether this StylusFileSystem can process URLs with the
specified scheme. |
boolean |
mkdir(String path)
Create a new directory in the file system. |
boolean |
renameTo(String oldPath,
String newPath)
Rename an existing directory in the file system. |
String |
resolveShortcuts(String path)
Return the target pathname of a shortcut or link. |
void |
setCurrentDirectory(String path)
Store the name of the last directory the user visited in a File->Open or File->Save As dialog. |
boolean |
supportsDirectories()
Check whether this custom file system is modeled as a tree or is flat. |
boolean |
supportServer()
|
Method Detail |
public boolean connectServer(String bindString)
public boolean disconnectServer()
public String getServerName()
public boolean matchesScheme(String scheme)
StylusFileSystem
can process URLs with the
specified scheme.
scheme
- A URL scheme name.
true
if this StylusFileSystem
can serve the parameter scheme name.public boolean exists(String path)
path
- The pathname to be checked.false
.
true
if the file exists.public boolean isDirectory(String path)
path
- The pathname to be checked.
true
if the file is a directory.public boolean isAbsolute(String path)
path
- The pathname to be checked.
true
if the pathname is an absolute pathname.public boolean isPathValid(String path)
path
- The pathname to be checked.
true
if the pathname is valid.public StylusFile[] listRoots()
StylusFile
objects, one for each root node.public String getScheme()
public boolean supportServer()
public boolean canChangeServers()
public boolean canCreateDirectories()
true
if the user should be allowed to create directories.mkdir(String)
,
buildDirectoryStructure(String)
public boolean supportsDirectories()
true
if the file system does have directories.public int getVersion()
public String getSeparator()
public String getName()
public String getFileClassName()
StylusFile
class for this file system.
When you use the Tools->Options menu to register a custom file system,
you register the name of the class that implements the StylusFileSystem
interface. Stylus Studio then
uses the getFileClassName method to get the name of the class that
implements the StylusFile
interface.
StylusFile
interface.public void setCurrentDirectory(String path)
StylusFileSystem
object making it unreachable, so all
non-static member variables will be lost. setCurrentDirectory should, therefore,
save this pathname in a static member variable.
path
- The pathname of the last directory visited by the dialog.getCurrentDirectory()
public String getCurrentDirectory()
setCurrentDirectory(String)
public boolean mkdir(String path)
path
- The pathname of the directory to be created.
true
if the mkdir succeeded, false if it failed.renameTo(String, String)
,
buildDirectoryStructure(String)
public boolean renameTo(String oldPath, String newPath)
oldPath
- The current name of the directory to be renamed.newPath
- The desired new name of the directory.
true
if the rename succeeded, false if it failed.mkdir(String)
,
buildDirectoryStructure(String)
public void buildDirectoryStructure(String path)
renameTo(String, String)
,
mkdir(String)
public String resolveShortcuts(String path)
path
- The shortcut or link file pathname.
public String getURLForPathName(String path)
path
- The pathname to be converted to a URL.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |