public interface TaskFactory
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.Modifier and Type | Method and Description |
---|---|
Task |
createDeleteFileTask(java.lang.String filePath)
Create a task that delete the file using the specified file path.
|
Task |
createDownloadFileTask(java.lang.String path,
java.io.OutputStream outputStream)
Creates a task that copies the content of a file on server to the
specified output stream.
|
Task |
createDropTableTask(ServerDatabaseConnection conn,
java.lang.String tableName)
Create a task that drop the table using the specified table name.
|
Task |
createExportDocumentTask(DocumentOutput document,
java.io.OutputStream outputStream,
FileFormat fileFormat)
Creates a task that exports a
DocumentOutput object
to an output stream using the specified FileFormat name. |
Task |
createExportDocumentTask(DocumentOutput document,
java.io.OutputStream outputStream,
FileFormat fileFormat,
java.util.Map<?,?> options)
Creates a task that exports a
DocumentOutput object
to an output stream using the specified FileFormat name. |
Task |
createExportModelTask(ModelOutput model,
java.io.OutputStream outputStream,
FileFormat fileFormat)
Creates a task that exports a
ModelOutput object
to an output stream using the specified FileFormat name. |
Task |
createExportModelTask(ModelOutput model,
java.io.OutputStream outputStream,
FileFormat fileFormat,
java.util.Map<?,?> options)
Creates a task that exports a
ModelOutput object
to an output stream using the specified FileFormat name. |
Task |
createExportModelTask(Processor modelApplier,
java.io.OutputStream outputStream,
FileFormat fileFormat)
Creates a task that exports a
Processor node
to an output stream using the specified FileFormat name. |
Task |
createExportModelTask(Processor modelApplier,
java.io.OutputStream outputStream,
FileFormat fileFormat,
java.util.Map<?,?> options)
Creates a task that exports a
Processor node
to an output stream using the specified FileFormat name. |
Task |
createExportStreamTask(ProcessorStream stream,
java.io.OutputStream outputStream,
FileFormat fileFormat)
Creates a task that export a stream description to an output stream using specified file format.
|
Task |
createExportStreamTask(ProcessorStream stream,
java.io.OutputStream outputStream,
FileFormat fileFormat,
java.util.Map<?,?> options)
Creates a task that export a stream description to an output stream using specified file format.
|
Task |
createImportPMMLModelTask(java.io.InputStream inputStream)
Creates a task that imports a
ModelOutput object from an input stream. |
Task |
createOpenDocumentTask(java.io.InputStream inputStream)
Creates a task that reads a
DocumentOutput object from an input stream. |
Task |
createOpenDocumentTask(java.io.InputStream inputStream,
boolean autoManage)
Creates a task that reads a
DocumentOutput object from an input stream. |
Task |
createOpenModelTask(java.io.InputStream inputStream)
Creates a task that reads a
ModelOutput object from an input stream. |
Task |
createOpenModelTask(java.io.InputStream inputStream,
boolean autoManage)
Creates a task that reads a
ModelOutput object from an input stream. |
Task |
createOpenProcessorTask(java.io.InputStream inputStream,
ProcessorStream stream)
Creates a task that reads a
Processor object from an input stream
and inserts it into the supplied ProcessorStream . |
Task |
createOpenStreamTask(java.io.InputStream inputStream)
Creates a task that reads a
ProcessorStream object from an input stream. |
Task |
createOpenStreamTask(java.io.InputStream inputStream,
boolean autoManage)
Creates a task that reads a
ProcessorStream object from an input stream. |
Task |
createOpenStreamTask(java.io.InputStream inputStream,
FileFormat format,
boolean autoManage)
Creates a task that reads a
ProcessorStream object from an input stream. |
Task |
createPublishModelToScoringAdapterTask(Processor node,
ServerDatabaseConnection dbConnection,
java.lang.String publishId)
Creates a task that publishes the model from a model apply
Processor to
the specified database and optional ID. |
Task |
createSaveDocumentTask(DocumentOutput document,
java.io.OutputStream outputStream)
Creates a task that saves a
DocumentOutput object to an output stream. |
Task |
createSaveModelTask(ModelOutput model,
java.io.OutputStream outputStream)
Creates a task that saves a
ModelOutput object to an output stream. |
Task |
createSaveProcessorTask(Processor node,
java.io.OutputStream outputStream)
Creates a task that saves a
Processor object to an output stream. |
Task |
createSaveStreamTask(ProcessorStream stream,
java.io.OutputStream outputStream)
Creates a task that saves a
ProcessorStream object to an output stream. |
Task |
createUpdatePMMLModelTask(ModelOutput modelOutput,
java.io.InputStream inputStream)
Creates a task that updates the
ModelOutput object with PMML read from an input stream. |
Task |
createUploadFileTask(java.lang.String path,
java.io.InputStream inputStream)
Creates a task that copies the content of the specified input stream
to a file on server, replacing any existing file content.
|
Task |
createValidateStreamTask(Processor node)
Creates a task that validate a stream and get required fields, the result of the task is
StreamValidationResult , which could be got from task.getResult(). |
Task createOpenStreamTask(java.io.InputStream inputStream)
ProcessorStream
object from an input stream.
Calling getResult()
on the completed task returns an
instance of ProcessorStream
.
The input stream must have the PROCESSOR_STREAM
format.
inputStream
- the input streamTask
createOpenStreamTask(InputStream, boolean)
Task createOpenStreamTask(java.io.InputStream inputStream, boolean autoManage)
ProcessorStream
object from an input stream.
Calling getResult()
on the completed task returns an
instance of ProcessorStream
. Code that needs to open streams
privately without having them made visible to the user should set the autoManage flag to false
.
The input stream must have the PROCESSOR_STREAM
format.
inputStream
- the input streamautoManage
- whether the opened stream should be added to the stream managerTask
Task createOpenStreamTask(java.io.InputStream inputStream, FileFormat format, boolean autoManage)
ProcessorStream
object from an input stream.
Calling getResult()
on the completed task returns an
instance of ProcessorStream
.
Code that needs to open streams
privately without having them made visible to the user should set the autoManage flag to false
.
The input stream format must be one of:
PROCESSOR_STREAM
PROCESSOR_STREAM_2
inputStream
- the input streamformat
- the input stream formatautoManage
- whether the opened stream should be added to the stream managerTask
Task createOpenProcessorTask(java.io.InputStream inputStream, ProcessorStream stream) throws OwnerException
Processor
object from an input stream
and inserts it into the supplied ProcessorStream
.
Calling getResult()
on the completed task returns an
instance of Processor
.inputStream
- the input streamstream
- the ProcessorStream
Task
OwnerException
- if the stream is not owned by the same session that
owns the task factoryTask createOpenModelTask(java.io.InputStream inputStream)
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.inputStream
- the input streamTask
createOpenModelTask(InputStream, boolean)
Task createOpenModelTask(java.io.InputStream inputStream, boolean autoManage)
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
.inputStream
- the input streamautoManage
- whether the model should be added to the model managerTask
Task createOpenDocumentTask(java.io.InputStream inputStream)
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.inputStream
- the input streamTask
createOpenDocumentTask(InputStream, boolean)
Task createOpenDocumentTask(java.io.InputStream inputStream, boolean autoManage)
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
.inputStream
- the input streamautoManage
- whether the document should be added to the output managerTask
Task createSaveStreamTask(ProcessorStream stream, java.io.OutputStream outputStream) throws OwnerException
ProcessorStream
object to an output stream.
Calling getResult()
on the completed task returns null
.stream
- the ProcessorStream
objectoutputStream
- the output streamTask
OwnerException
- if the stream is not owned by the same session that
owns the task factoryTask createSaveProcessorTask(Processor node, java.io.OutputStream outputStream) throws OwnerException
Processor
object to an output stream.
Calling getResult()
on the completed task returns null
.node
- the Processor
objectoutputStream
- the output streamTask
OwnerException
- if the node is not owned by the same session that
owns the task factoryTask createSaveModelTask(ModelOutput model, java.io.OutputStream outputStream) throws OwnerException
ModelOutput
object to an output stream.
Calling getResult()
on the completed task returns null
.model
- the ModelOutput
objectoutputStream
- the output streamTask
OwnerException
- if the model output is not owned by the same session that
owns the task factoryTask createSaveDocumentTask(DocumentOutput document, java.io.OutputStream outputStream) throws OwnerException
DocumentOutput
object to an output stream.
Calling getResult()
on the completed task returns null
.document
- the DocumentOutput
objectoutputStream
- the output streamTask
OwnerException
- if the document output is not owned by the same session that
owns the task factoryTask createExportModelTask(ModelOutput model, java.io.OutputStream outputStream, FileFormat fileFormat) throws OwnerException, ExportFormatException
ModelOutput
object
to an output stream using the specified FileFormat
name.
Calling getResult()
on the completed task returns null
.model
- the ModelOutput
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the model does not support the export formatTask createExportModelTask(Processor modelApplier, java.io.OutputStream outputStream, FileFormat fileFormat) throws OwnerException, ExportFormatException
Processor
node
to an output stream using the specified FileFormat
name.
Calling getResult()
on the completed task returns null
.modelApplier
- the Processor
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the model does not support the export formatTask createExportDocumentTask(DocumentOutput document, java.io.OutputStream outputStream, FileFormat fileFormat) throws OwnerException, ExportFormatException
DocumentOutput
object
to an output stream using the specified FileFormat
name.
Calling getResult()
on the completed task returns null
.document
- the DocumentOutput
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the document does not support the export formatFileFormat
Task createExportModelTask(ModelOutput model, java.io.OutputStream outputStream, FileFormat fileFormat, java.util.Map<?,?> options) throws OwnerException, ExportFormatException
ModelOutput
object
to an output stream using the specified FileFormat
name.
Calling getResult()
on the completed task returns null
.model
- the ModelOutput
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedoptions
- either null
or a map of attribute valuesTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the model does not support the export formatTask createExportModelTask(Processor modelApplier, java.io.OutputStream outputStream, FileFormat fileFormat, java.util.Map<?,?> options) throws OwnerException, ExportFormatException
Processor
node
to an output stream using the specified FileFormat
name.
Calling getResult()
on the completed task returns null
.modelApplier
- the Processor
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedoptions
- either null
or a map of attribute valuesTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the model does not support the export formatTask createExportDocumentTask(DocumentOutput document, java.io.OutputStream outputStream, FileFormat fileFormat, java.util.Map<?,?> options) throws OwnerException, ExportFormatException
DocumentOutput
object
to an output stream using the specified FileFormat
name.
If options
are supplied, the value is a table of attribute/value pairs.
For graph exports, the options are:
graph_width
(integer): the width of the exported image in pixelsgraph_height
(integer): the width of the exported image in pixelsFor HTML exports, the options are:
html_generate_css
(boolean): if the HTML auto-generates a separate CSS file, this can be used to disable thathtml_css_name
(string): the name of the CSS referenced by the HTML - this can be set even if a separate CSS is not generated e.g. to include a site's standard CSS
Calling getResult()
on the completed task returns null
.
document
- the DocumentOutput
objectoutputStream
- the output streamfileFormat
- the FileFormat
to be usedoptions
- either null
or a map of attribute valuesTask
OwnerException
- if the output is not owned by the same session that
owns the task factoryExportFormatException
- if the document does not support the export formatFileFormat
Task createImportPMMLModelTask(java.io.InputStream inputStream)
ModelOutput
object from an input stream.
Calling getResult()
on the completed task returns an
instance of ModelOutput
.inputStream
- the input streamTask
Task createUpdatePMMLModelTask(ModelOutput modelOutput, java.io.InputStream inputStream) throws OwnerException
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.modelOutput
- inputStream
- Task
OwnerException
- if the model output is not owned by the same session that
owns the task factoryTask createExportStreamTask(ProcessorStream stream, java.io.OutputStream outputStream, FileFormat fileFormat) throws OwnerException, ExportFormatException
stream
- the stream to be exportedoutputStream
- the output streamfileFormat
- the export file formatTask
OwnerException
- if the node is not owned by the same session that
owns the task factoryExportFormatException
- if the stream does not support the export formatTask createExportStreamTask(ProcessorStream stream, java.io.OutputStream outputStream, FileFormat fileFormat, java.util.Map<?,?> options) throws OwnerException, ExportFormatException
stream
- the stream to be exportedoutputStream
- the output streamfileFormat
- the export file formatoptions
- either null
or a map of attribute valuesTask
OwnerException
- if the node is not owned by the same session that
owns the task factoryExportFormatException
- if the stream does not support the export formatTask createValidateStreamTask(Processor node) throws OwnerException, SessionException, ObjectLockedException
StreamValidationResult
, which could be got from task.getResult().node
- the validate nodeTask
OwnerException
- if the node is not owned by the same session that
owns the task factorySessionException
ObjectLockedException
Task createDropTableTask(ServerDatabaseConnection conn, java.lang.String tableName)
conn
- - The ServerDatabaseConnection
used for connect to the database.tableName
- - The name of the table which you want to delete.Task
Task createDeleteFileTask(java.lang.String filePath)
filePath
- - The path of file on server.Task
Task createUploadFileTask(java.lang.String path, java.io.InputStream inputStream)
path
- the path of the remote file on serverinputStream
- the input streamTask createDownloadFileTask(java.lang.String path, java.io.OutputStream outputStream)
path
- the path of the remote file on serveroutputStream
- the output streamTask createPublishModelToScoringAdapterTask(Processor node, ServerDatabaseConnection dbConnection, java.lang.String publishId) throws OwnerException
Processor
to
the specified database and optional ID. The database connection must have been
created via the stream that owns the supplied node.
Calling getResult()
on the completed task returns a string representing
an example of the SQL needed to call the model.node
- the Processor
containing the modeldbConnection
- the database connection associated with the node's streampublishId
- (DB2 for z/OS databases only) an identifier for the modelOwnerException
- if the node is not owned by the same session that
owns the task factoryProcessorStream.createServerDatabaseConnection(String, String, String, String)
(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.