001         package com.croftsoft.apps.chat.server;
002    
003         import com.croftsoft.core.lang.NullArgumentException;
004    
005         import com.croftsoft.apps.chat.model.seri.SeriChatWorld;
006         import com.croftsoft.apps.chat.request.ViewRequest;
007         import com.croftsoft.apps.chat.request.Request;
008         import com.croftsoft.apps.chat.response.ViewResponse;
009         import com.croftsoft.apps.chat.user.User;
010    
011         /*********************************************************************
012         * Returns a view of the game.
013         *
014         * @version
015         *   2003-06-18
016         * @since
017         *   2003-06-11
018         * @author
019         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
020         *********************************************************************/
021    
022         public final class  ViewServer
023           extends AbstractServer
024         //////////////////////////////////////////////////////////////////////
025         //////////////////////////////////////////////////////////////////////
026         {
027    
028         private final SeriChatWorld  seriChatWorld;
029    
030         //////////////////////////////////////////////////////////////////////
031         //////////////////////////////////////////////////////////////////////
032    
033         public  ViewServer ( SeriChatWorld  seriChatWorld )
034         //////////////////////////////////////////////////////////////////////
035         {
036           NullArgumentException.check ( this.seriChatWorld = seriChatWorld );
037         }
038    
039         //////////////////////////////////////////////////////////////////////
040         //////////////////////////////////////////////////////////////////////
041    
042         public Object  serve (
043           User     user,
044           Request  request )
045         //////////////////////////////////////////////////////////////////////
046         {
047           long  eventIndex = user.nextEventIndex ( );
048    
049           return new ViewResponse (
050             seriChatWorld,
051             eventIndex );
052         }
053    
054         //////////////////////////////////////////////////////////////////////
055         //////////////////////////////////////////////////////////////////////
056         }