public Response validateCredentials() { Response ableToGetToken = Response.SUCCESSFUL; if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) { synchronized (this) { if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) { Log.i(LOG_TAG, "Credentials were expired."); AmazonTVMClient tvm = new AmazonTVMClient( this.sharedPreferences, PropertyLoader.getInstance().getTokenVendingMachineURL(), PropertyLoader.getInstance().useSSL()); ableToGetToken = tvm.anonymousRegister(); if (ableToGetToken.requestWasSuccessful()) { ableToGetToken = tvm.getToken(); if (ableToGetToken.requestWasSuccessful()) { Log.i(LOG_TAG, "Creating New Credentials."); initClients(); } } } } } else if (ddb == null) { synchronized (this) { if (ddb == null) { Log.i(LOG_TAG, "Creating New Credentials."); initClients(); } } } return ableToGetToken; }
public boolean hasCredentials() { return PropertyLoader.getInstance().hasCredentials(); }