| 
3.
Additional classes 3.1
Plugin Resource Class Create
a class oracle.reports.plugin.datasource.mypds.myTextResource to map
the messages and error numbers used in your PDS. Use this class to add customized
error messages, numbers, constant string names. Text
PDS uses TextResource class to achieve the above. It uses a TextBundle
class in oracle.reports.plugin.datasource.textpds.resource package to
map error numbers with corresponding strings. There is one TextBundle
class for each NLS. For e.g. TextBundle.class for strings in English,
TextBundle_ar.class for strings in Arabic and so on.
3.2
PluginException class for handling runtime exceptions
Each public Plugin
method throws oracle.reports.plugin.PluginException to
pass any important message in case of an exception.
Use this exception class
to pass necessary error information to the log or UI. The PluginException expects
3 parameters public PluginException(String module, int errorCode,
String errorMsg) for
eg: throw new PluginException("TextPDS", 0, "TextDataSource.execute()");
The error code of the exception
has to be defined for each module The
oracle.reports.plugin.datasource.textpds.resource.TextBundle class defines
some error code and corresponding error message
static final Object[][] contents = { {"63500",
"No URL specified for {0}"}, {"63501", "URL {0}
specified is not according to the file format {1} at line number {2} "},
} throw
new PluginException("TextPDS", TextResource.ERROR_NO_URL, err); The
{0} will be replaced with "err" in the final error message.
3.3
Configuration File If
you PDS has a configuration
file, copy it
to the <ORACLEHOME>\reports\conf directory.
Text PDS has an XML based configuration file.
Register the configuration
file for a PDS in rwbuilder.conf or <myServer>.conf
<pluginParam name="xmlpds" type="file">xmlpds.conf</pluginParam>
<pluginParam name="jdbcpds" type="file">jdbcpds.conf</pluginParam>
<pluginParam name="textpds" type="file">textpds.conf</pluginParam>
Plugin gives API
to fetch the contents of the configuration file as a String as below TextDataSource
protected void extractConfigFile() {
..
String XMLColumnData = getReportContext().getPluginParam("textpds");
}
The contents of this would be read once when the Text
PDS is initialized. Reports
provides a configuration file to store your proxy server information.
see <ORA_HOME>/reports/conf/proxyinfo.xml.
To have your own
proxy configuration, place the file in the directory <ORACLEHOME>/reports/conf/myproxyinfo.xml.
Comment the
following line in rwbuilder.conf or <myServer>.conf
<!--pluginParam name="proxy" type="file">myproxyinfo.xml</pluginParam-->
Plugin gives API
to fetch the contents of the proxy configuration file as a String as below
TextDataSource
protected void extractConfigFile() {
..
String XMLProxyData = getReportContext().getPluginParam("proxy"); }
3.4
Plugin Tracing You
can log error or debug message of your PDS using Plugin tracing facility. To do
so, 1. import
the class: oracle.reports.plugin.utility.Trace;
2. get the Reports Trace object as
Trace mytrace = getReportContext().getTrace();
3. mytrace.writeln(
int traceFlag, String location, String message ); e.g.:
try {
mytrace.writeln(Trace.DEBUG, "textpds", msg);
} catch (Exception e) {
} 
|