/** * Default environment that uses system properties / environment variables (prefixed with <code>env</code>) */ public PropertiesEnvironment() { this(PropertyUtils.getGlobalProperties()); }
/** * Default environment that uses system properties / environment variables (prefixed with <code>env</code>) */ public PropertiesEnvironment() { this(PropertyUtils.getGlobalProperties()); }
public SysEnvPropertySource() { this(GLOBAL_PROPERTIES_PROPERTY_SOURCE_NAME, PropertyUtils.getGlobalProperties()); }
/** * Return a property source from system properties plus the environment */ public static PropertySource<?> getDefaultPropertySource() { return new PropertiesPropertySource(PROPERTIES_PROPERTY_SOURCE, PropertyUtils.getGlobalProperties()); }
/** * Return a property source based on the properties object passed in, but where system properties plus environment properties "win" */ public static PropertySource<?> getPropertySource(Properties properties) { return new PropertiesPropertySource(PROPERTIES_PROPERTY_SOURCE, PropertyUtils.getGlobalProperties(properties)); }
/** * Return an environment that uses system properties / environment variables */ public synchronized static Environment getDefaultEnvironment() { if (instance == null) { Properties global = PropertyUtils.getGlobalProperties(); instance = new PropertiesEnvironment(global); } return instance; }
protected Properties getGlobalProperties(Properties properties) { return PropertyUtils.getGlobalProperties(PropertyUtils.toEmpty(properties)); }
protected Properties getPassThroughProperties(MavenContext context) { List<String> keys = context.getPassThroughPropertyKeys(); Properties properties = new Properties(); Collections.sort(keys); Properties global = PropertyUtils.getGlobalProperties(context.getProperties()); for (String key : keys) { String value = global.getProperty(key); if (!StringUtils.isBlank(value)) { properties.setProperty(key, value); } } return properties; }
/** * Return a property source based on the properties loaded from the locations passed in, but where system properties plus environment properties "win" if * {@code includeGlobal=true} */ public static PropertySource<?> getPropertySource(PropertiesService service, List<Location> locations, boolean includeGlobal) { Properties properties = service.getProperties(locations); if (includeGlobal) { properties = PropertyUtils.getGlobalProperties(properties); } return new PropertiesPropertySource(PROPERTIES_PROPERTY_SOURCE, properties); }
/** * Return a SpringContext that resolves all placeholders from the PropertySource passed in */ @Deprecated public static PropertySource<?> getGlobalPropertySource(List<String> locations, String encoding) { Properties loaded = PropertyUtils.load(locations, encoding); Properties global = PropertyUtils.getGlobalProperties(loaded); PropertyUtils.prepareContextProperties(global); return getGlobalPropertySource(global); }
/** * Process the properties passed in so they are ready for use by a Spring context.<br> * * 1 - Override with system/environment properties<br> * 2 - Decrypt any ENC(...) values<br> * 3 - Resolve all property values throwing an exception if any are unresolvable.<br> */ public static void prepareContextProperties(Properties properties, String encoding) { // Override with additional properties (if any) properties.putAll(getAdditionalProperties(properties, encoding)); // Override with system/environment properties properties.putAll(getGlobalProperties()); // Are we decrypting property values? decrypt(properties); // Are we resolving placeholders resolve(properties); }
@Deprecated public static PropertySource<?> getGlobalPropertySource(String name, List<org.kuali.common.util.property.ProjectProperties> pps) { // Load them from disk Properties source = PropertyUtils.load(pps); // Add in system/environment properties Properties globalSource = PropertyUtils.getGlobalProperties(source); logger.debug("Before prepareContextProperties()"); PropertyUtils.debug(globalSource); // Prepare them so they are ready for use PropertyUtils.prepareContextProperties(globalSource); logger.debug("After prepareContextProperties()"); PropertyUtils.debug(globalSource); // Return a PropertySource backed by the properties return new PropertiesPropertySource(name, globalSource); }
private Properties getOverrides(Project project) { // Get a reference to system + environment properties Properties global = PropertyUtils.getGlobalProperties(); // Setup a properties object where system properties "win" over project properties return ImmutableProperties.copyOf(PropertyUtils.combine(project.getProperties(), global)); }
@Override public void prepare() { long start = System.currentTimeMillis(); logger.info("[tomcat:preparing]"); // Remove old stuff (jdbc drivers, logs, applications, configuration files in /home/tomcat etc) DeployUtils.delete(channel, pathsToDelete); // Re-create directories that need to be there DeployUtils.mkdirs(channel, dirsToCreate); // Copy files to the remote server if (!skipFiles) { // Copy files from local to remote // TODO Get this hack out of here. The AppDynamics config sets a system property holding values for setenv.sh Properties properties = PropertyUtils.getGlobalProperties(filterProperties); DeployUtils.copyFiles(channel, deployables, properties); } // Make sure everything is owned by tomcat:tomcat DeployUtils.chown(channel, username, group, pathsToChown); logger.info("[tomcat:prepared] - {}", FormatUtils.getTime(System.currentTimeMillis() - start)); }
/** * Gets the {@link Config} from both the current configuration and the ones in {@code loaded}, at {@code location}, * and in the {@code servletContext}. * * @param loaded the loaded properties * @param location the location of additional properties * @param servletContext the servlet context in which to add more properties * * @return the final configuration */ public static Config getRootConfig(Properties loaded, String location, ServletContext servletContext) { // Get the Rice config object the listener created Config config = ConfigContext.getCurrentContextConfig(); Preconditions.checkNotNull(config, "'config' cannot be null"); Properties listenerProperties = getProperties(config); // Parse config from the location indicated, using listener properties in the process of doing so JAXBConfigImpl parsed = parseConfig(location, listenerProperties); // Add and override loaded properties with parsed properties addAndOverride(loaded, parsed.getRawProperties()); // Priority is servlet -> env -> system // Override anything we've loaded with servlet, env, and system properties Properties servlet = PropertySources.convert(servletContext); Properties global = PropertyUtils.getGlobalProperties(servlet); addAndOverride(loaded, global); logger.info("Using {} distinct properties", Integer.valueOf(loaded.size())); // Use JAXBConfigImpl in order to perform Rice's custom placeholder resolution logic now that everything is loaded return new JAXBConfigImpl(loaded); }
@Override public Properties getObject() throws Exception { Assert.notNull(helper, "helper is null"); Assert.notNull(locations, "locations are null"); Assert.notNull(encoding, "encoding is null"); Assert.notNull(missingLocationsMode, "missingLocationsMode is null"); Properties global = PropertyUtils.getGlobalProperties(); this.properties = PropertyUtils.toEmpty(properties); Properties result = new Properties(); for (String location : locations) { Properties resolverProperties = PropertyUtils.combine(properties, result, global); String resolvedLocation = helper.replacePlaceholders(location, resolverProperties); if (LocationUtils.exists(resolvedLocation)) { Properties properties = PropertyUtils.load(location, encoding); result.putAll(properties); } else { ModeUtils.validate(missingLocationsMode, "Skipping non-existent location [" + resolvedLocation + "]"); } } return result; }
Properties global = PropertyUtils.getGlobalProperties();
Properties global = PropertyUtils.getGlobalProperties();