Logo Search packages:      
Sourcecode: jets3t version File versions  Download package

org::jets3t::service::S3Service::S3Service ( AWSCredentials  awsCredentials,
String  invokingApplicationDescription,
Jets3tProperties  jets3tProperties 
) throws S3ServiceException [inline, protected]

Construct an S3Service identified by the given user credentials.

Parameters:
awsCredentials the S3 user credentials to use when communicating with S3, may be null in which case the communication is done as an anonymous user.
invokingApplicationDescription a short description of the application using the service, suitable for inclusion in a user agent string for REST/HTTP requests. Ideally this would include the application's version number, for example: Cockpit/0.7.3 or My App Name/1.0
jets3tProperties JetS3t properties that will be applied within this service.
Exceptions:
S3ServiceException 

Definition at line 129 of file S3Service.java.

References org::jets3t::service::Jets3tProperties::getBoolProperty(), org::jets3t::service::Jets3tProperties::getIntProperty(), org::jets3t::service::security::AWSDevPayCredentials::getProductToken(), org::jets3t::service::Jets3tProperties::getStringProperty(), org::jets3t::service::security::AWSDevPayCredentials::getUserToken(), and isHttpsOnly().

    {
        this.awsCredentials = awsCredentials;
        this.invokingApplicationDescription = invokingApplicationDescription;

        this.jets3tProperties = jets3tProperties;
        this.isHttpsOnly = jets3tProperties.getBoolProperty("s3service.https-only", true);
        this.internalErrorRetryMax = jets3tProperties.getIntProperty("s3service.internal-error-retry-max", 5);

        if (awsCredentials instanceof AWSDevPayCredentials) {
            AWSDevPayCredentials awsDevPayCredentials = (AWSDevPayCredentials) awsCredentials;
            this.awsDevPayUserToken = awsDevPayCredentials.getUserToken();
            this.awsDevPayProductToken = awsDevPayCredentials.getProductToken();
        } else {
            this.awsDevPayUserToken = jets3tProperties.getStringProperty("devpay.user-token", null);
            this.awsDevPayProductToken = jets3tProperties.getStringProperty("devpay.product-token", null);
        }

        // Configure the InetAddress DNS caching times to work well with S3. The cached DNS will
        // timeout after 5 minutes, while failed DNS lookups will be retried after 1 second.
        System.setProperty("networkaddress.cache.ttl", "300");
        System.setProperty("networkaddress.cache.negative.ttl", "1");

        // Override the default S3 Hostname constant if an alternative value is set.
        String customS3Hostname = this.jets3tProperties.getStringProperty(
            "s3service.s3-endpoint", Constants.S3_HOSTNAME);
        if (!Constants.S3_HOSTNAME.equals(customS3Hostname)) {
            Constants.S3_HOSTNAME = customS3Hostname;
        }

        // (Re)initialize the JetS3t JMX delegate, in case system properties have changed.
        MxDelegate.getInstance().init();

        MxDelegate.getInstance().registerS3ServiceMBean();
        MxDelegate.getInstance().registerS3ServiceExceptionMBean();
    }


Generated by  Doxygen 1.6.0   Back to index