@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() ); } }
private Map<String, DatabaseInterface> doCreate() { LogChannelInterface log = LogChannel.GENERAL; PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> plugins = registry.getPlugins( DatabasePluginType.class ); HashMap<String, DatabaseInterface> tmpAllDatabaseInterfaces = new HashMap<>(); for ( PluginInterface plugin : plugins ) { try { DatabaseInterface databaseInterface = (DatabaseInterface) registry.loadClass( plugin ); databaseInterface.setPluginId( plugin.getIds()[ 0 ] ); databaseInterface.setPluginName( plugin.getName() ); tmpAllDatabaseInterfaces.put( plugin.getIds()[ 0 ], databaseInterface ); } catch ( KettlePluginException cnfe ) { // System.out.println( "Could not create connection entry for " + plugin.getName() + ". " + cnfe.getCause().getClass().getName() ); log.logError( "Could not create connection entry for " + plugin.getName() + ". " + cnfe.getCause().getClass().getName() ); if ( log.isDebug() ) { log.logDebug( "Debug-Error loading plugin: " + plugin, cnfe ); } } catch ( Exception e ) { log.logError( "Error loading plugin: " + plugin, e ); } } return Collections.unmodifiableMap( tmpAllDatabaseInterfaces ); }
databaseInterface.setPluginId( pluginId ); databaseMeta.setDatabaseInterface( databaseInterface );