## CORBA Interface IIOMServerAppenderView

Contains methods that are used to read Log4SAS logging events.

### Definition

CORBA Module SASIOMCommon

### IIOMServerAppenderView Description

The IOMServerAppenderView interface contains methods that are used to read Log4SAS logging events.

CORBA Definitions
attribute Filter | See IServerLog.GetIOMServerAppenderView for details. When set as an interface attribute, the read cursor is reset to the beginning of the available entries.
method Close | Releases resources needed for this IOMServerAppenderView instance.
exception MapEOF | End of file.
method ReadEntries | Reads Log4SAS logging events.

Java Classes
IIOMServerAppenderViewHelper | Used to manipulate the IIOMServerAppenderView type
IIOMServerAppenderViewHolder | Used to process the IIOMServerAppenderView type as an out parameter
MapEOF | End of file.
MapEOFHelper | Used to manipulate the MapEOF type
MapEOFHolder | Used to process the MapEOF type as an out parameter

Java Interfaces
IIOMServerAppenderView | Contains methods that are used to read Log4SAS logging events.

Java Interface IIOMServerAppenderView

Contains methods that are used to read Log4SAS logging events.

Package com.sas.iom.SASIOMCommon

IIOMServerAppenderView Description
The IOMServerAppenderView interface contains methods that are used to read Log4SAS logging events.

`public interface IIOMServerAppenderView
extends org.omg.CORBA.Object`

Method Summary

void | Close () Releases resources needed for this IOMServerAppenderView instance.
void | ReadEntries ( int numToRead , AnySeqHolder entries , org.omg.CORBA.IntHolder numRead ) throws ( MapEOF, GenericError ); Reads Log4SAS logging events.

Java Class IIOMServerAppenderViewHelper

public class IIOMServerAppenderViewHelper

Description
Implementing class for methods (insert, extract, type, id, read, write, narrow) used to manipulate the IIOMServerAppenderView type.

    java.lang.Object
      |
      +--com.sas.iom.SAS.IIOMServerAppenderViewHelper

Java Class IIOMServerAppenderViewHolder

public class IIOMServerAppenderViewHolder

Description
Implementing class for methods (_read, _write, _type) used to process the IIOMServerAppenderView type as an out parameter.

    java.lang.Object
      |
      +--com.sas.iom.SAS.IIOMServerAppenderViewHolder

CORBA Attribute Filter

See IServerLog.GetIOMServerAppenderView for details. When set as an interface attribute, the read cursor is reset to the beginning of the available entries.

Description

Usage

Java Method Filter

    public java.lang.String Filter ();
    public void Filter ( java.lang.String Filter );

CORBA Method Close

Releases resources needed for this IOMServerAppenderView instance.

Description

Usage

Java Method Close

`void` Close ( )

Example

CORBA Exception MapEOF

End of file.

Description
All entries upto the filter's end date have been read.

Java Class MapEOF

public class MapEOF

    java.lang.Object
      |
      +--java.lang.Throwable
            |
            +--java.lang.Exception
                  |
                  +--org.omg.CORBA.UserException
                        |
                        +--com.sas.iom.SAS.IIOMServerAppenderView_1_0Package.MapEOF

Java Class MapEOFHelper

public class MapEOFHelper

Description
Implementing class for methods (insert, extract, type, id, read, write) used to manipulate the MapEOF type.

    java.lang.Object
      |
      +--com.sas.iom.SAS.IIOMServerAppenderView_1_0Package.MapEOFHelper

Java Class MapEOFHolder

public class MapEOFHolder

Description
Implementing class for methods (_read, _write, _type) used to process the MapEOF type as an out parameter.

    java.lang.Object
      |
      +--com.sas.iom.SAS.IIOMServerAppenderView_1_0Package.MapEOFHolder

CORBA Method ReadEntries

Reads Log4SAS logging events.

Description
The ReadEntries method is used to read Log4SAS logging events.

Usage

Java Method ReadEntries

`void` ReadEntries (

        int numToRead ,
        AnySeqHolder entries ,
        org.omg.CORBA.IntHolder numRead
        )
        throws (
                MapEOF,
                GenericError
        );

Parameter Details

