Java API to download Fault Analyzer report

The Java API downloads a Fault Analyzer report from the host and shows it in Eclipse-based products that are developed in Java.

The download part of the process happens only if the Fault Analyzer report is not already downloaded. This API belongs to the FAAPI package, which is available as part of the Fault Analyzer plug-in for Eclipse products. The assumption is that the specified host ID and port number are defined in the Systems Information view.

Specification

Two interfaces are designed to achieve this function:


        FAAPI.openReport(String UniqueAdressOfFaultEntry);
                //UniqueAdressOfFaultEntry :"hostId/portNo/historyFile/faultId"

        FAAPI.openReport(String hostId, int portNo, String historyFile, String faultId);

Both interfaces perform the same function, only the style of argument-specification differs. All arguments are case-sensitive.

Here are examples using both interfaces of how to open fault entry F03004 in history file DA.DCAT on system pthfae1, which listens on port 7799:


        FAAPI.openReport("pthfae1/7799/DA.DCAT/F03004");

        FAAPI.openReport("pthfae1", 7799, "DA.DCAT", "F03004");

Example

This example shows how to extend the Hello, World Command sample plug-in in Eclipse to open a Fault Analyzer report. Follow these steps to create the Hello, World Command sample plug-in, and then modify it to download and open a Fault Analyzer report.

  1. In IBM® Explorer for z/OS®, activate the Java perspective.
  2. Activate the plug-ins for the ADFz family of products.
  3. Click New -> Plug-in Project. The Plug-in Project window.
  4. Enter a Project name (in this sample FAAPITest) and then click Next. The New Plug-in Project Content window.
  5. Click Next. The New Plug-in Project Templates window.
  6. Select the Hello, World Command template and click Next. The New Plug-in Project Sample Command Contribution window.
  7. Click Finish. If you receive the following message, click Yes. The New Plug-in Project Templates window.

At this stage, FAAPITest is created. To run the generated plug-in at this stage, follow these steps:

  1. Click FAAPITest in Package Explorer.
  2. Click Run from the main menu and choose Run.
  3. Select Eclipse Application and click OK. The Run As window.
  4. The running environment displays. the following window. Click Sample Menu > Sample Command. The IBM Explorer for z/OS window.
  5. The following message appears on the screen: Hello, Eclipse world window.
  6. Click OK and close the running Eclipse environment.

Now change the FAAPITest plug-in to show a fault entry when you click Sample Menu -> Sample Command:

  1. Open MANIFEST.MF. This file exists in the META-INF folder of the FAAPITest plug-in.
  2. Click the Dependencies tab. Then click Add... for required plug-ins and select com.ibm.etools.fa.pdtclient.ui. Click OK and save the MANIFEST file.
  3. Open faapitest.handlers.SampleHandler.java and modify the run method as shown in the following example:
    
    package faapitest.handlers;
    
    import org.eclipse.core.commands.AbstractHandler;
    import org.eclipse.core.commands.ExecutionEvent;
    import org.eclipse.core.commands.ExecutionException;
    import org.eclipse.ui.IWorkbenchWindow;
    import org.eclipse.ui.handlers.HandlerUtil;
    import org.eclipse.jface.dialogs.MessageDialog;
    
    public class SampleHandler extends AbstractHandler {
    
    	@Override
    	public Object execute(ExecutionEvent event) throws ExecutionException {
    		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    		MessageDialog.openInformation(
    				window.getShell(),
    				"FAApiTest",
    				"Hello, Eclipse world");
    		return null;
    	}
    }
    
  4. Run the modified plug-in as explained earlier.
  5. Make sure that the system is defined in the Systems Information view. If not, add the system.
  6. Click Sample Menu -> Sample Command. The report is downloaded and displayed in the current perspective in the Eclipse editor area.