Examples of ClientConfiguration


Examples of com.amazonaws.ClientConfiguration

        AmazonS3Client client = clients.get(clientDescriptor);
        if (client != null) {
            return client;
        }

        ClientConfiguration clientConfiguration = new ClientConfiguration();
        String protocol = componentSettings.get("protocol", "https").toLowerCase();
        protocol = componentSettings.get("s3.protocol", protocol).toLowerCase();
        if ("http".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTP);
        } else if ("https".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTPS);
        } else {
            throw new ElasticsearchIllegalArgumentException("No protocol supported [" + protocol + "], can either be [http] or [https]");
        }

        String proxyHost = componentSettings.get("proxy_host");
        if (proxyHost != null) {
            String portString = componentSettings.get("proxy_port", "80");
            Integer proxyPort;
            try {
                proxyPort = Integer.parseInt(portString, 10);
            } catch (NumberFormatException ex) {
                throw new ElasticsearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid", ex);
            }
            clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
        }

        AWSCredentialsProvider credentials;

        if (account == null && key == null) {
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

    public synchronized AmazonEC2 client() {
        if (client != null) {
            return client;
        }

        ClientConfiguration clientConfiguration = new ClientConfiguration();
        String protocol = componentSettings.get("protocol", "https").toLowerCase();
        protocol = componentSettings.get("ec2.protocol", protocol).toLowerCase();
        if ("http".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTP);
        } else if ("https".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTPS);
        } else {
            throw new ElasticsearchIllegalArgumentException("No protocol supported [" + protocol + "], can either be [http] or [https]");
        }
        String account = componentSettings.get("access_key", settings.get("cloud.account"));
        String key = componentSettings.get("secret_key", settings.get("cloud.key"));

        String proxyHost = componentSettings.get("proxy_host");
        if (proxyHost != null) {
            String portString = componentSettings.get("proxy_port", "80");
            Integer proxyPort;
            try {
                proxyPort = Integer.parseInt(portString, 10);
            } catch (NumberFormatException ex) {
                throw new ElasticsearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid", ex);
            }
            clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
        }

        AWSCredentialsProvider credentials;

        if (account == null && key == null) {
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

     * @param awsCredentials
     *            The AWS credentials to use when making requests to Amazon S3
     *            with this client.
     */
    public AmazonS3Client(AWSCredentials awsCredentials) {
        this(awsCredentials, new ClientConfiguration());
    }
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

     * @param executorService
     *            The executor service by which all asynchronous requests will
     *            be executed.
     */
    public AmazonSNSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
        this(awsCredentialsProvider, new ClientConfiguration(), executorService);
    }
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

    public static AmazonS3 acquireClient(final ClientOptions clientOptions) {

        final AWSCredentials credentials = new BasicAWSCredentials(
                clientOptions.getAccessKey(), clientOptions.getSecretKey());

        final ClientConfiguration configuration = new ClientConfiguration();

        if (clientOptions.isHttps() != null) {
            configuration.setProtocol(clientOptions.isHttps() == true ? HTTPS
                    : HTTP);
        }

        if (clientOptions.getConnectionTimeout() != null) {
            configuration.setConnectionTimeout(clientOptions
                    .getConnectionTimeout());
        }

        if (clientOptions.getMaxErrorRetry() != null) {
            configuration.setMaxErrorRetry(clientOptions.getMaxErrorRetry());
        }

        if (clientOptions.getSocketTimeout() != null) {
            configuration.setSocketTimeout(clientOptions.getSocketTimeout());
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(format(
                    "Creating S3 client with configuration: [protocol: %1$s, connectionTimeOut: "
                            + "%2$s, maxErrorRetry: %3$s, socketTimeout: %4$s]",
                    configuration.getProtocol(),
                    configuration.getConnectionTimeout(),
                    configuration.getMaxErrorRetry(),
                    configuration.getSocketTimeout()));
        }

        final AmazonS3Client client = new AmazonS3Client(credentials,
                configuration);
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

    public synchronized AmazonEC2 client() {
        if (client != null) {
            return client;
        }

        ClientConfiguration clientConfiguration = new ClientConfiguration();
        String protocol = componentSettings.get("protocol", "http").toLowerCase();
        if ("http".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTP);
        } else if ("https".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTPS);
        } else {
            throw new ElasticSearchIllegalArgumentException("No protocol supported [" + protocol + "], can either be [http] or [https]");
        }
        String account = componentSettings.get("access_key", settings.get("cloud.account"));
        String key = componentSettings.get("secret_key", settings.get("cloud.key"));

        if (account == null) {
            throw new ElasticSearchIllegalArgumentException("No s3 access_key defined for s3 gateway");
        }
        if (key == null) {
            throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
        }

        String proxyHost = componentSettings.get("proxy_host");
        if (proxyHost != null) {
            String portString = componentSettings.get("proxy_port", "80");
            Integer proxyPort;
            try {
                proxyPort = Integer.parseInt(portString, 10);
            } catch (NumberFormatException ex) {
                throw new ElasticSearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid", ex);
            }
            clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
        }

        this.client = new AmazonEC2Client(new BasicAWSCredentials(account, key), clientConfiguration);

        if (componentSettings.get("ec2.endpoint") != null) {
View Full Code Here

Examples of com.amazonaws.ClientConfiguration

    public synchronized AmazonS3 client() {
        if (client != null) {
            return client;
        }

        ClientConfiguration clientConfiguration = new ClientConfiguration();
        String protocol = componentSettings.get("protocol", "http").toLowerCase();
        if ("http".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTP);
        } else if ("https".equals(protocol)) {
            clientConfiguration.setProtocol(Protocol.HTTPS);
        } else {
            throw new ElasticSearchIllegalArgumentException("No protocol supported [" + protocol + "], can either be [http] or [https]");
        }
        String account = componentSettings.get("access_key", settings.get("cloud.account"));
        String key = componentSettings.get("secret_key", settings.get("cloud.key"));

        if (account == null) {
            throw new ElasticSearchIllegalArgumentException("No s3 access_key defined for s3 gateway");
        }
        if (key == null) {
            throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
        }

        String proxyHost = componentSettings.get("proxy_host");
        if (proxyHost != null) {
            String portString = componentSettings.get("proxy_port", "80");
            Integer proxyPort;
            try {
                proxyPort = Integer.parseInt(portString, 10);
            } catch (NumberFormatException ex) {
                throw new ElasticSearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid", ex);
            }
            clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
        }

        this.client = new AmazonS3Client(new BasicAWSCredentials(account, key), clientConfiguration);

        if (componentSettings.get("s3.endpoint") != null) {
View Full Code Here

Examples of com.art.anette.client.controller.ClientConfiguration

            System.exit(1);
        }
        logger = LogController.getLogger(Main.class);

        // 4) Load config
        final ClientConfiguration config = ClientConfiguration.getInstance();
        setDefaultLocale(config);
        lang = ResourceBundle.getBundle("com/art/anette/client/ui/resources/lang");

        // 5) Now that we i18n we can check some more issues.
        if (!SystemTray.isSupported()) {
            ProgressUtils.errorMessage(lang.getString("NoTray"));
            System.exit(1);
        }

        if (!TimeZone.getDefault().useDaylightTime()) {
            showTimezoneInfo(logger);
            ProgressUtils.infoMessage(lang.getString("NoDaylightTime"));
        }

        if ("OpenJDK 64-Bit Server VM".equals(System.getProperty("java.vm.name"))) {
            ProgressUtils.errorMessage(lang.getString("BadVM1"));
            System.exit(1);
        }

        // 6) Install EDT Checker
        if ("true".equals(System.getProperty("anetteCheckEDT", "true"))) {
            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
        } else {
            logger.info("Don't install EDT check by user request");
        }

        // 7) Install checker for slow event processing
        if ("true".equals(System.getProperty("anetteCheckSlowEvents", "true"))) {
            EventDispatchThreadHangMonitor.initMonitoring();
        } else {
            logger.info("Don't install check for slow event processing by user request");
        }

        // 8) Set the timezone
        adjustTimezone(logger);

        try {
            NetworkControl.getInstance().initSSL();
        } catch (SSLException ex) {
            logger.severe("SSL Failure", ex);
            ProgressUtils.errorMessage("SSLFailed");
            System.exit(1);
        }

        final BasicController basicControl = BasicController.getInstance();

        // nicht registriert oder eingeloggt
        if ("".equals(config.getProperty("user.email")) || "".equals(config.getProperty("user.password"))) {
            showWelcomeDialog(config, basicControl, "", "");
        } else {
            try {
                final ProgressUtils.Monitor monitor = ProgressUtils.createProgress(lang.getString("ProgressLoggingIn"));
                basicControl.login(new LoginRequest(config.getProperty("user.email"), config.getProperty("user.password")));
                monitor.finish();
            } catch (NetworkException ex) {
                logger.warning("Connection Failure", ex);
                ProgressUtils.errorMessage(lang.getString("ConnectionFailed"), ex.getMessage());
                showWelcomeDialog(config, basicControl, config.getProperty("user.email"), config.getProperty("user.password"));
            } catch (LoginFailedException ex) {
                ProgressUtils.errorMessage(String.format(lang.getString("LoginFailed"), ex.getMessage()));
                logger.info("Login Failure", ex);
                showWelcomeDialog(config, basicControl, config.getProperty("user.email"), config.getProperty("user.password"));
            }
        }

        // nun eingeloggt; starte Hauptfenster
        if (basicControl.isLoggedIn()) {
View Full Code Here

Examples of com.art.anette.client.controller.ClientConfiguration

            throw new Exception("Already running");
        }
        logger = LogController.getLogger(CliTester.class);

        // 4) Load config
        final ClientConfiguration config = ClientConfiguration.getInstance();
        Main.setDefaultLocale(config);
        lang = ResourceBundle.getBundle("com/art/anette/client/ui/resources/lang");

        if (!TimeZone.getDefault().useDaylightTime()) {
            Main.showTimezoneInfo(logger);
            ProgressUtils.infoMessage(lang.getString("NoDaylightTime"));
        }

        // 8) Set the timezone
        Main.adjustTimezone(logger);

        final NetworkControl network = NetworkControl.getInstance();
        NetworkListener listener = new NetworkListener() {
            public void statusChange(NetworkEvent event) {
                logger.info("network event " + event);
            }
        };
        network.addListener(listener);
        try {
            network.initSSL();
        } catch (SSLException ex) {
            logger.severe("SSL Failure", ex);
            ProgressUtils.errorMessage("SSLFailed");
            throw new Exception("SSL-problem");
        }

        final BasicController basicControl = BasicController.getInstance();

        // nicht registriert oder eingeloggt
        assert !("".equals(config.getProperty("user.email")) || "".equals(config.getProperty("user.password")));

        try {
            final ProgressUtils.Monitor monitor = ProgressUtils.createProgress(lang.getString("ProgressLoggingIn"));
            basicControl.login(new LoginRequest(config.getProperty("user.email"), config.getProperty("user.password")));
            monitor.finish();
        } catch (NetworkException ex) {
            logger.severe("Connection Failure", ex);
            return;
        } catch (LoginFailedException ex) {
View Full Code Here

Examples of com.db4o.cs.config.ClientConfiguration

   * Saves a Model into the database
   * @param Model to save
   */
  public <T> boolean save(T aModel){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    theDB.store(aModel);
    System.out.println("Stored " + aModel);
    logger.log(Level.FINE, "Saving model [" + aModel + "]");
    theDB.commit();
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.