Parameter | Direction | Type | Description
--- | --- | --- | ---
numToRead | in | int | Number of entries to read.
entries | out | AnySeqHolder | Onh dimensional Any array with each cell containing a one dimensional array holding the requested column information. The arrays returned for name, level, and message are string arrays, and the array returned for datetime is a DateTime array. The columns of information are returned in the order requested with the default order being name, level, message, datetime.
numRead | out | org.omg.CORBA.IntHolder | Number of entries returned. 'numRead' may differ from the number of rows returned since Log4SAS supports multi-line messages. For example, the caller may ask for one entry and receive arrays that contain:
    name          level    message
    "IOM.logger"  "ERROR"  "This is line one of the message."
    ""            ""       "This is line two of the message.
'numRead' would contain a one but the actual arrays would have two rows. If the column filter "columns=message" was specified, only one array would be returned containing:
    message
    "This is line one of the message."
    "This is line two of the message."
Again, 'numRead' would be returned as one but there are actually two message lines. Without one of the name or level columns there is no programmatic way to determine where one event's messages end and the next event's messages begin. If 'numRead' is zero, no more entries exist and the filter's end date has not been reached.

Example

This example demosntrates how to read entries from the IOM Server Appender. A filter is provided to subset what entries are returned.

     1   import com.sas.iom.SASIOMCommon.IServerLog;
     2   import com.sas.iom.SASIOMCommon.IServerLogHelper;
     3   import com.sas.iom.SASIOMCommon.IIOMServerAppenderView;
     4   import com.sas.iom.SASIOMCommon.IIOMServerAppenderViewPackage.MapEOF;
     5
     6
     7   ...[code]...
     8
     9
    10   IIOMServerAppenderView iomServerAppenderView = null;
    11
    12   IServerLog iServerLog = IServerLogHelper.narrow(obj);
    13   try
    14   {
    15      String filter = "THRESHOLD=WARN END=25MAY2007:12:34:56";
    16      iomServerAppenderView = iServerLog.GetIOMServerAppenderView(filter);
    17   }
    18   catch ( com.sas.iom.SASIOMDefs.GenericError gen )
    19   {
    20      // add code to handle exception
    21   }
    22
    23   // now we can read entries from the IOMServerAppender
    24   boolean done = false;
    25   while (!done)
    26   {
    27      try
    28      {
    29         AnySeqHolder entries = new AnySeqHolder();
    30         IntHolder _numRead = new IntHolder();
    31         int numToRead = _numToRead;
    32
    33         iomServerAppenderView.ReadEntries(numToRead, entries, _numRead);
    34
    35         numRead = _numRead.value;
    36         if (numRead <= 0)
    37         {
    38            done = true;
    39            continue;
    40         }
    41
    42         Any[] anyValues = entries.value;
    43         Object[] lists = new Object[4];
    44
    45         for (int i = 0; i < anyValues.length; i++)
    46         {
    47            Any anyValue = anyValues[i];
    48
    49            TypeCode typecode = anyValue.type();
    50            TCKind kind = typecode.kind();
    51            int kindType = kind.value();
    52
    53            if (kindType == TCKind._tk_alias)
    54            {
    55               if (typecode.name().equals(
    56                   com.sas.iom.SASIOMDefs.StringSeqHelper.type().name()))
    57               {
    58                  lists[i] = com.sas.iom.SASIOMDefs.StringSeqHelper.extract(anyValue);
    59               }
    60               else if (typecode.name().equals(
    61                        com.sas.iom.SASIOMDefs.DateTimeSeqHelper.type().name()))
    62               {
    63                  lists[i] = com.sas.iom.SASIOMDefs.DateTimeSeqHelper.extract(anyValue);
    64               }
    65
    66            }
    67         }
    68
    69         String[] loggerNames = (String[]) lists[0];
    70         String[] loggerLevels  = (String[]) lists[1];
    71         String[] loggerMsgs   = (String[]) lists[2];
    72         long[]   loggerDateTimes = (long[]) lists[3];
    73
    74         // Add code here to manipulate the logger names, levels,
    75         // messages and datetimes that were returned from the
    76         // IOM Server appender.  For example:
    77         //
    78         //   Date d = DateConverter.corbaToJavaGMT(loggerDateTimes[i]);
    79         //   SimpleDateFormat sdf = new SimpleDateFormat("ddMMMyyyy:HH:mm:ss z");
    80         //   sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
    81         //   String col4AsStr = sdf.format(d);
    85      }
    86      catch (MapEOF e)
    87      {
    88         done = true;
    89      }
    90      catch (GenericError gen)
    91      {
    92         // handle exception
    93      }
    94   } // end while