TaskFactory Objects

The TaskFactory is used to create instances of Task. A task can be executed synchronously or asynchronously by the Session. Session-owned objects that are passed to TaskFactory methods must be executed by the session that owns them.

t.createDeleteFileTask(filePath) : Task

filePath (string) :- The path of file on server.

Create a task that delete the file using the specified file path.

t.createDownloadFileTask(path, outputStream) : Task

path (string) : the path of the remote file on server

outputStream (OutputStream) : the output stream

Creates a task that copies the content of a file on server to the specified output stream. The task will fail if the file cannot be read.

t.createDropTableTask(conn, tableName) : Task

conn (ServerDatabaseConnection) : - The ServerDatabaseConnection used for connect to the database.

tableName (string) : - The name of the table which you want to delete.

Create a task that drop the table using the specified table name.

t.createExportDocumentTask(document, outputStream, fileFormat) : Task

document (DocumentOutput) : the DocumentOutput object

outputStream (OutputStream) : the output stream

fileFormat (FileFormat) : the FileFormat to be used

Creates a task that exports a DocumentOutput object to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the output is not owned by the same session that owns the task factory

ExportFormatException : if the document does not support the export format

t.createExportModelTask(model, outputStream, fileFormat) : Task

model (ModelOutput) : the ModelOutput object

outputStream (OutputStream) : the output stream

fileFormat (FileFormat) : the FileFormat to be used

Creates a task that exports a ModelOutput object to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the output is not owned by the same session that owns the task factory

ExportFormatException : if the model does not support the export format

t.createExportModelTask(modelApplier, outputStream, fileFormat) : Task

modelApplier (Node) : the Node object

outputStream (OutputStream) : the output stream

fileFormat (FileFormat) : the FileFormat to be used

Creates a task that exports a Node to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the output is not owned by the same session that owns the task factory

ExportFormatException : if the model does not support the export format

t.createExportStreamTask(stream, outputStream, fileFormat) : Task

stream (Stream) : the stream to be exported

outputStream (OutputStream) : the output stream

fileFormat (FileFormat) : the export file format

Creates a task that export a stream description to an output stream using specified file format.

Exceptions:

OwnerException : if the node is not owned by the same session that owns the task factory

ExportFormatException : if the stream does not support the export format

t.createImportPMMLModelTask(inputStream) : Task

inputStream (InputStream) : the input stream

Creates a task that imports a ModelOutput object from an input stream. Calling getResult() on the completed task returns an instance of ModelOutput.

t.createOpenDocumentTask(inputStream) : Task

inputStream (InputStream) : the input stream

Creates a task that reads a DocumentOutput object from an input stream. Calling getResult() on the completed task returns an instance of DocumentOutput. The document is not added to the output manager.

t.createOpenDocumentTask(inputStream, autoManage) : Task

inputStream (InputStream) : the input stream

autoManage (boolean) : whether the document should be added to the output manager

Creates a task that reads a DocumentOutput object from an input stream. Calling getResult() on the completed task returns an instance of DocumentOutput. Code that needs to open documents privately without having them made visible to the user should set the autoManage flag to False.

t.createOpenModelTask(inputStream) : Task

inputStream (InputStream) : the input stream

Creates a task that reads a ModelOutput object from an input stream. Calling getResult() on the completed task returns an instance of ModelOutput. The model is not added to the model manager.

t.createOpenModelTask(inputStream, autoManage) : Task

inputStream (InputStream) : the input stream

autoManage (boolean) : whether the model should be added to the model manager

Creates a task that reads a ModelOutput object from an input stream. Calling getResult() on the completed task returns an instance of ModelOutput. Code that needs to open models privately without having them made visible to the user should set the autoManage flag to False.

t.createOpenProcessorTask(inputStream, stream) : Task

inputStream (InputStream) : the input stream

stream (Stream) : the Stream

Creates a task that reads a Node object from an input stream and inserts it into the supplied Stream. Calling getResult() on the completed task returns an instance of Node.

Exceptions:

OwnerException : if the stream is not owned by the same session that owns the task factory

t.createOpenStreamTask(inputStream) : Task

inputStream (InputStream) : the input stream

Creates a task that reads a Stream object from an input stream. Calling getResult() on the completed task returns an instance of Stream.

t.createOpenStreamTask(inputStream, autoManage) : Task

inputStream (InputStream) : the input stream

autoManage (boolean) : whether the opened stream should be added to the stream manager

Creates a task that reads a Stream object from an input stream. Calling getResult() on the completed task returns an instance of Stream. Code that needs to open streams privately without having them made visible to the user should set the autoManage flag to False.

t.createSaveDocumentTask(document, outputStream) : Task

document (DocumentOutput) : the DocumentOutput object

outputStream (OutputStream) : the output stream

Creates a task that saves a DocumentOutput object to an output stream. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the document output is not owned by the same session that owns the task factory

t.createSaveModelTask(model, outputStream) : Task

model (ModelOutput) : the ModelOutput object

outputStream (OutputStream) : the output stream

Creates a task that saves a ModelOutput object to an output stream. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the model output is not owned by the same session that owns the task factory

t.createSaveProcessorTask(node, outputStream) : Task

node (Node) : the Node object

outputStream (OutputStream) : the output stream

Creates a task that saves a Node object to an output stream. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the node is not owned by the same session that owns the task factory

t.createSaveStreamTask(stream, outputStream) : Task

stream (Stream) : the Stream object

outputStream (OutputStream) : the output stream

Creates a task that saves a Stream object to an output stream. Calling getResult() on the completed task returns None.

Exceptions:

OwnerException : if the stream is not owned by the same session that owns the task factory

t.createUpdatePMMLModelTask(modelOutput, inputStream) : Task
modelOutput (ModelOutput) : 
inputStream (InputStream) : 

Creates a task that updates the ModelOutput object with PMML read from an input stream. The task will fail if the ModelOutput is not based on a PMML model or the ModelOutput and the PMML algorithms are not the same.

Exceptions:

OwnerException : if the model output is not owned by the same session that owns the task factory

t.createUploadFileTask(path, inputStream) : Task

path (string) : the path of the remote file on server

inputStream (InputStream) : the input stream

Creates a task that copies the content of the specified input stream to a file on server, replacing any existing file content. The task will fail if the file cannot be written.