otie
Class Controller

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byotie.Controller
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Controller
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Field Summary
private  boolean Final
           
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
Controller()
           
 
Method Summary
private  java.util.ArrayList addSystemParameters(java.util.ArrayList aList, java.lang.String fileName, java.io.PrintWriter pW)
          Adds the system parameters into the ArrayList object given as parameter.
 void destroy()
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process HTTP request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
private  void error(java.io.PrintWriter pW)
           
private  void error(java.io.PrintWriter pW, java.lang.String message)
           
private  Attribute getAttribute(XMLFile xmlFile, java.lang.String elementName, java.io.PrintWriter printWriter)
          Create a new attribute representing a given system parameter.
private  java.util.ArrayList[] getAttributes(javax.servlet.http.HttpServletRequest request)
          A method that maps the request parameters into a more accessible format.
 void init()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Final

private boolean Final
Constructor Detail

Controller

public Controller()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Process HTTP request.

Parameters:
request - HttpServletRequest The request object.
response - HttpServletResponse The response object.
Throws:
javax.servlet.ServletException - A generic class of exception thrown by a servlet.
java.io.IOException - IO failure with the PrintWriter object.

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

getAttributes

private java.util.ArrayList[] getAttributes(javax.servlet.http.HttpServletRequest request)
A method that maps the request parameters into a more accessible format.

Parameters:
request - HttpServletRequest The HTTP request object.
Returns:
ArrayList Returns an ArrayList containing Attribute-objects representing the original HTTP request parameters.

error

private void error(java.io.PrintWriter pW)

error

private void error(java.io.PrintWriter pW,
                   java.lang.String message)

getAttribute

private Attribute getAttribute(XMLFile xmlFile,
                               java.lang.String elementName,
                               java.io.PrintWriter printWriter)
Create a new attribute representing a given system parameter.

Parameters:
xmlFile - XMLFile The XMLFile object representing the system main configuration.
elementName - String The name of the element of which the attribute is to be created.
printWriter - PrintWriter A PrintWriter object for outputting error messages.
Returns:
Attribute Return a new attribute object or null if parameter does not exist in the main configuration file.

addSystemParameters

private java.util.ArrayList addSystemParameters(java.util.ArrayList aList,
                                                java.lang.String fileName,
                                                java.io.PrintWriter pW)
Adds the system parameters into the ArrayList object given as parameter. The system parameters are assume to be in an XML-file that satisfies the format described in the project documentation.

Parameters:
aList - ArrayList The ArrayList object to which the parameters are to be added.
fileName - String The name (and path) of the main configuration file.
pW - PrintWriter A PrintWriter object for outputting error messages, if necessary.
Returns:
ArrayList Returns the original ArrayList in which the system parameters have been added.

destroy

public void destroy()