org.jets3t.service.Jets3tProperties Java Examples

The following examples show how to use org.jets3t.service.Jets3tProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpectraSession.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Override
public RequestEntityRestStorageService connect(final Proxy proxy, final HostKeyCallback hostkey, final LoginCallback prompt) {
    final RequestEntityRestStorageService client = super.connect(proxy, hostkey, prompt);
    final Jets3tProperties configuration = client.getConfiguration();
    configuration.setProperty("s3service.enable-storage-classes", String.valueOf(false));
    configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
    return client;
}
 
Example #2
Source File: S3TransferAccelerationService.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configure(final boolean enable, final Path file) {
    final Jets3tProperties options = session.getClient().getConfiguration();
    if(enable) {
        // Set accelerated endpoint
        options.setProperty("s3service.s3-endpoint", hostname);
        options.setProperty("s3service.disable-dns-buckets", String.valueOf(false));
        options.setProperty("s3service.disable-expect-continue", String.valueOf(true));
    }
    else {
        // Revert default configuration
        options.loadAndReplaceProperties(session.getClient().getConfiguration(), this.toString());
    }
}
 
Example #3
Source File: RequestEntityRestStorageService.java    From cyberduck with GNU General Public License v3.0 4 votes vote down vote up
private static Jets3tProperties toProperties(final Host bookmark, final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion) {
    final Jets3tProperties properties = new Jets3tProperties();
    final Preferences preferences = PreferencesFactory.get();
    if(log.isDebugEnabled()) {
        log.debug(String.format("Configure for endpoint %s", bookmark));
    }
    // Use default endpoint for region lookup
    if(bookmark.getHostname().endsWith(preferences.getProperty("s3.hostname.default"))) {
        // Only for AWS
        properties.setProperty("s3service.s3-endpoint", preferences.getProperty("s3.hostname.default"));
        properties.setProperty("s3service.disable-dns-buckets",
            String.valueOf(preferences.getBoolean("s3.bucket.virtualhost.disable")));
    }
    else {
        properties.setProperty("s3service.s3-endpoint", bookmark.getHostname());
        if(InetAddressUtils.isIPv4Address(bookmark.getHostname()) || InetAddressUtils.isIPv6Address(bookmark.getHostname())) {
            properties.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
        }
        else {
            properties.setProperty("s3service.disable-dns-buckets",
                String.valueOf(preferences.getBoolean("s3.bucket.virtualhost.disable")));
        }
    }
    properties.setProperty("s3service.enable-storage-classes", String.valueOf(true));
    if(StringUtils.isNotBlank(bookmark.getProtocol().getContext())) {
        if(!Scheme.isURL(bookmark.getProtocol().getContext())) {
            properties.setProperty("s3service.s3-endpoint-virtual-path",
                PathNormalizer.normalize(bookmark.getProtocol().getContext()));
        }
    }
    properties.setProperty("s3service.https-only", String.valueOf(bookmark.getProtocol().isSecure()));
    if(bookmark.getProtocol().isSecure()) {
        properties.setProperty("s3service.s3-endpoint-https-port", String.valueOf(bookmark.getPort()));
    }
    else {
        properties.setProperty("s3service.s3-endpoint-http-port", String.valueOf(bookmark.getPort()));
    }
    // The maximum number of retries that will be attempted when an S3 connection fails
    // with an InternalServer error. To disable retries of InternalError failures, set this to 0.
    properties.setProperty("s3service.internal-error-retry-max", String.valueOf(0));
    // The maximum number of concurrent communication threads that will be started by
    // the multi-threaded service for upload and download operations.
    properties.setProperty("s3service.max-thread-count", String.valueOf(1));
    properties.setProperty("httpclient.proxy-autodetect", String.valueOf(false));
    properties.setProperty("httpclient.retry-max", String.valueOf(0));
    properties.setProperty("storage-service.internal-error-retry-max", String.valueOf(0));
    properties.setProperty("storage-service.request-signature-version", signatureVersion.toString());
    properties.setProperty("storage-service.disable-live-md5", String.valueOf(true));
    properties.setProperty("storage-service.default-region", bookmark.getRegion());
    return properties;
}
 
Example #4
Source File: RequestEntityRestStorageService.java    From cyberduck with GNU General Public License v3.0 4 votes vote down vote up
public Jets3tProperties getConfiguration() {
    return properties;
}