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

## com.bbn.openmap.graphicLoader.netmap
Class NetMapReader

    java.lang.Object
      java.lang.Thread
          com.bbn.openmap.graphicLoader.netmap.NetMapReader

All Implemented Interfaces:
  NetMapConstants, java.lang.Runnable

public class NetMapReader
extends java.lang.Thread
implements NetMapConstants

The NetMapReader is the class that makes actual contact with the NetMap server and maintains the connection to it. It is controlled by the NetMapConnector, and is created by it as well. The NetMapReader understands that the NetMap server maintains a notion of views, and that to get information from the server, it has to request information about a particular view. Luckily, a list of views can be requested from the server as well.

The NetMap server will provide a text output stream of lines, with each line representing an event. The NetMapReader has an implicit understanding of the format of different line types, and creates a java Properties object for each line, categorizing each field, and putting it in the Properties object as (Field Header key, Field value). This Properties object is sent to the NetMapConnector, where it is distributed to the NetMapEventListeners. Each NetMapEventListener is free to peruse the Properties object in the event, and get information it needs from each one by asking for specific field values. Some fields may not be present in all Properties objects, but the fields should be consistant for the same event type. At some point, we'll include a description of the events and the fields that can be expected. In general, there are two things you can do. First, you can create a NetMapReader without a view, and then call getViewList() on it to get a list of possible views. The NetMapReader will disconnect itself after that request. Second, you can create a NetMapReader with a specific view (or set the view later), and then call start() on it to begin receivng events about that view. Call disconnect() when you want it to stop.

Field Summary

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Fields inherited from interface com.bbn.openmap.graphicLoader.netmap.NetMapConstants
`CLEAR, COMMAND_FIELD, DATABASE_TAG_FIELD, DEFAULT_PORT, DEFAULT_SERVER, ELEVATION_FIELD, ERROR_VALUE_DOUBLE, ERROR_VALUE_FLOAT, ERROR_VALUE_INT, HEIGHT_FIELD, ICON_FIELD, INDEX_FIELD, IP_FIELD, JMAP_VIEW_CMD, JOFFSET_FIELD, LABEL_FIELD, LAT_FIELD, LINE_DELETE, LINE_DELETE_STRING, LINK_NODE1_FIELD, LINK_NODE2_FIELD, LINK_OBJECT, LINK_OBJECT_STATUS, LON_FIELD, MENU_FIELD, NAME_FIELD, NODE_DELETE, NODE_DELETE_STRING, NODE_MOVE, NODE_MOVE_STRING, NODE_OBJECT, NODE_OBJECT_STATUS, POSX_FIELD, POSY_FIELD, REFRESH, SHAPE_FIELD, STATUS_FIELD, TIME_FIELD, UPDATE, WIDTH_FIELD`

Constructor Summary
`NetMapReader(java.lang.String host, java.lang.String port, NetMapConnector connector)` Create a NetMapReader to listen to a host on a port, with a NetMapConnector to get back in touch with.
`NetMapReader(java.lang.String host, java.lang.String port, NetMapConnector connector, java.lang.String view)` Create a NetMapReader to listen to a NetMapServer running on a port, and parse the stream relating information about the given view.

Method Summary
`protected java.lang.String` | `getVal(java.lang.String marker, java.lang.String line)`
`ChoiceList` | `getViewList(java.lang.String host, java.lang.String port)` For an established NetMapReader, get the list of views that the NetMapReader knows about.
`protected java.lang.Object` | `next()` Break the next token into an Object.
`protected java.util.Properties` | `procline(java.lang.String cmdline)` Process a line from NetMap input stream.
`void` | `run()` Called when NetMapReader.start() is called.
`void` | `setView(java.lang.String view)` Set the view that will be requested when the reader is started, via reader.start().
`void` | `shutdown()` A queue command that lets the NetMapReader know to disconnect when it has the opportunity to.
`protected java.util.Vector` | `tokenize(java.lang.String line)` Given a line, break it up into a Vector representing the String parts, and the int[] containing the number parts.
`protected java.lang.Object` | `unit()` Break the next token into an Object, with some addition semantic functionality to interpret EOF and parenthesis.
`protected void` | `unitInit(java.io.StringReader rdr)` Initialize the StringTokenizer.

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield`

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

Constructor Detail

### NetMapReader

    public NetMapReader(java.lang.String host,
                        java.lang.String port,
                        NetMapConnector connector)
                 throws java.io.IOException

  Create a NetMapReader to listen to a host on a port, with a NetMapConnector to get back in touch with. This method just connects, finds out the views, and closes the connection to the server.

### NetMapReader

    public NetMapReader(java.lang.String host,
                        java.lang.String port,
                        NetMapConnector connector,
                        java.lang.String view)
                 throws java.io.IOException

  Create a NetMapReader to listen to a NetMapServer running on a port, and parse the stream relating information about the given view. If the view is null, then the NetMapReader will get a view list and disconnect.

Method Detail

### setView

    public void setView(java.lang.String view)

  Set the view that will be requested when the reader is started, via reader.start().

### getViewList

    public ChoiceList getViewList(java.lang.String host,
                                  java.lang.String port)

  For an established NetMapReader, get the list of views that the NetMapReader knows about. The NetMapReader will disconnect after this query.

### shutdown

    public void shutdown()

  A queue command that lets the NetMapReader know to disconnect when it has the opportunity to.

### run

    public void run()

  Called when NetMapReader.start() is called. This makes the NetMapReader call the NetMap server to get information about the view that is set. This assumes that the view has been set. The NetMapConnector will be called back with Properties objects describing events received.

  Specified by:
    `run` in interface `java.lang.Runnable`

### procline

    protected java.util.Properties procline(java.lang.String cmdline)

  Process a line from NetMap input stream.

### tokenize

    protected java.util.Vector tokenize(java.lang.String line)

  Given a line, break it up into a Vector representing the String parts, and the int[] containing the number parts. The Vector will contain String represenations of the numbers. Should be called before procline() is called, and in fact is called from within procline().

### unitInit

    protected void unitInit(java.io.StringReader rdr)

  Initialize the StringTokenizer.

### unit

    protected java.lang.Object unit()

  Break the next token into an Object, with some addition semantic functionality to interpret EOF and parenthesis.

### next

    protected java.lang.Object next()

  Break the next token into an Object.

### getVal

    protected java.lang.String getVal(java.lang.String marker,
                                      java.lang.String line)

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

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details