org.pealfactory.bronze
Class Librarian

java.lang.Object
  extended by org.pealfactory.bronze.Tracker
      extended by org.pealfactory.bronze.Librarian
All Implemented Interfaces:
java.lang.Runnable, Trackable

 class Librarian
extends Tracker

Manages the download and unpacking of a zipped Microsiril library file; can also parse the contents to produce an HTML SELECT form element listing every method in the library.

The Librarian is used by the LibraryApplet as follows:

  1. getLibrary() is called to download and unpack a zipped Microsiril library file. This method updates the Tracker progress counter, 0 to 100%.
  2. Next, emitLibrary() is called to produce the HTML body of a SELECT tag. Methods are listed by name, in the order they appear in the library. A separate 0 to 100% progress counter is updated during parsing - this could take a few seconds on a slow machine, especially for the large Surprise library.
  3. The webpage that is hosting the LibraryApplet can then use the two calls getName() and getPN() to retrieve the full name and place notation of any method in the list.

The Librarian extends Tracker to provide progress monitoring (getProgress call).

Since:
Earwen

Field Summary
private  byte[] fLibFile
           
private  java.util.Vector fNames
           
private  java.util.Vector fPNs
           
 int kBLOCK_SIZE
           
 
Fields inherited from class org.pealfactory.bronze.Tracker
kDEFAULT_JOB_NAME, kRESPONSE_TIME
 
Fields inherited from interface org.pealfactory.bronze.Trackable
kERROR_NONE
 
Constructor Summary
Librarian()
           
 
Method Summary
 java.lang.String emitLibrary()
           
 java.lang.String getLibrary(java.net.URL base, java.lang.String path)
          Returns null if error, otherwise a String containing the complete HTML <select> tag for this library
 java.lang.String getName(int i)
           
 java.lang.String getPN(int i)
           
private  void loadLib(java.net.URL base, java.lang.String path)
           
 
Methods inherited from class org.pealfactory.bronze.Tracker
abort, abortWorker, endDelegateJob, getErrorMsg, getJobName, getProgress, getProgress, isAborted, isError, isFinished, isPaused, pause, reset, resume, run, setErrorMsg, setJobName, setProgress, setTotalDuration, startDelegateJob, startWorker, waitForResume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kBLOCK_SIZE

public final int kBLOCK_SIZE
See Also:
Constant Field Values

fNames

private java.util.Vector fNames

fPNs

private java.util.Vector fPNs

fLibFile

private byte[] fLibFile
Constructor Detail

Librarian

public Librarian()
Method Detail

getName

public java.lang.String getName(int i)

getPN

public java.lang.String getPN(int i)

getLibrary

public java.lang.String getLibrary(java.net.URL base,
                                   java.lang.String path)
Returns null if error, otherwise a String containing the complete HTML <select> tag for this library


loadLib

private void loadLib(java.net.URL base,
                     java.lang.String path)
              throws java.io.IOException
Throws:
java.io.IOException

emitLibrary

public java.lang.String emitLibrary()