com.faa.flyfaa
Class xmlAirportStatusServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.faa.flyfaa.xmlAirportStatusServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class xmlAirportStatusServlet
extends javax.servlet.http.HttpServlet

A servlet class to do the bulk of the work in generating the flyFAA Airport Status in XML. Uses JDOM to generate the XML tags. This class provides anonymous inner classes UpdateTimeElement, ClosureElement, GSElement, GDPElement and ArrivalDepartureElement to assist with the generation of these elements.

See Also:
JDOM's website, Serialized Form

Field Summary
private  java.lang.String dbDriver
          The type of drivers to be used (thin or thick).
static java.lang.String DOCTYPE
          A string to represent the <!DOCTYPE> tag
static java.lang.String DTD
          A string to represent the dtd reference for fly.faa.gov's XML Airport Status page
private static java.util.Properties flyProps
          The properties file for the flyfaa java application.
private static java.lang.String jdbcLogFile
          Contains the name of the log file.
private  oracle.jdbc.pool.OracleConnectionPoolDataSource l_ocpds
          The source of the database connection pool.
(package private) static java.lang.String Logf
          Pointer to the log file, which will be named FLYlogyyyy_Monddhhmm.txt (for example, FLYlog2003_Jan291940.txt) and is currently set up to reside in the /web/trace/atcscc/java_logs directory.
protected static javax.sql.PooledConnection m_connectionPool
          The pool of connections
(package private)  boolean MadeLog
          Flag to let me know whether the log file has been created.
private static oracle.jdbc.pool.OracleConnectionCacheImpl ocacheimpl
           
private  oracle.jdbc.pool.OracleConnectionEventListener ocel
           
private static java.io.PrintWriter out
          A printWriter for the log.
 
Fields inherited from class javax.servlet.http.HttpServlet
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE
 
Fields inherited from class javax.servlet.GenericServlet
config
 
Constructor Summary
xmlAirportStatusServlet()
           
 
Method Summary
private  boolean CreateLog(java.lang.String LogName)
          Creates a new PrintWriter, using the given filename, for writing log messages.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle the HTTP GET method; build the flyFAA XML Airport Status web page.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle the HTTP POST method; forwards request and response to the doGet method to build the flyFAA XML Airport Status web page.
 org.jdom.Element getClosureGroup(FlyFAAProjectBean proj)
          Generates an element containing all the Airport Closure information.
 org.jdom.Element getDelaysGroup(FlyFAAProjectBean proj)
          Generates an element containing all the General Arrival and Departure Delay information.
 org.jdom.Element getGroundDelayProgramsGroup(FlyFAAProjectBean proj)
          Generates an element containing all the Ground Delay Program information.
 org.jdom.Element getGroundStopGroup(FlyFAAProjectBean proj)
          Generates an element containing all the Ground Stop information.
static java.lang.String headWithTitle(java.lang.String title)
          Returns an HTML string containing a document title suitable for use at the beginning of a webpage.
 void init(javax.servlet.ServletConfig config)
          Initializes the servlet.
(package private) static void logging(int lvl, java.lang.String msg)
          Writes a message at a FlyLog.DebugLevel specified by lvl to the log file.
(package private) static void logging(int lvl, java.lang.Throwable e, java.lang.String msg)
          Writes a message at a DebugLevel specified by lvl with an Exception to the log file.
(package private) static void logging(java.lang.String msg)
          Writes a message to the log file prefixed by a date/timestamp.
(package private) static void logging(java.lang.Throwable e, java.lang.String msg)
          Writes a FlyLog.DebugLevel message with an Exception to the log file.
 org.jdom.Document XMLDocument(FlyFAAProjectBean proj)
          Generates a JDOM Document containing the complete contents of the flyFAA XML Airport Status.
 
Methods inherited from class javax.servlet.http.HttpServlet
, doDelete, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

Logf

static java.lang.String Logf
Pointer to the log file, which will be named FLYlogyyyy_Monddhhmm.txt (for example, FLYlog2003_Jan291940.txt) and is currently set up to reside in the /web/trace/atcscc/java_logs directory.

