The workspace analog of file system files and directories. There are exactly four
types of resource: files, folders, projects and the workspace root.
File resources are similar to files in that they hold data directly. Folder resources are analogous to directories in that they hold other resources but cannot directly hold data. Project resources group files and folders into reusable clusters. The workspace root is the top level resource under which all others reside.
Features of resources:
IResource
objects are handles to state maintained by a workspace. That is, resource objects do not actually contain data themselves but rather represent resource state and give it behavior. Programmers are free to manipulate handles for resources that do not exist in a workspace but must keep in mind that some methods and operations require that an actual resource be available. - Resources have two different kinds of properties as detailed below. All properties are keyed by qualified names.
- Session properties: Session properties live for the lifetime of one execution of the workspace. They are not stored on disk. They can carry arbitrary object values. Clients should be aware that these values are kept in memory at all times and, as such, the values should not be large.
- Persistent properties: Persistent properties have string values which are stored on disk across platform sessions. The value of a persistent property is a string which should be short (i.e., under 2KB).
- Resources are identified by type and by their path, which is similar to a file system path. The name of a resource is the last segment of its path. A resource's parent is located by removing the last segment (the resource's name) from the resource's full path.
- Resources can be local or non-local. A non-local resource is one whose contents and properties have not been fetched from a repository.
- Phantom resources represent incoming additions or outgoing deletions which have yet to be reconciled with a synchronization partner.
This interface is not intended to be implemented by clients.
Resources implement the IAdaptable
interface; extensions are managed by the platform's adapter manager.
@see IWorkspace
@see Platform#getAdapterManager()