com.spss.psapi.task

Interface TaskFactory



  • public interface TaskFactory
    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.
    Since:
    PSAPI 1.0
    Version:
    1.1
    Author:
    Julian Clinton, Rob Duncan
    Specification Status:
    Under Development
    • Method Detail

      • createOpenStreamTask

        Task createOpenStreamTask(java.io.InputStream inputStream)
        Creates a task that reads a ProcessorStream object from an input stream. Calling getResult() on the completed task returns an instance of ProcessorStream.
        Parameters:
        inputStream - the input stream
        Returns:
        the open Task
        See Also:
        createOpenStreamTask(InputStream, boolean)
      • createOpenStreamTask

        Task createOpenStreamTask(java.io.InputStream inputStream,
                                boolean autoManage)
        Creates a task that reads a 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.
        Parameters:
        inputStream - the input stream
        autoManage - whether the opened stream should be added to the stream manager
        Returns:
        the open Task
        Since:
        PSAPI 16.0
      • createOpenProcessorTask

        Task createOpenProcessorTask(java.io.InputStream inputStream,
                                   ProcessorStream stream)
                                     throws OwnerException
        Creates a task that reads a Processor object from an input stream and inserts it into the supplied ProcessorStream. Calling getResult() on the completed task returns an instance of Processor.
        Parameters:
        inputStream - the input stream
        stream - the ProcessorStream
        Returns:
        the open Task
        Throws:
        OwnerException - if the stream is not owned by the same session that owns the task factory
      • createOpenModelTask

        Task createOpenModelTask(java.io.InputStream inputStream)
        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.
        Parameters:
        inputStream - the input stream
        Returns:
        the open Task
        See Also:
        createOpenModelTask(InputStream, boolean)
      • createOpenModelTask

        Task createOpenModelTask(java.io.InputStream inputStream,
                               boolean autoManage)
        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.
        Parameters:
        inputStream - the input stream
        autoManage - whether the model should be added to the model manager
        Returns:
        the open Task
      • createOpenDocumentTask

        Task createOpenDocumentTask(java.io.InputStream inputStream)
        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.
        Parameters:
        inputStream - the input stream
        Returns:
        the open Task
        See Also:
        createOpenDocumentTask(InputStream, boolean)
      • createOpenDocumentTask

        Task createOpenDocumentTask(java.io.InputStream inputStream,
                                  boolean autoManage)
        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.
        Parameters:
        inputStream - the input stream
        autoManage - whether the document should be added to the output manager
        Returns:
        the open Task
      • createSaveStreamTask

        Task createSaveStreamTask(ProcessorStream stream,
                                java.io.OutputStream outputStream)
                                  throws OwnerException
        Creates a task that saves a ProcessorStream object to an output stream. Calling getResult() on the completed task returns null.
        Parameters:
        stream - the ProcessorStream object
        outputStream - the output stream
        Returns:
        the save Task
        Throws:
        OwnerException - if the stream is not owned by the same session that owns the task factory
      • createSaveProcessorTask

        Task createSaveProcessorTask(Processor node,
                                   java.io.OutputStream outputStream)
                                     throws OwnerException
        Creates a task that saves a Processor object to an output stream. Calling getResult() on the completed task returns null.
        Parameters:
        node - the Processor object
        outputStream - the output stream
        Returns:
        the save Task
        Throws:
        OwnerException - if the node is not owned by the same session that owns the task factory
      • createSaveModelTask

        Task createSaveModelTask(ModelOutput model,
                               java.io.OutputStream outputStream)
                                 throws OwnerException
        Creates a task that saves a ModelOutput object to an output stream. Calling getResult() on the completed task returns null.
        Parameters:
        model - the ModelOutput object
        outputStream - the output stream
        Returns:
        the save Task
        Throws:
        OwnerException - if the model output is not owned by the same session that owns the task factory
      • createSaveDocumentTask

        Task createSaveDocumentTask(DocumentOutput document,
                                  java.io.OutputStream outputStream)
                                    throws OwnerException
        Creates a task that saves a DocumentOutput object to an output stream. Calling getResult() on the completed task returns null.
        Parameters:
        document - the DocumentOutput object
        outputStream - the output stream
        Returns:
        the save Task
        Throws:
        OwnerException - if the document output is not owned by the same session that owns the task factory
      • createExportModelTask

        Task createExportModelTask(ModelOutput model,
                                 java.io.OutputStream outputStream,
                                 FileFormat fileFormat)
                                   throws OwnerException,
                                          ExportFormatException
        Creates a task that exports a ModelOutput object to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns null.
        Parameters:
        model - the ModelOutput object
        outputStream - the output stream
        fileFormat - the FileFormat to be used
        Returns:
        the export Task
        Throws:
        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
      • createExportModelTask

        Task createExportModelTask(Processor modelApplier,
                                 java.io.OutputStream outputStream,
                                 FileFormat fileFormat)
                                   throws OwnerException,
                                          ExportFormatException
        Creates a task that exports a Processor node to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns null.
        Parameters:
        modelApplier - the Processor object
        outputStream - the output stream
        fileFormat - the FileFormat to be used
        Returns:
        the export Task
        Throws:
        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
        Since:
        PSAPI 17.0
      • createExportDocumentTask

        Task createExportDocumentTask(DocumentOutput document,
                                    java.io.OutputStream outputStream,
                                    FileFormat fileFormat)
                                      throws OwnerException,
                                             ExportFormatException
        Creates a task that exports a DocumentOutput object to an output stream using the specified FileFormat name. Calling getResult() on the completed task returns null.
        Parameters:
        document - the DocumentOutput object
        outputStream - the output stream
        fileFormat - the FileFormat to be used
        Returns:
        the export Task
        Throws:
        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
        See Also:
        FileFormat
      • createImportPMMLModelTask

        Task createImportPMMLModelTask(java.io.InputStream inputStream)
        Creates a task that imports a ModelOutput object from an input stream. Calling getResult() on the completed task returns an instance of ModelOutput.
        Parameters:
        inputStream - the input stream
        Returns:
        the import Task
      • createUpdatePMMLModelTask

        Task createUpdatePMMLModelTask(ModelOutput modelOutput,
                                     java.io.InputStream inputStream)
                                       throws OwnerException
        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.
        Parameters:
        modelOutput -
        inputStream -
        Returns:
        the update Task
        Throws:
        OwnerException - if the model output is not owned by the same session that owns the task factory
      • createExportStreamTask

        Task createExportStreamTask(ProcessorStream stream,
                                  java.io.OutputStream outputStream,
                                  FileFormat fileFormat)
                                    throws OwnerException,
                                           ExportFormatException
        Creates a task that export a stream description to an output stream using specified file format.
        Parameters:
        stream - the stream to be exported
        outputStream - the output stream
        fileFormat - the export file format
        Returns:
        the export Task
        Throws:
        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
        Since:
        PSAPI 13.0
      • createDropTableTask

        Task createDropTableTask(ServerDatabaseConnection conn,
                               java.lang.String tableName)
        Create a task that drop the table using the specified table name.
        Parameters:
        conn - - The ServerDatabaseConnection used for connect to the database.
        tableName - - The name of the table which you want to delete.
        Returns:
        a delete table Task
        Since:
        PSAPI 15.0
      • createDeleteFileTask

        Task createDeleteFileTask(java.lang.String filePath)
        Create a task that delete the file using the specified file path.
        Parameters:
        filePath - - The path of file on server.
        Returns:
        a delete file Task
        Since:
        PSAPI 15.0
      • createUploadFileTask

        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. The task will fail if the file cannot be written.
        Parameters:
        path - the path of the remote file on server
        inputStream - the input stream
        Returns:
        a new upload task
        Since:
        PSAPI 15.0
      • createDownloadFileTask

        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. The task will fail if the file cannot be read.
        Parameters:
        path - the path of the remote file on server
        outputStream - the output stream
        Returns:
        a new download task
        Since:
        PSAPI 15.0
      • createPublishModelToScoringAdapterTask

        Task createPublishModelToScoringAdapterTask(Processor node,
                                                  ServerDatabaseConnection dbConnection,
                                                  java.lang.String publishId)
                                                    throws OwnerException
        Creates a task that publishes the model from a model apply 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.
        Parameters:
        node - the Processor containing the model
        dbConnection - the database connection associated with the node's stream
        publishId - (DB2 for z/OS databases only) an identifier for the model
        Returns:
        a new publish task
        Throws:
        OwnerException - if the node is not owned by the same session that owns the task factory
        Since:
        PSAPI 16.0.2
        See Also:
        ProcessorStream.createServerDatabaseConnection(String, String, String, String)

(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.