Beispiel #1
0
  public void init() {

    hostname = turkDAO.getConfigValue(Config.HOST);
    log.info("Config.HOST = " + hostname);

    ClientConfig clientConfig = new ClientConfig();

    String accessKeyId = turkDAO.getConfigValue(Config.ACCESS_KEY_ID);

    log.info("Config.ACCESS_KEY_ID = " + accessKeyId);
    clientConfig.setAccessKeyId(accessKeyId);

    String secretAccessKey = turkDAO.getConfigValue(Config.SECRET_ACCESS_KEY);

    String turkEnvironment = turkDAO.getConfigValue(Config.TURK_ENVIRONMENT);
    log.info("Config.TURK_ENVIRONMENT = " + turkEnvironment);

    clientConfig.setSecretAccessKey(secretAccessKey);

    if ("SANDBOX".equalsIgnoreCase(turkEnvironment)) {
      clientConfig.setServiceURL(ClientConfig.SANDBOX_SERVICE_URL);
    } else {
      clientConfig.setServiceURL(ClientConfig.PRODUCTION_SERVICE_URL);
    }

    clientConfig.setRetryAttempts(10);
    clientConfig.setRetryDelayMillis(1000);
    HashSet<String> retriableErrors = new HashSet<String>();
    retriableErrors.add("Server.ServiceUnavailable");

    clientConfig.setRetriableErrors(retriableErrors);

    service = new RequesterService(clientConfig);

    tierOneReward = Double.parseDouble(turkDAO.getConfigValue(Config.TIER_1_REWARD));
    tierTwoReward = Double.parseDouble(turkDAO.getConfigValue(Config.TIER_2_REWARD));
  }