Package com.streamreduce.util

Examples of com.streamreduce.util.ExternalIntegrationClient


            logger.info("Connection with providerId of " + connection.getProviderId() + " does not " +
                    "support validation via an external client.");
            return;
        }

        ExternalIntegrationClient externalClient = connectionProvider.getClient(connection);
        externalClient.validateConnection();
        externalClient.cleanUp();
    }
View Full Code Here


    private void validateOutboundConfigurations(Set<OutboundConfiguration> outboundConfigurations) throws InvalidCredentialsException, IOException {
        if (CollectionUtils.isEmpty(outboundConfigurations)) {
            return;
        }

        ExternalIntegrationClient externalClient = null;
        try {
            for (OutboundConfiguration outboundConfiguration : outboundConfigurations) {
                if (outboundConfiguration.getProtocol().equals("s3")) {
                    AWSClient awsClient = new AWSClient(outboundConfiguration);
                    externalClient = awsClient;
                    externalClient.validateConnection();
                    try {
                        awsClient.createBucket(outboundConfiguration);
                    } catch (IllegalStateException e) { //thrown when a bucket name is already taken
                        throw new InvalidOutboundConfigurationException(e.getMessage(), e);
                    }
                } else if (outboundConfiguration.getProtocol().equals("webhdfs")) {
                    externalClient = new WebHDFSClient(outboundConfiguration);
                    externalClient.validateConnection();
                }
            }
        } finally {
            if (externalClient != null) {
                externalClient.cleanUp();
            }
        }
    }
View Full Code Here

        logger.debug("Updating inventory item cache for connection [" + connection.getId() + "]: " +
                             connection.getAlias());

        List<String> processedKeys = new ArrayList<>();
        List<JSONObject> externalInventoryItems;
        ExternalIntegrationClient client = getClient(connection);

        if (client instanceof AWSClient) {
            AWSClient awsClient = null;
            try {
                awsClient = new AWSClient(connection);
                // Get the EC2 inventory items
                externalInventoryItems = (awsClient.getEC2Instances());
                // Get the S3 inventory items
                externalInventoryItems.addAll(awsClient.getS3BucketsAsJson());
            } finally {
                if (awsClient != null) {
                    awsClient.cleanUp();
                }
            }
        } else if (client instanceof GitHubClient) {
            externalInventoryItems = ((GitHubClient) client).getRepositories();
        } else if (client instanceof GoogleAnalyticsClient) {
            externalInventoryItems = ((GoogleAnalyticsClient) client).getProfiles();
        } else if (client instanceof JiraClient) {
            externalInventoryItems = ((JiraClient)client).getProjects(false);
        else if (client instanceof PingdomClient) {
            externalInventoryItems = ((PingdomClient)client).checks();
        } else if (client instanceof FeedClient) {
            return;
        } else if (client instanceof TwitterClient) {
            return;
        } else {
            throw new IllegalArgumentException(client.getClass().getName() + " is not a supported external client.");
        }

        logger.debug("  Provider id: " + connection.getProviderId());
        logger.debug("  Inventory items found: " + externalInventoryItems.size());
View Full Code Here

        Connection connection = inventoryItem.getConnection();
        ObjectId connectionId = connection.getId();
        String key = json.getString("key");
        String name = json.getString("name");
        String description = json.getString("description");
        ExternalIntegrationClient rawClient = externalClientCache.getIfPresent(connectionId);
        JiraClient client;

        if (rawClient == null) {
            client = new JiraClient(connection);
View Full Code Here

                .html((rawContent))
                .build();
    }

    private ExternalIntegrationClient getClient(Connection connection) {
        ExternalIntegrationClient client;
        client = externalClientCache.getIfPresent(connection.getId());
        if (client == null) {
            client = connectionProviderFactory.externalIntegrationConnectionProviderFromId(connection.getProviderId())
                    .getClient(connection);
            externalClientCache.put(connection.getId(), client);
View Full Code Here

TOP

Related Classes of com.streamreduce.util.ExternalIntegrationClient

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.