Java Code Examples for org.pentaho.di.core.plugins.PluginInterface#getIds()

The following examples show how to use org.pentaho.di.core.plugins.PluginInterface#getIds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwingGUIResource.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private Map<String, SwingUniversalImage> loadStepImages() {
  Map<String, SwingUniversalImage> map = new HashMap<>();

  for ( PluginInterface plugin : PluginRegistry.getInstance().getPlugins( StepPluginType.class ) ) {
    try {
      SwingUniversalImage image = getUniversalImageIcon( plugin );
      for ( String id : plugin.getIds() ) {
        map.put( id, image );
      }
    } catch ( Exception e ) {
      log.logError( "Unable to load step icon image for plugin: "
        + plugin.getName() + " (id=" + plugin.getIds()[0] + ")", e );
    }
  }

  return map;
}
 
Example 2
Source File: JobEntryCopy.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setDeprecationAndSuggestedJobEntry() {
  PluginRegistry registry = PluginRegistry.getInstance();
  final List<PluginInterface> deprecatedJobEntries = registry.getPluginsByCategory( JobEntryPluginType.class,
    BaseMessages.getString( JobMeta.class, "JobCategory.Category.Deprecated" ) );
  for ( PluginInterface p : deprecatedJobEntries ) {
    String[] ids = p.getIds();
    if ( !ArrayUtils.isEmpty( ids ) && ids[0].equals( this.entry != null ? this.entry.getPluginId() : "" ) ) {
      this.isDeprecated = true;
      this.suggestion = registry.findPluginWithId( JobEntryPluginType.class, this.entry.getPluginId() ) != null
        ? registry.findPluginWithId( JobEntryPluginType.class, this.entry.getPluginId() ).getSuggestion() : "";
      break;
    }
  }
}
 
Example 3
Source File: StepMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setDeprecationAndSuggestedStep() {
  PluginRegistry registry = PluginRegistry.getInstance();
  final List<PluginInterface> deprecatedSteps = registry.getPluginsByCategory( StepPluginType.class,
    BaseMessages.getString( PKG, "BaseStep.Category.Deprecated" ) );
  for ( PluginInterface p : deprecatedSteps ) {
    String[] ids = p.getIds();
    if ( !ArrayUtils.isEmpty( ids ) && ids[0].equals( this.stepid ) ) {
      this.isDeprecated = true;
      this.suggestion = registry.findPluginWithId( StepPluginType.class, this.stepid ) != null
        ? registry.findPluginWithId( StepPluginType.class, this.stepid ).getSuggestion() : "";
      break;
    }
  }
}
 
Example 4
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static Image getImage( Shell shell, PluginInterface plugin ) {
  String id = plugin.getIds()[0];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesJobentries().get( id ).getAsBitmapForSize(
      shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE );
  }
  return null;
}
 
Example 5
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setShellImage( Shell shell ) {
  if ( stepMeta != null ) {
    PluginInterface plugin =
      PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
    createHelpButton( shell, stepMeta, plugin );
    String id = plugin.getIds()[ 0 ];
    if ( id != null ) {
      shell.setImage( GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize(
        shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ) );
    }
  }
}
 
Example 6
Source File: BaseStreamingDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Image getImage() {
  PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example 7
Source File: CommonStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected Image getImage() {
  final PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  final String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example 8
Source File: PartitionSettings.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void fillOptionsAndCodesByPlugins( List<PluginInterface> plugins ) {
  int pluginIndex = 0;
  for ( PluginInterface plugin : plugins ) {
    options[ StepPartitioningMeta.methodDescriptions.length + pluginIndex ] = plugin.getDescription();
    codes[ StepPartitioningMeta.methodCodes.length + pluginIndex ] = plugin.getIds()[ 0 ];
    pluginIndex++;
  }
}
 
Example 9
Source File: ExtensionPointMap.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Add the extension point plugin to the map
 * 
 * @param extensionPointPlugin
 */
public void addExtensionPoint( PluginInterface extensionPointPlugin ) {
  lock.writeLock().lock();
  try {
    for ( String id : extensionPointPlugin.getIds() ) {
      extensionPointPluginMap.put( extensionPointPlugin.getName(), id, createLazyLoader( extensionPointPlugin ) );
    }
  } finally {
    lock.writeLock().unlock();
  }
}
 
Example 10
Source File: ExtensionPointMap.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Remove the extension point plugin from the map
 * 
 * @param extensionPointPlugin
 */
public void removeExtensionPoint( PluginInterface extensionPointPlugin ) {
  lock.writeLock().lock();
  try {
    for ( String id : extensionPointPlugin.getIds() ) {
      extensionPointPluginMap.remove( extensionPointPlugin.getName(), id );
    }
  } finally {
    lock.writeLock().unlock();
  }
}
 
Example 11
Source File: ValueMetaFactory.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static String[] getAllValueMetaNames() {
  List<String> strings = new ArrayList<String>();
  List<PluginInterface> plugins = pluginRegistry.getPlugins( ValueMetaPluginType.class );
  for ( PluginInterface plugin : plugins ) {
    String id = plugin.getIds()[0];
    if ( !( "0".equals( id ) ) ) {
      strings.add( plugin.getName() );
    }
  }
  return strings.toArray( new String[strings.size()] );
}
 
Example 12
Source File: JmsProducerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Image getImage() {
  PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example 13
Source File: MQTTProducerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Image getImage() {
  PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example 14
Source File: KettleDatabaseRepositoryCreationHelper.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Update the list in R_JOBENTRY_TYPE
 *
 * @param create
 *
 * @exception KettleException
 *              if something went wrong during the update.
 */
public void updateJobEntryTypes( List<String> statements, boolean dryrun, boolean create ) throws KettleException {
  synchronized ( repository ) {

    // We should only do an update if something has changed...
    PluginRegistry registry = PluginRegistry.getInstance();
    List<PluginInterface> jobPlugins = registry.getPlugins( JobEntryPluginType.class );

    for ( int i = 0; i < jobPlugins.size(); i++ ) {
      PluginInterface jobPlugin = jobPlugins.get( i );
      String type_desc = jobPlugin.getIds()[0];
      String type_desc_long = jobPlugin.getName();
      ObjectId id = null;
      if ( !create ) {
        id = repository.jobEntryDelegate.getJobEntryTypeID( type_desc );
      }
      if ( id == null ) {
        // Not found, we need to add this one...

        // We need to add this one ...
        id = new LongObjectId( i + 1 );
        if ( !create ) {
          id = repository.connectionDelegate.getNextJobEntryTypeID();
        }

        RowMetaAndData table = new RowMetaAndData();
        table.addValue( new ValueMetaInteger(
          KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_ID_JOBENTRY_TYPE ), id );
        table.addValue( new ValueMetaString(
          KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_CODE ), type_desc );
        table.addValue( new ValueMetaString(
          KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_DESCRIPTION ), type_desc_long );

        if ( dryrun ) {
          String sql =
            database.getSQLOutput(
              null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE, table.getRowMeta(), table.getData(),
              null );
          statements.add( sql );
        } else {
          database.prepareInsert( table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE );
          database.setValuesInsert( table );
          database.insertRow();
          database.closeInsert();
        }
      }
    }
  }
}