Search in sources :

Example 1 with NodeFactoryUnknownException

use of org.knime.core.node.workflow.WorkflowPersistor.NodeFactoryUnknownException in project knime-core by knime.

the class FileNativeNodeContainerPersistor method preLoadNodeContainer.

/**
 * {@inheritDoc}
 */
@Override
public void preLoadNodeContainer(final WorkflowPersistor parentPersistor, final NodeSettingsRO parentSettings, final LoadResult result) throws InvalidSettingsException, IOException {
    super.preLoadNodeContainer(parentPersistor, parentSettings, result);
    m_parentPersistor = parentPersistor;
    NodeSettingsRO settings = getNodeSettings();
    String error;
    NodeAndBundleInformation nodeInfo;
    try {
        nodeInfo = loadNodeFactoryInfo(parentSettings, settings);
    } catch (InvalidSettingsException e) {
        setDirtyAfterLoad();
        throw e;
    }
    NodeSettingsRO additionalFactorySettings;
    try {
        additionalFactorySettings = loadAdditionalFactorySettings(settings);
    } catch (Exception e) {
        error = "Unable to load additional factory settings for \"" + nodeInfo + "\"";
        setDirtyAfterLoad();
        throw new InvalidSettingsException(error, e);
    }
    NodeFactory<NodeModel> nodeFactory;
    try {
        nodeFactory = loadNodeFactory(nodeInfo.getFactoryClass());
    } catch (Exception e) {
        // setDirtyAfterLoad(); // don't set dirty, missing node placeholder will be used instead
        throw new NodeFactoryUnknownException(nodeInfo, additionalFactorySettings, e);
    }
    try {
        if (additionalFactorySettings != null) {
            nodeFactory.loadAdditionalFactorySettings(additionalFactorySettings);
        }
    } catch (Exception e) {
        error = "Unable to load additional factory settings into node factory (node \"" + nodeInfo + "\")";
        getLogger().error(error);
        throw new NodeFactoryUnknownException(error, nodeInfo, additionalFactorySettings, e);
    }
    m_nodeAndBundleInformation = nodeInfo;
    m_node = new Node(nodeFactory);
}
Also used : NodeAndBundleInformation(org.knime.core.node.NodeAndBundleInformation) NodeModel(org.knime.core.node.NodeModel) NodeFactoryUnknownException(org.knime.core.node.workflow.WorkflowPersistor.NodeFactoryUnknownException) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) Node(org.knime.core.node.Node) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) CanceledExecutionException(org.knime.core.node.CanceledExecutionException) NodeFactoryUnknownException(org.knime.core.node.workflow.WorkflowPersistor.NodeFactoryUnknownException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 Node (org.knime.core.node.Node)1 NodeAndBundleInformation (org.knime.core.node.NodeAndBundleInformation)1 NodeModel (org.knime.core.node.NodeModel)1 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)1 NodeFactoryUnknownException (org.knime.core.node.workflow.WorkflowPersistor.NodeFactoryUnknownException)1