Examples of UpdateFailedException


Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

            countFailedApiCall(updateInfo.apiKey, updateInfo.objectTypes, then, requestUrl, reasonPhrase,
                               statusCode, reasonPhrase);
            if (statusCode==401)
                throw new AuthExpiredException();
            else if (statusCode>=400&&statusCode<500)
                throw new UpdateFailedException("Unexpected response code " + statusCode, new Exception(), true,
                                                ApiKey.PermanentFailReason.clientError(statusCode, reasonPhrase));
            throw new UpdateFailedException(new Exception());
    }
  }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                               updateInfo.objectTypes, then, requestUrl, reasonPhrase,
                               statusCode, reasonPhrase);
            if (statusCode==401)
                throw new AuthExpiredException();
            else if (statusCode>=400&&statusCode<500)
                throw new UpdateFailedException("Unexpected response code " + statusCode, new Exception(), true,
                                                ApiKey.PermanentFailReason.clientError(statusCode, reasonPhrase));
            throw new UpdateFailedException(new Exception());
    }
  }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                               httpResponseCode, body);
            if (httpResponseCode==403) {
                handleTokenRevocation(body);
            }
            if (httpResponseCode>=400&&httpResponseCode<500)
                throw new UpdateFailedException("Unexpected response code: " + httpResponseCode, true,
                                                ApiKey.PermanentFailReason.clientError(httpResponseCode));
            else
                throw new UpdateFailedException("Unexpected code: " + httpResponseCode);
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                                   updateInfo.objectTypes, then, activityURL, ExceptionUtils.getStackTrace(new Exception()),
                                   httpResponseCode, body);
                if (httpResponseCode==403)
                    handleTokenRevocation(body);
                if (httpResponseCode>=400&&httpResponseCode<500)
                    throw new UpdateFailedException("Unexpected response code: " + httpResponseCode, true, ApiKey.PermanentFailReason.clientError(httpResponseCode));
                else
                    throw new UpdateFailedException("Unexpected code: " + httpResponseCode);
            }
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                               updateInfo.objectTypes, then, activityFeedURL, ExceptionUtils.getStackTrace(new Exception()),
                               httpResponseCode, body);
            if (httpResponseCode==403)
                handleTokenRevocation(body);
            if (httpResponseCode>=400&&httpResponseCode<500)
                throw new UpdateFailedException("Unexpected response code: " + httpResponseCode, true, ApiKey.PermanentFailReason.clientError(httpResponseCode));
            else
                throw new UpdateFailedException("Unexpected code: " + httpResponseCode);
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                                                      "<p>We apologize for the inconvenience</p>");

            // Record permanent failure since this connector won't work again until
            // it is reauthenticated
            guestService.setApiKeyStatus(apiKey.getId(), ApiKey.Status.STATUS_PERMANENT_FAILURE, null, ApiKey.PermanentFailReason.NEEDS_REAUTH);
            throw new UpdateFailedException("requires token reauthorization", true, ApiKey.PermanentFailReason.NEEDS_REAUTH);
        }

        // We're not on a mirrored test server.  Try to swap the expired
        // access token for a fresh one.  Typically moves access tokens are good for
        // 180 days from time of issue.
        String swapTokenUrl = "https://api.moves-app.com/oauth/v1/access_token";

        final String refreshToken = guestService.getApiKeyAttribute(apiKey, "refreshToken");
        Map<String,String> params = new HashMap<String,String>();
        params.put("refresh_token", refreshToken);
        params.put("client_id", guestService.getApiKeyAttribute(apiKey, "moves.client.id"));
        params.put("client_secret", guestService.getApiKeyAttribute(apiKey, "moves.client.secret"));
        params.put("grant_type", "refresh_token");

        String fetched;
        try {
            fetched = HttpUtils.fetch(swapTokenUrl, params);
            // Record that this connector is now up
            guestService.setApiKeyStatus(apiKey.getId(), ApiKey.Status.STATUS_UP, null, null);
        } catch (Exception e) {
            // Notify the user that the tokens need to be manually renewed
            notificationsService.addNamedNotification(apiKey.getGuestId(), Notification.Type.WARNING, connector.statusNotificationName(),
                                                      "Heads Up. We failed in our attempt to automatically refresh your Moves authentication tokens.<br>" +
                                                      "Please head to <a href=\"javascript:App.manageConnectors()\">Manage Connectors</a>,<br>" +
                                                      "scroll to the Moves connector, delete the connector, and re-add<br>" +
                                                      "<p>We apologize for the inconvenience</p>");

            // Record permanent update failure since this connector is never
            // going to succeed
            guestService.setApiKeyStatus(apiKey.getId(), ApiKey.Status.STATUS_PERMANENT_FAILURE, null, ApiKey.PermanentFailReason.NEEDS_REAUTH);
            throw new UpdateFailedException("refresh token attempt failed", e, true, ApiKey.PermanentFailReason.NEEDS_REAUTH);
        }

        JSONObject token = JSONObject.fromObject(fetched);
        final long expiresIn = token.getLong("expires_in");
        final String access_token = token.getString("access_token");
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                                                      "scroll to the Google Calendar connector, and renew your tokens (look for the <i class=\"icon-resize-small icon-large\"></i> icon)");

            // Record permanent update failure since this connector is never
            // going to succeed
            guestService.setApiKeyStatus(apiKey.getId(), ApiKey.Status.STATUS_PERMANENT_FAILURE, Utils.stackTrace(e), ApiKey.PermanentFailReason.NEEDS_REAUTH);
            throw new UpdateFailedException("refresh token attempt permanently failed due to a bad token refresh response", e, true, ApiKey.PermanentFailReason.NEEDS_REAUTH);
        }
        catch (IOException e) {
            // Notify the user that the tokens need to be manually renewed
            throw new UpdateFailedException("refresh token attempt failed", e, true, ApiKey.PermanentFailReason.NEEDS_REAUTH);
        }

        return credential;
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                throw new Exception("Account email not in email list");
            emailMap.put(apiKey,emailAddress);
            return emailAddress;
        }
        catch (Exception e){
            throw new UpdateFailedException("Failed to get gmail address!", e, false, null);
        }

    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

    } catch (MessagingException ex){
            notificationsService.addNamedNotification(updateInfo.getGuestId(),
                                                      Notification.Type.ERROR, connector().getName() + ".smsFolderError",
                                                      "The SMS folder configured for SMS Backup, \"" + smsFolderName + "\", does not exist. Either change it in your connector settings or check if SMS Backup is set to use this folder.");
            throw new UpdateFailedException("Couldn't open SMS folder.",true, null);
        }
        catch (Exception ex) {
            ex.printStackTrace();
      reportFailedApiCall(updateInfo.apiKey, smsObjectType.value(),
          then, query, Utils.stackTrace(ex), ex.getMessage());
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

      countSuccessfulApiCall(updateInfo.apiKey, callLogObjectType.value(), then, query);
    }
        catch (MessagingException ex){
            notificationsService.addNamedNotification(updateInfo.getGuestId(), Notification.Type.ERROR, connector().getName() + ".callLogFolderError",
                                  "The call log folder configured for SMS Backup, \"" + callLogFolderName + "\", does not exist. Either change it in your connector settings or check if SMS Backup is set to use this folder.");
            throw new UpdateFailedException("Couldn't open Call Log folder.",true, null);
        }
        catch (Exception ex) {
            ex.printStackTrace();
      reportFailedApiCall(updateInfo.apiKey,
          callLogObjectType.value(), then, query, Utils.stackTrace(ex),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.