public class OpenListHandler
extends java.lang.Object
Example: Get a list of journal objects (*JRN) on the system
 // Start by getting a connection.
 CommandConnection conn = CommandConnection.getConnection("system", "user", "password");
 // The formatter converts the raw output bytes from the program call into more useful things.
 OpenListOfObjectsFormat format = new OpenListOfObjectsFormat();
 // The format listener gets notified when those useful things are ready.
 OpenListOfObjectsFormatListener listener = new ObjectListOfObjectsListener()
 {
   public void newObjectEntry(String objectNameUsed, String objectLibraryUsed,
                              String objectTypeUsed, String informationStatus, int numberOfFieldsReturned)
   {
     System.out.println("Journal "+objectNameUsed+" in library "+objectLibraryUser+".");
   }
   public void newObjectFieldData(int lengthOfFieldInformation, int keyField, String typeOfData,
                                  int lengthOfData, int offsetToData, byte[] tempDataBuffer)
   {
     if (keyField == 203)
     {
       // Text description.
       System.out.println("Description: "+Conv.ebcdicByteArrayToString(tempDataBuffer, offsetToData, lengthOfData));
     }
     else if (keyField == 605)
     {
       // ASP device name.
       System.out.println("ASP device: "+Conv.ebcdicByteArrayToString(tempDataBuffer, offsetToData, lengthOfData));
     }
   }
   // We want all of the entries in the list, so don't stop processing at any time.
   public boolean stopProcessing()
   {
     return false;
   }
   public void totalRecordsInList(int total)
   {
     System.out.println("Total objects found: "+total);
   }
   public void openComplete()
   {
   }
 };
 // The selection listener tells the OpenListOfJobs about other criteria we want to use to filter
 // out objects from the list.
 OpenListOfObjectsSelectionListener selectionListener = new OpenListOfObjectsSelectionListener()
 {
   public boolean isSelected()
   {
     return false;
   }
   public int getNumberOfStatuses()
   {
     return 1;
   }
   public String getStatus(int index)
   {
     return "A"; // Omit objects we do not have authority to.
   }
 };
 // These keys retrieve the text description (203) and the ASP device name (605).
 int[] keys = new int[] { 203, 605 };
 // Construct the open list program call.
 OpenListOfObjects list = new OpenListOfObjects(format, 1024, 0, null, "*ALL", "*ALL", "*JRN", null, selectionListener, keys);
 // Use an OpenListHandler to help us get all of the entries.
 OpenListHandler handler = new OpenListHandler(list, format, listener);
 // Kick it off. The handler will call GetListEntries, which in turn will call our formatter with
 // the output data for each entry in the list, which in turn will call our format listener to
 // notify us via newObjectEntry() and newObjectFieldData().
 handler.process(conn, 1000);
 // All done.
 conn.close();
 | Constructor and Description | 
|---|
| OpenListHandler(OpenListProgram program,
               ListEntryFormat format,
               ListFormatListener listener) | 
| Modifier and Type | Method and Description | 
|---|---|
| ListFormatListener | getFormatListener() | 
| void | process(CommandConnection conn,
       int numRecordsToReturn)Calls the OpenListProgram, then loops calling GetListEntries, then finally calls CloseList. | 
| void | setFormatListener(ListFormatListener listener) | 
public OpenListHandler(OpenListProgram program, ListEntryFormat format, ListFormatListener listener)
public ListFormatListener getFormatListener()
public void setFormatListener(ListFormatListener listener)
public void process(CommandConnection conn, int numRecordsToReturn) throws java.io.IOException
conn - The connection to use.numRecordsToReturn - The number of records the GetListEntries call should return each time.java.io.IOException