-
Notifications
You must be signed in to change notification settings - Fork 92
FileSystemProvider
Table of Contents
In v3 of Zowe Explorer, we have made an architectural shift from using temporary, on-disk files to using the FileSystemProvider
interface provided by VS Code. Starting with v3, the three "core" tree views in Zowe Explorer will use implementations of the FileSystemProvider
to encapsulate remote operations (reading/writing, renaming, deleting, etc.):
Tree view | FileSystemProvider implementation |
---|---|
Data Sets | DatasetFSProvider |
Jobs | JobsFSProvider |
Unix System Services (USS) | UssFSProvider |
We will no longer write files to the temporary, on-disk directory that was created for previous versions.
We have also exposed a BaseProvider
class in Zowe Explorer API to help extenders create their own FileSystemProvider
implementations if needed.
However, the implementations above are not directly accessible through Zowe Explorer API. Extenders should use the vscode.workspace.fs
façade to access information instead.
The FileSystemProvider
interface largely operates on the concept of resource URIs. Our FileSystemProvider implementations leverage these URIs to build a path structure for the providers to operate. Note that each segment is important when building correct URIs for Zowe Explorer resources.
All core resource URIs for Zowe Explorer use this general structure:
zowe-*:/<Profile Name (LPAR)>/<Resource Path>
Where zowe-*
is a scheme that starts with the zowe-
prefix. The core schemes are exposed in Zowe Explorer API as the ZoweScheme
enum and are defined as the following:
- Data Sets:
zowe-ds
- Jobs:
zowe-jobs
- USS:
zowe-uss
Data Set URIs
For a sequential data set named FRUIT.CHKLIST
on the food.zosmf
LPAR, the URI would read as follows:
zowe-ds:/food.zosmf/FRUIT.CHKLIST
Partitioned data sets are interpreted as directories in the FileSystemProvider, and members are entries inside the directory.
For example, to represent the member APPLE
in PDS FRUIT.BASKET
on the food.zosmf
LPAR, the URI would be:
zowe-ds:/food.zosmf/FRUIT.BASKET/APPLE
USS URIs
USS URIs use the format zowe-uss:/<Profile Name (LPAR)>/<USS Path>
to represent files or folders.
A file at path /u/users/fruit/apple.txt
on the food.zosmf
LPAR would look like this:
zowe-uss:/food.zosmf/u/users/fruit/apple.txt
It's parent folder, /u/users/fruit/
would look like this:
zowe-uss:/food.zosmf/u/users/fruit/
Job URIs
Job URIs use the format zowe-jobs:/<Profile Name (LPAR)>/<Job ID>/
. Spool URIs use the format zowe-jobs:/<Profile Name (LPAR)>/<Job ID>/<Unique Spool ID>
.
Extenders can leverage the buildUniqueSpoolName
function in Zowe Explorer API to help build spool URIs.
The Job ID
segment matches the jobid
parameter on the IJobFile
object.
When instantiating a VS Code TreeItem
, each item can be paired with a resourceUri
to establish a relationship between the URI and the tree node.
We recommend that extenders pair their URIs alongside their tree nodes so the resource is easily accessible and so that updates to the URI are reflected in the tree view (such as when a URI is deleted from a provider).
Please note that all of these operations assume that the given resource URI exists in the FileSystemProvider. If the resource does not exist, an exception may be thrown - these should be caught and handled by your extension as needed.
To retrieve statistics for a resource URI, use the vscode.workspace.fs.stat
function.
- Returns a
FileStat
object containing metadata about the URI, such as its type, size, and timestamps.- For USS files and Data Sets, this also contains e-tag and encoding information
- For Jobs, this contains the
IJob
orIJobFile
object depending on the resource (job or spool)
To list the contents of a USS directory, PDS, or job specified by a given URI, use the vscode.workspace.fs.readDirectory
function.
- Returns an array of tuples, where each tuple represents a child entry in the directory.
- For Jobs, use this to return a list of spool files under a given job URI
- For USS files, use this to a list of files and folders at the given path.
- For Data Sets, use this to get the members for a given PDS.
To read the contents of a spool file, data set or USS file, use the vscode.workspace.fs.readFile
function.
- Returns a
Uint8Array
with the contents of the resource.
zowe/vscode-extension-for-zowe
Welcome
Using Zowe Explorer
Roadmaps
Development Process
Testing process
Release Process
Backlog Grooming Process
How to Extend Zowe Explorer
- Extending Zowe Explorer
- Error Handling for Extenders
- Secure Credentials for Extenders
- Sample Extender Repositories
Conformance Criteria
Early Access