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

public class Job

extends java.lang.Object

This class implements an interface on ITP/Server for job submission.

Example

The following example shows how to submit a job to an (local) ITP/Server server to run an ITP Model. The result document will be returned in PDF format, for which we implement the ITPDSDataReceiver interface. For the ITP/Server service the following parameters are defined:

  1. ITP Model to be executed.
  2. XML data input for the model.

The ITP/Server 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)
      {
      }
    }
 
    ....
 
  }

Constructor

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

This creates an ITP/Server job for an ITP/Server server and instance specified by host and port.

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

Create an ITP/Server job for an ITP/Server server and instance specified by host and port. The job will be identified by a specified jobID.

Parameters:

Methods

setProgressListener
public void setProgressListener(ProgressListener audience)

Enables a so-called ProgressListener for this ITP/Server job. The ProgressListener will receive all progress events.

Parameters:
setAdvancedCapabilities
public void setAdvancedCapabilities(ITPDSDataSender sender, ITPDSDataReceiver receiver)

Tells the server that this client implements advanced capabilities.

Parameters:
setAdvancedCapabilities
public void setAdvancedCapabilities(ITPDSDataSender sender,ITPDSDataReceiver receiver,ITPDSExchangeData exchange_data)

Tells the server, which advanced capabilities this client implements.

Parameters:
setConfirmDisconnect
public void setConfirmDisconnect(boolean confirm_disconnect)

Configures whether the disconnect from the server will be confirmed.

addParameter
public void addParameter(java.lang.String parameter)

Adds a single parameter string to the parameter list for this job.

Parameters:
setParameters
public void setParameters(java.lang.String[] parameters)

Sets the list of job parameters.

Parameters:
clearParameters
public void clearParameters()

Clears the parameter list.

setHost
public void setHost(java.lang.String host)

Sets the ITP/Server server for this job.

Parameters:
setPort
public void setPort(java.lang.String port)

Sets the ITP/Server instance port for this job.

Parameters:
setServer
public void setServer(java.lang.String host, java.lang.String port)

Sets the ITP/Server server and instance for this job.

Parameters:
setJobID
public void setJobID(java.lang.String jobID)

Sets the ITP/Server job identifier for this job.

Parameters:
setSessionID
public void setSessionID(java.lang.String sessionID)

Sets the ITP/Server session identifier for this job.

Parameters:
getParameters
public java.lang.String[] getParameters()

Returns the current parameter list for this job.

Returns:
getHost
public java.lang.String getHost()

Return ITP/Server server for this job.

Returns:
getPort
public java.lang.String getPort()

Return ITP/Server instance port for this job.

Returns:
getJobID
public java.lang.String getJobID()

Return ITP/Server job identifier for this job.

Returns:
getSessionID
public java.lang.String getSessionID()

Return ITP/Server session identifier for this job.

Returns:
getLastError

public java.lang.String getLastError()

Returns the last known error if there is one.

Returns:
submit

public boolean submit(boolean sync) throws java.lang.Exception

Method used to submit a job to ITP/Server, using the properties and parameters specified in the job. This method will return true if the job was asynchronous and the job was queued, or if the job was synchronous and successfully finished processing. If the job was synchronous, and not completed successfully, false will be returned instead. If the job is asynchronous, the connection is closed after the job is queued, denying all possibilities for feedback (progress information) and data transfers.

Parameters:

sync - Specifies whether the job will be submitted synchronous or asynchronous.

For more information refer to: getLastError()

submit

public boolean submit(boolean sync, java.lang.String user) throws java.lang.Exception

Method used to submit a job to ITP/Server using the properties and parameters specified in the job. This method will return true if the job was asynchronous and the job was queued, or if the job was synchronous and successfully finished processing. If the job was synchronous and not completed successfully, false will be returned instead. If the job is asynchronous, the connection is closed after the job is queued, denying all possibilities for feedback and other transfers, such as that of files.

Parameters:
submit

public boolean submit(boolean sync, int ByteCoding) throws java.lang.Exception

Method used to submit a job to ITP/Server, using the properties and parameters specified in the job. This method will return true if the job was asynchronous and the job was queued, or if the job was synchronous and successfully finished processing. If the job was synchronous and not completed successfully, false will be returned instead. If the job is asynchronous, the connection is closed after the job is queued, denying all possibilities for feedback and other transfers, such as that of files.

Parameters:
submit

public boolean submit(boolean sync, java.lang.String user, int byteCoding) throws java.lang.Exception

Method used to submit a job to ITP/Server, using the properties and parameters specified in the job. This method will return true if the job was asynchronous and the job was queued, or if the job was synchronous and successfully finished processing. If the job was synchronous and not completed successfully, false will be returned instead. If the job is asynchronous, the connection is closed after the job is queued, denying all possibilities for feedback and other transfers, such as that of files.

Parameters: