public class NetPuzlServer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
NetPuzlServer.QueueListener
Queue Listener thread checks if the request handler has new requests and
then runs the appropriate request.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<ObjID,NetPuzlObject> |
cache
The cache/symbol table of NetPuzlObjects and their associated object IDs
|
private NetPuzlClientHandler |
clientHandler
The NetPuzl Client Hander
|
private TServer.SStatus |
currentStatus
Sever Status if ready to accept XML communication should be "open"
|
private static int |
DEFAULT_PORT_NUMBER
Server default port number
|
private HeinekenMathMatrix |
heinekenMathMatrix
The Heineken Math Matrix
|
private HeinekenMatrix |
heinekenMatrix
The Heineken Matrix
|
private HomeMatrix |
homeMatrix
Home matrix which holds the matrix
|
private boolean |
isListening
Is Server Listening to port
|
private java.net.ServerSocket |
netPuzlServer |
private PairPanickingMatrix |
pairPanicMatrix
The pair panicking matrix
|
private int |
portNumber
Server port number
|
private java.util.concurrent.BlockingQueue<RequestHandler> |
requests
The queue of matrix modification requests made by clients
|
private static java.lang.Integer |
specPortNum
If the user specifies the port number this gets set.
|
Constructor and Description |
---|
NetPuzlServer()
Instantiates a copy of the NetPuzl Server
|
Modifier and Type | Method and Description |
---|---|
private void |
acceptConnections(java.net.ServerSocket server,
NetPuzlClientHandler clientHandler)
Accepts connections.
|
void |
connectPort()
In case the port 44455 is busy, this method will cycle through the other
possible ports as specified ((c4.1.1.3)).
|
java.util.Map<ObjID,NetPuzlObject> |
getCache()
Gets the map that holds the cache/symbol table of this server
|
TServer.SStatus |
getCurrentStatus()
Returns current server status BUSY, CLOSED or OPEN
|
HeinekenMathMatrix |
getHeinekenMathMatrix()
Returns an instance of the Heineken Math Matrix
|
HeinekenMatrix |
getHeinekenMatrix()
Retruns an instance of Heineken Matrix
|
HomeMatrix |
getHomeMatrix()
Get Home Matrix
|
PairPanickingMatrix |
getPairPanicMatrix()
The pair panicking matrix
|
java.util.concurrent.BlockingQueue<RequestHandler> |
getRequests()
Gets the queue of requests of this server
|
java.net.ServerSocket |
getServerSocket()
getServer returns a copy of the Server Socket for testing purposes
|
private void |
initThread(java.lang.Thread thread) |
boolean |
isListening()
isListening returns if the server is listening.
|
static void |
main(java.lang.String[] args)
Starts a new NetPuzlServer.
|
private void |
setCurrentStatus(TServer.SStatus currentStatus)
setCurrentStatus sets the current status of the server open closed or
busy.
|
private void |
setHeinekenMathMatrix(HeinekenMathMatrix matrix)
Sets the Heineken math matrix
|
private void |
setHeinekenMatrix(HeinekenMatrix matrix)
Sets the Heineken Matrix
|
private void |
setHomeMatrix(HomeMatrix homeMatrix)
Sets the Home matrix
|
private void |
setPairPanicMatrix(PairPanickingMatrix pairPanicMatrix)
Sets the pair panicking matrix
|
private static final int DEFAULT_PORT_NUMBER
private boolean isListening
private int portNumber
private static java.lang.Integer specPortNum
private java.util.Map<ObjID,NetPuzlObject> cache
private NetPuzlClientHandler clientHandler
private TServer.SStatus currentStatus
private HeinekenMathMatrix heinekenMathMatrix
private HeinekenMatrix heinekenMatrix
private HomeMatrix homeMatrix
private java.net.ServerSocket netPuzlServer
private PairPanickingMatrix pairPanicMatrix
private java.util.concurrent.BlockingQueue<RequestHandler> requests
private void initThread(java.lang.Thread thread)
private void acceptConnections(java.net.ServerSocket server, NetPuzlClientHandler clientHandler)
server
- the socket connection for the serverclientHandler
- the clienthandler adds and manages the clients or
agentspublic void connectPort() throws java.io.IOException
java.io.IOException
public java.util.Map<ObjID,NetPuzlObject> getCache()
public TServer.SStatus getCurrentStatus()
public HeinekenMathMatrix getHeinekenMathMatrix()
public HeinekenMatrix getHeinekenMatrix()
public HomeMatrix getHomeMatrix()
public PairPanickingMatrix getPairPanicMatrix()
public java.util.concurrent.BlockingQueue<RequestHandler> getRequests()
public java.net.ServerSocket getServerSocket()
public boolean isListening()
private void setCurrentStatus(TServer.SStatus currentStatus)
currentStatus
- private void setHeinekenMathMatrix(HeinekenMathMatrix matrix)
matrix
- the heineken math matrixprivate void setHeinekenMatrix(HeinekenMatrix matrix)
matrix
- the heineken matrixprivate void setHomeMatrix(HomeMatrix homeMatrix)
homeMatrix
- the main matrixprivate void setPairPanicMatrix(PairPanickingMatrix pairPanicMatrix)
pairPanicMatrix
- the pair panicking matrixpublic static void main(java.lang.String[] args)
args
- Specifies the port number only the first argument is used.