Multivalent API

multivalent.std.adaptor
Class ManualPageVolume

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Behavior
          extended by multivalent.std.adaptor.ManualPageVolume

public class ManualPageVolume
extends Behavior

Collect all man pages in user's MANPATH environment variable. 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 java.lang.String ENV_MANPATH
           
static java.lang.String MSG_DATABASE
          Request database to be rebuilt, to pick up changes made.
static java.lang.String MSG_EXISTS
          Determine whether manual page exists in database, in any section.
static java.lang.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.
static java.lang.String MSG_SECTION_VALID
          Determine whether manual page section / volume letter is valid.
static java.lang.String PREF_DIR
          Boolean indicating whether or not to show file system directories of man page roots.
static java.lang.String PREF_RECENT
          Boolean indicating whether or not to scan for and show recently added (or changed) man pages.
static java.lang.String PREF_VOLNAMES
          List of volume names separated by colons, parallel to PREF_RECENT.
static java.lang.String PREF_VOLUMES
          List of letters separated by colons corresponding to volume extensions.
static java.lang.String PROTOCOL
           
 
Fields inherited from class multivalent.Behavior
ATTR_BEHAVIOR, name_
 
Fields inherited from class multivalent.VObject
attr_
 
Constructor Summary
ManualPageVolume()
           
 
Method Summary
 void buildDatabase()
          Scan directories of MANPATH and collect page names.
 void configure()
          Set up MANPATH, volume letters and names.
static void main(java.lang.String[] argv)
          Test database reading.
 void restore(ESISNode n, java.util.Map<java.lang.String,java.lang.Object> attr, Layer layer)
          Takes the place of a constructor's initialization functions; that is, it is invoked exactly once immediately after object instantiation.
 boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
          Intercept openDocument with manpage protocol.
 boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
          Round robin distribution to all behaviors.
 java.lang.String showPage(java.lang.String page)
          Parse page spec, look up in database, report if no found or multiple matches, or openDocument on single match.
 java.lang.String showVolume(java.lang.String volnum)
          Writes HTML page that list all pages in specified volume number, or all pages in database for "*".
 
Methods inherited from class multivalent.Behavior
buildAfter, buildBefore, checkRep, clipboardAfter, clipboardBefore, createUI, destroy, eventAfter, eventBefore, formatAfter, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintAfter, paintBefore, putPreference, redo, restoreChildren, save, setName, toString, undo
 
Methods inherited from class multivalent.VObject
attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSG_EXISTS

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

"manualpageExists": arg= String name-of-page

See Also:
Constant Field Values

MSG_SECTION_VALID

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

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

See Also:
Constant Field Values

MSG_DATABASE

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

"rebuildManPageDatabaseNewCommand2".

See Also:
Constant Field Values

MSG_KILLCATS

public static final java.lang.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".

See Also:
Constant Field Values

PROTOCOL

public static final java.lang.String PROTOCOL
See Also:
Constant Field Values

PREF_DIR

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

See Also:
Constant Field Values

PREF_RECENT

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

See Also:
Constant Field Values

ENV_MANPATH

public static final java.lang.String ENV_MANPATH
See Also:
Constant Field Values

PREF_VOLUMES

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

See Also:
Constant Field Values

PREF_VOLNAMES

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

See Also:
Constant Field Values
Constructor Detail

ManualPageVolume

public ManualPageVolume()
Method Detail

semanticEventBefore

public boolean semanticEventBefore(SemanticEvent se,
                                   java.lang.String msg)
Description copied from class: Behavior
Round robin distribution to all behaviors. Message and clientData unpacked from SemanticEvent for convenience. Message is interned, so if you compare to a literal, you can use "==". Message can't be changed (it can be short-circuited out of), but client data can be mutated as it is passed along (so it's not passed as a parameter).

Overrides:
semanticEventBefore in class Behavior

semanticEventAfter

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

Overrides:
semanticEventAfter in class Behavior

showVolume

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


showPage

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


configure

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


buildDatabase

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


restore

public void restore(ESISNode n,
                    java.util.Map<java.lang.String,java.lang.Object> attr,
                    Layer layer)
Description copied from class: Behavior
Takes the place of a constructor's initialization functions; that is, it is invoked exactly once immediately after object instantiation. When restored from hub, passed XML content subtree if any as first parameter and attributes from XML tag's attributes. This protocol cannot be short-circuited.

Overrides:
restore in class Behavior

main

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


Multivalent API