Interface DirectoryAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates and removes files and directories under the directory associated with this session.
The view of the administrative methods defined in this session is
determined by the provider. For an instance of this session where no path
has been specified, it may not be parallel to the
DirectoryLookupSession . For example, a default
DirectoryLookupSession may view the entire directory hierarchy while the
default DirectoryAdminSession uses an isolated Directory
to create new entries. Another scenario is a federated provider who does
not wish to permit administrative operations for the federation unaware.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanCreateDirectoryWithRecordTypes(Type[] directoryRecordTypes) Tests if this user can create a singleDirectoryusing the desired record types.booleancanCreateFileWithRecordTypes(Type[] fileRecordTypes) Tests if this user can create a singleFileusing the desired record types.booleanTests if this user can create or remove entries in this directory.voidclearDirectory(Id directoryId) Deletes all files and subdirectories within the given directory.createDirectory(DirectoryForm directoryForm) Creates a new directory.createFile(FileForm fileForm) Creates a new file in this directory.voiddeleteDirectory(Id directoryId) Deletes a directory in this directory.voiddeleteFile(Id fileId) Deletes a file.Gets the directory associated with this session.getDirectoryFormForCreate(String name, Type[] directoryRecordTypes) Gets the file form for creating new directories.getDirectoryFormForUpdate(Id directoryId) Gets the directory form for updating an existing files.Gets theIdof this directory.getFileFormForCreate(String name, Type[] fileRecordTypes) Gets the file form for creating new files.getFileFormForUpdate(Id fileId) Gets the file form for updating an existing files.voidOverwrite files if a destination pathname exists and is a file.voidupdateDirectory(DirectoryForm directoryForm) Updates an existing directory.voidupdateFile(FileForm fileForm) Updates an existing file.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.
-
canModifyDirectory
boolean canModifyDirectory()Tests if this user can create or remove entries in this directory. A return of true does not guarantee successful authorization. A return of false indicates that it is known modifying this directory will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseif modifying this directory is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
overwrite
void overwrite()Overwrite files if a destination pathname exists and is a file.- Compliance:
mandatory- This method is must be implemented.
-
canCreateFileWithRecordTypes
Tests if this user can create a singleFileusing the desired record types. WhileFilingManager.getFileRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificFile. Providing an empty array tests if aFilecan be created with no records.- Parameters:
fileRecordTypes- array of file record types- Returns:
trueifFilecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-fileRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getFileFormForCreate
FileForm getFileFormForCreate(String name, Type[] fileRecordTypes) throws AlreadyExistsException, OperationFailedException, PermissionDeniedException Gets the file form for creating new files. A new form should be requested for each create transaction.- Parameters:
name- name of a filefileRecordTypes- array of file record types- Returns:
- the file form
- Throws:
AlreadyExistsException-namealready exists as a file in this direrctory andoverwrite()isfalseInvalidArgumentException-nameis invalidNullArgumentException-nameorfileRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createFile
Creates a new file in this directory.- Parameters:
fileForm- the file form- Returns:
- the new file
- Throws:
IllegalStateException-fileFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-fileFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-fileFormdid not originate fromgetFileFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
getFileFormForUpdate
FileForm getFileFormForUpdate(Id fileId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the file form for updating an existing files. A new file form should be requested for each update transaction.- Parameters:
fileId-Idof the file to update- Returns:
- the file form
- Throws:
NotFoundException-fileIdis not foundNullArgumentException-fileIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateFile
Updates an existing file.- Parameters:
fileForm- the form containing the elements to be updated- Throws:
IllegalStateException-fileFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-fileFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-fileFormdid not originate fromgetFileFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
deleteFile
void deleteFile(Id fileId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes a file.- Parameters:
fileId- theIdof the file to delete- Throws:
NotFoundException-fileIdis not foundNullArgumentException-fileIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateDirectoryWithRecordTypes
Tests if this user can create a singleDirectoryusing the desired record types. WhileFilingManager.getDiectoryRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificDirectory. Providing an empty array tests if aDirectorycan be created with no records.- Parameters:
directoryRecordTypes- array of directory record types- Returns:
trueifDirectorycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-directoryRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getDirectoryFormForCreate
DirectoryForm getDirectoryFormForCreate(String name, Type[] directoryRecordTypes) throws AlreadyExistsException, OperationFailedException, PermissionDeniedException Gets the file form for creating new directories. A new form should be requested for each create transaction. This method is used for creating newDirectorieswhere only theDirectoryTypeis known.- Parameters:
name- the name of a subdirectory in this directorydirectoryRecordTypes- array of directory record types- Returns:
- the directory form
- Throws:
AlreadyExistsException- directory already exists andoverwrite()is falseInvalidArgumentException-nameis invalidNullArgumentException-nameordirectoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createDirectory
Directory createDirectory(DirectoryForm directoryForm) throws OperationFailedException, PermissionDeniedException Creates a new directory.- Parameters:
directoryForm- the directory form- Returns:
- the new directory
- Throws:
IllegalStateException-directoryFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-directoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-directoryFormdid not originate fromgetDirectoryFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
getDirectoryFormForUpdate
DirectoryForm getDirectoryFormForUpdate(Id directoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the directory form for updating an existing files. A new directory form should be requested for each update transaction. This method is used when theDirectoryto be updated is known and is desired to access any metadata specific to theDirectorybeing updated.- Parameters:
directoryId-Idof the directory to update- Returns:
- the directory form
- Throws:
NotFoundException-directoryIdis not foundNullArgumentException-directoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateDirectory
void updateDirectory(DirectoryForm directoryForm) throws OperationFailedException, PermissionDeniedException Updates an existing directory.- Parameters:
directoryForm- the form containing the elements to be updated- Throws:
IllegalStateException-directoryFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-directoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-directoryFormdid not originate fromgetDirectoryFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
deleteDirectory
void deleteDirectory(Id directoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes a directory in this directory. The directory to remove must be empty.- Parameters:
directoryId- theIdof the directory to delete- Throws:
NotFoundException-directoryIdis not foundNullArgumentException-directoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
clearDirectory
void clearDirectory(Id directoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes all files and subdirectories within the given directory.- Parameters:
directoryId- theIdof the directory to delete- Throws:
NotFoundException-directoryIdis not foundNullArgumentException-directoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-