Search in sources :

Example 1 with TableStoreFormatUnknownException

use of org.knime.core.data.container.storage.TableStoreFormatUnknownException in project knime-core by knime.

the class FileNodePersistor method load.

/**
 * Loads content into node instance.
 *
 * @param node The target node, used for meta info (#ports, e.g) and to invoke the
 *            {@link Node#load(NodePersistor, ExecutionMonitor, LoadResult)} on
 * @param parentPersistor workflow persistor for decryption
 * @param exec For progress/cancelation
 * @param loadTblRep The table repository used during load
 * @param dataRepository ...
 * @param loadResult where to add errors to
 * @throws IOException If files can't be read
 * @throws CanceledExecutionException If canceled
 * @noreference This method is not intended to be referenced by clients.
 * @nooverride
 */
public final void load(final Node node, final WorkflowPersistor parentPersistor, final ExecutionMonitor exec, final Map<Integer, BufferedDataTable> loadTblRep, final WorkflowDataRepository dataRepository, final LoadResult loadResult) throws IOException, CanceledExecutionException {
    ExecutionMonitor loadExec = exec.createSilentSubProgress(0.6);
    ExecutionMonitor loadFileStoreExec = exec.createSilentSubProgress(0.2);
    ExecutionMonitor loadIntTblsExec = exec.createSilentSubProgress(0.2);
    exec.setMessage("settings");
    m_portObjects = new PortObject[node.getNrOutPorts()];
    m_portObjectSpecs = new PortObjectSpec[node.getNrOutPorts()];
    m_portObjectSummaries = new String[node.getNrOutPorts()];
    String nodeName = node.getName();
    // load internals
    if (m_hasContent) {
        try {
            m_nodeInternDirectory = loadNodeInternDirectory(m_settings, getNodeDirectory());
        } catch (InvalidSettingsException ise) {
            String e = "Unable to load internals directory";
            loadResult.addError(e);
            getLogger().warn(e, ise);
            setDirtyAfterLoad();
        }
    }
    WorkflowLoadHelper loadHelper = getLoadHelper();
    try {
        if (!loadHelper.isTemplateFlow()) {
            m_fileStoreHandler = loadFileStoreHandler(node, loadFileStoreExec, m_settings, dataRepository);
        }
    } catch (Exception e) {
        if (!(e instanceof InvalidSettingsException) && !(e instanceof IOException)) {
            getLogger().error("Unexpected \"" + e.getClass().getSimpleName() + "\" encountered");
        }
        String err = "Unable to load file store handler for node \"" + nodeName + "\": " + e.getMessage();
        loadResult.addError(err, true);
        if (mustWarnOnDataLoadError()) {
            getLogger().warn(err, e);
        } else {
            getLogger().debug(err);
        }
        setNeedsResetAfterLoad();
    }
    loadFileStoreExec.setProgress(1.0);
    exec.setMessage("ports");
    try {
        if (!loadHelper.isTemplateFlow()) {
            loadPorts(node, loadExec, m_settings, loadTblRep, dataRepository);
        }
    } catch (Exception e) {
        if (!(e instanceof InvalidSettingsException) && !(e instanceof IOException)) {
            getLogger().error("Unexpected \"" + e.getClass().getSimpleName() + "\" encountered");
        }
        String err = "Unable to load port content for node \"" + nodeName + "\": " + e.getMessage();
        loadResult.addError(err, true);
        if (mustWarnOnDataLoadError()) {
            getLogger().warn(err, e);
        } else {
            getLogger().debug(err);
        }
        if (e instanceof TableStoreFormatUnknownException) {
            ((TableStoreFormatUnknownException) e).getTableStoreMissingInfo().ifPresent(loadResult::addMissingTableFormat);
        }
        setNeedsResetAfterLoad();
    }
    loadExec.setProgress(1.0);
    try {
        if (!loadHelper.isTemplateFlow()) {
            if (getLoadVersion().isOlderThan(LoadVersion.V2100)) {
                loadInternalHeldTablesPre210(node, loadIntTblsExec, m_settings, loadTblRep, dataRepository);
            } else {
                loadInternalHeldObjects(node, loadIntTblsExec, m_settings, loadTblRep, dataRepository);
            }
        }
    } catch (Exception e) {
        if (!(e instanceof InvalidSettingsException) && !(e instanceof IOException)) {
            getLogger().error("Unexpected \"" + e.getClass().getSimpleName() + "\" encountered");
        }
        String err = "Unable to load internally held tables for node \"" + nodeName + "\": " + e.getMessage();
        loadResult.addError(err, true);
        if (mustWarnOnDataLoadError()) {
            getLogger().warn(err, e);
        } else {
            getLogger().debug(err);
        }
        setNeedsResetAfterLoad();
    }
    loadIntTblsExec.setProgress(1.0);
}
Also used : WorkflowLoadHelper(org.knime.core.node.workflow.WorkflowLoadHelper) IOException(java.io.IOException) TableStoreFormatUnknownException(org.knime.core.data.container.storage.TableStoreFormatUnknownException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) TableStoreFormatUnknownException(org.knime.core.data.container.storage.TableStoreFormatUnknownException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 TableStoreFormatUnknownException (org.knime.core.data.container.storage.TableStoreFormatUnknownException)1 WorkflowLoadHelper (org.knime.core.node.workflow.WorkflowLoadHelper)1