out

private static java.io.PrintWriter out
A printWriter for the log.

jdbcLogFile

private static java.lang.String jdbcLogFile
Contains the name of the log file.

MadeLog

boolean MadeLog
Flag to let me know whether the log file has been created.

m_connectionPool

protected static javax.sql.PooledConnection m_connectionPool
The pool of connections

l_ocpds

private oracle.jdbc.pool.OracleConnectionPoolDataSource l_ocpds
The source of the database connection pool.

ocacheimpl

private static oracle.jdbc.pool.OracleConnectionCacheImpl ocacheimpl

ocel

private oracle.jdbc.pool.OracleConnectionEventListener ocel

flyProps

private static java.util.Properties flyProps
The properties file for the flyfaa java application.

dbDriver

private java.lang.String dbDriver
The type of drivers to be used (thin or thick).

DOCTYPE

public static final java.lang.String DOCTYPE
A string to represent the <!DOCTYPE> tag

DTD

public static final java.lang.String DTD
A string to represent the dtd reference for fly.faa.gov's XML Airport Status page
Constructor Detail

xmlAirportStatusServlet

public xmlAirportStatusServlet()
Method Detail

headWithTitle

public static java.lang.String headWithTitle(java.lang.String title)
Returns an HTML string containing a document title suitable for use at the beginning of a webpage.
Parameters:
title - The string to be used as the document's title

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the servlet. The method is called once, automatically, by the iPlanet Web Server when it loads the servlet. The init() method should save the ServletConfig object so that it can be returned by the getServletConfig() method. Here we will get a pooled connection object (or Connection Pool).
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - If the properties file cannot be found or read, or if the connection pool cache cannot be created

CreateLog

private boolean CreateLog(java.lang.String LogName)
Creates a new PrintWriter, using the given filename, for writing log messages. If the file cannot be opened, standard error is opened instead.
Parameters:
LogName - The name of the file to be used as the log file.
Returns:
true if the log was created successfully, false otherwise.

logging

static void logging(java.lang.String msg)
Writes a message to the log file prefixed by a date/timestamp.
Parameters:
msg - The message to be written to the log file.

logging

static void logging(int lvl,
                    java.lang.String msg)
Writes a message at a FlyLog.DebugLevel specified by lvl to the log file. The message is prefixed with a custom Date/Timestamp of a form similar to '9/30/02 20:26:03.389:' followed by either '[DEBUG]' or '[ERROR]' depending on the given lvl. The message is only written if the 'enableLog' flag from the properties file is set and the 'FlyLog.DebugLevel' property from the properties file is greater than or equal to the given lvl.

Parameters:
lvl - int representing the FlyLog.DebugLevel of this log message. If the FlyLog.DebugLevel property is at least this value, the message will be printed.
msg - String containing the log message to be printed

logging

static void logging(java.lang.Throwable e,
                    java.lang.String msg)
Writes a FlyLog.DebugLevel message with an Exception to the log file. The message is prefixed with a medium format Date/Timestamp of a form similar to '4/23/02 8:26:03 PM:'. The message is only written if the 'enableLog' flag from the properties file is set. This method does not specify a parameter for the FlyLog.DebugLevel. It will only print the msg if the FlyLog.DebugLevel is FlyLog.DebugLevel, that is, if all log messages are supposed to be printed.

Parameters:
e - Throwable object (usually an Exception)
msg - String containing the log message to be printed

logging

static void logging(int lvl,
                    java.lang.Throwable e,
                    java.lang.String msg)
Writes a message at a DebugLevel specified by lvl with an Exception to the log file. The message is prefixed with a medium format Date/Timestamp of a form similar to '4/23/02 8:26:03 PM:'. The message is only written if the 'enableLog' flag from the properties file is set and the 'DebugLevel' property from the properties file is greater than or equal to the given lvl.

