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

The following examples show how to use org.pentaho.di.core.plugins.PluginInterface#getName() . 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: DataHandler.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void pluginAdded( Object serviceObject ) {
  PluginInterface plugin = (PluginInterface) serviceObject;
  String pluginName = plugin.getName();
  try {
    DatabaseInterface databaseInterface = (DatabaseInterface) registry.loadClass( plugin );
    databaseInterface.setPluginId( plugin.getIds()[ 0 ] );
    databaseInterface.setName( pluginName );
    databaseTypeAdded( pluginName, databaseInterface );
  } catch ( KettleException e ) {
    Throwable t = e;
    if ( e.getCause() != null ) {
      t = e.getCause();
    }
    System.out.println( "Could not create connection entry for "
      + pluginName + ".  " + t.getClass().getName() );
    LogChannel.GENERAL.logError( "Could not create connection entry for "
      + pluginName + ".  " + t.getClass().getName() );
  }
}
 
Example 2
Source File: BaseImportRule.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
  // The rule name with an indication of whether or not this rule is enabled should do for now.
  //
  String pluginId = PluginRegistry.getInstance().getPluginId( this );
  PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId( ImportRulePluginType.class, pluginId );
  return plugin.getName() + " (" + ( enabled ? "enabled" : "disabled" ) + ").";
}
 
Example 3
Source File: ValueMetaFactory.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static String getValueMetaName( int type ) {
  for ( PluginInterface plugin : pluginRegistry.getPlugins( ValueMetaPluginType.class ) ) {
    if ( Integer.toString( type ).equals( plugin.getIds()[0] ) ) {
      return plugin.getName();
    }
  }
  return "-";
}
 
Example 4
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();
        }
      }
    }
  }
}
 
Example 5
Source File: DataHandler.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public void pluginRemoved( Object serviceObject ) {
  PluginInterface plugin = (PluginInterface) serviceObject;
  String pluginName = plugin.getName();
  databaseTypeRemoved( pluginName );
}