コード例 #1
0
  private Database retrieveDatabase(
      final String dataSourceName, final SchemaCrawlerOptions schemaCrawlerOptions)
      throws Exception {
    final ConnectionOptions connectionOptions =
        (ConnectionOptions) appContext.getBean(dataSourceName);
    final Connection connection = connectionOptions.createConnection();

    try {
      final Database database = SchemaCrawlerUtility.getDatabase(connection, schemaCrawlerOptions);
      return database;
    } catch (final Exception e) {
      throw new SchemaCrawlerException(dataSourceName, e);
    }
  }
コード例 #2
0
 public void execute() throws Exception {
   final Executable executable = new SchemaCrawlerExecutable(command);
   if (outputOptions != null) {
     executable.setOutputOptions(outputOptions);
   }
   if (schemaCrawlerOptions != null) {
     executable.setSchemaCrawlerOptions(schemaCrawlerOptions);
   }
   if (config != null) {
     executable.setAdditionalConfiguration(config);
   }
   if (connectionOptions != null) {
     executable.execute(connectionOptions.createConnection());
   } else {
     throw new SchemaCrawlerException("No connection options provided");
   }
 }