Parameters:
lvl - int representing the DebugLevel of this log message.
e - Throwable object (usually an Exception)
msg - String containing the log message to be printed

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Handle the HTTP GET method; build the flyFAA XML Airport Status web page.
Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - HttpServletRequest object
response - HttpServletResponse object
Throws:
javax.servlet.ServletException -  
java.io.IOException -  

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Handle the HTTP POST method; forwards request and response to the doGet method to build the flyFAA XML Airport Status web page.
Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - HttpServletRequest object
response - HttpServletResponse object
Throws:
javax.servlet.ServletException -  
java.io.IOException -  

XMLDocument

public org.jdom.Document XMLDocument(FlyFAAProjectBean proj)
Generates a JDOM Document containing the complete contents of the flyFAA XML Airport Status.
Parameters:
proj - FlyFAAProjectBean reference
Returns:
Document Document of flyFAA AIRPORT_STATUS_INFORMATION, including Updated_Time, dtd file pointer, Airport Closures, Ground Stops, Ground Delay Programs, and Delays.

getClosureGroup

public org.jdom.Element getClosureGroup(FlyFAAProjectBean proj)
Generates an element containing all the Airport Closure information. If there are no Airport Closures, no <Airport> elements will appear in the <Airport_Closure_List>. For example:

 <Name>Airport Closures</Name>
 <Airport_Closure_List>
 <Airport>
 <ARPT>HPN</ARPT>
 <Reason>SNOW REMOVAL</Reason>
 <Start>Dec 5 at 9:45 am EST.</Start>
 <Reopen>Dec 5 at 10:30 am EST.</Reopen>
 </Airport>
 </Airport_Closure_List>
 </Delay_type>
 

Parameters:
proj - FlyFAAProjectBean reference
Returns:
Element Element of Airport Closures

getGroundStopGroup

public org.jdom.Element getGroundStopGroup(FlyFAAProjectBean proj)
Generates an element containing all the Ground Stop information. If there are no Ground Stops, no <Program> elements will appear in the <Ground_Stop_List>. For example:

 <Name>Ground Stop Programs</Name>
 <Ground_Stop_List>
 <Program>
 <ARPT>HPN</ARPT>
 <Reason>WX BELOW MINIMUMS</Reason>
 <End_Time>1:30 pm EST.</End_Time>
 </Program>
 </Ground_Stop_List>
 </Delay_type>
 

Parameters:
proj - FlyFAAProjectBean reference
Returns:
Element Element of Ground Stops

getGroundDelayProgramsGroup

public org.jdom.Element getGroundDelayProgramsGroup(FlyFAAProjectBean proj)
Generates an element containing all the Ground Delay Program information. If there are no Ground Delay Programs, no <Ground_Delay> elements will appear in the <Ground_Delay_List>. For example:

 <Delay_type>
 <Name>Ground Delay Programs</Name>
 <Ground_Delay_List>
 <Ground_Delay>
 <ARPT>EWR</ARPT>
 <Reason>WEATHER, SNOW/SNOW REMOVAL</Reason>
 <Avg>4 hours and 9 minutes</Avg>
 <Max>9 hours and 19 minutes</Max>
 </Ground_Delay>
 </Ground_Delay_List>
 </Delay_type>
 

Parameters:
proj - FlyFAAProjectBean reference
Returns:
Element Element of Ground Delay Programs

getDelaysGroup

public org.jdom.Element getDelaysGroup(FlyFAAProjectBean proj)
Generates an element containing all the General Arrival and Departure Delay information. If there is no such data, no <Delay> elements will appear in the <Arrival_Departure_Delay_List>. For example:

 <Delay_type>
 <Name>General Arrival/Departure Delay Info</Name>
 <Arrival_Departure_Delay_List>
 <Delay>
 <ARPT>LGA</ARPT>
 <Reason>ZNY HOLDING DUE TO SNOW</Reason>
 <Arrival_Departure Type="Arrival">
 <Min>46 minutes</Min>
 <Max>1 hour</Max>
 <Trend>Increasing</Trend>
 </Arrival_Departure>
 </Delay>
 </Arrival_Departure_Delay_List>
 </Delay_type>
 

Parameters:
proj - FlyFAAProjectBean reference
Returns:
Element Element of General Arrival and Departure Delay Information