edu.northwestern.at.wordhoard.server
Interface WordHoardSession

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
WordHoardSessionImpl

public interface WordHoardSession
extends java.rmi.Remote

Session remote object.


Method Summary
 java.lang.Long createOrUpdateAccount(Account account)
          Creates or updates an account.
 java.lang.Long createUserDataObject(UserDataObject userDataObject)
          Creates a user data object.
 void deleteAccount(java.lang.Long id)
          Deletes an account.
 void deleteUserDataObject(java.lang.Class udoClass, java.lang.Long id)
          Deletes a user data object.
 void deleteWordSet(WordSet wordSet)
          Deletes a word set.
 void endSession()
          Ends the session.
 java.util.List getAccounts()
          Gets all the accounts.
 Account login(java.lang.String username, java.lang.String password)
          Logs in.
 void logMessage(int level, java.lang.String msg)
          Logs a message.
 void logout()
          Logs out.
 int performBatchInserts(java.lang.String[] insertStatements)
          Performs batch inserts using prepared MySQL insert statements.
 void tickle()
          Tickles the session.
 java.lang.Long updateUserDataObject(UserDataObject userDataObject, UserDataObjectUpdater userDataObjectUpdater)
          Updates a user data object.
 

Method Detail

endSession

void endSession()
                throws java.rmi.RemoteException
Ends the session.

Throws:
java.rmi.RemoteException

tickle

void tickle()
            throws java.rmi.RemoteException
Tickles the session.

Clients should tickle their sessions every 30 minutes. Sessions which go untickled for 2 hours are considered to be dead and are timed out and terminated.

Throws:
java.rmi.RemoteException

logMessage

void logMessage(int level,
                java.lang.String msg)
                throws java.rmi.RemoteException
Logs a message.

Parameters:
level - Log message level.
msg - Log message.
Throws:
java.rmi.RemoteException

login

Account login(java.lang.String username,
              java.lang.String password)
              throws java.rmi.RemoteException
Logs in.

Parameters:
username - Username.
password - Password.
Returns:
Account record with password set to null if login successful. Null if login unsuccessful.
Throws:
java.rmi.RemoteException

logout

void logout()
            throws java.rmi.RemoteException
Logs out.

Throws:
java.rmi.RemoteException

getAccounts

java.util.List getAccounts()
                           throws java.rmi.RemoteException,
                                  WordHoardError
Gets all the accounts.

Returns:
List of all accounts in increasing order by username.
Throws:
java.rmi.RemoteException
WordHoardError

createOrUpdateAccount

java.lang.Long createOrUpdateAccount(Account account)
                                     throws java.rmi.RemoteException,
                                            WordHoardError
Creates or updates an account.

Parameters:
account - Account.
Returns:
Id of the account.
Throws:
java.rmi.RemoteException
WordHoardError

deleteAccount

void deleteAccount(java.lang.Long id)
                   throws java.rmi.RemoteException,
                          WordHoardError
Deletes an account.

Parameters:
id - Account id.
Throws:
java.rmi.RemoteException
WordHoardError

createUserDataObject

java.lang.Long createUserDataObject(UserDataObject userDataObject)
                                    throws java.rmi.RemoteException,
                                           WordHoardError,
                                           BadOwnerException,
                                           PersistenceException
Creates a user data object.

Parameters:
userDataObject - User data object.
Returns:
Id of the object.
Throws:
java.rmi.RemoteException
WordHoardError
BadOwnerException
PersistenceException

updateUserDataObject

java.lang.Long updateUserDataObject(UserDataObject userDataObject,
                                    UserDataObjectUpdater userDataObjectUpdater)
                                    throws java.rmi.RemoteException,
                                           WordHoardError,
                                           BadOwnerException,
                                           PersistenceException
Updates a user data object.

Parameters:
userDataObject - The user data object to update.
userDataObjectUpdater - Method which updates fields of user data object.
Returns:
true if update succeeds, false otherwise.
Throws:
BadOwnerException - if user is not logged in or is not the owner of the user data object.
java.rmi.RemoteException
WordHoardError
PersistenceException

deleteUserDataObject

void deleteUserDataObject(java.lang.Class udoClass,
                          java.lang.Long id)
                          throws java.rmi.RemoteException,
                                 WordHoardError,
                                 PersistenceException
Deletes a user data object.

Parameters:
udoClass - Class of user data object to delete.
id - ID of user data object to delete.
Throws:
java.rmi.RemoteException
WordHoardError
PersistenceException

deleteWordSet

void deleteWordSet(WordSet wordSet)
                   throws java.rmi.RemoteException,
                          WordHoardError,
                          PersistenceException
Deletes a word set.

Parameters:
wordSet - Word set to delete.
Throws:
java.rmi.RemoteException
WordHoardError
PersistenceException

performBatchInserts

int performBatchInserts(java.lang.String[] insertStatements)
                        throws java.rmi.RemoteException,
                               WordHoardError,
                               PersistenceException
Performs batch inserts using prepared MySQL insert statements.

Parameters:
insertStatements - String array of MySQL insert statements.
Returns:
count of inserts performed.
Throws:
PersistenceException
java.rmi.RemoteException
WordHoardError