Interface DBTransaction


public interface DBTransaction

Database Transaction Inteface between Server and Database

Category: Baseline

Inherits from:

Client:


Method Summary
 int ChangePassword(java.lang.String UserId, java.lang.String OldPassword, java.lang.String NewPassword)
          Change the password of the given user.
 int ChangePermission(int FileID, int PermissionType, int NewPermission)
          Allows changing the permissions for the given user.
 int CreateUser(java.lang.String UserName, java.lang.String Password)
          Creates a new user in the database.
 boolean GetSubtree(FileInfo fileInfo, int dirId, int userId)
          Gets the contents of the directory mentioned.
 int LoginUser(java.lang.String UserName, java.lang.String Password)
          Log information of the user login in the database.
 int LogoutUser(int UserId)
          Gives a clean exit to the client and passed necessary information to end the session to the database.
 boolean RenameFile(java.lang.String oldName, java.lang.String newName, int currentDirId, int userId)
          Renames the given file with the new filename.
 

Method Detail

LoginUser

public int LoginUser(java.lang.String UserName,
                     java.lang.String Password)
Log information of the user login in the database. [Category: Baseline] [Clients: ]

Parameters:
UserName - the name of a user logging in
Password - the password of the user logging in.
Returns:
status Status of the current operation
Throws:
InvalidName - if UserName does not exist in the database
InvalidPassword - if Password is not valid
DBConnectionLost - if database connection is lost

LogoutUser

public int LogoutUser(int UserId)
Gives a clean exit to the client and passed necessary information to end the session to the database. [Category: Baseline] [Clients: ]

Parameters:
UserId - the name of a user logging in
Returns:
status Status of the current operation
Throws:
InvalidId - if UserId does not exist in the database
NotLoggedIn - if the user is not logged in
DBConnectionLost - if database connection is lost

CreateUser

public int CreateUser(java.lang.String UserName,
                      java.lang.String Password)
Creates a new user in the database. [Category: Baseline] [Clients: ]

Parameters:
UserName - the name of a user to be created
Password - the password of a user to be created
Returns:
status Status of the current operation
Throws:
InvalidUserName - if UserName is not a valid name (invalid chars etc.)
UserAlreadyExits - if UserName already exists
InvalidPasssssword - if Password is invalid (too short)
DBConnectionLost - if database connection is lost

ChangePassword

public int ChangePassword(java.lang.String UserId,
                          java.lang.String OldPassword,
                          java.lang.String NewPassword)
Change the password of the given user. [Category: Baseline] [Clients: ]

Parameters:
UserId - The Id of a user whose password has been changed
OldPassword - The old password of a user
NewPassword - The new password of a user
Returns:
status Status of the current operation
Throws:
InvalidUserId - if UserId does not exist
InvalidOldPassword - if OldPassword is invalid.
InvalidNewPassword - if Password is invalid (too short)
DBConnectionLost - if database connection is lost

ChangePermission

public int ChangePermission(int FileID,
                            int PermissionType,
                            int NewPermission)
Allows changing the permissions for the given user. [Category: Baseline] [Clients: ]

Parameters:
PermissionType - The permission (read, write, execute) to be changed.
NewPermission - The new permission
Returns:
status Status of the current operation
Throws:
InvalidFileId - If FileID is invalid
InsufficentPermisions - if user does not have enough permissions for the operations
DBConnectionLost - if database connection is lost

GetSubtree

public boolean GetSubtree(FileInfo fileInfo,
                          int dirId,
                          int userId)
Gets the contents of the directory mentioned. For example, a server bring only 20 entries of file informations from the database. [Category: Baseline] [Clients: ]

Parameters:
fileInfo - an object which contains the file list and the indentification of parent directory.
dirId - the identification number of the target directory
userId - the identification number of the user
Returns:
true if the transaction is completed.
Throws:
InvalidDirectory - if dirId does not exists in the database
PermissionDenied - if a user has no permission on the directory
ConnectionFail - if database connection is closed in transaction

RenameFile

public boolean RenameFile(java.lang.String oldName,
                          java.lang.String newName,
                          int currentDirId,
                          int userId)
Renames the given file with the new filename. [Category: Baseline] [Clients: ]

Parameters:
oldName - the name of a file which is to be changed
newName - the changed name of the file
currentDirId - the identification number of a current directory
userId - the identification number of the user
Returns:
true if the transaction is completed
Throws:
NoSuchFile - if oldName does not exists in the database
InvalidFileName - if newName is not valid
NoCurrentDir - if currentDirId does not exists in the database
ConnectionFail - if database connection is closed in transaction