• No results found

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

java.lang.Object

| +--com.aia_itp.itpdsapi.Job

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

• Template to be executed.

• XML data input for the template.

The CCM 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

The following job creates a CCM Core job for a CCM 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 CCM Core server

2. port. Port on which the CCM Core instance is configured on the server

The following job creates a CCM Core job for a CCM 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 CCM Core server

2. port. Port on which the CCM Core instance is configured on the server 3. jobID. ID identifying the job. This ID is shown in the monitor and in the log

Methods

The Java submission interface includes the following methods.

setProgressListener

public void setProgressListener(ProgressListener audience)

This method enables ProgressListener for this CCM Core job. ProgressListener receives all progress events.

The method has one parameter:

1. audience. Object implementing the ProgressListener interface.

setAdvancedCapabilities

public void setAdvancedCapabilities(ITPDSDataSender sender,ITPDSDataReceiver receiver) This method tells the server that this client implements advanced capabilities.

It has two parameters:

1. sender. Object implementing the ITPDSDataSender interface.

2. receiver. Object implementing the ITPDSDataReceiver.

setAdvancedCapabilities

public void setAdvancedCapabilities(ITPDSDataSender sender,ITPDSDataReceiver receiver,ITPDSExchangeData

exchange_data)

This method tells the server which advanced capabilities this client implements.

It has three parameters:

1. sender. Object implementing the ITPDSDataSender interface.

2. receiver. Object implementing the ITPDSDataReceiver interface.

3. exchange_data. Object implementing the ITPDSExchangeData interface.

setConfirmDisconnect

public void setConfirmDisconnect(boolean confirm_disconnect) This method configures whether the disconnect from the server is confirmed.

addParameter

public void addParameter(java.lang.String parameter)

This method adds a single parameter string to the parameter list for this job.

It has one parameter:

1. parameter. Job parameter.

setParameters

public void setParameters(java.lang.String[] parameters) This method sets the list of job parameters.

It has one parameter:

1. parameters. An array of job parameters (strings).

clearParameters

public void clearParameters() This method clears the parameter list.

setHost

public void setHost(java.lang.String host) This method sets the CCM Core server for this job.

It has one parameter:

1. host. IP address or host name of the CCM Core server.

setPort

public void setPort(java.lang.String port) This method sets the CCM Core instance port for this job.

It has one parameter:

1. port. Port using which the CCM Core instance is configured on the server.

setServer

public void setServer(java.lang.String host, java.lang.String port) This method sets the CCM Core server and instance for this job.

It has two parameters:

1. host. IP address or host name of the CCM Core server.

2. port. Port using which the CCM Core instance is configured on the server.

setJobID

public void setJobID(java.lang.String jobID) This method sets the CCM Core job identifier for this job.

It has one parameter:

1. jobID. Job identifier.

setSessionID

public void setSessionID(java.lang.String sessionID) This method sets the CCM Core session identifier for this job.

It has one parameter:

1. sessionID. Session identifier.

getParameters

public java.lang.String[] getParameters() This method returns the current parameter list for this job.

getHost

public java.lang.String getHost()

This method returns CCM Core server for this job.

getPort

public java.lang.String getPort()

This method returns CCM Core instance port for this job.

getJobID

public java.lang.String getJobID()

This method returns CCM Core job identifier for this job.

getSessionID

public java.lang.String getSessionID()

This method returns CCM Core session identifier for this job.

getLastError

public java.lang.String getLastError()

This method returns the last known error if there is one.

submit

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

You can use this method to submit a job to CCM Core using the properties and parameters specified in the job. This method returns 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 did not complete successfully, the method returns FALSE. If the job is asynchronous, the connection is closed after the job is queued, denying all possibilities for progress information and data transfers.

It has one parameter:

1. sync. Specifies whether the job is submitted synchronously or asynchronously.

submit

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

This method is used to submit a job to CCM Core using the properties and parameters specified in the job. This method returns 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 did not complete successfully, the method returns FALSE. 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.

It has two parameters:

1. sync. Specifies whether the job is submitted synchronously or asynchronously.

2. user. Submits the job with this userid. The userid does not have to exist.

submit

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

This method is used to submit a job to CCM Core using the properties and parameters specified in the job. This method returns 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.

It has two parameters:

1. sync. Specifies whether the job is submitted synchronously or asynchronously.

2. ByteCoding. Submits the job using this byte coding. ByteCoding can be either ITPDS.RQST_IN_ASCII or ITPDS.RQST_IN_UNICODE.

submit

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

It throws java.lang.Exception.

This method is used to submit a job to CCM Core, using the properties and parameters specified in the job. This method returns 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 did not complete successfully, the method returns FALSE. 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.

It has three parameters:

1. sync. Specifies whether the job is submitted synchronously or asynchronously.

2. user. Submits the job with this userid. The userid does not have to exist.

3. ByteCoding. Submits the job using this byte coding. ByteCoding can be either ITPDS.RQST_IN_ASCII or ITPDS.RQST_IN_UNICODE.

Related documents