uk.org.ogsadai.dataresource
Interface FileAccessProvider

All Known Implementing Classes:
FilesDataResourceAccessor

public interface FileAccessProvider

Interface providing an authorization layer to control access to a file system data resource.

Author:
The OGSA-DAI Project Team

Method Summary
 boolean canReadFile(java.lang.String userCredential, java.io.File file)
          Determines whether the user is allowed to read the specified file or directory.
 boolean canWriteFile(java.lang.String userCredential, java.io.File file)
          Determines whether the user is allowed to write the specified file or directory.
 java.io.File getHomeDirectory(java.lang.String userCredential)
          Gets the file data resource directory for a specified user.
 void validateReadFile(java.lang.String userCredential, java.io.File file)
          Determines whether the user is allowed to read the specified file or directory.
 void validateWriteFile(java.lang.String userCredential, java.io.File file)
          Determines whether the user is allowed to write the specified file or directory.
 

Method Detail

getHomeDirectory

public java.io.File getHomeDirectory(java.lang.String userCredential)
                              throws DataResourceAuthorizationException,
                                     FilesResourceUseException,
                                     AuthorizationExecutionException
Gets the file data resource directory for a specified user. This may be the root file data resource directory or a sub-directory depending upon how authorisation and access has been configured.

Parameters:
userCredential - Credentials specifying a user.
Returns:
the directory of the specified user.
Throws:
DataResourceAuthorizationException - if the user is not permitted any access to any part of the file data resource.
FilesResourceUseException - if there is a problem in using the resource.
AuthorizationExecutionException - if there is a problem when authorizing the request.

canReadFile

public boolean canReadFile(java.lang.String userCredential,
                           java.io.File file)
                    throws FilesResourceUseException
Determines whether the user is allowed to read the specified file or directory.

Parameters:
userCredential - Credentials of the specified user.
file - File or directory. The file need not currently exist.
Returns:
true if the user may attempt to read this file or directory, false otherwise.
Throws:
FilesResourceUseException - if there is a problem in using the resource.

validateReadFile

public void validateReadFile(java.lang.String userCredential,
                             java.io.File file)
                      throws DataResourceAuthorizationException,
                             FilesResourceUseException,
                             AuthorizationExecutionException
Determines whether the user is allowed to read the specified file or directory.

Parameters:
userCredential - Credentials of the specified user.
file - File or directory. The file need not currently exist.
Throws:
DataResourceAuthorizationException - if the user is not permitted any access to any part of the file data resource.
FilesResourceUseException - if there is a problem in using the resource.
AuthorizationExecutionException - if there is a problem when authorizing the request.

canWriteFile

public boolean canWriteFile(java.lang.String userCredential,
                            java.io.File file)
                     throws FilesResourceUseException
Determines whether the user is allowed to write the specified file or directory.

Parameters:
userCredential - Credentials of the specified user.
file - File or directory. The file need not currently exist.
Returns:
true if the user may attempt to write this file or directory, false otherwise.
Throws:
FilesResourceUseException - if there is a problem in using the resource.

validateWriteFile

public void validateWriteFile(java.lang.String userCredential,
                              java.io.File file)
                       throws DataResourceAuthorizationException,
                              FilesResourceUseException,
                              AuthorizationExecutionException
Determines whether the user is allowed to write the specified file or directory.

Parameters:
userCredential - Credentials of the specified user.
file - File or directory. The file need not currently exist.
Throws:
DataResourceAuthorizationException - if the user is not permitted any access to any part of the file data resource.
FilesResourceUseException - if there is a problem in using the resource.
AuthorizationExecutionException - if there is a problem when authorizing the request.