Search in sources :

Example 1 with RowBuffer

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);
    }
}
Also used : PluginTypeInterface(org.pentaho.di.core.plugins.PluginTypeInterface) HashMap(java.util.HashMap) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowBuffer(org.pentaho.di.core.row.RowBuffer) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException) SubjectDataBrowserDialog(org.pentaho.di.ui.core.dialog.SubjectDataBrowserDialog) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) ArrayList(java.util.ArrayList) List(java.util.List) RepositoryObject(org.pentaho.di.repository.RepositoryObject) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) FileObject(org.apache.commons.vfs2.FileObject)

Example 2 with RowBuffer

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;
}
Also used : RowBuffer(org.pentaho.di.core.row.RowBuffer)

Example 3 with 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());
    }
}
Also used : RowBuffer(org.pentaho.di.core.row.RowBuffer) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Aggregations

RowBuffer (org.pentaho.di.core.row.RowBuffer)3 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 FileObject (org.apache.commons.vfs2.FileObject)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 SWTException (org.eclipse.swt.SWTException)1 Test (org.junit.Test)1 KettleAuthException (org.pentaho.di.core.exception.KettleAuthException)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)1 KettleRowException (org.pentaho.di.core.exception.KettleRowException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)1 LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)1 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)1 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)1 PluginTypeInterface (org.pentaho.di.core.plugins.PluginTypeInterface)1