Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor addition to 'Object Creation'

...

  • Up to and including Release 1.12.7, there must be a sub-folder in the live/sos folder called rest, containing a Job createApiAccessToken.job.xml and a Job Chain createApiAccessToken.job_chain.xml. These objects provided by default with a new installation or update of the JOC cockpitCockpit. They are not required for Releases 1.12.8 and newer.
    (For details see
    JIRA
    serverSOS JIRA
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJITL-525
    ).
  • A user that has been granted at least the sos:products:joc_cockpit:history:view permission has to be specified in the private.conf file. Note that the api_user role defined in the shiro.ini-example file has these permissions by default. More information about the private.conf file can be found below.

Object Creation

To create the object:

Code Block
function spooler_process()  {
 
    // using the current job name
    var jobHistoryInfo = getJobHistoryInfoObject("job1");
    ...
    return false;
}
 
 function getJobHistoryInfoObject(jobname, timelimit) {
    var jobHistory = new Packages.com.sos.jitl.checkhistory.JobHistory( spooler.delegate );

    if ((jobname === undefined) || (jobname === "")) {
      jobname = spooler_task.job.name;
    }
    if (timelimit === undefined) {
       timelimit = "";
    }

    var jobHistoryInfo = jobHistory.getJobInfo( jobname, timelimit );
    return jobHistoryInfo;
}

Note that in the above example the job1 Parameter in the spooler_process function has to include the full path within the JobScheduler live folder.

Object Methods

The object provides the following methods:

...

  • There must be a valid access token for a user that has the permission:
    • sos:products:joc_cockpit:history:view (e.g. api_user with the api_user role).
  • You can use the com.sos.jitl.restclient.CreateApiAccessToken pre-processing monitor (see the example below) to make sure that this user is logged in.
    • Note that the functions provided by this monitor are integrated in the Java job implementation described below.
  • The monitor will check whether there is a valid access token.
  • A valid access token will be created if one is not found:
    • For this the configuration stored in /sos/rest (see attached rest.zip file) is needed.
      • You have to configure the correct JOC Url and the user account there.
  • No parameters are necessary for the monitor. The user and password are not necessary per job/order configuration.
  • The /sos/rest/createApiAccessToken Job must be configured:
    • The job reads the value for the joc_url and the user credentials from the config/.private.conf file.
    • The values are stored in joc.webservice.jitl in the joc.account key and joc.url.
    • If not there the values from root with the same keys will be read.

...