private void validateStepUsesDatabaseMeta( T metaToSave, DatabaseMeta dbMeta ) throws KettleException { // If a step makes use of a DatabaseMeta for configuration, it needs to report the usage DatabaseMeta[] usedConnections = metaToSave.getUsedDatabaseConnections(); if ( usedConnections == null || usedConnections.length <= 0 || !Arrays.asList( usedConnections ).contains( dbMeta ) ) { throw new KettleException( "The step did not report a DatabaseMeta in getUsedDatabaseConnections()" ); } }
transMeta.getStep( s ).getStepMetaInterface().getUsedDatabaseConnections(); for ( int c = 0; c < usedDatabaseConnections.length; c++ ) { String[] dbLibs = usedDatabaseConnections[c].getDatabaseInterface().getUsedLibraries();
/** * This method asks all steps in the transformation whether or not the specified database connection is used. The * connection is used in the transformation if any of the steps uses it or if it is being used to log to. * * @param databaseMeta * The connection to check * @return true if the connection is used in this transformation. */ public boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ) { for ( int i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); DatabaseMeta[] dbs = stepMeta.getStepMetaInterface().getUsedDatabaseConnections(); for ( int d = 0; d < dbs.length; d++ ) { if ( dbs[d].equals( databaseMeta ) ) { return true; } } } return transLogTable.getDatabaseMeta() != null && transLogTable.getDatabaseMeta().equals( databaseMeta ); }