org.infinispan.commons.util.FileLookupFactory Java Examples
The following examples show how to use
org.infinispan.commons.util.FileLookupFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InfinispanEmbeddedProducer.java From quarkus with Apache License 2.0 | 6 votes |
@Singleton @Produces EmbeddedCacheManager manager() { if (config.xmlConfig.isPresent()) { String configurationFile = config.xmlConfig.get(); try { InputStream configurationStream = FileLookupFactory.newInstance().lookupFileStrict(configurationFile, Thread.currentThread().getContextClassLoader()); ConfigurationBuilderHolder configHolder = new ParserRegistry().parse(configurationStream, null); verifyTransactionConfiguration(configHolder.getDefaultConfigurationBuilder(), "default"); for (Map.Entry<String, ConfigurationBuilder> entry : configHolder.getNamedConfigurationBuilders().entrySet()) { verifyTransactionConfiguration(entry.getValue(), entry.getKey()); } return new DefaultCacheManager(configHolder, true); } catch (IOException e) { throw new RuntimeException(e); } } return new DefaultCacheManager(); }
Example #2
Source File: QuarkusCacheManagerProvider.java From keycloak with Apache License 2.0 | 6 votes |
private InputStream loadConfiguration(Config.Scope config) throws FileNotFoundException { String homeDir = System.getProperty("keycloak.home.dir"); if (homeDir == null) { log.warn("Keycloak home directory not set."); return loadDefaultConfiguration(config); } Path configPath = Paths.get(homeDir + "/conf/" + getConfigFileName(config)); if (configPath.toFile().exists()) { log.debugf("Loading cluster configuration from %s", configPath); return FileLookupFactory.newInstance() .lookupFileStrict(configPath.toUri(), Thread.currentThread().getContextClassLoader()); } log.infof("Clustering configuration file not found at %s.", configPath); return loadDefaultConfiguration(config); }
Example #3
Source File: QuarkusCacheManagerProvider.java From keycloak with Apache License 2.0 | 5 votes |
private InputStream loadDefaultConfiguration(Config.Scope config) throws FileNotFoundException { if (config.getBoolean("clustered", false)) { log.debugf("Using default clustered cache configuration."); return FileLookupFactory.newInstance() .lookupFileStrict("default-clustered-cache.xml", Thread.currentThread().getContextClassLoader()); } log.debug("Using default local cache configuration."); return FileLookupFactory.newInstance() .lookupFileStrict("default-local-cache.xml", Thread.currentThread().getContextClassLoader()); }