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


Java Jets3tProperties类代码示例

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


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

示例1: RequestEntityRestStorageService

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
public RequestEntityRestStorageService(final S3Session session,
                                       final Jets3tProperties properties,
                                       final HttpClientBuilder configuration) {
    super(session.getHost().getCredentials().isAnonymousLogin() ? null :
                    new AWSCredentials(null, null) {
                        @Override
                        public String getAccessKey() {
                            return session.getHost().getCredentials().getUsername();
                        }

                        @Override
                        public String getSecretKey() {
                            return session.getHost().getCredentials().getPassword();
                        }
                    },
            new PreferencesUseragentProvider().get(), null, properties);
    this.session = session;
    configuration.disableContentCompression();
    configuration.setRetryHandler(new S3HttpRequestRetryHandler(this, preferences.getInteger("http.connections.retry")));
    configuration.setRedirectStrategy(new DefaultRedirectStrategy() {
        @Override
        public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException {
            if(response.containsHeader("x-amz-bucket-region")) {
                final String host = ((HttpUriRequest) request).getURI().getHost();
                if(!StringUtils.equals(session.getHost().getHostname(), host)) {
                    regionEndpointCache.putRegionForBucketName(
                            StringUtils.split(StringUtils.removeEnd(((HttpUriRequest) request).getURI().getHost(), session.getHost().getHostname()), ".")[0],
                            response.getFirstHeader("x-amz-bucket-region").getValue());
                }
            }
            return super.getRedirect(request, response, context);
        }
    });
    this.setHttpClient(configuration.build());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:36,代码来源:RequestEntityRestStorageService.java

示例2: 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

示例3: AWSRoleSessionCredentials

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
public AWSRoleSessionCredentials(String iamAccessKey, String iamSecretKey, String roleToBeAssumed, String externalId,
                             String friendlyName, Jets3tProperties jets3tProperties){
  if(roleToBeAssumed == null){
    throw new IllegalArgumentException("roleToBeAssumed needs to be present.");
  }
  this.iamAccessKey = iamAccessKey;
  this.iamSecretKey = iamSecretKey;
  this.roleToBeAssumed = roleToBeAssumed;
  this.externalId = externalId;
  this.friendlyName = friendlyName;
  if(jets3tProperties == null){
    this.jets3tProperties = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME);
  }else {
    this.jets3tProperties = jets3tProperties;
  }
  assumeRoleAndGetCredentials();
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:18,代码来源:AWSRoleSessionCredentials.java

示例4: ThreadGroupManager

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
public ThreadGroupManager(AbstractRunnable[] runnables,
    ThreadWatcher threadWatcher, Jets3tProperties jets3tProperties,
    boolean isAdminTask)
{
    this.runnables = runnables;
    this.threadWatcher = threadWatcher;
    if (isAdminTask) {
        this.maxThreadCount = jets3tProperties
            .getIntProperty("s3service.admin-max-thread-count", 20);
    } else {
        this.maxThreadCount = jets3tProperties
            .getIntProperty("s3service.max-thread-count", 2);
    }
    this.ignoreExceptions = jets3tProperties
        .getBoolProperty("s3service.ignore-exceptions-in-multi", false);

    this.threads = new Thread[runnables.length];
    started = new boolean[runnables.length]; // All values initialized to false.
    alreadyFired = new boolean[runnables.length]; // All values initialized to false.
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:21,代码来源:S3ServiceMulti.java

示例5: createConnectionPool

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
@Override
protected AbstractConnPool createConnectionPool(final HttpParams params) {
    // Set the maximum connections per host for the HTTP connection manager,
    // *and* also set the maximum number of total connections (new in 0.7.1).
    // The max connections per host setting is made the same value as the max
    // global connections if there is no per-host property.
    Jets3tProperties props = (Jets3tProperties) params.getParameter(
            Jets3tProperties.JETS3T_PROPERTIES_ID);
    int maxConn = 20;
    int maxConnectionsPerHost = 0;
    if (props != null) {
        maxConn = props.getIntProperty("httpclient.max-connections", 20);
        maxConnectionsPerHost = props.getIntProperty(
                "httpclient.max-connections-per-host",
                0);
    }
    if (maxConnectionsPerHost == 0) {
        maxConnectionsPerHost = maxConn;
    }
    connPerRoute.setDefaultMaxPerRoute(maxConnectionsPerHost);
    return new ConnPoolByRoute(connOperator, connPerRoute, maxConn);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:23,代码来源:RestUtils.java

示例6: RestS3Service

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
/**
 * Constructs the service and initialises the properties.
 *
 * @param credentials
 * the S3 user credentials to use when communicating with S3, may be null in which case the
 * communication is done as an anonymous user.
 * @param 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: <code>Cockpit/0.7.3</code> or <code>My App Name/1.0</code>
 * @param credentialsProvider
 * an implementation of the HttpClient CredentialsProvider interface, to provide a means for
 * prompting for credentials when necessary.
 * @param jets3tProperties
 * JetS3t properties that will be applied within this service.
 *
 * @throws S3ServiceException
 */
public RestS3Service(ProviderCredentials credentials, String invokingApplicationDescription,
    CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
    throws S3ServiceException
{
    super(credentials, invokingApplicationDescription, credentialsProvider, jets3tProperties);

    if (credentials instanceof AWSDevPayCredentials) {
        AWSDevPayCredentials awsDevPayCredentials = (AWSDevPayCredentials) credentials;
        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);
    }

    this.setRequesterPaysEnabled(
        this.jets3tProperties.getBoolProperty("httpclient.requester-pays-buckets-enabled", false));
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:37,代码来源:RestS3Service.java

示例7: ThreadGroupManager

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
public ThreadGroupManager(AbstractRunnable[] runnables,
    ThreadWatcher threadWatcher, Jets3tProperties jets3tProperties,
    boolean isAdminTask)
{
    this.runnables = runnables;
    this.threadWatcher = threadWatcher;
    if (isAdminTask) {
        this.maxThreadCount = jets3tProperties
            .getIntProperty("threaded-service.admin-max-thread-count", 20);
    } else {
        this.maxThreadCount = jets3tProperties
            .getIntProperty("threaded-service.max-thread-count", 2);
    }
    this.ignoreExceptions = jets3tProperties
        .getBoolProperty("threaded-service.ignore-exceptions-in-multi", false);

    this.threads = new Thread[runnables.length];
    started = new boolean[runnables.length]; // All values initialized to false.
    alreadyFired = new boolean[runnables.length]; // All values initialized to false.
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:21,代码来源:ThreadedStorageService.java

示例8: main

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
/**
 * Creates stand-alone dialog box for testing only.
 *
 * @param args
 * @throws Exception
 */
public static void main(String args[]) throws Exception {
    JFrame f = new JFrame();

    HyperlinkActivatedListener listener = new HyperlinkActivatedListener() {
        private static final long serialVersionUID = -225585129296632961L;

        public void followHyperlink(URL url, String target) {
            BareBonesBrowserLaunch.openURL(url.toString());
        }
    };

    StartupDialog startupDialog = new StartupDialog(f,
        Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME), listener);
    startupDialog.setVisible(true);
    ProviderCredentials credentials = startupDialog.getProviderCredentials();
    startupDialog.dispose();

    if (credentials != null) {
        System.out.println("Credentials: " + credentials.getLogString());
    } else {
        System.out.println("Credentials: null");
    }

    f.dispose();
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:32,代码来源:StartupDialog.java

示例9: 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

示例10: 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

示例11: 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

示例12: StartupDialog

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
/**
 * Creates a modal dialog box with a title.
 *
 * @param owner
 * the frame within which this dialog will be displayed and centred.
 * @param hyperlinkListener
 */
public StartupDialog(Frame owner, Jets3tProperties properties, HyperlinkActivatedListener hyperlinkListener) {
    super(owner, "Cockpit Login", true);
    this.ownerFrame = owner;
    this.hyperlinkListener = hyperlinkListener;
    this.myProperties = properties;
    this.initGui();
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:15,代码来源:StartupDialog.java

示例13: main

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
/**
     * Creates stand-alone dialog box for testing only.
     *
     * @param args
     * @throws Exception
     */
    public static void main(String args[]) throws Exception {
//        String algorithm = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME)
//            .getStringProperty("crypto.algorithm", "PBEWithMD5AndDES");
//        File file = new File("/Users/jmurty/Desktop/test.enc");
//        AWSCredentials awsCredentialsTest = new AWSCredentials("a", "b");
//        awsCredentialsTest.save("please", file, algorithm);
//        System.err.println("Saved: " + awsCredentialsTest);
//        System.err.println("Loaded: " + AWSCredentials.load("please", file));
//        if (true)
//            return;
//
        JFrame f = new JFrame();

        HyperlinkActivatedListener listener = new HyperlinkActivatedListener() {
            private static final long serialVersionUID = -225585129296632961L;

            public void followHyperlink(URL url, String target) {
                BareBonesBrowserLaunch.openURL(url.toString());
            }
        };

        StartupDialog startupDialog = new StartupDialog(f,
            Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME), listener);
        startupDialog.setVisible(true);
        AWSCredentials awsCredentials = startupDialog.getAWSCredentials();
        startupDialog.dispose();

        if (awsCredentials != null) {
            System.out.println("AWS Credentials: " + awsCredentials.getLogString());
        } else {
            System.out.println("AWS Credentials: null");
        }

        f.dispose();
    }
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:42,代码来源:StartupDialog.java

示例14: initHttpProxy

import org.jets3t.service.Jets3tProperties; //导入依赖的package包/类
/**
 * @param httpClient
 * @param proxyAutodetect
 * @param proxyHostAddress
 * @param proxyPort
 * @param proxyUser
 * @param proxyPassword
 * @param proxyDomain
 */
public static void initHttpProxy(HttpClient httpClient,
    Jets3tProperties jets3tProperties, boolean proxyAutodetect,
    String proxyHostAddress, int proxyPort, String proxyUser,
    String proxyPassword, String proxyDomain)
{
    String s3Endpoint = jets3tProperties.getStringProperty(
            "s3service.s3-endpoint", Constants.S3_DEFAULT_HOSTNAME);
    initHttpProxy(httpClient, jets3tProperties, proxyAutodetect, proxyHostAddress, proxyPort,
        proxyUser, proxyPassword, proxyDomain, s3Endpoint);
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:20,代码来源:RestUtils.java

示例15: 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


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