Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.account.XMPPAccountStore Class Reference

List of all members.

Classes

class  Crypto

Public Member Functions

 XMPPAccountStore ()
synchronized void setAccountFile (final File file, final String key)
synchronized List< XMPPAccountgetAllAccounts ()
synchronized List< String > getDomains ()
synchronized List< String > getServers ()
synchronized void setAccountActive (XMPPAccount account)
synchronized void deleteAccount (XMPPAccount account)
synchronized XMPPAccount createAccount (String username, String password, String domain, String server, int port, boolean useTLS, boolean useSASL)
synchronized void changeAccountData (XMPPAccount account, String username, String password, String domain, String server, int port, boolean useTLS, boolean useSASL)
synchronized XMPPAccount getActiveAccount ()
synchronized boolean isEmpty ()
synchronized boolean exists (String username, String domain, String server, int port)
XMPPAccount findAccount (String jidString)

Detailed Description

The XMPPAccountStore is responsible for administering XMPP account credentials. All data will just reside in memory unless setAccountFile(File, String) is called. This call should only be made once and before any account manipulation is done. Note: Although this class is thread safe it is not recommended to manipulate and use data from different threads.

Author:
Stefan Rossbach

Constructor & Destructor Documentation

de.fu_berlin.inf.dpp.account.XMPPAccountStore.XMPPAccountStore ( )

Member Function Documentation

synchronized void de.fu_berlin.inf.dpp.account.XMPPAccountStore.changeAccountData ( XMPPAccount  account,
String  username,
String  password,
String  domain,
String  server,
int  port,
boolean  useTLS,
boolean  useSASL 
)

Changes the properties of an account.

Parameters:
usernamethe new user name
passwordthe new password
domainthe domain name of the server
serverthe server ip / name
portthe port of the server
useTLSif the connection should be secured using TLS
useSASLif the authentication should be negotiated using SASL
Exceptions:
IllegalArgumentExceptionif username or domain string is empty or only contains whitespace characters
if the domain or server contains upper case characters
if the port value is not in range of 0 <= x <= 65535
if the server string is not empty and the port is 0
if an account already exists with the given username, password, domain, server and port
synchronized XMPPAccount de.fu_berlin.inf.dpp.account.XMPPAccountStore.createAccount ( String  username,
String  password,
String  domain,
String  server,
int  port,
boolean  useTLS,
boolean  useSASL 
)

Creates an account. The account will automatically become active if the account store is empty.

Parameters:
usernamethe user name of the new account as lower case string
passwordthe password of the new account.
domainthe domain name of the server
serverthe server of the new account as lower case string or an empty string if not used
portthe port of the server or 0 if not used
useTLSif the connection should be secured using TLS
useSASLif the authentication should be negotiated using SASL
Exceptions:
NullPointerExceptionif username, password, domain or server is null
IllegalArgumentExceptionif username or domain string is empty or only contains whitespace characters
if the domain or server contains upper case characters
if the port value is not in range of 0 < x <= 65535
if the server string is not empty and the port is 0
if an account already exists with the given username, password, domain, server and port
synchronized void de.fu_berlin.inf.dpp.account.XMPPAccountStore.deleteAccount ( XMPPAccount  account)

Deletes an account.

Parameters:
accountthe account to delete
Exceptions:
IllegalArgumentExceptionif the account is not found in the store
IllegalStateExceptionif the account is active
synchronized boolean de.fu_berlin.inf.dpp.account.XMPPAccountStore.exists ( String  username,
String  domain,
String  server,
int  port 
)

Checks if the an account with the given arguments exists in the account store

Parameters:
usernamethe username
domainthe domain name of the server
serverthe server ip / name
portthe port of the server
Returns:
true if such an account exists, false otherwise
XMPPAccount de.fu_berlin.inf.dpp.account.XMPPAccountStore.findAccount ( String  jidString)

Searches for an account in the account store.

Parameters:
jidStringthe jid of the user as string
Returns:
the matching XMPP account or null in case of no match
Exceptions:
NullPointerExceptionif jidString is null
synchronized XMPPAccount de.fu_berlin.inf.dpp.account.XMPPAccountStore.getActiveAccount ( )

Returns the current active account.

Returns:
the active account
Exceptions:
IllegalStateExceptionif the account store is empty
synchronized List<XMPPAccount> de.fu_berlin.inf.dpp.account.XMPPAccountStore.getAllAccounts ( )

Returns a list containing all accounts.

Returns:
synchronized List<String> de.fu_berlin.inf.dpp.account.XMPPAccountStore.getDomains ( )

Returns a list of all used domains.

Example:
If the XMPPAccountStore contains users

the server list contains

  • jabber.org
  • xyz.com
  • saros-con.imp.fu-berlin.de
Returns:
synchronized List<String> de.fu_berlin.inf.dpp.account.XMPPAccountStore.getServers ( )

Returns a list of all used servers.

Example:
If the XMPPAccountStore contains users

the server list contains

  • jabber.org
  • googlemail.com
  • saros-con.imp.fu-berlin.de
Returns:
synchronized boolean de.fu_berlin.inf.dpp.account.XMPPAccountStore.isEmpty ( )

Returns if the account store is currently empty

Returns:
true if the account store is empty, false otherwise
synchronized void de.fu_berlin.inf.dpp.account.XMPPAccountStore.setAccountActive ( XMPPAccount  account)

Makes the given account active.

Parameters:
accountthe account to activate
Exceptions:
IllegalArgumentExceptionif the account is not found in the store
synchronized void de.fu_berlin.inf.dpp.account.XMPPAccountStore.setAccountFile ( final File  file,
final String  key 
)

Sets the account file where the store should search for accounts. This method should be used with care as it discards all currently loaded accounts which may result in unexpected behavior if account objects are already in use. The store will be refreshed with possible new data when this method is called. All missing directories will be created on demand. Note: Although the file is encrypted it is highly recommended to use a file location that is only accessible by the current user.

Parameters:
filethe file to load and store account data or null to just enable in memory account management
keythe key for encryption and decryption of the file or null to use the default key
 All Classes Namespaces Files Functions Variables Enumerations