View Javadoc

1   /*
2    * AI Soccer Project - network gaming environment for AI warriors.
3    * Copyright (C) 2001-2004  Marcin Werla, Pawel Widera
4    *
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, you can find it here:
17   * http://www.gnu.org/licenses/gpl.html
18   */
19  
20  package snifos.server.test;
21  
22  import org.dom4j.Document;
23  
24  import snifos.common.UserId;
25  
26  import snifos.server.Server;
27  
28  
29  /***
30   * Dummy implementation of server interface.
31   * @version $Id: DummyServer.java,v 1.2 2004/05/08 21:55:26 mwerla Exp $
32   */
33  public class DummyServer implements Server {
34      private UserId userId;
35      private Document message;
36  
37      /***
38      * Returns last message which was passed to send message method.
39       * @return Last message which was passed to send message method.
40       */
41      public Document getMessage() {
42          return message;
43      }
44  
45      /***
46       * Returns last user id which was passed to send message method.
47       * @return Last user id which was passed to send message method.
48       */
49      public UserId getUserId() {
50          return userId;
51      }
52  
53      /***
54      * Just stores the message and user id inside the server.
55       * @see Server#sendMessage(UserId, Document)
56       */
57      public void sendMessage(UserId userId, Document message) {
58          this.userId = userId;
59          this.message = message;
60      }
61  
62      /***
63       * @see Server#receiveMessage(UserId, Document)
64       */
65      public void receiveMessage(UserId userId, Document message) {
66          // Not needed for now
67      }
68  
69      /***
70       * @see Server#disconnectUser(UserId)
71       */
72      public void disconnectUser(UserId userId) {
73          // Not needed for now
74      }
75  
76      /***
77       * @see java.lang.Runnable#run()
78       */
79      public void run() {
80          // Not needed for now
81      }
82  
83      /***
84       * @see Server#unregisterUser(UserId)
85       */
86      public void unregisterUser(UserId userId) {
87          // Not needed for now	
88      }
89  }