예제 #1
0
  private void extractLibraries(TransMeta transMeta) {
    List<String> libraries = new ArrayList<String>();

    // First the common libraries
    //
    libraries.add("lib/kettle-engine-3.0.jar");
    for (int i = 0; i < generalLibs.length; i++) {
      libraries.add("libext/" + generalLibs[i]);
    }

    // Determine the libs that the steps use.
    //
    for (int s = 0; s < transMeta.nrSteps(); s++) {
      // The step itself
      String stepLibs[] = transMeta.getStep(s).getStepMetaInterface().getUsedLibraries();
      if (stepLibs != null) {
        for (int i = 0; i < stepLibs.length; i++) {
          libraries.add("libext/" + stepLibs[i]);
        }
      }

      // Used connections
      DatabaseMeta[] usedDatabaseConnections =
          transMeta.getStep(s).getStepMetaInterface().getUsedDatabaseConnections();
      for (int c = 0; c < usedDatabaseConnections.length; c++) {
        String dbLibs[] = usedDatabaseConnections[c].getDatabaseInterface().getUsedLibraries();
        if (dbLibs != null) {
          for (int i = 0; i < dbLibs.length; i++) {
            libraries.add("libext/" + dbLibs[i]);
          }
        }
      }
    }

    libraryFiles =
        Const.getDistinctStrings((String[]) libraries.toArray(new String[libraries.size()]));
  }
예제 #2
0
  public void analyseImpact(
      List<DatabaseImpact> impact,
      TransMeta transMeta,
      StepMeta stepMeta,
      RowMetaInterface prev,
      String[] input,
      String[] output,
      RowMetaInterface info)
      throws KettleStepException {

    RowMetaInterface out = prev.clone();
    getFields(
        out,
        stepMeta.getName(),
        new RowMetaInterface[] {
          info,
        },
        null,
        transMeta);
    if (out != null) {
      for (int i = 0; i < out.size(); i++) {
        ValueMetaInterface outvalue = out.getValueMeta(i);
        DatabaseImpact di =
            new DatabaseImpact(
                DatabaseImpact.TYPE_IMPACT_READ,
                transMeta.getName(),
                stepMeta.getName(),
                databaseMeta.getDatabaseName(),
                "", //$NON-NLS-1$
                outvalue.getName(),
                outvalue.getName(),
                stepMeta.getName(),
                sql,
                Messages.getString("DynamicSQLRowMeta.DatabaseImpact.Title") // $NON-NLS-1$
                );
        impact.add(di);
      }
    }
  }