IBM FileNet P8, Version 5.2.1            

LogViewer

This sample demonstrates how to create a log viewing tool that uses Swing components to render the user interface.

Run the sample by entering the following command line:

    java LogViewer

The main method invokes the constructor, which sets up the user interface to the log viewing tool. The UI contains a system menu with Select system/router, logon, and logoff selections. It also contains a log menu with Select Log, Create new log index, Query Log, and List Exposed Log Fields selections. The selections are processed as described here.

Select system/router

Allows the user to choose the system and connection point to which to connect. The input must be in the following form:

server_name:port_number/connectionPoint_name

Logon

Collects the username and password, passing this information, along with the connectionPoint_URL from the Select system/router selection, to the VWSession constructor.

Logoff

Invokes VWSession.logoff to free system resources.

Select Log

Creates an array of strings that contain the log names that use VWSession.fetchEventLogNames. A dialog box displays and prompts the user to select a log by name, gets a VWLog object of that name, and notifies the user.

Query Log

Gets a VWLogDefinition object that uses VWLog.fetchLogDefinition, and uses VWLogDefinition.getIndexes to create an array of VWIndexDefinition objects. A dialog box displays a selection list of indexes for an index query (constructed by using the VWIndexDefinition object.

A dialog then is displayed prompting the use to select a query method or cancel. The user selects either Basic Query or Index-Based Query, and a VWLogQuery object is created.

If Index-Based Query is selected, another dialog box is displayed. The dialog box enables the user to select maximum and minimum values for each component field of the selected index. VWIndexDefinition.getFieldNames is used to load a string array with a sorted list of index field names. The min and max arrays are passed as arguments to VWLog.startQuery to get a VWLogQuery object.

If the Basic Query method is chosen, the VWLogQuery object is created immediately, with the min and max object arrays for VWLog.startQuery set to NULLs. A VWLogElement object is used to load information from the VWLogQuery object into ArrayList objects. This data array is passed to Swing components that display event type, sequence number, and time stamp in a table, one row for each log element.

Create new log index

As do indexes on databases, indexes on exposed log fields serve to speed up queries, just . When Create new log index is selected, LogViewer uses VWSystemConfiguration and VWLogDefinition to handle index information. Log index creation begins by creating a VWSystemConfiguration object by using VWSession.fetchSystemConfiguration and a VWLogDefinition object by using VWLog.fetchLogDefinition.

A dialog box displays prompting the user to choose indexes and specify a name. This name is passed to VWLogDefinition.createIndexDefinition with a string array of exposed field names (VWLogDefinition.getFields is used to get a VWExposedFieldDefinition object, and VWExposedFieldDefinition.getName then returns the exposed field names). An index for the log definition is created.

The system configuration is then updated with the new log definition by using VWSystemConfiguration.updateLogDefinition. The configuration must be committed by using VWSystemConfiguration.commit.

List Exposed Log Fields

Creates a list of all exposed fields in the currently selected log. A VWLogDefinition object, a VWExposedFieldDefinition object array, and a String array of exposed field names is created. VWLog.fetchLogDefinition loads the log definition object, and VWLogDefinition.getFields loads an array of exposed fields. The exposed field's names are copied into a string array. A dialog box displays the exposed fields for the selected log.



Last updated: March 2016
logviewer.htm

© Copyright IBM Corporation 2016.