RiverRat  - An MIT iCampus project http://web.mit.edu/riverrat/

Main Page | Software Documentation | Hardware Documentation | People | Contact | Wiki

Main Page | Class Hierarchy | Class List | File List | Class Members

riverrat.BasicServer Class Reference

Finished prototype - Provides a framework for building RiverRat servers. More...

Inheritance diagram for riverrat.BasicServer:

riverrat.LiveServer riverrat.PlaybackServer riverrat.testing.FakeServer riverrat.testing.NMEAFakeServer riverrat.testing.XMLFakeServer List of all members.

Public Member Functions

 BasicServer ()
 Default constructor.

 BasicServer (int newport)
 Constructor.

void startDocument ()
 StartDocument.

void startElement (String uri, String local, String raw, Attributes attrs)
 StartElement.

void endElement (String uri, String local, String raw)
 EndElement.

void endDocument ()
 EndDocument.

void warning (SAXParseException ex) throws SAXException
 Warning.

void error (SAXParseException ex) throws SAXException
 Error.

void fatalError (SAXParseException ex) throws SAXException
 Fatal Error.

void setSocket (Socket s)
 Sets the client Socket.

void run ()
 Run method.

void mainServer ()
 Main output function.


Static Public Member Functions

void main (String args[])
 Test case.


Protected Member Functions

void openConnection ()
 Initializes a connection.

void setPrintWriter ()
 Initializes a PrintWriter.

void closeConnection ()
 Close connection.

void normalizeAndPrint (String s, boolean isAttValue)
 Normalizes and prints the given string.

void normalizeAndPrint (char[] ch, int offset, int length, boolean isAttValue)
 Normalizes and prints the given array of characters.

void normalizeAndPrint (char c, boolean isAttValue)
 Normalizes and prints the given character.


Protected Attributes

int port = 8080
 Specifies the port to allow connections on.

ServerSocket serverSocket
 The ServerSocket that accepts incoming connections to the server.

Socket clientSocket
 The client socket.

OutputStream networkOutputStream
 Output stream for the network socket (going from Server to Client).

InputStream networkInputStream
 Input stream for the network socket (going from Client to Server).

int fElementDepth
 Element depth.

Locator fLocator
 Document locator.

PrintWriter sout
 Socket output writer.


Static Protected Attributes

final boolean DEFAULT_CANONICAL = true

Detailed Description

Finished prototype - Provides a framework for building RiverRat servers.

Definition at line 14 of file BasicServer.java.


Constructor & Destructor Documentation

riverrat.BasicServer.BasicServer  ) 
 

Default constructor.

Starts a server without a socket.

Definition at line 43 of file BasicServer.java.

References riverrat.BasicServer.serverSocket, and riverrat.BasicServer.sout.

Referenced by riverrat.BasicServer.main().

riverrat.BasicServer.BasicServer int  newport  ) 
 

Constructor.

Opens up a ServerSocket listening for connections on the specified port.

Parameters:
newport int with the desired port

Definition at line 54 of file BasicServer.java.

References riverrat.BasicServer.serverSocket, and riverrat.BasicServer.sout.


Member Function Documentation

void riverrat.BasicServer.closeConnection  )  [protected]
 

Close connection.

Definition at line 103 of file BasicServer.java.

References riverrat.BasicServer.clientSocket, riverrat.BasicServer.networkInputStream, riverrat.BasicServer.networkOutputStream, and riverrat.BasicServer.sout.

Referenced by riverrat.BasicServer.run().

void riverrat.BasicServer.error SAXParseException  ex  )  throws SAXException
 

Error.

Part of the ErrorHandler interface.

Definition at line 226 of file BasicServer.java.

void riverrat.BasicServer.fatalError SAXParseException  ex  )  throws SAXException
 

Fatal Error.

Part of the ErrorHandler interface.

Definition at line 231 of file BasicServer.java.

void riverrat.BasicServer.main String  args[]  )  [static]
 

Test case.

Opens up a server socket and listens for client connections. On connecting, looks for XML files in the path from which the server was launched and outputs them over the socket, parsing them on the fly and using the ContentHandler callbacks to output the data.

Parameters:
args 

Reimplemented in riverrat.LiveServer, riverrat.testing.FakeServer, riverrat.testing.NMEAFakeServer, and riverrat.testing.XMLFakeServer.

Definition at line 272 of file BasicServer.java.

References riverrat.BasicServer.BasicServer().

void riverrat.BasicServer.mainServer  ) 
 

Main output function.

Override this function in different server types.

Reimplemented in riverrat.testing.FakeServer, riverrat.testing.NMEAFakeServer, and riverrat.testing.XMLFakeServer.

Definition at line 253 of file BasicServer.java.

References riverrat.BasicServer.sout.

Referenced by riverrat.BasicServer.run().

void riverrat.BasicServer.openConnection  )  [protected]
 

Initializes a connection.

This is a blocking method, and does not allow execution to continue until a connection has been opened.

Definition at line 68 of file BasicServer.java.

References riverrat.BasicServer.clientSocket, riverrat.BasicServer.port, riverrat.BasicServer.serverSocket, and riverrat.BasicServer.setPrintWriter().

Referenced by riverrat.BasicServer.run().

void riverrat.BasicServer.setPrintWriter  )  [protected]
 

Initializes a PrintWriter.

Definition at line 89 of file BasicServer.java.

References riverrat.BasicServer.clientSocket, riverrat.BasicServer.networkInputStream, riverrat.BasicServer.networkOutputStream, and riverrat.BasicServer.sout.

Referenced by riverrat.BasicServer.openConnection(), and riverrat.BasicServer.setSocket().

void riverrat.BasicServer.warning SAXParseException  ex  )  throws SAXException
 

Warning.

Part of the ErrorHandler interface.

Definition at line 221 of file BasicServer.java.


Member Data Documentation

Socket riverrat.BasicServer.clientSocket [protected]
 

The client socket.

Currently the server will only support 1 connection.

Definition at line 22 of file BasicServer.java.

Referenced by riverrat.BasicServer.closeConnection(), riverrat.BasicServer.openConnection(), riverrat.BasicServer.run(), riverrat.BasicServer.setPrintWriter(), and riverrat.BasicServer.setSocket().


The documentation for this class was generated from the following file:  

Brought to you by the RiverRat team.