01.02.2013 Views

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Debugging Applications that Use <strong>the</strong> Event-Driven <strong>Publishing</strong> API<br />

You can use <strong>the</strong> returned status record for fetching information about <strong>the</strong> status of<br />

your job.<br />

17.1.5 Using <strong>the</strong> Servers' Status Record<br />

The status record contains processing information about your job. It contains <strong>the</strong> same<br />

information found in <strong>the</strong> server queue (SHOWJOBS). Additionally, it contains<br />

information about <strong>the</strong> files produced for finished jobs and <strong>the</strong> lineage for scheduled<br />

jobs.<br />

The most important information in <strong>the</strong> status record is <strong>the</strong> current job status and <strong>the</strong><br />

status text, used in turn <strong>to</strong> check for runtime errors and <strong>the</strong>ir causes.<br />

You can use timing information <strong>to</strong> determine if a job is subject <strong>to</strong> cancellation because<br />

it has exceeded its predicted time for completion.<br />

One way <strong>to</strong> use <strong>the</strong> status record is <strong>to</strong> cancel a job. The Event-Driven <strong>Publishing</strong> API<br />

offers a method for cancelling a job that has been submitted <strong>to</strong> <strong>the</strong> server. This might<br />

be handy if you want <strong>to</strong> remove a job that has exceeded its allowed time <strong>to</strong> run or if<br />

you simply have scheduled jobs you want <strong>to</strong> cancel.<br />

To cancel a job, use <strong>the</strong> following procedure:<br />

DECLARE<br />

myPlist SRW_PARAMLIST;<br />

myIdent SRW.JOB_IDENT;<br />

myStatus SRW.STATUS_RECORD;<br />

BEGIN<br />

myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));<br />

SRW.ADD_PARAMETER(myPlist,'GATEWAY','http://…');<br />

SRW.ADD_PARAMETER(myPlist,'SERVER','mySVR');<br />

SRW.ADD_PARAMETER(myPlist,'REPORT','myReport.RDF');<br />

SRW.ADD_PARAMETER(myPlist,'USERID','me/secret');<br />

myIdent := SRW.RUN_REPORT(myPlist);<br />

myStatus := SRW.REPORT_STATUS(myIdent);<br />

if myStatus.StatusCode != srw.RUNNING <strong>the</strong>n<br />

SRW.CANCEL_REPORT(myIdent);<br />

END;<br />

As evident in this example, you cancel a report by calling <strong>the</strong> CANCEL_REPORT<br />

procedure (SRW.CANCEL_REPORT) and passing it <strong>the</strong> job_ident record of <strong>the</strong> job<br />

you want <strong>to</strong> cancel. The procedure takes an optional parameter list <strong>to</strong> enable you <strong>to</strong><br />

pass any additional parameters you might need.<br />

17.2 Debugging Applications that Use <strong>the</strong> Event-Driven <strong>Publishing</strong> API<br />

Because <strong>the</strong>se processes all run behind <strong>the</strong> scenes, <strong>the</strong>re is no actual place where<br />

debugging information is produced during normal execution. Therefore, <strong>the</strong> API has<br />

two procedures that <strong>to</strong>ggle a special debugging mode that produces extensive<br />

debugging information via DBMS_OUTPUT:<br />

■ SRW.START_DEBUGGING<br />

■ SRW.STOP_DEBUGGING<br />

To switch on debugging mode simply call SRW.START_DEBUGGING and <strong>to</strong> s<strong>to</strong>p it call<br />

SRW.STOP_DEBUGGING. The debugging-mode must be started immediately before<br />

you run your actual logic. It stays on as long as <strong>the</strong> current instance of <strong>the</strong> package is<br />

loaded.<br />

Using Event-Driven <strong>Publishing</strong> 17-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!