use of org.pentaho.di.core.row.RowBuffer in project pentaho-kettle by pentaho.
the class Spoon method showPluginInfo.
/**
* Show a plugin browser
*/
public void showPluginInfo() {
try {
// First we collect information concerning all the plugin types...
//
Map<String, RowMetaInterface> metaMap = new HashMap<>();
Map<String, List<Object[]>> dataMap = new HashMap<>();
PluginRegistry registry = PluginRegistry.getInstance();
List<Class<? extends PluginTypeInterface>> pluginTypeClasses = registry.getPluginTypes();
for (Class<? extends PluginTypeInterface> pluginTypeClass : pluginTypeClasses) {
PluginTypeInterface pluginTypeInterface = registry.getPluginType(pluginTypeClass);
if (pluginTypeInterface.isFragment()) {
continue;
}
String subject = pluginTypeInterface.getName();
RowBuffer pluginInformation = registry.getPluginInformation(pluginTypeClass);
metaMap.put(subject, pluginInformation.getRowMeta());
dataMap.put(subject, pluginInformation.getBuffer());
}
// Now push it all to a subject data browser...
//
SubjectDataBrowserDialog dialog = new SubjectDataBrowserDialog(shell, metaMap, dataMap, "Plugin browser", "Plugin type");
dialog.open();
} catch (Exception e) {
new ErrorDialog(shell, "Error", "Error listing plugins", e);
}
}
use of org.pentaho.di.core.row.RowBuffer in project pentaho-kettle by pentaho.
the class PluginRegistry method getPluginInformation.
/**
* @param pluginType the type of plugin to get information for
* @return a row buffer containing plugin information for the given plugin type
* @throws KettlePluginException
*/
public RowBuffer getPluginInformation(Class<? extends PluginTypeInterface> pluginType) throws KettlePluginException {
RowBuffer rowBuffer = new RowBuffer(getPluginInformationRowMeta());
for (PluginInterface plugin : getPlugins(pluginType)) {
Object[] row = new Object[getPluginInformationRowMeta().size()];
int rowIndex = 0;
row[rowIndex++] = getPluginType(plugin.getPluginType()).getName();
row[rowIndex++] = plugin.getIds()[0];
row[rowIndex++] = plugin.getName();
row[rowIndex++] = Const.NVL(plugin.getDescription(), "");
row[rowIndex++] = Utils.isEmpty(plugin.getLibraries()) ? "" : plugin.getLibraries().toString();
row[rowIndex++] = Const.NVL(plugin.getImageFile(), "");
row[rowIndex++] = plugin.getClassMap().values().toString();
row[rowIndex] = Const.NVL(plugin.getCategory(), "");
rowBuffer.getBuffer().add(row);
}
return rowBuffer;
}
use of org.pentaho.di.core.row.RowBuffer in project pentaho-kettle by pentaho.
the class PluginRegistryUnitTest method getGetPluginInformation.
@Test
public void getGetPluginInformation() throws KettlePluginException {
PluginRegistry.getInstance().reset();
RowBuffer result = PluginRegistry.getInstance().getPluginInformation(BasePluginType.class);
assertNotNull(result);
assertEquals(8, result.getRowMeta().size());
for (ValueMetaInterface vmi : result.getRowMeta().getValueMetaList()) {
assertEquals(ValueMetaInterface.TYPE_STRING, vmi.getType());
}
}
Aggregations