Interface FileSystemSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, 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 Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can perform entry lookups.booleanTests if a file, directory or alias name exists.Gets the directory associated with this session.Gets theIdof this directory.Gets a specified file or alias to the file by its name in the current directory only.getFiles()Gets the list of files and aliases to files in this directory.getFilesByName(String name) Gets a specified files and aliases to files for the given file name.Gets the parent of the directory associated with this session.Gets the list of directories and aliases to directories in this directory.Gets a specified directories and aliases to directories for the given directory name.getSubdirectory(String name) Gets a specified directory or alias to the directory by its name in the current directory only.booleanTests if the directory associated with this session has a parent directory.booleanTests if a name exists and is an alias.booleanisDirectory(String name) Tests if a name exists and is a directory or an alias to a directory.booleanTests if a name exists and is a file or an alias to a file.voidThe returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidFederates the view for methods in this session.voidIsolates the view for methods in this session.voidA complete view of the file or directory returns is desired.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getDirectoryId
Id getDirectoryId()Gets theIdof this directory.- Returns:
- the
Idof 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 requestPermissionDeniedException- 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 aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.- Returns:
falseif lookup methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
hasParentDirectory
boolean hasParentDirectory()Tests if the directory associated with this session has a parent directory.- Returns:
trueif a parent exists,falseotherwise- 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()isfalseOperationFailedException- unable to complete requestPermissionDeniedException- 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:
trueif the name exists,falseotherwise- Throws:
NullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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:
trueif the name is a file,falseotherwise- Throws:
NullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method is must be implemented.
-
isDirectory
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:
trueif the path is a directory,falseotherwise- Throws:
NullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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:
trueif the path is an alias,falseotherwise- Throws:
NullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method is must be implemented.
-
getFile
File getFile(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a specified file or alias to the file by its name in the current directory only. For federated views, usegetFilesByName().- Parameters:
name- the name to the file- Returns:
- the file
- Throws:
NotFoundException-nameis not found or is a directoryNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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 likegetFile(). 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-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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 requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getSubdirectory
Directory getSubdirectory(String name) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a specified directory or alias to the directory by its name in the current directory only. For federated views, usegetDirectoriesByName().- Parameters:
name- the name of the directory- Returns:
- the directory
- Throws:
NotFoundException-nameis not found or is a fileNullArgumentException-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getSubdirectoriesByName
DirectoryList getSubdirectoriesByName(String name) throws OperationFailedException, PermissionDeniedException Gets a specified directories and aliases to directories for the given directory name. In an isolated view, this method behaves likegetDirectory(). 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-nameisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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 requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-