se.datadosen.jalbum
Class AccountManager

java.lang.Object
  extended by se.datadosen.jalbum.AccountManager

public class AccountManager
extends java.lang.Object

Manager class for FTP accounts.

Since:
8.0

Nested Class Summary
static class AccountManager.AccountStatus
           
 
Method Summary
 void addAccount(AccountProfile newAccount)
          Add a new FTP account to the list.
 void addAccountManagerListener(AccountManagerListener l)
           
 AccountProfile findAccountByName(java.lang.String name)
           
 AccountProfile findCurrentAccount(AlbumBean engine)
           
 AccountProfile findJAlbumAccountByUserName(java.lang.String userName)
           
protected  void fireAccountListUpdated()
           
 javax.swing.DefaultListModel getAccounts()
           
static java.lang.String getCid(AccountProfile account)
           
static java.lang.String getCid(java.lang.String userName, java.lang.String password)
           
 AccountProfile getFirstMyjalbumAccount()
          Iterate through the list of accounts and find the first available myjalbum account.
static AccountManager getInstance()
           
static AccountManager.AccountStatus getJalbumAccountQuota(java.lang.String username, java.lang.String password)
           
static AccountManager.AccountStatus getJalbumAccountStatus(AccountProfile profile)
           
static AccountManager.AccountStatus getJalbumAccountStatus(java.lang.String username, java.lang.String password)
           
 boolean hasAccounts()
          Check if the manager has any FTP accounts in its list.
 void loadAccounts()
          Load account list from file.
 void removeAccount(AccountProfile oldAccount)
          Remove a FTP account from the list.
 void removeAccountManagerListener(AccountManagerListener l)
           
 void resetAccounts()
           
static java.lang.String resolveCid(AccountProfile account)
          Get the cid for the passed account if it's a jalbum account If not, the cid for the account the user is signed into Jalbum as is passed, or null if the user isn't signed into the Jalbum client
 void saveAccounts()
          Save the account list to file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AccountManager getInstance()

addAccount

public void addAccount(AccountProfile newAccount)
Add a new FTP account to the list.


removeAccount

public void removeAccount(AccountProfile oldAccount)
Remove a FTP account from the list.


removeAccountManagerListener

public void removeAccountManagerListener(AccountManagerListener l)

addAccountManagerListener

public void addAccountManagerListener(AccountManagerListener l)

fireAccountListUpdated

protected void fireAccountListUpdated()

hasAccounts

public boolean hasAccounts()
Check if the manager has any FTP accounts in its list.


resetAccounts

public void resetAccounts()

loadAccounts

public void loadAccounts()
                  throws ElementException,
                         java.io.IOException
Load account list from file.

Throws:
ElementException - Could not fetch account elements.
java.io.IOException - Could not load from file.

getFirstMyjalbumAccount

public AccountProfile getFirstMyjalbumAccount()
Iterate through the list of accounts and find the first available myjalbum account.


findJAlbumAccountByUserName

public AccountProfile findJAlbumAccountByUserName(java.lang.String userName)

findAccountByName

public AccountProfile findAccountByName(java.lang.String name)

findCurrentAccount

public AccountProfile findCurrentAccount(AlbumBean engine)

getCid

public static java.lang.String getCid(java.lang.String userName,
                                      java.lang.String password)

getCid

public static java.lang.String getCid(AccountProfile account)

resolveCid

public static java.lang.String resolveCid(AccountProfile account)
Get the cid for the passed account if it's a jalbum account If not, the cid for the account the user is signed into Jalbum as is passed, or null if the user isn't signed into the Jalbum client

Since:
8.4

getJalbumAccountQuota

public static AccountManager.AccountStatus getJalbumAccountQuota(java.lang.String username,
                                                                 java.lang.String password)
                                                          throws java.io.IOException
Throws:
java.io.IOException

getJalbumAccountStatus

public static AccountManager.AccountStatus getJalbumAccountStatus(AccountProfile profile)
                                                           throws java.io.IOException,
                                                                  AuthenticationException
Throws:
java.io.IOException
AuthenticationException

getJalbumAccountStatus

public static AccountManager.AccountStatus getJalbumAccountStatus(java.lang.String username,
                                                                  java.lang.String password)
                                                           throws java.io.IOException,
                                                                  AuthenticationException
Throws:
java.io.IOException
AuthenticationException

saveAccounts

public void saveAccounts()
                  throws java.io.IOException,
                         java.lang.Exception
Save the account list to file.

Throws:
java.io.IOException - Could not write to file.
java.lang.Exception - Could not get BeanBinder properties

getAccounts

public javax.swing.DefaultListModel getAccounts()