Developing Diagnostic Plug-Ins

This section discusses creation, implementation, and registration of diagnostic plug-ins.

Note: Except for registering the Diagnostic Plug-in, which is performed using a PIA page, you complete all of the development steps using Application Designer.

To create a diagnostic application package: Open the application package in Application Designer, Save the package.

  1. In Application Designer select File, New, Application Package.

  2. Save and name the package.

See Understanding Application Classes.

In the application package you've created, create a new application class, and save the class.

Note: You can pass only one data type in each diagnostic plug-in application class. To return multiple data types, define multiple application classes. Results that are passed to the framework are retained in memory.

See Understanding Application Classes.

To implement the diagnostic PeopleCode:

  1. Open the PeopleCode editor (View > PeopleCode).

  2. Import the PTDiagnostic package, by entering:

    import PT_DIAGNOSTICS:*;
  3. This imports all the classes in the PT_DIAGNOSTICS application package.

  4. Define the class, using the same procedure as your would for any PeopleCode program. For example,

    class <class name> extends PTDiagnostic:PTDiagnostic

    This makes the class a diagnostic application class.

    The class name mentioned in the PeopleCode should be the same as the class name which is under the application package.

    All the classes defined in the diagnostic plug-in application package should be extended from the class PTDiagnostic:PTDiagnostic.

  5. Define the following mandatory methods:

    Method

    Description

    Method <class name>

    This is the constructor of the class.

    Inside the method it is mandatory to have%Super = create PT_DIAGNOSTICS:PTDiagnostics().

    More description of %Super resides in the PTDiagnostics application class.

    If you want to display the rowset in the browser, then you have to set the hasRowset property to True, otherwise make it False. For example,

    &status = %Super.SetProperty (%This, "hasRowset", "Boolean", False);

     

    If you want to call additional information from the user during the execution and use it as the search criteria, then set the Where property to true, otherwise make it False. For example,

    &status = %Super.SetProperty (%This, "Where", "Boolean", True);

    Method GetDiagnosticInfo

    This is the method that gets called when you launch the diagnostic plug-in.

    To display any output in the browser you have to call %Super.Insertdata(Data type, <String to name the display>, <variable name>).

    Method IsPlugIn

    The purpose of this method is to identify the application package as a diagnostic plug-in. If this method is not present, then the system does not recognize it as a diagnostic plug-in during the registration process.

    This method should appear at the end of the diagnostic application class, and it should be an empty method.

    The definition of this should be :

    Method IsPlugIn end-method;

Before a diagnostics application package can be used, you have to register it using the Register Diagnostics page. Once the registration is complete, the application package becomes a diagnostic plug-in.

To register a diagnostic plug-in:

  1. Access the Register Diagnostics page by selecting Application Diagnostics > Register Diagnostics.

  2. Add a row, if needed.

  3. In the Plug-In Name edit box, enter the name of the application package, or use the lookup prompt to select it.

    Note: When using the lookup prompt, the system displays all application packages not only diagnostic plug-in packages. When developing custom diagnostic plug-ins, using a naming convention can be helpful to refine the search.

  4. Click Save.

Note: If you have not defined the IsPlugIn method or if it is not at the end of the class, an error message appears. The system only registers application packages containing all the required elements of a diagnostic plug-in.

Once the registration is complete, the application package can be selected as a Diagnostic Plug-In in Application Designer. Inserting diagnostic plug-ins into projects, enables them to be shared, copied to or compared between databases, and exported to and imported from files. Sharing diagnostic plug-ins would be necessary for plug-ins that need to be sent to Oracle support staff for their review, for example, or to other developers at your site.

The project should contain the:

  • Diagnostic plug-in

  • application package

  • application package PeopleCode

To insert a plug-in into a project:

  1. In Application Designer, select Insert > Definitions into Project.

  2. Select Diagnostic Plug-Ins as the definition type.

  3. Select the plug-in and click Insert.

  4. After inserting the plug-in, make sure to include the underlying application packages and application package PeopleCode in the project as well.

Once the diagnostic plug-in definitions have been inserted into a project, you can share a diagnostic plug-in. Check the Upgrade tab to see these definition types: Application Packages, Diagnostic Plug-Ins, and PeopleCode. You cannot see these with the Development tab selected.

To share a diagnostic plug-in:

  1. Open the project containing the diagnostic definitions in Application Designer.

  2. Select Tools, Copy Project, to File.

  3. Share the generated XML file with the interested parties.