public static SiteConfig defaultSiteConfig( String baseUrl ) { return new SiteConfigBuilder( "indy", baseUrl ).withRequestTimeoutSeconds( 30 ) .withMaxConnections( IndyClientHttp.GLOBAL_MAX_CONNECTIONS ) .build(); }
public synchronized SiteConfig getPnclSiteConfig() { if ( pnclSiteConfig == null ) { SiteConfigBuilder builder = new SiteConfigBuilder( PNCL_SITE_ID, getPnclURL() ); // TODO: SSL? builder.withRequestTimeoutSeconds( getPnclTimeout() ); pnclSiteConfig = builder.build(); } return pnclSiteConfig; }
public synchronized SiteConfig getKojiSiteConfig() throws IOException { if ( kojiSiteConfig == null ) { SiteConfigBuilder builder = new SiteConfigBuilder( KOJI_SITE_ID, getKojiURL() ); File keyCert = new File( getKojiClientKeyCertificateFile() ); if ( keyCert.exists() ) { builder.withKeyCertPem( FileUtils.readFileToString( keyCert ) ); } File serverCert = new File( getKojiServerCertificateFile() ); if ( serverCert.exists() ) { builder.withServerCertPem( FileUtils.readFileToString( serverCert ) ); } if ( getKojiTrustSelfSigned() ) { builder.withTrustType( SiteTrustType.TRUST_SELF_SIGNED ); } builder.withRequestTimeoutSeconds( getKojiTimeout() ); kojiSiteConfig = builder.build(); } return kojiSiteConfig; }
@PostConstruct private void postConstruct() { try { PasswordManager emptyPasswordManager = new MemoryPasswordManager(); SiteConfig sc = new SiteConfigBuilder().withId("Carto") .withUri(config.getConfig().getCartographerServerUrl()) .withRequestTimeoutSeconds(config.getConfig().getAproxRequestTimeout()).build(); HttpFactory httpFactory = new HttpFactory(emptyPasswordManager); cartographer = new CartographerRESTClient(sc, httpFactory); } catch (ConfigurationParseException | ClientHttpException e) { throw new IllegalStateException("Could not initialize Cartographer Client.", e); } }
private Indy init(String accessToken) { Indy indy = indyMap.get(accessToken); if (indy == null) { //TODO use indyConcurrentMap.computeIfAbsent IndyClientAuthenticator authenticator = null; if (accessToken != null) { authenticator = new OAuth20BearerTokenAuthenticator(accessToken); } try { SiteConfig siteConfig = new SiteConfigBuilder("indy", baseUrl) .withRequestTimeoutSeconds(DEFAULT_REQUEST_TIMEOUT) .withMaxConnections(IndyClientHttp.GLOBAL_MAX_CONNECTIONS) .build(); IndyClientModule[] modules = new IndyClientModule[] { new IndyFoloAdminClientModule(), new IndyFoloContentClientModule(), new IndyPromoteClientModule() }; indy = new Indy(siteConfig, authenticator, new IndyObjectMapper(true), modules); indyMap.put(accessToken, indy); } catch (IndyClientException e) { throw new IllegalStateException("Failed to create Indy client: " + e.getMessage(), e); } } return indy; }
builder.withRequestTimeoutSeconds( getTimeout() ); builder.withConnectionPoolTimeoutSeconds( getConnectionPoolTimeout() ); builder.withMaxConnections( getMaxConnections() );
break; case REQUEST_TIMEOUT_SECONDS: siteConfigBuilder.withRequestTimeoutSeconds( Integer.parseInt( value ) ); break; case MAX_CONNECTIONS:
private SiteConfig toSiteConfig( RemoteRepository repository ) { SiteConfigBuilder builder = new SiteConfigBuilder( repository.getName(), repository.getUrl() ); logger.debug( "Adding server PEM to site config for: {}\n{}", repository.getKey(), repository.getServerCertPem() ); builder.withKeyCertPem( repository.getKeyCertPem() ) .withProxyHost( repository.getProxyHost() ) .withProxyPort( repository.getProxyPort() ) .withProxyUser( repository.getProxyUser() ) .withRequestTimeoutSeconds( repository.getTimeoutSeconds() ) .withServerCertPem( repository.getServerCertPem() ) .withTrustType( SiteTrustType.TRUST_SELF_SIGNED ) .withUser( repository.getUser() ); SiteConfig config = builder.build(); logger.debug( "Got server PEM in site config:\n{}", config.getServerCertPem() ); config.setAttribute( PASSWORD_PREFIX + KEY.name(), repository.getKeyPassword() ); config.setAttribute( PASSWORD_PREFIX + USER.name(), repository.getPassword() ); config.setAttribute( PASSWORD_PREFIX + PROXY.name(), repository.getProxyPassword() ); return config; }
.withProxyPort( location.getProxyPort() ) .withProxyUser( location.getProxyUser() ) .withRequestTimeoutSeconds( LocationUtils.getTimeoutSeconds( location ) ) .withUser( location.getUser() ) .withIgnoreHostnameVerification( location.isIgnoreHostnameVerification() )