use of org.knime.core.node.NodeAndBundleInformation in project knime-core by knime.
the class InstallMissingNodesJob method findExtensions.
private IStatus findExtensions(final IProgressMonitor monitor, final List<NodeAndBundleInformation> missingNodes, final Set<IInstallableUnit> featuresToInstall) {
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
Bundle myself = FrameworkUtil.getBundle(getClass());
try {
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : metadataManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)) {
if (!missingNodes.isEmpty()) {
IMetadataRepository repo = metadataManager.loadRepository(uri, monitor);
for (Iterator<NodeAndBundleInformation> it = missingNodes.iterator(); it.hasNext(); ) {
NodeAndBundleInformation info = it.next();
if (searchInRepository(repo, info, metadataManager, monitor, featuresToInstall)) {
it.remove();
}
}
}
}
return Status.OK_STATUS;
} catch (ProvisionException ex) {
NodeLogger.getLogger(getClass()).error("Could not create provisioning agent: " + ex.getMessage(), ex);
return new Status(IStatus.ERROR, myself.getSymbolicName(), "Could not query updates site for missing extensions", ex);
}
}
use of org.knime.core.node.NodeAndBundleInformation in project knime-core by knime.
the class NativeNodeContainer method performStateTransitionEXECUTED.
/**
* {@inheritDoc}
*/
@Override
void performStateTransitionEXECUTED(final NodeContainerExecutionStatus status) {
synchronized (m_nodeMutex) {
switch(getInternalState()) {
case POSTEXECUTE:
closeFileStoreHandlerAfterExecute(status.isSuccess());
if (status.isSuccess()) {
if (this.getNode().getLoopContext() != null) {
// loop not yet done - "stay" configured until done.
assert this.getLoopStatus().equals(LoopStatus.RUNNING);
setInternalState(InternalNodeContainerState.CONFIGURED_MARKEDFOREXEC);
} else {
setInternalState(InternalNodeContainerState.EXECUTED);
m_nodeAndBundleInformation = new NodeAndBundleInformation(m_node);
setExecutionEnvironment(null);
}
} else {
// node will be configured in doAfterExecute.
// for now we assume complete failure and clean up (reset)
// We do keep the message, though.
NodeMessage oldMessage = getNodeMessage();
NodeContext.pushContext(this);
try {
performReset();
} finally {
NodeContext.removeLastContext();
}
this.clearFileStoreHandler();
setNodeMessage(oldMessage);
setInternalState(InternalNodeContainerState.IDLE);
setExecutionEnvironment(null);
}
setExecutionJob(null);
break;
default:
throwIllegalStateException();
}
}
}
use of org.knime.core.node.NodeAndBundleInformation in project knime-core by knime.
the class InstallMissingNodesJob method run.
@Override
protected IStatus run(final IProgressMonitor monitor) {
List<NodeAndBundleInformation> missingNodes = m_missingNodes.stream().filter(distinctByKey(i -> i.getFactoryClass())).collect(Collectors.toList());
Set<IInstallableUnit> featuresToInstall = new HashSet<>();
IStatus status = findExtensions(monitor, missingNodes, featuresToInstall);
if (!status.isOK()) {
return status;
} else if (featuresToInstall.isEmpty()) {
Display.getDefault().asyncExec(() -> {
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "No suitable extension found", "Could not find any extension(s) that provides the missing node(s).");
});
return Status.OK_STATUS;
} else {
if (!missingNodes.isEmpty()) {
Display.getDefault().syncExec(() -> {
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Not all extension found", "No extensions for the following nodes were found: " + missingNodes.stream().map(i -> i.getNodeNameNotNull()).collect(Collectors.joining(", ")));
});
}
startInstallJob(featuresToInstall);
return Status.OK_STATUS;
}
}
Aggregations