server.brickblock.fwimpl
Class BBServer

java.lang.Object
  extended by server.framework.models.AbstractServer<BBSession,BBPlayer>
      extended by server.brickblock.fwimpl.BBServer

public class BBServer
extends AbstractServer<BBSession,BBPlayer>

The BrickBlock implementation of the AbstractServer model. Handles special actions that are not handled by the parent class.

Author:
Martin Jarrett, Eivind Sorteberg

Nested Class Summary
 
Nested classes/interfaces inherited from class server.framework.models.AbstractServer
AbstractServer.CommType
 
Constructor Summary
BBServer(int port, AbstractServer.CommType commType, TestModule.TestType testType)
          Creates a BBServer object by calling the parent class' constructor.
 
Method Summary
protected  BBPlayer createPlayerInstance(SocketWrapper wrapper, TestModule.TestType testType)
          Creates a BBPlayer instance.
protected  BBSession createSessionInstance(TestModule.TestType testtype)
          Creates a BBSession instance.
 boolean notifyAboutSpecialMessageReceived(ActionPair actionPair, BBPlayer sender, BBSession session)
          Called when special actions are received that could not be handled by the parent class.
 
Methods inherited from class server.framework.models.AbstractServer
createPlayer, findPlayer, firePlayerListChanged, fireSessionClosed, getCommType, getGUI, getParser, getTestType, handleDisconnect, notifyAboutMessageReceived, runTest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BBServer

public BBServer(int port,
                AbstractServer.CommType commType,
                TestModule.TestType testType)
Creates a BBServer object by calling the parent class' constructor. Does not add any extra content to the object.

Parameters:
port - The server port.
commType - The transport protocol in use.
testType - The test type, if any.
Method Detail

notifyAboutSpecialMessageReceived

public boolean notifyAboutSpecialMessageReceived(ActionPair actionPair,
                                                 BBPlayer sender,
                                                 BBSession session)
Called when special actions are received that could not be handled by the parent class. The effects of these actions depends on the type of action.

Specified by:
notifyAboutSpecialMessageReceived in class AbstractServer<BBSession,BBPlayer>
Parameters:
actionPair - Wrapper containing the action and values.
sender - The sender of the message.
session - The session to which the action applies.
Returns:
Whether the message should be forwarded to the connected clients.

createPlayerInstance

protected BBPlayer createPlayerInstance(SocketWrapper wrapper,
                                        TestModule.TestType testType)
Creates a BBPlayer instance.

Specified by:
createPlayerInstance in class AbstractServer<BBSession,BBPlayer>
Parameters:
wrapper - The player's SocketWrapper object.
testType - The test type, if any.
Returns:
A BBPlayer instance.

createSessionInstance

protected BBSession createSessionInstance(TestModule.TestType testtype)
Creates a BBSession instance.

Specified by:
createSessionInstance in class AbstractServer<BBSession,BBPlayer>
Parameters:
testtype - The test type, if any.
Returns:
A BBSession instance.