Console Service Functions

In this section:

This topic describes Console Service functions and provides examples for each.


Top of page

x
Changing the Order of Job Execution

Function Name: changeJobPriority

Purpose: Given a job ID, which uniquely identifies a job, and an integer of 1 through 5 representing a priority, changes the order of execution to the new priority.

Input

Description

Type

Authentication information.

Authenticate

Job ID. Unique identifier for the job.

String

Priority. The order of execution of a job on queue of the Distribution Server. 1 is the highest and 5 is the lowest.

Integer

Output

Description

There is no output for this function. If it fails, it will throw an exception.



Example: Changing the Order of Job Execution in Visual Basic .NET

In the following example, the job priority for a specific job in the job queue is changed. The getJobsInQueue function is run to retrieve a list of jobs awaiting execution.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getJobsInQueue(CAuthenticate)
   C.changeJobPriority(CAuthenticate, Jobs(4).id, 3)    
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Changing the Order of Job Execution in Java

In the following example, the job priority for a specific job in the job queue is changed. The getJobsInQueue function is run to retrieve a list of jobs awaiting execution.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getJobsInQueue(Authobj);
C.changeJobPriority(Authobj,jobs[4].getId(),3);
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

Top of page

x
Retrieving a List of Jobs on Queue to Run on the Distribution Server

Function Name: getJobsInQueue

Purpose: Retrieves a list of all jobs that are currently on queue to run on the Distribution Server.

Input

Description

Type

Authentication information.

Authenticate

Output

Description

Type

List of job information.

Job



Example: Retrieving a List of Jobs on Queue in Visual Basic .NET

In the following example, a list of jobs from the job queue that are waiting to be run is retrieved. The job ID, schedule description, and date/time that the job was sent to the queue are written to the RCjobsInQueue.txt file.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   Dim newOutput As String
   Dim tempfile As String
   Dim i As Integer
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getJobsInQueue(CAuthenticate)
   tempfile = "d:\RCtemp\RCjobsInQueue.txt"
   FileOpen(1, tempfile, OpenMode.Output)
   For i = 0 To Jobs.Length - 1
         newOutput = Jobs(i).id + " " + _
                     Jobs(i).schedule.description + " " + _
                     Jobs(i).startTime
         PrintLine(1, newOutput)
   Next i
   FileClose(1)                                                                        
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Retrieving a List of Jobs on Queue in Java

In the following example, a list of jobs from the job queue that are waiting to be run is retrieved. The job ID, schedule description, and date/time that the job was sent to the queue are written to the RCjobsInQueue.txt file.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getJobsInQueue(Authobj);
File tempfile = new File("d:\\RCtemp\\RCjobsInQueue.txt");
FileOutputStream fos = new FileOutputStream(tempfile);
PrintWriter out=new PrintWriter(fos);
SimpleDateFormat sdf = new SimpleDateFormat();
for ( int i=0; i<jobs.length; i++ )
{
         String newOutput = jobs[i].getId() + " " +
                            jobs[i].getSchedule().getDescription() + " " +
                            sdf.format(jobs[i].getStartTime().getTime());
         out.println(newOutput);
}
out.close();
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

Top of page

x
Retrieving a List of Jobs on Queue That Have a Specific Owner

Function Name: getJobsInQueueByOwner

Purpose: Retrieves a list of jobs having a specific owner that are currently on queue to run on the Distribution Server.

Input

Description

Type

Authentication information.

Authenticate

User name of job owner.

String

Output

Description

Type

List of job information.

Job



Example: Retrieving a List of Jobs on Queue For an Owner in Visual Basic .NET

In the following example, a list of jobs from the job queue that are waiting to be run for a specific owner is retrieved. The job ID, schedule description, and date/time that the job was sent to the queue are written to the RCjobsInQueueByOwner.txt file.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   Dim newOutput As String
   Dim tempfile As String
   Dim i As Integer
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getJobsInQueueByOwner(CAuthenticate, "admin")
   tempfile = "d:\RCtemp\RCjobsInQueueByOwner.txt"
   FileOpen(1, tempfile, OpenMode.Output)
   For i = 0 To Jobs.Length - 1
         newOutput = Jobs(i).id + " " + _
                     Jobs(i).schedule.description + " " + _
                     Jobs(i).startTime
         PrintLine(1, newOutput)
   Next i
   FileClose(1)    
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Retrieving a List of Jobs on Queue For an Owner in Java

In the following example, a list of jobs from the job queue that are waiting to be run for a specific owner is retrieved. The job ID, schedule description, and date/time that the job was sent to the queue are written to the RCjobsInQueueByOwner.txt file.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getJobsInQueueByOwner(Authobj,"admin");
File tempfile = new File("d:\\RCtemp\\RCjobsInQueueByOwner.txt");
FileOutputStream fos = new FileOutputStream(tempfile);
PrintWriter out=new PrintWriter(fos);
SimpleDateFormat sdf = new SimpleDateFormat();
for ( int i=0; i<jobs.length; i++ )
{
         String newOutput = jobs[i].getId() + " " +
                            jobs[i].getSchedule().getDescription() + " " +
                            sdf.format(jobs[i].getStartTime().getTime());
         out.println(newOutput);
}
out.close();
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

Top of page

x
Retrieving a List of All Jobs Running on the Distribution Server

Function Name: getRunningJobs

