/** * Load all properties from the specified class path resource * (in ISO-8859-1 encoding), using the default class loader. * <p>Merges properties if more than one resource of the same name * found in the class path. * @param resourceName the name of the class path resource * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName) throws IOException { return loadAllProperties(resourceName, null); }
/** * Load all properties from the specified class path resource * (in ISO-8859-1 encoding), using the default class loader. * <p>Merges properties if more than one resource of the same name * found in the class path. * @param resourceName the name of the class path resource * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName) throws IOException { return loadAllProperties(resourceName, null); }
public LoginInfoEndpoint() { try { gitProperties = PropertiesLoaderUtils.loadAllProperties("git.properties"); } catch (IOException e) { // Ignore } try { buildProperties = PropertiesLoaderUtils.loadAllProperties("build.properties"); } catch (IOException e) { // Ignore } }
PropertiesLoaderUtils.loadAllProperties(this.schemaMappingsLocation, this.classLoader); if (logger.isTraceEnabled()) { logger.trace("Loaded schema mappings: " + mappings);
PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader); if (logger.isTraceEnabled()) { logger.trace("Loaded NamespaceHandler mappings: " + mappings);
private static String resolveJedisVersion() { String version = Jedis.class.getPackage().getImplementationVersion(); if (!StringUtils.hasText(version)) { try { Properties props = PropertiesLoaderUtils.loadAllProperties("META-INF/maven/redis.clients/jedis/pom.properties"); if (props.containsKey("version")) { version = props.getProperty("version"); } } catch (IOException e) { // ignore this one } } return version; }
@Override public void afterPropertiesSet() { try { Properties gitProperties = PropertiesLoaderUtils.loadAllProperties("git.properties"); commitId = gitProperties.getProperty("git.commit.id.abbrev", "UNKNOWN"); String currentTime = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()); timestamp = gitProperties.getProperty("git.commit.time", currentTime); } catch (IOException e) { logger.debug("Exception loading git.properties", e); } try { Properties buildProperties = PropertiesLoaderUtils.loadAllProperties("build.properties"); version = buildProperties.getProperty("build.version"); } catch (IOException e) { logger.debug("Exception loading build.properties", e); } Assert.hasText(uaaUrl); Assert.hasText(version); Assert.hasText(commitId); Assert.hasText(timestamp); }
PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader); if (logger.isTraceEnabled()) { logger.trace("Loaded NamespaceHandler mappings: " + mappings);
PropertiesLoaderUtils.loadAllProperties(this.schemaMappingsLocation, this.classLoader); if (logger.isTraceEnabled()) { logger.trace("Loaded schema mappings: " + mappings);
/** * Load all properties from the given class path resource, * using the default class loader. * <p>Merges properties if more than one resource of the same name * found in the class path. * @param resourceName the name of the class path resource * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName) throws IOException { return loadAllProperties(resourceName, null); }
/** * @param configurationResourceName * @throws IOException */ public CacheEntityFactory(String configurationResourceName) throws IOException { this.properties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); this.defaultCacheEntity = properties.getProperty("cache.type"); }
/** * @param configurationResourceName * @throws IOException */ public CacheEntityFactory(String configurationResourceName) throws IOException { this.properties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); this.defaultCacheEntity = properties.getProperty("cache.type"); }
public static void loadAllProperties(String propertyFileName) { try { Properties properties = PropertiesLoaderUtils.loadAllProperties(propertyFileName); processProperties(properties); } catch (IOException e) { e.printStackTrace(); } }
protected RedisClient resolveRedisClient(@SuppressWarnings("rawtypes") Map configValues) throws IOException { String configurationResourceName = (String) configValues.get("hibernate.redis.configurationResourceName"); if (null != configurationResourceName) { Properties redisProperties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); return new RedisClient(RedisUtils.createJedisPool(redisProperties)); } else { return null; } }
protected RedisClient resolveRedisClient(@SuppressWarnings("rawtypes") Map configValues) throws IOException { String configurationResourceName = (String) configValues.get("hibernate.redis.configurationResourceName"); if (null != configurationResourceName) { try { referenceCount.incrementAndGet(); Properties redisProperties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); return new RedisClient(RedisUtils.createJedisPool(redisProperties)); } catch (RuntimeException e) { referenceCount.decrementAndGet(); throw e; } } else { return null; } }
/** * Load the specified NamespaceHandler mappings lazily. */ private Map<String, Object> getHandlerMappings() { if (this.handlerMappings == null) { synchronized (this) { if (this.handlerMappings == null) { try { Properties mappings = PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader); if (logger.isDebugEnabled()) { logger.debug("Loaded NamespaceHandler mappings: " + mappings); } Map<String, Object> handlerMappings = new ConcurrentHashMap<String, Object>(); CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings); this.handlerMappings = handlerMappings; } catch (IOException ex) { throw new IllegalStateException( "Unable to load NamespaceHandler mappings from location [" + this.handlerMappingsLocation + "]", ex); } } } } return this.handlerMappings; }
protected RedisClient resolveRedisClient(@SuppressWarnings("rawtypes") Map configValues) throws IOException { String configurationResourceName = (String) configValues.get("hibernate.redis.configurationResourceName"); if (null != configurationResourceName) { Properties redisProperties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); return new RedisClient(RedisUtils.createJedisPool(redisProperties)); } else { return null; } }
protected RedisClient resolveRedisClient(@SuppressWarnings("rawtypes") Map configValues) throws IOException { String configurationResourceName = (String) configValues.get("hibernate.redis.configurationResourceName"); if (null != configurationResourceName) { try { referenceCount.incrementAndGet(); Properties redisProperties = PropertiesLoaderUtils.loadAllProperties(configurationResourceName); return new RedisClient(RedisUtils.createJedisPool(redisProperties)); } catch (RuntimeException e) { referenceCount.decrementAndGet(); throw e; } } else { return null; } }
/** * 配置数据库 */ private void configDatabase(HttpServletRequest request, Map<String, Object> map) { try { Properties dbconfig = PropertiesLoaderUtils.loadAllProperties(CmsDataSource.DATABASE_CONFIG_TEMPLATE); String host = request.getParameter("host"); String port = request.getParameter("port"); String database = request.getParameter("database"); cmsUpgrader.setDataBaseUrl(dbconfig, host, port, database); dbconfig.setProperty("jdbc.username", request.getParameter("username")); dbconfig.setProperty("jdbc.encryptPassword", VerificationUtils .base64Encode(VerificationUtils.encrypt(request.getParameter("password"), CommonConstants.ENCRYPT_KEY))); String databaseConfiFile = CommonConstants.CMS_FILEPATH + CmsDataSource.DATABASE_CONFIG_FILENAME; File file = new File(databaseConfiFile); try (FileOutputStream outputStream = new FileOutputStream(file);) { dbconfig.store(outputStream, null); } try (Connection connection = DatabaseUtils.getConnection(databaseConfiFile)) { } map.put("message", "success"); } catch (Exception e) { map.put("error", e.getMessage()); } }
/** * 配置数据库 */ private void configDatabase(HttpServletRequest request, Map<String, Object> map) { try { Properties dbconfig = PropertiesLoaderUtils.loadAllProperties(CmsDataSource.DATABASE_CONFIG_TEMPLATE); String host = request.getParameter("host"); String port = request.getParameter("port"); String database = request.getParameter("database"); cmsUpgrader.setDataBaseUrl(dbconfig, host, port, database); dbconfig.setProperty("jdbc.username", request.getParameter("username")); dbconfig.setProperty("jdbc.encryptPassword", VerificationUtils .base64Encode(VerificationUtils.encrypt(request.getParameter("password"), CommonConstants.ENCRYPT_KEY))); String databaseConfiFile = CommonConstants.CMS_FILEPATH + CmsDataSource.DATABASE_CONFIG_FILENAME; File file = new File(databaseConfiFile); try (FileOutputStream outputStream = new FileOutputStream(file);) { dbconfig.store(outputStream, null); } try (Connection connection = DatabaseUtils.getConnection(databaseConfiFile)) { } map.put("message", "success"); } catch (Exception e) { map.put("error", e.getMessage()); } }