use of org.knime.core.node.workflow.FileWorkflowPersistor in project knime-core by knime.
the class RepositoryFactory method loadMetaNode.
private static WorkflowManagerUI loadMetaNode(final String pluginId, final String workflowDir) {
LOGGER.debug("found pre-installed template " + workflowDir);
Bundle bundle = Platform.getBundle(pluginId);
URL url = FileLocator.find(bundle, new Path(workflowDir), null);
if (url != null) {
try {
File f = new File(FileLocator.toFileURL(url).getFile());
LOGGER.debug("meta node template name: " + f.getName());
WorkflowLoadHelper loadHelper = new WorkflowLoadHelper(true) {
/**
* {@inheritDoc}
*/
@Override
public String getDotKNIMEFileName() {
return WorkflowPersistor.WORKFLOW_FILE;
}
};
// don't lock workflow dir
FileWorkflowPersistor persistor = WorkflowManager.createLoadPersistor(f, loadHelper);
WorkflowManager metaNode = WorkflowManager.META_NODE_ROOT.load(persistor, new ExecutionMonitor(), false).getWorkflowManager();
return WorkflowManagerWrapper.wrap(metaNode);
} catch (CanceledExecutionException cee) {
LOGGER.error("Unexpected canceled execution exception", cee);
} catch (Exception e) {
LOGGER.error("Failed to load meta workflow repository", e);
}
}
return null;
}
Aggregations