Purpose: Retrieves a list of all jobs that are currently running on the Distribution Server.

Input

Description

Type

Authentication information.

Authenticate

Output

Description

Type

List of job information.

Job



Example: Retrieving a List of Running Jobs in Visual Basic .NET

In the following example, a list of jobs from the job queue that are currently running is retrieved. The job ID, schedule description, and date/time that the job started running are written to the RCjobsRunning.txt file.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   Dim newOutput As String
   Dim tempfile As String
   Dim i As Integer
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getRunningJobs(CAuthenticate)
   tempfile = "d:\RCtemp\RCjobsRunning.txt"
   FileOpen(1, tempfile, OpenMode.Output)
   For i = 0 To Jobs.Length - 1
         newOutput = Jobs(i).id + " " + _
                     Jobs(i).schedule.description + " " + _
                     Jobs(i).startTime
         PrintLine(1, newOutput)
   Next i
   FileClose(1)   
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Retrieving a List of Running Jobs in Java

In the following example, a list of jobs from the job queue that are currently running is retrieved. The job ID, schedule description, and date/time that the job started running are written to the RCjobsRunning.txt file.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getRunningJobs(Authobj);
File tempfile = new File("d:\\RCtemp\\RCjobsRunning.txt");
FileOutputStream fos = new FileOutputStream(tempfile);
PrintWriter out=new PrintWriter(fos);
SimpleDateFormat sdf = new SimpleDateFormat();
for ( int i=0; i<jobs.length; i++ )
{
         String newOutput = jobs[i].getId() + " " +
                            jobs[i].getSchedule().getDescription() + " " +
                            sdf.format(jobs[i].getStartTime().getTime());
         out.println(newOutput);
}
out.close();
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

Top of page

x
Retrieving a List of All Jobs Belonging to a Specific Owner

Function Name: getRunningJobsByOwner

Purpose: Retrieves a list of all jobs that are currently running on the Distribution Server which belong to a specific owner.

Input

Description

Type

Authentication information.

Authenticate

User name of job owner.

String

Output

Description

Type

List of job information.

Job



Example: Retrieving a List of Running Jobs By Owner in Visual Basic .NET

In the following example, a list of jobs from the job queue for a specific owner that are currently running is retrieved. The job ID, schedule description, and date/time that the job started running are written to the RCjobsRunningByOwner.txt file.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   Dim newOutput As String
   Dim tempfile As String
   Dim i As Integer
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getRunningJobsByOwner(CAuthenticate, "admin")
   tempfile = "d:\RCtemp\RCjobsRunningByOwner.txt"
   FileOpen(1, tempfile, OpenMode.Output)
   For i = 0 To Jobs.Length - 1
         newOutput = Jobs(i).id + " " + _
                     Jobs(i).schedule.description + " " + _
                     Jobs(i).startTime
         PrintLine(1, newOutput)
   Next i
   FileClose(1)
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Retrieving a List of Running Jobs By Owner in Java

In the following example, a list of jobs from the job queue for a specific owner that are currently running is retrieved. The job ID, schedule description, and date/time that the job started running are written to the RCjobsRunningByOwner.txt file.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getRunningJobsByOwner(Authobj,"admin");
File tempfile = new File("d:\\RCtemp\\RCjobsRunningByOwner.txt");
FileOutputStream fos = new FileOutputStream(tempfile);
PrintWriter out=new PrintWriter(fos);
SimpleDateFormat sdf = new SimpleDateFormat();
for ( int i=0; i<jobs.length; i++ )
{
         String newOutput = jobs[i].getId() + " " +
                            jobs[i].getSchedule().getDescription() + " " +
                            sdf.format(jobs[i].getStartTime().getTime());
         out.println(newOutput);
}
out.close();
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

Top of page

x
Removing a Job From the Distribution Server Queue

Function Name: removeJobFromQueue

Purpose: Provided with a specific job ID, which uniquely identifies a job, removes the job from ReportCaster's Distribution Server queue.

Input

Description

Type

Authentication information.

Authenticate

Job ID that identifies a job.

String.

Output

Description

There is no output for this function. If it fails, it will throw an exception.



Example: Removing a Job From the Distribution Queue in Visual Basic .NET

In the following example, a job from the job queue is removed. The getJobsInQueue function is run to retrieve a list of jobs awaiting execution.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim C As New CManager.ConsoleManagerWSService
   Dim SecToken As String
   Dim CAuthenticate As New CManager.Authenticate
   Dim Jobs() As CManager.Job
   SecToken = RCLogon.logon("admin", "")
   CAuthenticate.securityToken = SecToken
   Jobs = C.getJobsInQueue(CAuthenticate)
   C.removeJobFromQueue(CAuthenticate, Jobs(4).id)
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Removing a Job From the Distribution Queue in Java

In the following example, a job from the job queue is removed. The getJobsInQueue function is run to retrieve a list of jobs awaiting execution.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
ConsoleManagerWSService CService = new ConsoleManagerWSServiceLocator();
ConsoleManagerWS C = CService.getConsoleService();
String sectoken = RCLogon.logon("admin","");
Authenticate Authobj = new Authenticate();
Authobj.setSecurityToken(sectoken);
Job[] jobs = C.getJobsInQueue(Authobj);
C.removeJobFromQueue(Authobj,jobs[4].getId());
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
}

WebFOCUS