com.threerings.parlor.tourney.server
Class TourniesManager

java.lang.Object
  extended by com.threerings.parlor.tourney.server.TourniesManager
All Implemented Interfaces:
Lifecycle.BaseComponent, Lifecycle.InitComponent, TourniesProvider, InvocationProvider

public abstract class TourniesManager
extends Object
implements TourniesProvider, Lifecycle.InitComponent

An extensible tournament manager.


Field Summary
protected  com.google.inject.Injector _injector
           
protected  RootDObjectManager _omgr
           
protected  int _tourneyCount
          Count to provide a unique key to tournies as they're created.
protected  Map<Comparable<?>,TourneyManager> _tourneys
          Holds all the current tournies in the game.
protected  TourneyRepository _tournrep
           
 
Constructor Summary
TourniesManager(Lifecycle cycle)
           
 
Method Summary
 void createTourney(ClientObject caller, TourneyConfig config, InvocationService.ResultListener listener)
          Handles a TourniesService.createTourney(com.threerings.parlor.tourney.data.TourneyConfig, com.threerings.presents.client.InvocationService.ResultListener) request.
protected abstract  long getIntervalDelay()
          Returns the tourney interval delay in milliseconds.
protected abstract  Class<? extends TourneyManager> getTourneyManagerClass()
          Returns the derivation of TourneyManager to use.
 void init()
           
protected  void loadTourneyConfigs()
          Load all the tournament configuration information stored in the repository.
protected  void makeTourney(TourneyConfig config, InvocationService.ResultListener listener)
          Called to actually create a tourney once it has been validated and the prize has been reserved.
protected  void releaseTourney(Comparable<?> key)
          Called by the tourney manager to remove itself from the tournies.
protected  void updateTournies()
          Called to update loaded tournies, possibly announcing tourney information or start a pending tourney.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tourneyCount

protected int _tourneyCount
Count to provide a unique key to tournies as they're created.


_tourneys

protected Map<Comparable<?>,TourneyManager> _tourneys
Holds all the current tournies in the game.


_injector

@Inject
protected com.google.inject.Injector _injector

_omgr

@Inject
protected RootDObjectManager _omgr

_tournrep

@Inject
protected TourneyRepository _tournrep
Constructor Detail

TourniesManager

@Inject
public TourniesManager(Lifecycle cycle)
Method Detail

init

public void init()
Specified by:
init in interface Lifecycle.InitComponent

createTourney

public void createTourney(ClientObject caller,
                          TourneyConfig config,
                          InvocationService.ResultListener listener)
                   throws InvocationException
Description copied from interface: TourniesProvider
Handles a TourniesService.createTourney(com.threerings.parlor.tourney.data.TourneyConfig, com.threerings.presents.client.InvocationService.ResultListener) request.

Specified by:
createTourney in interface TourniesProvider
Throws:
InvocationException

makeTourney

protected void makeTourney(TourneyConfig config,
                           InvocationService.ResultListener listener)
Called to actually create a tourney once it has been validated and the prize has been reserved.


releaseTourney

protected void releaseTourney(Comparable<?> key)
Called by the tourney manager to remove itself from the tournies.


loadTourneyConfigs

protected void loadTourneyConfigs()
Load all the tournament configuration information stored in the repository.


updateTournies

protected void updateTournies()
Called to update loaded tournies, possibly announcing tourney information or start a pending tourney.


getTourneyManagerClass

protected abstract Class<? extends TourneyManager> getTourneyManagerClass()
Returns the derivation of TourneyManager to use.


getIntervalDelay

protected abstract long getIntervalDelay()
Returns the tourney interval delay in milliseconds.