Interface FileSystemSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface FileSystemSession extends OsidSession

This session defines methods for examining file systems. A FileSystemSession is associated with a directory that, unlike other catalogs, behaves as the current directory path for supplying relative path names. Absolute path names can be supplied to access any file or directory in the file system.

This session defines the following views:

  • comparative view: elements may be silently omitted or re-ordered
  • plenary view: provides a complete result set or is an error condition
  • federated directory view: searches include entries in directories of which this directory is an ancestor
  • isolated directory view: lookups are restricted to entries in this directory only

Generally, the comparative view should be used for most applications as it permits operation even if there is data out of sync. Some administrative applications may need to know whether it had retrieved an entire set of objects and may sacrifice some interoperability for the sake of precision using the plenary view.

  • Method Details

    • getDirectoryId

      Id getDirectoryId()
      Gets the Id of this directory.
      Returns:
      the Id of this directory
      Compliance:
      mandatory - This method must be implemented.
    • getDirectory

      Gets the directory associated with this session.
      Returns:
      the directory associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canLookupDirectoryEntries

      boolean canLookupDirectoryEntries()
      Tests if this user can perform entry lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer lookup operations.
      Returns:
      false if lookup methods are not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • hasParentDirectory

      boolean hasParentDirectory()
      Tests if the directory associated with this session has a parent directory.
      Returns:
      true if a parent exists, false otherwise
      Compliance:
      mandatory - This method is must be implemented.
    • getParentDirectory

      Gets the parent of the directory associated with this session.
      Returns:
      the parent of the directory associated with this session
      Throws:
      IllegalStateException - hasParentDirectory() is false
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • useComparativeDirectoryView

      void useComparativeDirectoryView()
      The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.
      Compliance:
      mandatory - This method is must be implemented.
    • usePlenaryDirectoryView

      void usePlenaryDirectoryView()
      A complete view of the file or directory returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.
      Compliance:
      mandatory - This method is must be implemented.
    • useFederatedDirectoryView

      void useFederatedDirectoryView()
      Federates the view for methods in this session. A federated view will include entries in directories which are children of this directory.
      Compliance:
      mandatory - This method is must be implemented.
    • useIsolatedDirectoryView

      void useIsolatedDirectoryView()
      Isolates the view for methods in this session. An isolated view restricts lookups to this directory only.
      Compliance:
      mandatory - This method is must be implemented.
    • exists

      Tests if a file, directory or alias name exists. In a federated view, the existence test is performed on this directory and any children of this directory. In an isolated view, the existence test is restrcited to this directory only.
      Parameters:
      name - a file or directory name
      Returns:
      true if the name exists, false otherwise
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method is must be implemented.
    • isFile

      Tests if a name exists and is a file or an alias to a file. In a federated view, the exietence test is performed on this directory and any children of this directory. In an isolated view, the existence test is restrcited to this directory only.
      Parameters:
      name - a file name
      Returns:
      true if the name is a file, false otherwise
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method is must be implemented.
    • isDirectory

      boolean isDirectory(String name) throws OperationFailedException, PermissionDeniedException
      Tests if a name exists and is a directory or an alias to a directory. In a federated view, the exietence test is performed on this directory and any children of this directory. In an isolated view, the existence test is restrcited to this directory only.
      Parameters:
      name - a file or directory name
      Returns:
      true if the path is a directory, false otherwise
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method is must be implemented.
    • isAlias

      Tests if a name exists and is an alias. In a federated view, the exietence test is performed on this directory and any children of this directory. In an isolated view, the existence test is restrcited to this directory only.
      Parameters:
      name - a file or directory name
      Returns:
      true if the path is an alias, false otherwise
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method is must be implemented.
    • getFile

      Gets a specified file or alias to the file by its name in the current directory only. For federated views, use getFilesByName() .
      Parameters:
      name - the name to the file
      Returns:
      the file
      Throws:
      NotFoundException - name is not found or is a directory
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • getFilesByName

      Gets a specified files and aliases to files for the given file name. In an isolated view, this method behaves like getFile() . Is a federated view, this method returns a list of files by the same name in descendant directories. In plenary mode, the returned list contains all known files or an error results. Otherwise, the returned list may contain only those files that are accessible through this session.
      Parameters:
      name - the name of the file
      Returns:
      the list of files of the given name
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • getFiles

      Gets the list of files and aliases to files in this directory. In a federated view, this method returns all files in descendant directories. In plenary mode, the returned list contains all known files or an error results. Otherwise, the returned list may contain only those files that are accessible through this session.
      Returns:
      the list of files in this directory
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • getSubdirectory

      Gets a specified directory or alias to the directory by its name in the current directory only. For federated views, use getDirectoriesByName() .
      Parameters:
      name - the name of the directory
      Returns:
      the directory
      Throws:
      NotFoundException - name is not found or is a file
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • getSubdirectoriesByName

      Gets a specified directories and aliases to directories for the given directory name. In an isolated view, this method behaves like getDirectory() . Is a federated view, this method returns a list of directories by the same name in descedent directories. In plenary mode, the returned list contains all known files or an error results. Otherwise, the returned list may contain only those files that are accessible through this session.
      Parameters:
      name - the name of the file
      Returns:
      the list of files of the given name
      Throws:
      NullArgumentException - name is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • getSubdirectories

      Gets the list of directories and aliases to directories in this directory. In a federated view, this method returns all directories in descedent directories. In plenary mode, the returned list contains all known files or an error results. Otherwise, the returned list may contain only those files that are accessible through this session.
      Returns:
      the list of directories in this directory
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.