当前位置: 首页>>代码示例>>Java>>正文


Java Jets3tProperties.setProperty方法代码示例

本文整理汇总了Java中org.jets3t.service.Jets3tProperties.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Jets3tProperties.setProperty方法的具体用法?Java Jets3tProperties.setProperty怎么用?Java Jets3tProperties.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jets3t.service.Jets3tProperties的用法示例。


在下文中一共展示了Jets3tProperties.setProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAccessPathStyleBucketEuCentral

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
@Test
public void testAccessPathStyleBucketEuCentral() throws Exception {
    final S3Session session = new S3Session(
            new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(),
                    new Credentials(
                            System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")
                    ))) {
        @Override
        public S3Protocol.AuthenticationHeaderSignatureVersion getSignatureVersion() {
            return S3Protocol.AuthenticationHeaderSignatureVersion.AWS4HMACSHA256;
        }

        @Override
        protected Jets3tProperties configure() {
            final Jets3tProperties properties = super.configure();
            properties.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
            return properties;
        }
    };
    assertNotNull(session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback()));
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    assertEquals(new S3LocationFeature.S3Region("eu-central-1"), new S3LocationFeature(session).getLocation(
            new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory))
    ));
    session.close();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:27,代码来源:S3LocationFeatureTest.java

示例2: configure

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
@Override
protected Jets3tProperties configure() {
    final Jets3tProperties configuration = super.configure();
    configuration.setProperty("s3service.enable-storage-classes", String.valueOf(false));
    configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
    return configuration;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:8,代码来源:SpectraSession.java

示例3: configure

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
@Override
public void configure(final boolean enable, final Path file) throws BackgroundException {
    final Jets3tProperties options = session.getClient().getJetS3tProperties();
    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.configure(), this.toString());
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:S3TransferAccelerationService.java

示例4: testAccessPathStyleBucketEuCentral

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
@Test(expected = BackgroundException.class)
public void testAccessPathStyleBucketEuCentral() throws Exception {
    final S3Session session = new S3Session(
            new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(),
                    new Credentials(
                            System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")
                    ))) {
        @Override
        public S3Protocol.AuthenticationHeaderSignatureVersion getSignatureVersion() {
            return S3Protocol.AuthenticationHeaderSignatureVersion.AWS4HMACSHA256;
        }

        @Override
        protected Jets3tProperties configure() {
            final Jets3tProperties properties = super.configure();
            properties.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
            return properties;
        }
    };
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume));
    try {
        final AttributedList<Path> list = new S3ObjectListService(session).list(container, new DisabledListProgressListener());
    }
    catch(BackgroundException e) {
        assertEquals("Listing directory test-eu-central-1-cyberduck failed.", e.getMessage());
        assertEquals("Received redirect response HTTP/1.1 301 Moved Permanently but no location header.", e.getDetail());
        throw e;
    }
    finally {
        session.close();
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:35,代码来源:S3ObjectListServiceTest.java

示例5: getStorageService

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
protected RestStorageService getStorageService(ProviderCredentials credentials,
    String endpointHostname) throws ServiceException
{
    Jets3tProperties properties = new Jets3tProperties();
    properties.setProperty("s3service.s3-endpoint", endpointHostname);
    return getStorageService(credentials, properties);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:8,代码来源:TestRestS3Service.java

示例6: getStorageService

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
protected StorageService getStorageService()
    throws S3ServiceException
{
    if (targetS3.isSelected()) {
        return new RestS3Service(credentials);
    } else {
        // Override endpoint property in JetS3t properties
        Jets3tProperties gsProperties = Jets3tProperties.getInstance(
            Constants.JETS3T_PROPERTIES_FILENAME);
        gsProperties.setProperty(
            "s3service.s3-endpoint", Constants.GS_DEFAULT_HOSTNAME);
        return new RestS3Service(credentials, null, null, gsProperties);
    }
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:15,代码来源:StartupDialog.java

示例7: configureS3Service

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
S3Service configureS3Service(String host, int proxy)
    throws IOException, S3ServiceException {
  // configure the service
  Jets3tProperties props = new Jets3tProperties();
  props.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
  props.setProperty("s3service.s3-endpoint", host);
  props.setProperty("s3service.s3-endpoint-http-port",
      String.valueOf(proxy));
  props.setProperty("s3service.https-only", String.valueOf(false));
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  AWSCredentials creds =
      new AWSCredentials(ugi.getShortUserName(), "SomeSecretKey", ugi.getUserName());
  return new RestS3Service(creds, null, null, props);
}
 
开发者ID:WANdisco,项目名称:s3hdfs,代码行数:15,代码来源:S3HdfsTestUtil.java

示例8: configure

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
protected Jets3tProperties configure() {
    final Jets3tProperties configuration = new Jets3tProperties();
    if(log.isDebugEnabled()) {
        log.debug(String.format("Configure for endpoint %s", host));
    }
    if(host.getHostname().endsWith(preferences.getProperty("s3.hostname.default"))) {
        // Only for AWS
        configuration.setProperty("s3service.s3-endpoint", host.getProtocol().getDefaultHostname());
        configuration.setProperty("s3service.disable-dns-buckets",
            String.valueOf(preferences.getBoolean("s3.bucket.virtualhost.disable")));
    }
    else {
        configuration.setProperty("s3service.s3-endpoint", host.getHostname());
        configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
    }
    configuration.setProperty("s3service.enable-storage-classes", String.valueOf(true));
    if(StringUtils.isNotBlank(host.getProtocol().getContext())) {
        if(!Scheme.isURL(host.getProtocol().getContext())) {
            configuration.setProperty("s3service.s3-endpoint-virtual-path",
                PathNormalizer.normalize(host.getProtocol().getContext()));
        }
    }
    configuration.setProperty("s3service.https-only", String.valueOf(host.getProtocol().isSecure()));
    if(host.getProtocol().isSecure()) {
        configuration.setProperty("s3service.s3-endpoint-https-port", String.valueOf(host.getPort()));
    }
    else {
        configuration.setProperty("s3service.s3-endpoint-http-port", String.valueOf(host.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.
    configuration.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.
    configuration.setProperty("s3service.max-thread-count", String.valueOf(1));
    configuration.setProperty("httpclient.proxy-autodetect", String.valueOf(false));
    configuration.setProperty("httpclient.retry-max", String.valueOf(0));
    configuration.setProperty("storage-service.internal-error-retry-max", String.valueOf(0));
    configuration.setProperty("storage-service.request-signature-version", authenticationHeaderSignatureVersion.toString());
    configuration.setProperty("storage-service.disable-live-md5", String.valueOf(true));
    return configuration;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:43,代码来源:S3Session.java

示例9: getStorageService

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
@Override
protected RestStorageService getStorageService(ProviderCredentials credentials) throws ServiceException {
    Jets3tProperties properties = new Jets3tProperties();
    properties.setProperty("s3service.s3-endpoint", Constants.GS_DEFAULT_HOSTNAME);
    return new RestS3Service(credentials, null, null, properties);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:7,代码来源:TestRestS3ServiceToGoogleStorage.java

示例10: downloadThrows

import org.jets3t.service.Jets3tProperties; //导入方法依赖的package包/类
private void downloadThrows(final S3Artifact s3Artifact, final Path downloadTo) throws Exception {
  log.info("Downloading {}", s3Artifact);

  Jets3tProperties jets3tProperties = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME);
  jets3tProperties.setProperty("httpclient.socket-timeout-ms", Long.toString(configuration.getS3ChunkDownloadTimeoutMillis()));

  final S3Service s3 = new RestS3Service(getCredentialsForBucket(s3Artifact.getS3Bucket()), null, null, jets3tProperties);

  long length = 0;

  if (s3Artifact.getFilesize().isPresent()) {
    length = s3Artifact.getFilesize().get();
  } else {
    StorageObject details = s3.getObjectDetails(s3Artifact.getS3Bucket(), s3Artifact.getS3ObjectKey());

    Preconditions.checkNotNull(details, "Couldn't find object at %s/%s", s3Artifact.getS3Bucket(), s3Artifact.getS3ObjectKey());

    length = details.getContentLength();
  }

  int numChunks = (int) (length / configuration.getS3ChunkSize());

  if (length % configuration.getS3ChunkSize() > 0) {
    numChunks++;
  }

  final long chunkSize = length / numChunks + (length % numChunks);

  log.info("Downloading {}/{} in {} chunks of {} bytes to {}", s3Artifact.getS3Bucket(), s3Artifact.getS3ObjectKey(), numChunks, chunkSize, downloadTo);

  final ExecutorService chunkExecutorService = Executors.newFixedThreadPool(numChunks, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("S3ArtifactDownloaderChunkThread-%d").build());
  final List<Future<Path>> futures = Lists.newArrayListWithCapacity(numChunks);

  for (int chunk = 0; chunk < numChunks; chunk++) {
    futures.add(chunkExecutorService.submit(new S3ArtifactChunkDownloader(configuration, log, s3, s3Artifact, downloadTo, chunk, chunkSize, length, exceptionNotifier)));
  }

  long remainingMillis = configuration.getS3DownloadTimeoutMillis();
  boolean failed = false;

  for (int chunk = 0; chunk < numChunks; chunk++) {
    final Future<Path> future = futures.get(chunk);

    if (failed) {
      future.cancel(true);
      continue;
    }

    final long start = System.currentTimeMillis();

    if (!handleChunk(s3Artifact, future, downloadTo, chunk, start, remainingMillis)) {
      failed = true;
    }

    remainingMillis -= (System.currentTimeMillis() - start);
  }

  chunkExecutorService.shutdownNow();

  Preconditions.checkState(!failed, "Downloading %s/%s failed", s3Artifact.getS3Bucket(), s3Artifact.getS3ObjectKey());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:62,代码来源:S3ArtifactDownloader.java


注:本文中的org.jets3t.service.Jets3tProperties.setProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。