de.kosi.model
Class FoyerImpl

java.lang.Object
  |
  +--de.kosi.model.FoyerImpl
All Implemented Interfaces:
Foyer, java.rmi.Remote, java.io.Serializable

public class FoyerImpl
extends java.lang.Object
implements Foyer, java.io.Serializable

This class contains the Default Implementation of the Foyer interface.

ChangeLog:

 $Log: FoyerImpl.java,v $
 Revision 1.13  2001/08/31 14:04:47  jiriki
 Fixed Bug 457164

 Revision 1.12  2001/08/02 10:44:30  jiriki
 Worked on Tournament

 Revision 1.11  2001/08/02 09:33:53  jiriki
 Worked on tournament

 Revision 1.10  2001/07/31 13:00:27  jiriki
 Worked on Tournament

 Revision 1.9  2001/07/19 11:42:12  jiriki
 - Fixed Bug in TrickPane.
 - Started implementation of tournament.

 Revision 1.8  2001/07/16 12:19:32  jiriki
 Fixed Bug 441047.

 Revision 1.7  2001/07/02 17:37:18  jiriki
 - New Implementation of SSL Authorization
 - Implemented Client-Side Persistence

 Revision 1.6  2001/06/05 10:09:35  jiriki
 Implemented online-user list in foyer.

 Revision 1.5  2001/05/09 20:50:35  jiriki
 Removed Bugs 422366 and 422375.

 Revision 1.4  2001/05/09 18:55:21  jiriki
 Removed Bug 422612.

 Revision 1.3  2001/05/09 15:18:27  jiriki
 Removed Bug 422635.

 Revision 1.2  2001/05/09 10:02:44  betacarotine
 Removed Bug 421326.

 Revision 1.1.1.1  2001/04/29 18:05:17  jiriki
 Imported sources from zola.

 Revision 1.30  2001/04/27 12:49:35  login
 Added Locale in user creation, improved game stopwatch

 Revision 1.29  2001/04/17 19:30:08  wombat
 Updated Documentation

 Revision 1.28  2001/04/08 17:07:12  wombat
 Account Erstellung eingebaut

 Revision 1.27  2001/04/08 14:42:37  wombat
 Foyer chat entfernt.

 Revision 1.26  2001/04/05 14:11:52  login
 Worked on Tournament

 Revision 1.25  2001/03/21 13:26:36  wombat
 - Removed bugs in Table
 - began implementation of stree client
 - updated documentation

 Revision 1.24  2001/03/19 21:50:49  wombat
 - Worked on admin client.
 - improved shutdown sequence
 - removed bugs in login/logout sequence

 Revision 1.23  2001/03/18 18:10:26  wombat
 Updated Documentation

 Revision 1.22  2001/03/18 17:32:03  wombat
 Changed database concept

 Revision 1.21  2001/03/15 19:31:51  wombat
 Updated Documentation

 Revision 1.20  2001/03/14 13:46:34  wombat
 Worked on Admin Tool. Removed deadlock while killing session

 Revision 1.19  2001/03/05 20:55:21  login
 - Game (und zugehoerige Klassen) soweit fertig
 - package de.kosi.model.tournament angelegt
 - Pair angelegt
 - Round angelegt
 - Movement-Interface angelegt
 - KosiMovement fertig!!! :-)
 - KosiMovementTest um das KosiMovement zu testen
       (kann mit KOSI/kosimovementtest  aufgerufen werden)
 - Tournament und TournamentImpl in das package de.kosi.model.tournament
       verschoben
 - buildfile fuer die neuen klassen angepasst

 Revision 1.18  2001/03/01 20:31:32  wombat
 Worked on table implementation / updated documentation

 Revision 1.17  2001/03/01 14:43:00  wombat
 Worked on table implementation.

 Revision 1.16  2001/03/01 11:37:25  wombat
 worked on table implementation.

 Revision 1.15  2001/03/01 10:33:55  wombat
 Foyer modified to throw an Exception in the login() method, when calling the client foyer listener
 does not work.

 Revision 1.14  2001/02/25 23:16:05  wombat
 - deadlock vermeidung umgestellt.
 - ListenerList erstellt

 Revision 1.13  2001/02/07 16:54:04  wombat
 Updated Documentation

 

