Developing Diagnostic Plug-Ins
This section discusses how to:
Create the diagnostic application package.
Create the diagnostic application classes.
Implement the diagnostic PeopleCode.
Register the diagnostic plug-in.
Share diagnostic plug-ins
Note: Except for registering the Diagnostic Plug-in, which is performed using a PIA page, you complete all of these development steps using Application Designer.
Creating the Diagnostic Application Package
To create a diagnostic application package: Open the application package in Application Designer, Save the package.
In Application Designer select File, New, Application Package.
Save and name the package.
Creating the Diagnostic 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.
Implementing the Diagnostic PeopleCode
To implement the diagnostic PeopleCode:
Open the PeopleCode editor ().
Import the PTDiagnostic package, by entering:
This imports all the classes in the PT_DIAGNOSTICS application package.
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.
Define the following mandatory methods:
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);
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>).
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;
Registering the Diagnostic Plug-In
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:
Access the Register Diagnostics page by selecting.
Add a row, if needed.
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.
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.
Sharing Diagnostic Definitions
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:
application package PeopleCode
To insert a plug-in into a project:
In Application Designer, select.
Select Diagnostic Plug-Ins as the definition type.
Select the plug-in and click Insert.
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:
Open the project containing the diagnostic definitions in Application Designer.
Select Tools, Copy Project, to File.
Share the generated XML file with the interested parties.