multivalent.std.adaptor

Class ManualPageVolume

public class ManualPageVolume extends Behavior

Collect all man pages in Preferences' MANPATH (Java doesn't read environment variables, which is just as well, but would like to initially import setting). Big list of all pages read, alphabetized, by volume. Use standard system help mechanism, multiple media types (for possible Texinfo)

Intercepts manpage protocol (e.g., "manpage:ls(1)" or "manpage:ascii.5" or "manpage:sort") to look up in its database

Principle: Separate UI from media adaptor.

Discarded ideas:

Later, perhaps

Version: $Revision: 1.7 $ $Date: 2003/06/02 05:42:14 $

See Also: ManualPage

Field Summary
static StringMSG_DATABASE
Request database to be rebuilt, to pick up changes made.
static StringMSG_EXISTS
Determine whether manual page exists in database, in any section.
static StringMSG_KILLCATS
Formatting on today's machines is so fast that there is no need for cached formatted "cat" pages; request to delete them.
static StringMSG_SECTION_VALID
Determine whether manual page section / volume letter is valid.
static StringPREF_DIR
Boolean indicating whether or not to show file system directories of man page roots.
static StringPREF_MANPATH
List of directories that are man page roots, same as MANPATH environment variable.
static StringPREF_RECENT
Boolean indicating whether or not to scan for and show recently added (or changed) man pages.
static StringPREF_VOLNAMES
List of volume names separated by colons, parallel to PREF_RECENT.
static StringPREF_VOLUMES
List of letters separated by colons corresponding to volume extensions.
static StringPROTOCOL
Method Summary
voidbuildDatabase()
Scan directories of MANPATH and collect page names.
voidconfigure()
Set up MANPATH, volume letters and names.
static voidmain(String[] argv)
Test database reading.
voidrestore(ESISNode n, Map<String,Object> attr, Layer layer)
booleansemanticEventAfter(SemanticEvent se, String msg)
Intercept openDocument with manpage protocol.
booleansemanticEventBefore(SemanticEvent se, String msg)
StringshowPage(String page)
Parse page spec, look up in database, report if no found or multiple matches, or openDocument on single match.
StringshowVolume(String volnum)
Writes HTML page that list all pages in specified volume number, or all pages in database for "*".

Field Detail

MSG_DATABASE

public static final String MSG_DATABASE
Request database to be rebuilt, to pick up changes made.

"rebuildManPageDatabaseNewCommand2".

MSG_EXISTS

public static final String MSG_EXISTS
Determine whether manual page exists in database, in any section.

"manualpageExists": arg= java.lang.String name-of-page

MSG_KILLCATS

public static final String MSG_KILLCATS
Formatting on today's machines is so fast that there is no need for cached formatted "cat" pages; request to delete them. Cat pages can be regenerated if needed, except in the cast of "stray cats" in which there is no source version.

"manpageDeleteCats".

MSG_SECTION_VALID

public static final String MSG_SECTION_VALID
Determine whether manual page section / volume letter is valid.

"manualpageValidSection": arg= java.lang.String string-to-check / java.lang.Boolean returned-answer

PREF_DIR

public static final String PREF_DIR
Boolean indicating whether or not to show file system directories of man page roots.

PREF_MANPATH

public static final String PREF_MANPATH
List of directories that are man page roots, same as MANPATH environment variable.

PREF_RECENT

public static final String PREF_RECENT
Boolean indicating whether or not to scan for and show recently added (or changed) man pages.

PREF_VOLNAMES

public static final String PREF_VOLNAMES
List of volume names separated by colons, parallel to PREF_RECENT.

PREF_VOLUMES

public static final String PREF_VOLUMES
List of letters separated by colons corresponding to volume extensions.

PROTOCOL

public static final String PROTOCOL

Method Detail

buildDatabase

public void buildDatabase()
Scan directories of MANPATH and collect page names.

configure

public void configure()
Set up MANPATH, volume letters and names. Separated from buildDatabase() so can show UI without necessarily building database.

main

public static void main(String[] argv)
Test database reading.

restore

public void restore(ESISNode n, Map<String,Object> attr, Layer layer)

semanticEventAfter

public boolean semanticEventAfter(SemanticEvent se, String msg)
Intercept openDocument with manpage protocol. eventAfter to let newcomers filter or intercept.

semanticEventBefore

public boolean semanticEventBefore(SemanticEvent se, String msg)

showPage

public String showPage(String page)
Parse page spec, look up in database, report if no found or multiple matches, or openDocument on single match.

showVolume

public String showVolume(String volnum)
Writes HTML page that list all pages in specified volume number, or all pages in database for "*".