COP 4610L (Spring 2004)
Operating Systems Lab (Distributed Applications in the Enterprise)
Dr. R. Lent

Programming Assignment 2

DUE: February 13, 8:00 PM

Your second assignment is to create a basic HTTP client (not a web browser) with a GUI frontend to retrieve and display current weather conditions from the National Oceanic and Atmospheric Administration (NOAA) website. NOAA reports weather information of all states in html (not in xml unfortunately, so you will have to parse the information by yourself).

The weather locations that we are interested in will be defined by individual configuration files of the form name.wth. These configuration files contain three lines. The first line contains the name of the location (lower/upper case), the second contains the state (in lowercase), and the third, one or more keywords that match the name of location in the html page of NOAA. There are some configuration files in the assignment directory for a few cities.

Take for example the configuration file for Orlando. Hourly weather data can be retrieved from NOAA by using a URL of the form:

http://iwin.nws.noaa.gov/iwin/fl/hourly.html

The URL allow us to fetch the information on florida (fl). To see the weather conditions of Orlando we need to search for the first line that starts with ORLANDO INTL (as defined in the third line of orlando.wth). You may find more that one line starting with ORLANDO INTL, but we are interested only in the first one (the latest weather report).

The date/time at which the information was generated would be near the top of the report.

The steps to complete are:

1.(20pt) Create a GUI containing the following components:
a. A menu bar with at least one menu. The menu should contain item "Open" and "Exit".
b. Two text areas (JTextArea)
c. One button
You are free to choose the layout for placing these components.

2. (20pt) A click to "Open" will show a file chooser. The files that we want to open should have extension .wth. You are not required to check that the file ends with a .wth.

3. (20pt) After choosing a file, your program opens and reads its content. The information (weather location, state, and keywords) is then displayed on the first text area

4. (10pt) Create the proper URL from the information just read. A click to the button component retrieves the URL with the weather information.

5. (15pt) Parse the response message from the weather server and get the following information: Time, Wind, Sky, and Temperature. Show all this information on the second text area.

6. (15pt) Enable drag-and-drop of configuration files onto the first text area of your application.

EC: (5pt) include an icon to visually indicate sky conditions.

Requirements

Software: Just JDK 1.4.x. No extra packages for this assignment.

To successfully complete this project, you will need to understand the following items:

1. Lecture Set 1: how to retrieve URLs. Understand this example.

2. Lecture set 3: Swing intro 1 and Swing intro 2. Several examples show how to use all the GUI components and interactions that you need to complete this project: buttons, labels, text areas, enable drag and drop,etc.

Instructions and comments

0. Start now! You will need the time allocated for this project

1. Insert appropriate comments to facilitate the grading of your work. You may attach an extra text file explaining your program.

2. Pack (zip, rar, tar) your java source files with the name (no need to submit example files):

first_initial last_name-assignment_number.zip

e.g. rlent-2.zip

3. A creative, clear, and good written solution may give you extra points

4. Submit your assignment before the due time/date via WebCT

5. A working implementation of this project was/will be demonstrated in class.