コード例 #1
0
  public Response validateCredentials() {
    Response ableToGetToken = Response.SUCCESSFUL;

    if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) {
      Log.i(LOG_TAG, "Credentials were expired.");

      clearCredentials();

      AmazonTVMClient tvm =
          new AmazonTVMClient(
              this.sharedPreferences,
              PropertyLoader.getInstance().getTokenVendingMachineURL(),
              PropertyLoader.getInstance().useSSL());
      ableToGetToken = tvm.anonymousRegister();
      if (ableToGetToken.requestWasSuccessful()) {
        ableToGetToken = tvm.getToken();
      }
    }

    if (ableToGetToken.requestWasSuccessful() && ddb == null) {
      Log.i(LOG_TAG, "Creating New Credentials.");

      AWSCredentials credentials =
          AmazonSharedPreferencesWrapper.getCredentialsFromSharedPreferences(
              this.sharedPreferences);

      ddb = new AmazonDynamoDBClient(credentials);
    }

    return ableToGetToken;
  }
コード例 #2
0
 public boolean hasCredentials() {
   return PropertyLoader.getInstance().hasCredentials();
 }