Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent
Class Multivalent

    java.lang.Object
      multivalent.Multivalent

public final class Multivalent
extends java.lang.Object

Execute application startup, and act as a central repository for resources shared among all browser windows.

- `preferences` - name-value pairs that are saved to disk and shared among all browsers. The system preferences are read in first, then the user-specific preferences, which can override.
- `list` of `Browser` instances, addressable by name
- mapping from document URI to genre to behavior (Java class): `getGenre(String,String)` and `remapBehavior(String)`
- shared resources: `Cache`, `Timer`
- software engineering: `Logger`

Specification and implementation versions are available from the `Package`.

Version:
  $Revision: 1.20 $ $Date: 2005/10/10 02:15:28 $

Field Summary
`static java.lang.String` | `COPYRIGHT`
`static java.lang.String` | `FILENAME_PREFERENCES`
`static java.net.URI` | `HOME_SITE` URI of Multivalent home WWW site.
`static java.lang.String` | `MSG_EXIT` Safely destroy browsers and all their documents, and Destroy .
`static java.lang.String` | `PREF_CACHEDIR`
`static java.lang.String` | `VERSION`

Method Summary
`java.util.Iterator<Browser>` | `browsersIterator()`
`Browser` | `getBrowser(java.lang.String name)` Convenience method for creating a standalone browser, as if `getBrowser(name, "System", true)`.
`Browser` | `getBrowser(java.lang.String name, java.lang.String systemHub, boolean standalone)` Returns `Browser` with given name, with passed URL to system behaviors hub.
`com.pt.io.Cache` | `getCache()`
`java.lang.String` | `getGenre(java.lang.String contenttype, java.lang.String path)` Maps MIME Content-Type and path to Multivalent genre.
`java.util.Map<java.lang.String,java.lang.String>` | `getGenreMap()`
`static Multivalent` | `getInstance()` Returns singleton instance, from which preferences and other state can be accessed.
`static java.util.logging.Logger` | `getLogger()` Returns main logger (subsystems can use own logger).
`java.lang.String` | `getPreference(java.lang.String key, java.lang.String defaultval)` Returns preference under passed key, or if it doesn't exists sets value with defaultval and establishes this as the future preference value.
`java.util.Timer` | `getTimer()` Heartbeat timer calls observers every 100 ms
`static void` | `main(java.lang.String[] argv)`
`java.util.Iterator<java.lang.String>` | `prefKeyIterator()`
`void` | `putPreference(java.lang.String key, java.lang.String val)`
`java.lang.String` | `remapBehavior(java.lang.String bename)` Returns preferred behavior according to substitution map in `Preferences.txt`.
`void` | `removePreference(java.lang.String key)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### COPYRIGHT

    public static final java.lang.String COPYRIGHT

See Also:
  Constant Field Values

### VERSION

    public static final java.lang.String VERSION

### MSG_EXIT

    public static final java.lang.String MSG_EXIT

  Safely destroy browsers and all their documents, and Destroy .

  `"EXIT"`: `arg=` `HashMap` attributes, `in=` `INode` root of tree, `out=`unused.

  See Also:
    Constant Field Values

### FILENAME_PREFERENCES

    public static final java.lang.String FILENAME_PREFERENCES

See Also:
  Constant Field Values

### PREF_CACHEDIR

    public static final java.lang.String PREF_CACHEDIR

See Also:
  Constant Field Values

### HOME_SITE

    public static final java.net.URI HOME_SITE

  URI of Multivalent home WWW site.

Method Detail

### getInstance

    public static Multivalent getInstance()

  Returns singleton instance, from which preferences and other state can be accessed.

### getCache

    public com.pt.io.Cache getCache()

### getGenre

    public java.lang.String getGenre(java.lang.String contenttype,
                                     java.lang.String path)

  Maps MIME Content-Type and path to Multivalent genre. Genre can be mapped to a Java class via `Behavior.getInstance(String,String,ESISNode,Map,Layer)`.

### getGenreMap

    public java.util.Map<java.lang.String,java.lang.String> getGenreMap()

### getLogger

    public static java.util.logging.Logger getLogger()

  Returns main logger (subsystems can use own logger).

  Conventions for use of logging levels by behaviors:

  - `Level.SEVERE` (highest value) - errors
  - `Level.WARNING` - warnings
  - `Level.INFO` - significant system operations (e.g., opening a document -- but not all semantic events)
  - `Level.CONFIG` - version, JARs found, cache dir, fonts, hardware info
  - `Level.FINE` - semantic events, short-circuited sem ev
  - `Level.FINER` - performance metrics (memory, time), create fonts and images, caching
  - `Level.FINEST` (lowest value) - URI=>URL conversions, behavior creation, enter/exit methods

### getTimer

    public java.util.Timer getTimer()

  Heartbeat timer calls observers every 100 ms.

### remapBehavior

    public java.lang.String remapBehavior(java.lang.String bename)

  Returns preferred behavior according to substitution map in `Preferences.txt`. Clients can ask for the preferred "Hyperlink" and get the lastest-greatest, which was written after the client. Replacements must subclass what they replace and should generally recognize as many attributes as applicable. `Behavior.getInstance(String, String, Map, Layer)` remaps all behavior names.

### getPreference

    public final java.lang.String getPreference(java.lang.String key,
                                                java.lang.String defaultval)

  Returns preference under passed key, or if it doesn't exists sets value with defaultval and establishes this as the future preference value. Keys are case insensitive.

### putPreference

    public final void putPreference(java.lang.String key,
                                    java.lang.String val)

### removePreference

    public final void removePreference(java.lang.String key)

### prefKeyIterator

    public final java.util.Iterator<java.lang.String> prefKeyIterator()

### getBrowser

    public Browser getBrowser(java.lang.String name)

  Convenience method for creating a standalone browser, as if `getBrowser(name, "System", true)`.

### getBrowser

    public Browser getBrowser(java.lang.String name,
                              java.lang.String systemHub,
                              boolean standalone)

  Returns `Browser` with given name, with passed URL to system behaviors hub. If no such browser, create new one. This, not Browser's constructor, is the way to create new instances.

### browsersIterator

    public java.util.Iterator<Browser> browsersIterator()

### main

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD