Generic HTTP-Enabled Application Responder (GHEAR)

Table of Contents

  1. Background
  2. Goals
  3. How It Works
    1. GHEAR Framework
    2. Automagically included Functionality
    3. Incorporating an Application into the Framework
    4. Requesting Information
    5. Config File
  4. Requirements
  5. Known Bugs & Missing Features
  6. Planned Future Enhancements
  7. Security Considerations
  8. References
  9. Version History
  10. Download
  11. JavaDoc
  12. Misc
  13. Credits
  14. License

Background

Often one will want to get some kind of information or status from compute-intensive or long-running processes. Sometimes, it would be useful to get this kind of information even when not at the console.

The GHEAR framework was created to solve this problem. It's a relatively simple set of Java classes that can be used to provide an HTTP-compatible information-reporting mechanism to any such process. In other words, you can get information from the process with any web browser.

Goals

How it Works

GHEAR Framework

The GHEAR framework comprises a multithreaded server class, and some abstract classes that are subclassed to build an HTTP-enabled application. The server class knows how to respond to HTTP requests, and wraps up responses nicely.

The classes that make up GHEAR are as follows:

Other classes included in the tar file are: In addition to the actual class files, there are several support files included in the tar file:

Automagically included functionality

Functionality includes the ability to respond to HTTP requests on a specified port, prepend and append pre-set HTML files to all output, and

Any system built using the GHEAR framework will respond to three commands, regardless of what's implemented in the ServiceDispatcher. Specifically, these commands are:

Incorporating an Application into the Framework

  1. First, you need to identify the pieces. You will need one or more processes (specifically Java classes) that do some kind of work. For each of these processes, you should identify what kinds of information they will want to report.
  2. Modify these classes to extend com.andthehorseyourodinon.ghear.Service.
  3. Implement the methods for these classes:
  4. Now that your processes have become Services, you need to create a Service Dispatcher for them.
  5. Subclass com.andthehorseyourodinon.ghear.ServiceDispatcher
  6. Implement the methods for these classes:
  7. Add any metrics information to your Services or ServiceDispatcher.
  8. Update the ghear.conf file to point at your ServiceDispatcher See below for settings.
  9. That's it!
Run your services by doing the equivalent of:

 java com.andthehorseyourodeinon.ghear.Server
 

The GHEAR server will start, read its configuration file, and launch your ServiceDispatcher

Requesting information

Config File Options

The config file should be fairly self-explanatory. A sample is included below.

#
# ghear.conf
#
# The Generic HTTP-Enabled Application Responder (it's not pronounced "Fear" for nothing!)
#
# This file is for configuration of the Responder. Other config files may exist for
# specific services that are launched by the Responder.
#
#
#
# Most important configuration: the ServiceDispatch class
# This identifies the Java class of the ServiceDispatcher. Since the ServiceDispatcher
# is responsible for spawning off the appropriate Services, this is how you can
# customize the system to work for your own Services. You simply subclass ServiceDispatcher
# and have it use the services that you create (and preferably subclass from Service).
#

dispatch-service = com.andthehorseyourodeinon.ghear.SampleServiceDispatcher

#
# Port for the Responder thread to listen at.
#

port=16068

#
# Use the files "stdheader.html" and "stdfooter.html" to wrap all output?
# This allows you to create an easy, consistent look-n-feel to the server
# responses.

usestdheader = true
usestdfooter = true

#
# Create a log file for each run? If this doesn't equal "false," it'll
# write a log file.
#
write-log = false

#
# Verbosity? Do you want a chatty server, or a silent server?
#
# Set at:
# 0 for silent operation
# 1 for fatal error reporting
# 2 for all error reporting
# 3 for warnings
# 4 for informational messages
# 5 for all possible internal messages, to a boring degree.
#
verbose=5

Requirements

GHEAR is written in Java, using the 1.1.8 JDK. It should be compatible with any 1.1 or later JDK.

Known Bugs & Missing features

Planned Future Enhancements

Security Considerations

As far as I know, there aren't any major buffer overrun-type problems with Java's I/O libraries, but if there are, this code could be at risk. A compromised Virtual Machine could be used to cause a lot of problems, so it seems prudent to run GHEAR application under accounts that have limited permissions. Don't run 'em as root!

Obviously, GHEAR yields some information about one or more running processes. If this information is sensitive, don't use GHEAR for those processes!

GHEAR's listener thread is itself vulnerable to certain denial of service attacks, and could be used to induce others (like overloading the CPU by overwhelming the VM with requests).

References

(none)

Version History

Initial release.

Download

You can grab a tarball.

You can access the current CVS tree using:

setenv CVSROOT :pserver:anonymous@www.andthehorseyourodeinon.com:/home/cvsroot

Password for anonymous access to the CVS repository is "anonymous".

JavaDoc

Right this way...

The whole bundle (including utilities, and so on) lives at http://www.andthehorseyourodeinon.com/tech/javadoc/packages.html

Misc

Q: What's with the "Fear" bit?
A: Well, in words like "enough" or "tough" the "gh" is pronounced similarly to the usual pronunciation of the letter "f." So, GHEAR should properly by pronounced "fear." Check out the source. It'll all make sense...

Credits

Initial version by Samuel Goldstein (samuelg@andthehorseyourodeinon.com)
Contributors: Karl Zilles
Latest Web Page Update: 21 May 2000

License

This program is distributed under the GNU Public License. For the full text of the GPL, please visit http://www.gnu.org/copyleft/gpl.html.
Home Art Terrorism Poetic Justice Ravings Technology

This site designed for IE or Netscape versions 3.0 or bigger...
Copyright © 1999-2000, Patsy Butts, Nick Verstehen, and Contributors (contact us)

[Blue Ribbon Campaign icon]
Join the Blue Ribbon Online Free Speech Campaign!