Job Class

The Job class provides methods for setting the job parameters and for job submission. This section describes the properties and methods of this class as well as error handling.

Properties

Property Type Description
Host String A string that contains the name of the server running KCM Core. The name can be specified either in (IPv4) Internet Protocol dotted address notation (a.b.c.d) or as a resolvable host name.
Port String A string that contains the port to connect to. The port can be specified either in numerical format or as a resolvable port name (TCP/IP service name).
JobID String A string that contains the Job Identifier for this job.
ApplicationID String Optional. Additional accounting information.
SessionID String Session ID. See Model class.
ConfirmDisconnect Boolean Requires KCM Core to wait for confirmation after completing a job.
LastError String Read-only. The last error message generated.

Methods

setAdvancedCapabilities method

Allows the user of the application to specify callback objects that are involved in communication with the server:

  • Receiving files

  • Transmitting files

  • Exchanging data

public void setAdvancedCapabilities(ITPOLSDataSender sender,
                                      ITPOLSDataReceiver receiver)
  public void setAdvancedCapabilities(ITPOLSDataSender sender,
                                      ITPOLSDataReceiver receiver,
                                      ITPOLSExchangeData exchange_data)

The callback classes have to implement the appropriate interfaces:

public interface ITPOLSDataReceiver {

  /**
   * Method called when the CCM ComposerUI Server server executes a SendFile command.
   * This method should return either null to indicate that it does not want to receive the
   * data or an OutputStream object to which the data will be written.
   * @param DataItem The Dest parameter as passed in 
   * the SendFile Src(...) Dest(...) command.
   */
  public OutputStream ITPOLSReceiveData(String DataItem);

  /**
   * Method called when receipt of the data has been finished.
   * When this method is called all data has been written to the
   * OutputStream returned by ITPOLSReceiveData. It is typically
   * used to close the OutputStream object.
   * @param DataItem The Dest parameter as passed in 
   * the SendFile Src(...) Dest(...) command.
   * @param out The OutputStream object as returned by ITPOLSReceiveData.
   */
  public void ITPOLSReceiveDataFinished(String DataItem, OutputStream out);
}

public interface ITPOLSDataSender {

/**
   * Method called when the CCM ComposerUI Server server executes a ReceiveFile command.
   * This method should return either null to indicate that it does not want to send the
   * data or an ITPOLSInputStream object from which the data will be read. 
   * <p>
   * The InputStream object that is returned must be wrapped in 
   * an ITPOLSInputStream object, because CCM ComposerUI Server requires the size of the data 
   * to be available before actually sending the data.
   *
   * @param DataItem The Src parameter as passed in the ReceiveFile Src(...) command.
   */
  public ITPOLSInputStream ITPOLSSendData(String DataItem);
/**
   * Method call when sending the data has been finished.
   * When this method is called all data has been sent to the CCM ComposerUI Server server. 
   * It is typically used to close the InputStream object.
   *
   * @param DataItem The Src parameter as passed in the ReceiveFile Src(...) command.
   * @param in The ITPOLSInputStream object as returned by ITPOLSSendData.
   */
  public void ITPOLSSendDataFinished(String DataItem, ITPOLSInputStream in);
}

public interface ITPOLSExchangeData
{
  /**
   * Method called when the CCM ComposerUI Server server executes a exchange_data(key, value)
   * function.
   * This method should return a (optionally empty) string to the server.
   *
   * @param Key The Key parameter as passed in the exchange_data function.
   * @param Value The Data parameter as passed in the exchange_data function.
   */
  public String ITPOLSExchangeData(String Key, String Value);}

submit method

The submit functions takes the service name as the first function parameter, followed by a boolean flag that indicates whether job submission is synchronous.

Optional parameters are:

  • User: The user submitting the job. This is "Remote" by default.

  • byteCoding: The encoding of the request, either RQST_IN_ASCII or RQST_IN_UNICODE, which is the default.

public boolean submit (
                    String service,
                    boolean sync) 
              throws Exception
  public boolean submit (
                    String service,
                    boolean sync, 
                    String user) 
              throws Exception
  public boolean submit (
                    String service,
                    boolean sync, 
                    int ByteCoding) 
              throws Exception
  public boolean submit (
                    String service,
                    boolean synchronous,
                    String user,
                    int byteCoding)
              throws Exception

Parameters are set before submit is called.

// Clear the parameter list, for subsequent addParamter() calls
  public void clearParameters()
  // Sets all parameters at once
  public void setParameters(String[] parameters)
  // Adds a single parameter to the parameter list
  public void addParameter(String parameter)