ch.tatool.app.service.impl
Class UserAccountServiceImpl

java.lang.Object
  extended by ch.tatool.app.service.impl.UserAccountServiceImpl
All Implemented Interfaces:
UserAccountService

public class UserAccountServiceImpl
extends Object
implements UserAccountService

Implementation of the user account service. Each user account is backed by a database

Author:
Michael Ruflin

Constructor Summary
UserAccountServiceImpl()
           
 
Method Summary
 void changePassword(UserAccount account, String newPassword)
          Change the password for an account.
 void closeAccount(UserAccount account)
          Closes an opened account.
 UserAccount createAccount(String accountName, Map<String,String> userProperties, String password)
          Create a new account folder.
 void deleteAccount(UserAccount account)
          Delete a module.
 List<UserAccount.Info> getAccounts()
          Get all available module instances.
 String getDataDirName()
           
 Messages getMessages()
           
 File getTatoolDataFolder()
          Get the Tatool data folder.
 boolean isRelativeToHome()
           
 UserAccount loadAccount(UserAccount.Info info, String password)
          Opens an account data object.
 void saveAccount(UserAccount account)
          Saves an account.
 void setDataDirName(String dataDirName)
           
 void setMessages(Messages messages)
           
 void setRelativeToHome(boolean relativeToHome)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAccountServiceImpl

public UserAccountServiceImpl()
Method Detail

createAccount

public UserAccount createAccount(String accountName,
                                 Map<String,String> userProperties,
                                 String password)
Create a new account folder.

Specified by:
createAccount in interface UserAccountService
Parameters:
userProperties - the properties of the user account
password - a password if the user account should be password protected

loadAccount

public UserAccount loadAccount(UserAccount.Info info,
                               String password)
Opens an account data object. The account object is backed by the database. The password is conveniently used as database password, which would fail in case of incorrect password.

Specified by:
loadAccount in interface UserAccountService
Parameters:
info - the info object for this account
password - the password if required - or null if not
Returns:
A UserAccount object

saveAccount

public void saveAccount(UserAccount account)
Saves an account.

Specified by:
saveAccount in interface UserAccountService

closeAccount

public void closeAccount(UserAccount account)
Closes an opened account. This method should free all opened resources. Note: This method does NOT save the account data!

Specified by:
closeAccount in interface UserAccountService

changePassword

public void changePassword(UserAccount account,
                           String newPassword)
Change the password for an account.

Specified by:
changePassword in interface UserAccountService

deleteAccount

public void deleteAccount(UserAccount account)
Delete a module. This method should completely remove all module related data from the system.

Specified by:
deleteAccount in interface UserAccountService

getAccounts

public List<UserAccount.Info> getAccounts()
Get all available module instances.

Specified by:
getAccounts in interface UserAccountService

getTatoolDataFolder

public File getTatoolDataFolder()
Get the Tatool data folder. Note: The folder is created if it does not yet exist.

Returns:
the folder

getDataDirName

public String getDataDirName()

setDataDirName

public void setDataDirName(String dataDirName)

isRelativeToHome

public boolean isRelativeToHome()

setRelativeToHome

public void setRelativeToHome(boolean relativeToHome)

setMessages

public void setMessages(Messages messages)

getMessages

public Messages getMessages()


Copyright © 2012. All Rights Reserved.