Search in sources :

Example 16 with NodeFactory

use of org.knime.core.node.NodeFactory in project knime-core by knime.

the class TableSorterTest method setUp.

/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    NodeFactory<NodeModel> dummyFactory = (NodeFactory) new VirtualParallelizedChunkPortObjectInNodeFactory(new PortType[0]);
    m_exec = new ExecutionContext(new DefaultNodeProgressMonitor(), new Node(dummyFactory), SingleNodeContainer.MemoryPolicy.CacheOnDisc, new HashMap<Integer, ContainerTable>());
}
Also used : NodeModel(org.knime.core.node.NodeModel) ExecutionContext(org.knime.core.node.ExecutionContext) VirtualParallelizedChunkPortObjectInNodeFactory(org.knime.core.node.workflow.virtual.parchunk.VirtualParallelizedChunkPortObjectInNodeFactory) NodeFactory(org.knime.core.node.NodeFactory) HashMap(java.util.HashMap) VirtualParallelizedChunkPortObjectInNodeFactory(org.knime.core.node.workflow.virtual.parchunk.VirtualParallelizedChunkPortObjectInNodeFactory) DefaultNodeProgressMonitor(org.knime.core.node.DefaultNodeProgressMonitor) Node(org.knime.core.node.Node) PortType(org.knime.core.node.port.PortType) Before(org.junit.Before)

Example 17 with NodeFactory

use of org.knime.core.node.NodeFactory in project knime-core by knime.

the class FileNativeNodeContainerPersistor method loadNodeFactory.

/**
 * Creates the node factory instance for the given fully-qualified factory class name.
 * Otherwise a respective exception will be thrown.
 *
 * @since 3.5
 */
@SuppressWarnings("unchecked")
public static final NodeFactory<NodeModel> loadNodeFactory(final String factoryClassName) throws InvalidSettingsException, InstantiationException, IllegalAccessException, InvalidNodeFactoryExtensionException {
    Optional<NodeFactory<? extends NodeModel>> facOptional = NodeFactoryExtensionManager.getInstance().createNodeFactory(factoryClassName);
    if (facOptional.isPresent()) {
        return (NodeFactory<NodeModel>) facOptional.get();
    }
    List<NodeFactoryClassMapper> classMapperList = NodeFactoryClassMapper.getRegisteredMappers();
    for (NodeFactoryClassMapper mapper : classMapperList) {
        @SuppressWarnings("rawtypes") NodeFactory factory = mapper.mapFactoryClassName(factoryClassName);
        if (factory != null) {
            LOGGER.debug(String.format("Replacing stored factory class name \"%s\" by actual factory " + "class \"%s\" (defined by class mapper \"%s\")", factoryClassName, factory.getClass().getName(), mapper.getClass().getName()));
            return factory;
        }
    }
    throw new InvalidSettingsException(String.format("Unknown factory class \"%s\" -- not registered via extension point", factoryClassName));
}
Also used : NodeModel(org.knime.core.node.NodeModel) ConfigurableNodeFactory(org.knime.core.node.ConfigurableNodeFactory) NodeFactory(org.knime.core.node.NodeFactory) MissingNodeFactory(org.knime.core.node.missing.MissingNodeFactory) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NodeFactoryClassMapper(org.knime.core.node.NodeFactoryClassMapper)

Aggregations

NodeFactory (org.knime.core.node.NodeFactory)17 Node (org.knime.core.node.Node)11 NodeModel (org.knime.core.node.NodeModel)11 HashMap (java.util.HashMap)7 PortType (org.knime.core.node.port.PortType)7 VirtualParallelizedChunkPortObjectInNodeFactory (org.knime.core.node.workflow.virtual.parchunk.VirtualParallelizedChunkPortObjectInNodeFactory)7 Before (org.junit.Before)6 DefaultNodeProgressMonitor (org.knime.core.node.DefaultNodeProgressMonitor)6 ExecutionContext (org.knime.core.node.ExecutionContext)6 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)3 MissingNodeFactory (org.knime.core.node.missing.MissingNodeFactory)3 IContainerObject (org.knime.workbench.repository.model.IContainerObject)3 IRepositoryObject (org.knime.workbench.repository.model.IRepositoryObject)3 IOException (java.io.IOException)2 Image (org.eclipse.swt.graphics.Image)2 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)2 ConfigurableNodeFactory (org.knime.core.node.ConfigurableNodeFactory)2 FileNodePersistor (org.knime.core.node.FileNodePersistor)2 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)2 DialogNode (org.knime.core.node.dialog.DialogNode)2