Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Example: File transfer using JadeJob
The following scenario is given:
...
Graphical Representation of the Solution
Graphviz |
---|
digraph "Example: File Transfer using JadeJob"\{
graph [rankdir=TB]
node [fontsize=10]
node [style=filled,fillcolor=aquamarine]
checkDB [shape=Mrecord, label="\{checkDB | \{GO|no_GO \}\}"]
checkEncrypted [shape=Mrecord, label="\{checkEncrypted | \{Yes|No\}\}"]
checkDB:GO -> checkEncrypted
checkDB:no_GO -> WAITING
checkEncrypted:Yes -> transportSourceToLocal -> encrypt -> transportLocalToTarget -> report
checkEncrypted:No -> transportSourceToTarget -> report
\}
|
...
For the connection to the Oracle™ RDBMSDB we use the pl/sql script plsql_script.txt which is executed by the JAVA-AdapterClass
{*}sos.scheduler.db.JobSchedulerPLSQLJobJSAdapterClass{*}.
The pl/sql script is defined as
Code Block |
---|
declare
status varchar2(64);
sourcefilepath varchar2(2048);
sourcefilename varchar2(2048);
targetfilepath varchar2(2048);
targetfilename varchar2(2048);
encryptedyn varchar2(16);
begin
select STATUS, SOURCEFILEPATH, SOURCEFILENAME, TARGETFILEPATH, TARGETFILENAME, ENCRYPTEDYN
into status, sourcefilepath, sourcefilename, targetfilepath, targetfilename, encryptedyn
from scenario1;
dbms_output.put_line('status=' || status);
dbms_output.put_line('sourcefilepath=' || sourcefilepath);
dbms_output.put_line('sourcefilename=' || sourcefilename);
dbms_output.put_line('targetfilepath=' || targetfilepath);
dbms_output.put_line('targetfilename=' || targetfilename);
dbms_output.put_line('encryptedyn=' || encryptedyn);
end;
|
...
For the interpretation of the table status "GO" a postprocessing routine is used (here programmed in javax.script:rhino)
Code Block |
---|
function spooler_process_after(spooler_process_result) \{ var params = spooler_task.order().params(); var status = params.value("status"); if ( status == "GO" ) \{ spooler_log.info("Table status is \"GO\", continue!"); \} else \{ spooler_log.info("Waiting until table status is \"GO\" ..."); spooler_task.order().set_state("WAITING"); \} return spooler_process_result; \} |
CheckFileExists: check File exist
The file defined by the parameters sourcefilepath and sourcefilename is checked with the JITL job
sos.scheduler.file.JobSchedulerExistsFile.
checkEncrypted: Interpretation of Parameter encryptedyn
The value of the parameter encryptedyn decides wether the file is to be encrypted or not. The encryption is done in a local copy of the file, therefore different steps of the jobchain are used. The functions are part of the job checkEncrypted programmed in javax.script:rhino.
Code Block |
---|
function spooler_process()\{ spooler_log.info("------- " + spooler_job.name() + " -------"); var encryptedyn = spooler_task.order().params().value("encryptedyn"); if ( "Y" == encryptedyn ) \{ spooler_log.info("Encryption required"); spooler_task.order().set_state("transportSourceToLocal"); \} else if ( "N" == encryptedyn ) \{ spooler_log.info("No encryption required"); spooler_task.order().set_state("transportSourceToTarget"); \} else \{ spooler_log.error("encryptedyn = \"" + encryptedyn + "\" (must be Y or N)"); return false; \} return true; \} |
In case of encrypting we have the steps
...