Package com.streamreduce.core.service.exception

Examples of com.streamreduce.core.service.exception.InvalidCredentialsException


        try {
            List<JSONObject> response =  makeRequest(userUrl);
            return (response.size() == 1 ? response.get(0) : null);
        } catch (InvalidCredentialsException e) {
            throw new InvalidCredentialsException("The GitHub connection credentials for " +
                                                          getConnectionCredentials().getIdentity() + " are invalid.");
        }
    }
View Full Code Here


    @Override
    public void validateConnection() throws InvalidCredentialsException, IOException {
        List<JSONObject> profileIds = getProfiles();
        if (CollectionUtils.isEmpty(profileIds)) {
            throw new InvalidCredentialsException("You must have one or more profiles defined in Google Analytics in order to continue.");
        }
    }
View Full Code Here

        oAuthService.signRequest(token, request);

        Response response = request.send();

        if (response.getCode() == 401 || response.getCode() == 403) {
            throw new InvalidCredentialsException("The OAuth Token is invalid, or has been revoked");
        } else if (response.getCode() != 200) {
            throw new IOException("Unexpected status code of " + response.getCode() + ": " + response.getBody() +
                                          " for a " + method + " request to" + url);
        }
View Full Code Here

            if (entity != null) {
                response = EntityUtils.toString(entity);
            }
            int responseCode = httpResponse.getStatusLine().getStatusCode();
            if (responseCode == 401 || responseCode == 403) {
                throw new InvalidCredentialsException("The connection credentials are invalid.");
            } else if (responseCode < 200 || responseCode > 299) {
                throw new IOException("Unexpected status code of " + responseCode + " for a " + method + " request to " + url);
            }

            if (responseHeaders != null) {
View Full Code Here

            String username = getConnectionCredentials().getIdentity();
            String password = getConnectionCredentials().getCredential();

            if (!StringUtils.hasText(username) || !StringUtils.hasText(password)) {
                throw new InvalidCredentialsException("You must supply an identity/username for cloud connections.");
            }

            try {
                computeServiceContext = ContextBuilder.newBuilder("aws-ec2")
                                                      .credentials(username, password)
                                                      .modules(ImmutableSet.<Module>of(
                                                              new SshjSshClientModule(),
                                                              new SLF4JLoggingModule()))
                                                      .overrides(overrides)
                                                      .buildView(ComputeServiceContext.class);

                // since the compute service context doesn't try to auth against AWS until it
                // needs to, make a call to listNodes() to force the auth.
                computeServiceContext.getComputeService().listNodes();
            } catch (AuthorizationException ae) {
                throw new InvalidCredentialsException(ae);
            }
        }

        return computeServiceContext;
    }
View Full Code Here

        if (blobStoreContext == null) {
            String username = getConnectionCredentials().getIdentity();
            String password = getConnectionCredentials().getCredential();

            if (!StringUtils.hasText(username) || !StringUtils.hasText(password)) {
                throw new InvalidCredentialsException("You must supply an identity/username for cloud connections.");
            }

            try {
                blobStoreContext = ContextBuilder.newBuilder("aws-s3")
                                                 .credentials(username, password)
                                                 .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
                                                 .buildView(BlobStoreContext.class);
            } catch (AuthorizationException ae) {
                throw new InvalidCredentialsException(ae);
            }
        }

        return blobStoreContext;
    }
View Full Code Here

                cloudWatchContext = ContextBuilder.newBuilder("aws-cloudwatch")
                        .credentials(username, password)
                        .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
                        .build();
            } catch (AuthorizationException ae) {
                throw new InvalidCredentialsException(ae);
            }
        }

        return cloudWatchContext;
    }
View Full Code Here

            return;
        }
        // otherwise we got back an error.
        else if (json.containsKey("error")) {
            JSONObject error = json.getJSONObject("error");
            throw new InvalidCredentialsException(error.getString("errormessage"));
        }
    }
View Full Code Here

     * @throws InvalidCredentialsException
     */
    private void validateCredentials() throws InvalidCredentialsException {
        ConnectionCredentials creds = connection.getCredentials();
        if (creds == null || (creds.getIdentity() == null || creds.getCredential() == null || creds.getApiKey() == null)) {
            throw new InvalidCredentialsException("Connection credentials require a username, password and API key.");
        }
    }
View Full Code Here

                JSONObject fileStatus = responseBody.getJSONObject("FileStatus" );
                /*
                   Since the file exists, does the user own it?
                */
                if (!fileStatus.get("owner" ).equals(username)) {
                    throw new InvalidCredentialsException(String.format("User %s does not own the target destination.", username));
                }
                /*
                   We can't write to a directory.
                   NOTE: This is commented out for now since I'm not sure it's necessary behavior. @NJH
               else if (fileStatus.get("type").equals("DIRECTORY")) {
View Full Code Here

TOP

Related Classes of com.streamreduce.core.service.exception.InvalidCredentialsException

Copyright © 2018 www.massapicom. 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.