Version:
$Revision: 1.13 $ ($Date: 2001/08/31 14:04:47 $)
See Also:
Serialized Form

Constructor Summary
FoyerImpl()
          Creates a new FoyerImpl.
 
Method Summary
 void close()
          Close the Foyer.
 void createAccount(java.lang.String username, java.lang.String email, java.util.Locale locale, int strength, java.util.TimeZone timeZone, java.lang.String biddingSystem)
          Create a new user account.
 Table createTable(TableListener listener, int direction, boolean publicTable)
          This method creates a new Table.
 Tournament createTournament(java.lang.String classname)
          This method creates a new Tournament.
 AdminInterface getAdminInterface()
          Returns a reference to the admiistrativ interface of the server.
 User getCurrentUser()
          Returns the user currently logged in.
 int getMaxTables()
          Get the maximum number of tables allowed to concurrently exist in the server.
 int getMaxTournaments()
          Get the maximum number of tournaments allowed to concurrently exist in the server.
 int getMaxUsers()
          Return the maximum number of users allowed to be concurrently logged into the server.
 DistributedList getOnlineUserList()
          Returns the List of users currently logged in.
 DistributedList getTableList()
          Returns the List of currently available Tables.
 DistributedList getTournamentList()
          Returns the List of currently available Tournaments.
 User getUser(java.lang.String loginname)
          Returns a reference to the user with the given name.
 xl2.odb.collections.XL2SortedMap getUserMap()
          Returns the usermap.
 Session login(java.lang.String loginname, java.lang.String password, FoyerListener listener)
          Log into the Foyer.
 void logout()
          Log out of the Foyer.
 void setMaxTables(int maxTables)
          Set the maximum number of tables allowed to concurrently exist in the server.
 void setMaxTournaments(int maxTournaments)
          Set the maximum number of tournaments allowed to concurrently exist in the server.
 void setMaxUsers(int maxUsers)
          Set the maximum number of users allowed to be concurrently logged into the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FoyerImpl

public FoyerImpl()
          throws java.rmi.RemoteException
Creates a new FoyerImpl.
Throws:
java.rmi.RemoteException - if the ChatChannel cannot be created.
Method Detail

close

public void close()
Close the Foyer. All users are disconnected and the foyer is unexported from RMI.

getUserMap

public xl2.odb.collections.XL2SortedMap getUserMap()
Returns the usermap.
Returns:
The usermap.

login

public Session login(java.lang.String loginname,
                     java.lang.String password,
                     FoyerListener listener)
              throws KosiAccessException,
                     java.rmi.RemoteException
Log into the Foyer.
Specified by:
login in interface Foyer
Parameters:
loginname - Loginname of the account to open.
password - Password of the account.
listener - Listener informing the user of important events.
Returns:
a new session for the user.
Throws:
KosiAccessException - if a wrong password is provided, or the user does not exist.
java.rmi.RemoteException - if calling the FoyerListener does not work.

logout

public void logout()
            throws java.rmi.RemoteException,
                   InvalidSessionException
Log out of the Foyer. This ends the current session.
Specified by:
logout in interface Foyer
Throws:
java.rmi.RemoteException - if the remote call fails.
InvalidSessionException - if not called from within a valid session.

createAccount

public void createAccount(java.lang.String username,
                          java.lang.String email,
                          java.util.Locale locale,
                          int strength,
                          java.util.TimeZone timeZone,
                          java.lang.String biddingSystem)
                   throws java.rmi.RemoteException,
                          java.lang.IllegalArgumentException
Create a new user account. The password for this account is mailed to the provided email address.
Specified by:
createAccount in interface Foyer
Parameters:
username - Username for the new account.
email - EMail address of the user.
locale - Locale for the user.
strength - Strength of the user (one of the User.STRENGHT_* constants).
timeZone - Time zone the user lives in.
biddingSystem - Bidding system. This is used to set up first conventions for the user.
Throws:
java.rmi.RemoteException - If the temote call fails.
java.lang.IllegalArgumentException - If the username or the email address are not valid.

