public ImportServlet() { super(); this.geppaequoConfig = CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); }
@Config(name = "tuhao") public final class TuhaoConfig extends AbstractConfig { public TuhaoConfig() throws IOException { super(); } @Managed public String getEncryptedGithubKey() { return get("encryptedGithubKey"); } @Managed public void setEncryptedGithubKey(String encryptedGithubKey) { set("encryptedGithubKey", encryptedGithubKey); } @Managed public String getGithubId() { return get("githubId"); } @Managed public void setGithubId(String githubId) { set("githubId", githubId); } }
public Booter() throws IOException { super(); this.tempDirectory = new TempDirectory("local-repo"); this.geppaequoConfig = CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); if (this.geppaequoConfig.getProxyHost() != null && !this.geppaequoConfig.getProxyHost().isEmpty()) { this.proxy = new Proxy(null, this.geppaequoConfig.getProxyHost(), this.geppaequoConfig.getProxyPort()); } else { this.proxy = null; } }
); final GeppaequoConfig geppaequoConfig = ConfigRegistry.CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); final List<String> includes = geppaequoConfig.getLifebuoy().getIncludes(); final List<String> excludes = geppaequoConfig.getLifebuoy().getExcludes(); final Map<String, String> titles = geppaequoConfig.getLifebuoy().getTitles(); final List<Pattern> includesPatterns = new ArrayList<>(includes.size()); final List<Pattern> excludesPatterns = new ArrayList<>(excludes.size());
GeppaequoConfig config = ConfigRegistry.CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); String proxyIfNeeded = config.getProxyIfNeeded(this.uri.getHost()); if (proxyIfNeeded != null) { request = request.viaProxy(proxyIfNeeded);
private static KeyPair getKeyPair() { GeppaequoConfig config = CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); KeyPair keyPair = null; try { KeyStore ks; String lookupKey = "java:comp/env/KeyStoreService"; char[] keyStorePwd = config.getKeyStorePwd().toCharArray(); try { KeyStoreService keystoreService; Key key = ks.getKey(config.getKeyAlias(), config.getKeyPwd().toCharArray()); log.info("key : {}", key); if (key == null || !(key instanceof PrivateKey)) { throw new Exception("no key found for alias ["+config.getKeyAlias()+"], or not a private key : [\n" + key != null ? key.toString():"null"+"\n]"); Certificate cert = ks.getCertificate(config.getKeyAlias()); log.info("cert : {}", cert); PublicKey publicKey = cert.getPublicKey();
private boolean hasPermission(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse) throws IOException { final GeppaequoConfig geppaequoConfig = CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); try { final GeppaequoConfig.OAuth oauth = geppaequoConfig.getOAuth(); log.trace("[OAuth Filter] oauth is {}", oauth.getActive()?"ACTIVE":"INACTIVE"); if (!oauth.getActive()) { log.trace("[OAuth Filter] oauth config is desactivated, skip OAuth authentication"); return true;
public List<RemoteRepository> newRepositories(RepositorySystem system, RepositorySystemSession session) { List<RemoteRepository> ret = new ArrayList<>(); List<QuintessenceConfig.Repo> repositories = CONFIG_REGISTRY.getConfig(QuintessenceConfig.class).getRepositoryObjects(); for (QuintessenceConfig.Repo repository : repositories) { Builder builder = new RemoteRepository .Builder(repository.getName(), "default", repository.getUri().toString()) .setPolicy(new RepositoryPolicy(true, UPDATE_POLICY_ALWAYS, CHECKSUM_POLICY_WARN)); if (this.proxy != null && !this.geppaequoConfig.matchNonProxyHosts(repository.getUri().getHost())) { ret.add(builder.setProxy(this.proxy).build()); } else { ret.add(builder.build()); } } return ret; }
@Override public void contextInitialized(final ServletContextEvent servletContextEvent) { servletContextEvent.getServletContext().setAttribute(CONFIGMAP_ATTRIBUTE, CONFIG_REGISTRY.getConfigMap()); MBeanExporter exporter = new MBeanExporter(ManagementFactory.getPlatformMBeanServer()); for (AbstractConfig config: CONFIG_REGISTRY.getConfigs()) { exporter.export(config.getMetadata().getName()+":name=config", config); String configName = config.getMetadata().getName(); try { GitRepositoryState gitRepositoryState = new GitRepositoryState(configName); config.setGitRepositoryState(gitRepositoryState); } catch (IOException e) { log.warn("no GitRepositoryState for module "+configName); } servletContextEvent.getServletContext().setAttribute(configName, config); } }
@Override public void contextDestroyed(final ServletContextEvent servletContextEvent) { MBeanExporter exporter = new MBeanExporter(ManagementFactory.getPlatformMBeanServer()); for (String name : CONFIG_REGISTRY.getConfigNames()) { exporter.unexport(name+":name=config"); servletContextEvent.getServletContext().removeAttribute(name); } servletContextEvent.getServletContext().removeAttribute(CONFIGMAP_ATTRIBUTE); CONFIG_REGISTRY.clearConfigs(); }
public Resource() { super(); this.laxRedirectStrategy = new LaxRedirectStrategy(); this.mapper = new ObjectMapper(); this.mapper.registerModule(new JSR353Module()); this.githubId = CONFIG_REGISTRY.getConfig(TuhaoConfig.class).getGithubId(); }
GeppaequoConfig config = ConfigRegistry.CONFIG_REGISTRY.getConfig(GeppaequoConfig.class); String proxyIfNeeded = config.getProxyIfNeeded(this.uri.getHost()); if (proxyIfNeeded != null) { request = request.viaProxy(proxyIfNeeded);
@Config(name = "buildhub") public final class BuildHubConfig extends AbstractConfig {
@Override public void execute(JobExecutionContext context) throws JobExecutionException { log.info("starting Cleaner job"); try { BuildHubConfig config = CONFIG_REGISTRY.getConfig(BuildHubConfig.class); LAffreuxSingleton.getInstance().clean(config.getDays()); } catch (IOException e) { throw new JobExecutionException(e); } finally { log.info("stopping Cleaner job"); } }
@Config(name = "quintessence") public final class QuintessenceConfig extends AbstractConfig {
private JsonObject getAccessToken(CloseableHttpClient httpclient, String code) throws Exception { JsonObject accessTokenEntityAsJsonObject; URI uriPost2GetAccessToken = URI.create("https://github.com/login/oauth/access_token"); if (this.githubKey == null) { this.githubKey = codec.decrypt(CONFIG_REGISTRY.getConfig(TuhaoConfig.class).getEncryptedGithubKey().toCharArray()); } HttpPost httpPost2GetAccessToken = new HttpPost(uriPost2GetAccessToken); httpPost2GetAccessToken.addHeader("Accept", MediaType.APPLICATION_JSON); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("client_id", this.githubId)); nameValuePairs.add(new BasicNameValuePair("client_secret", this.githubKey)); nameValuePairs.add(new BasicNameValuePair("code", code)); httpPost2GetAccessToken.setEntity(new UrlEncodedFormEntity(nameValuePairs)); try (CloseableHttpResponse accessTokenResponse = httpclient.execute(httpPost2GetAccessToken)) { HttpEntity accessTokenEntity = accessTokenResponse.getEntity(); accessTokenEntityAsJsonObject = mapper.readValue(EntityUtils.toString(accessTokenEntity), JsonObject.class); EntityUtils.consume(accessTokenEntity); } return accessTokenEntityAsJsonObject; }
@Config(name = "geppaequo") public class GeppaequoConfig extends AbstractConfig {
@Override public void contextInitialized(ServletContextEvent arg0) { this.mapper = new ObjectMapper(); try { this.googleCloudMessagingAPIKey = codec.decrypt(CONFIG_REGISTRY.getConfig(DagrConfig.class).getEncryptedGoogleCloudMessagingAPIKey().toCharArray()); } catch (Exception e) { e.printStackTrace(); } Bus<Node> theBus = dags.getBusFromTravis("aequologica", null); if (theBus != null) { subscription = theBus.toObservable() .filter( event -> event.getType().equals(BusEvent.Type.CLEAN_OK) || event.getType().equals(BusEvent.Type.CLEAN_ERROR) || event.getType().equals(BusEvent.Type.CLEAN_ABORTED)) .map( event -> event.get()) .subscribe( node -> sendNotification(node)); } log.debug("[gcm] subbscribed !"); } @Override