net.user1.union.api
Interface Account

All Superinterfaces:
AttributeHolder

public interface Account
extends AttributeHolder

An Account represents a persistent user in the Union Server.


Method Summary
 void dispose()
          Disposes of a reference count for the Account in the cache.
 Client getClient()
          Returns the currently connected client for this account if the account is logged in.
 java.lang.String getPassword()
          Return the password for the account.
 java.lang.String getUserID()
          Return the userID for the account.
 void initModerator(boolean isModerator)
          Initializes the Account as a moderator.
 boolean isModerator()
          Returns true if the account has moderator privileges.
 void setModerator(boolean isModerator)
          Sets the account moderator status.
 
Methods inherited from interface net.user1.union.core.attribute.AttributeHolder
getAttribute, getAttribute, getAttributes, getAttributes, getAttributesByScope, getAttributeValue, getAttributeValue, onChangeAttribute, onRemoveAttribute, removeAttribute, removeAttribute, setAttribute
 

Method Detail

getUserID

java.lang.String getUserID()
Return the userID for the account.

Returns:
the userID for the account

getPassword

java.lang.String getPassword()
Return the password for the account.

Returns:
the password for the account

getClient

Client getClient()
Returns the currently connected client for this account if the account is logged in. If no client has logged in for this account then it returns null.

Returns:
the client for the account

isModerator

boolean isModerator()
Returns true if the account has moderator privileges.

Returns:
true if the account is a moderator

setModerator

void setModerator(boolean isModerator)
                  throws DatasourceException
Sets the account moderator status. Note: Datasources MUST not use this but instead use the initModerator() method when intiializing an Account.

Parameters:
isModerator - - true if the account should be a moderator
Throws:
DatasourceException - if the Datasource could not persist the new moderator status.

initModerator

void initModerator(boolean isModerator)
Initializes the Account as a moderator. Note: ONLY Datasources should use this method. Otherwise use the setModerator() method.

Parameters:
isModerator - - true if the account should be a moderator

dispose

void dispose()
Disposes of a reference count for the Account in the cache. This method MUST be called when finished working with an Account retrieved with the Server.getAccount(String userID) method. It MUST NOT be called when finished working with an Account retrieved from the Client.getAccount() method. A good pattern to use is something like:
  
 Acount account = server.getAccount("userID");
 try {
     // work with the account
 } finally {
     account.dispose();
 } 
 



Copyright USER1 Subsystems Corporation - Tue Jan 28 2014, 05:05 PM -0500