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:
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)
{
}
}
....
}
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.
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.
public void setProgressListener(ProgressListener audience)
Enables a so-called ProgressListener for this ITP/Server job. The ProgressListener will receive all progress events.
public void setAdvancedCapabilities(ITPDSDataSender sender, ITPDSDataReceiver receiver)
Tells the server that this client implements advanced capabilities.
public void setAdvancedCapabilities(ITPDSDataSender sender,ITPDSDataReceiver receiver,ITPDSExchangeData exchange_data)
Tells the server, which advanced capabilities this client implements.
public void setConfirmDisconnect(boolean confirm_disconnect)
Configures whether the disconnect from the server will be confirmed.
public void addParameter(java.lang.String parameter)
Adds a single parameter string to the parameter list for this job.
public void setParameters(java.lang.String[] parameters)
Sets the list of job parameters.
public void clearParameters()
Clears the parameter list.
public void setHost(java.lang.String host)
Sets the ITP/Server server for this job.
public void setPort(java.lang.String port)
Sets the ITP/Server instance port for this job.
public void setServer(java.lang.String host, java.lang.String port)
Sets the ITP/Server server and instance for this job.
public void setJobID(java.lang.String jobID)
Sets the ITP/Server job identifier for this job.
public void setSessionID(java.lang.String sessionID)
Sets the ITP/Server session identifier for this job.
public java.lang.String[] getParameters()
Returns the current parameter list for this job.
public java.lang.String getHost()
Return ITP/Server server for this job.
public java.lang.String getPort()
Return ITP/Server instance port for this job.
public java.lang.String getJobID()
Return ITP/Server job identifier for this job.
public java.lang.String getSessionID()
Return ITP/Server session identifier for this job.
public java.lang.String getLastError()
Returns the last known error if there is one.
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.
sync - Specifies whether the job will be submitted synchronous or asynchronous.
For more information refer to: getLastError()
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.
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.
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.