Job class

The following is a public class job that extends java.lang.Object. This class implements an interface on KCM Core for job submission.

java.lang.Object
  |
  +--com.aia_itp.itpdsapi.Job

The following example shows how to submit a job to a local KCM Core server to run a template. The result document is returned in PDF format for which the ITPDSDataReceiver interface is implemented. For the KCM Core Service, the following parameters are defined:

  • Template to be executed.
  • XML data input for the template.

The KCM Core Service is configured on port 5335.

  import com.aia_itp.itpdsapi.*;
  import java.io.*;
  
  class MyClass implements ITPDSDataReceiver {
    static String PORT_ITPSERVER= "3001";
 
    ....
 
    public void ProduceDocument(String model, String xmldata) throws Exception {
      Job j = new Job("127.0.0.1", PORT_ITPSERVER);
      j.addParameter("RunMdlPdf"); // Service name
      j.addParameter(model);
      j.addParameter(xmldata);
      j.setAdvancedCapabilities(null, this);
      if(!j.submit(true)){
        throw new Exception(j.getLastError());
      }
    }
 
    public OutputStream ITPDSReceiveData(String DataItem)
    {
      try
      {
        return new BufferedOutputStream(new FileOutputStream("/temp/myfile.pdf"));
      }
      catch (FileNotFoundException e)
      {
        return null;
      }
    }
 
    public void ITPDSReceiveDataFinished(String DataItem, OutputStream out){
      try
      {
        out.close();
      }
      catch (IOException e)
      {
      }
    }
 
    ....
 
  }

The following job creates a KCM Core job for a KCM Core server and instance specified by host and port.

 public Job(java.lang.String host, java.lang.String port)

The job has two parameters:

  1. host. IP address or host name of the KCM Core server
  2. port. Port on which the KCM Core instance is configured on the server

The following job creates a KCM Core job for a KCM Core server and instance specified by host and port. The job is identified by a specified jobID.

public Job(java.lang.String host,java.lang.String port, java.lang.String jobID)

The job has three parameters:

  1. host. IP address or host name of the KCM Core server
  2. port. Port on which the KCM Core instance is configured on the server
  3. jobID. ID identifying the job. This ID is shown in the monitor and in the log