createTournament

public Tournament createTournament(java.lang.String classname)
                            throws java.rmi.RemoteException,
                                   InvalidSessionException,
                                   TournamentException
This method creates a new Tournament.
Specified by:
createTournament in interface Foyer
Returns:
a new Tournament.
Throws:
java.rmi.RemoteException - if the remote call fails.
InvalidSessionException - if not called from within a valid session.
TournamentException - If an exception occurs, while creating the tournament.

createTable

public Table createTable(TableListener listener,
                         int direction,
                         boolean publicTable)
                  throws java.rmi.RemoteException,
                         InvalidSessionException,
                         TableException,
                         UserAlreadyPlayingException
This method creates a new Table.
Specified by:
createTable in interface Foyer
Parameters:
listener - listener TableListener for the owner creating this table.
direction - direction the user want to play in (one of the Player constants).
publicTable - wether this Table is a public table.
Returns:
a new Table.
Throws:
java.rmi.RemoteException - if the remote call fails.
TableException - if an error occurs while creatingthe table.
InvalidSessionException - if not called from within a valid session.
UserAlreadyPlayingException - If the user calling this method is already playing.

getTournamentList

public DistributedList getTournamentList()
Returns the List of currently available Tournaments.
Specified by:
getTournamentList in interface Foyer
Returns:
DistributedList containing Tournaments.

getTableList

public DistributedList getTableList()
Returns the List of currently available Tables.
Specified by:
getTableList in interface Foyer
Returns:
DistributedList containing Tables.

getOnlineUserList

public DistributedList getOnlineUserList()
                                  throws InvalidSessionException
Returns the List of users currently logged in.
Specified by:
getOnlineUserList in interface Foyer
Returns:
DistributedList containing User objects.
Throws:
InvalidSessionException - if not called from within a valid session.

getUser

public User getUser(java.lang.String loginname)
             throws InvalidSessionException
Returns a reference to the user with the given name.
Specified by:
getUser in interface Foyer
Parameters:
loginname - Loginname of the user.
Returns:
a reference to the user object, null if user does not exist.
Throws:
InvalidSessionException - if not called from within a valid session.

getCurrentUser

public User getCurrentUser()
                    throws InvalidSessionException
Returns the user currently logged in.
Specified by:
getCurrentUser in interface Foyer
Returns:
The user currently logged in.
Throws:
InvalidSessionException - if not called from within a valid session.

getAdminInterface

public AdminInterface getAdminInterface()
                                 throws java.rmi.RemoteException,
                                        KosiAccessException,
                                        InvalidSessionException
Returns a reference to the admiistrativ interface of the server.
Specified by:
getAdminInterface in interface Foyer
Returns:
A reference to the administrative interface.
Throws:
java.rmi.RemoteException - If the remote call fails.
KosiAccessException - If called by an user, that is not an administrator.
InvalidSessionException - if not called from within a valid session.

getMaxUsers

public int getMaxUsers()
Return the maximum number of users allowed to be concurrently logged into the server.
Returns:
Number of users allowed in the server.

setMaxUsers

public void setMaxUsers(int maxUsers)
Set the maximum number of users allowed to be concurrently logged into the server.
Parameters:
maxUsers - Maximum users. This value has to be >= 0.

getMaxTables

public int getMaxTables()
Get the maximum number of tables allowed to concurrently exist in the server.
Returns:
Maximum number of tables.

setMaxTables

public void setMaxTables(int maxTables)
Set the maximum number of tables allowed to concurrently exist in the server.
Parameters:
maxTables - Maximum number of tables. This has to be >= 0.

getMaxTournaments

public int getMaxTournaments()
Get the maximum number of tournaments allowed to concurrently exist in the server.
Returns:
Maximum number of tournaments.

setMaxTournaments

public void setMaxTournaments(int maxTournaments)
Set the maximum number of tournaments allowed to concurrently exist in the server.
Parameters:
maxTournaments - Maximum number of tournaments.