org.jboss.pnc.environmentdriver.BeanFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of environment-driver Show documentation
Show all versions of environment-driver Show documentation
Environment driver provides REST endpoints to create and destroy Openshift objects
package org.jboss.pnc.environmentdriver;
import java.net.http.HttpClient;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.net.ssl.SSLContext;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Matej Lazar
*/
@ApplicationScoped
public class BeanFactory {
public static final Logger userLogger = LoggerFactory.getLogger("org.jboss.pnc._userlog_.envdriver");
@Inject
Configuration configuration;
@Inject
ManagedExecutor executor;
private HttpClient httpClient;
@PostConstruct
void init() throws NoSuchAlgorithmException {
httpClient = java.net.http.HttpClient.newBuilder()
.sslContext(SSLContext.getDefault())
.executor(executor)
.connectTimeout(Duration.ofSeconds(configuration.getHttpClientConnectTimeout()))
.build();
}
@UserLogger
@Produces
@ApplicationScoped
public Logger getUserLogger() {
return userLogger;
}
@Produces
@ApplicationScoped
public HttpClient getHttpClient() {
return httpClient;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy