use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class MVIndividualSettings method loadSettings.
/**
* Loads settings for a column.
* @param settings the settings
* @param repair if true, missing factories are replaced by the do nothing factory, else an exception is thrown
* @return if repair is false, any warning message that occurred, else null
* @throws InvalidSettingsException when the settings are not properly structured
* or repair is false and a factory is missing
*/
public String loadSettings(final NodeSettingsRO settings, final boolean repair) throws InvalidSettingsException {
String factID = settings.getString(FACTORY_ID_CFG);
String warning = null;
m_factory = m_handlerFactoryManager.getFactoryByID(factID);
if (m_factory == null) {
warning = "The factory " + factID + " is not a registered extension but is chosen in the settings.";
if (!repair) {
throw new InvalidSettingsException(warning);
}
m_factory = m_handlerFactoryManager.getDoNothingHandlerFactory();
}
if (settings.containsKey(SETTINGS_CFG)) {
m_settings = new NodeSettings("");
settings.getNodeSettings(SETTINGS_CFG).copyTo(this.m_settings);
}
return warning;
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class ReadContextPropertyNodeModel method configure.
/**
* {@inheritDoc}
*/
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
if (m_config == null) {
m_config = new ReadContextPropertyConfiguration();
m_config.loadSettingsNoFail(new NodeSettings("empty"));
setWarningMessage("Auto-configuration: " + "extracting all available properties");
}
Result result = m_config.createResult();
String message = result.getWarningMessage();
if (message != null) {
setWarningMessage(message);
}
pushFlowVariables(result);
return new PortObjectSpec[] { FlowVariablePortObjectSpec.INSTANCE };
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class DBReaderNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException {
final DataTableSpec lastSpec = getLastSpec();
assert (lastSpec != null) : "Spec must not be null!";
NodeSettings specSett = new NodeSettings("spec.xml");
lastSpec.save(specSett);
File specFile = new File(nodeInternDir, "spec.xml");
specSett.saveToXML(new FileOutputStream(specFile));
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class DBGroupByNodeModel2 method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
super.loadValidatedSettingsFrom(settings);
m_addCountStar.loadSettingsFrom(settings);
m_countStarColName.loadSettingsFrom(settings);
m_groupByCols.loadSettingsFrom(settings);
m_columnNamePolicy.loadSettingsFrom(settings);
m_settings = new NodeSettings("copy");
settings.copyTo(m_settings);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class Statistics3NodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
NodeSettings sett = new NodeSettings("statistic.xml.gz");
getStatTable().save(sett);
sett.saveToXML(new FileOutputStream(new File(internDir, sett.getKey())));
}
Aggregations