Ejemplo n.º 1
0
  @Override
  public void validate() throws MessageHandlerException {
    RemindContext.getInstance()
        .getMessageHandler()
        .addMessage(
            "Validating database access: jdbcDriver="
                + jdbcDriver
                + ", jdbcUrl="
                + jdbcUrl
                + ", user="******"Testing connection...");
    DbAccess dbAccess = new DbAccess(jdbcDriver, jdbcUrl, user, password);

    try {
      dbAccess.testConnection(validationStatement);
    } catch (JdbcConnectionTestException e) {
      RemindContext.getInstance()
          .getMessageHandler()
          .addMessage(
              MessageLevel.ERROR,
              "Error while validating database access: jdbcDriver="
                  + jdbcDriver
                  + ", jdbcUrl="
                  + jdbcUrl
                  + ", user="******"Connection tested successfully.");
  }
Ejemplo n.º 2
0
  @Override
  public SqlStatementList convert(Source<File> source) throws MessageHandlerException {
    File sqlFile = source.retrieve();
    SqlStatementList sqlStatementList = new SqlStatementList(sqlFile);
    RemindContext.getInstance()
        .getMessageHandler()
        .addMessage("Converting " + sqlFile.getAbsolutePath() + " to sql statement list.");
    sqlStatementList.convertSqlFileToStatements();

    return sqlStatementList;
  }
Ejemplo n.º 3
0
  public DatabaseTarget(String environment, String sid, String schema) {
    this.environment = environment;
    this.schema = schema;
    this.sid = sid;

    PropertiesProvider propertiesProvider = RemindContext.getInstance().getPropertiesProvider();

    Map<String, String> lookupkeyMapping = new HashMap<String, String>();
    lookupkeyMapping.put(EnvMappedKey, environment);
    lookupkeyMapping.put(SidMappedKey, sid);

    Properties connectionProperties =
        propertiesProvider.getProperties(connectionKeyProvider.getLookupId(lookupkeyMapping));
    jdbcUrl = connectionProperties.getProperty(JdbcUrl, "");
    jdbcDriver = connectionProperties.getProperty(JdbcDriver, "");
    validationStatement = connectionProperties.getProperty(ValidationStatement, "");

    lookupkeyMapping.put(SchemaMappedKey, schema);

    Properties schemaProperties =
        propertiesProvider.getProperties(schemaKeyProvider.getLookupId(lookupkeyMapping));
    user = schemaProperties.getProperty(User, "");
    password = schemaProperties.getProperty(Password, "");
  }