Example usage for org.springframework.util SystemPropertyUtils PLACEHOLDER_PREFIX

List of usage examples for org.springframework.util SystemPropertyUtils PLACEHOLDER_PREFIX

Introduction

In this page you can find the example usage for org.springframework.util SystemPropertyUtils PLACEHOLDER_PREFIX.

Prototype

String PLACEHOLDER_PREFIX

To view the source code for org.springframework.util SystemPropertyUtils PLACEHOLDER_PREFIX.

Click Source Link

Document

Prefix for system property placeholders: "${".

Usage

From source file:net.community.chest.gitcloud.facade.AbstractContextInitializer.java

protected SortedSet<File> ensureFoldersExistence(File appBase, NamedExtendedPlaceholderResolver propsResolver,
        ExtendedPlaceholderResolver sourcesResolver) {
    final SortedSet<File> createdFiles = verifyFolderProperty(ConfigUtils.GITCLOUD_BASE_PROP, appBase,
            ExtendedSetUtils.<File>sortedSet(ExtendedFileUtils.BY_ABSOLUTE_PATH_COMPARATOR));
    final String appBasePrefix = appBase.getAbsolutePath();
    final PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
            SystemPropertyUtils.PLACEHOLDER_PREFIX, SystemPropertyUtils.PLACEHOLDER_SUFFIX,
            SystemPropertyUtils.VALUE_SEPARATOR, true);
    final ExtendedPlaceholderResolver resolver = new AggregatedExtendedPlaceholderResolver(propsResolver,
            sourcesResolver);//from w w w .jav  a  2s.  c om
    ExtendedPlaceholderResolverUtils.forAllEntriesDo(propsResolver, new Closure<Map.Entry<String, String>>() {
        @Override
        @SuppressWarnings("synthetic-access")
        public void execute(Entry<String, String> e) {
            String propName = e.getKey(), propValue = e.getValue();
            if (StringUtils.isEmpty(propName) || (!propName.endsWith(".dir"))
                    || StringUtils.isEmpty(propValue)) {
                return;
            }

            String resolvedValue = helper.replacePlaceholders(propValue, resolver);
            if (ExtendedCharSequenceUtils.getSafeLength(resolvedValue) < appBasePrefix.length()) {
                return;
            }

            String pathValue = resolvedValue.replace('/', File.separatorChar); // just in case using '/'
            if (logger.isDebugEnabled()) {
                logger.debug("ensureFoldersExistence(" + propName + "): " + pathValue);
            }

            if (pathValue.startsWith(appBasePrefix)) {
                verifyFolderProperty(propName, new File(pathValue), createdFiles);
            }
        }
    });
    return createdFiles;
}

From source file:org.jahia.settings.SettingsBean.java

private String interpolate(String source) {
    return source != null && source.length() > 0 && source.contains(SystemPropertyUtils.PLACEHOLDER_PREFIX)
            ? SystemPropertyUtils.resolvePlaceholders(source, true)
            : source;//from www .j  a v  a 2  s .  c  o  m
}

From source file:org.jahia.settings.SettingsBean.java

private String getPropertyValue(String propertyName) {
    String result = properties.getProperty(propertyName);
    if (result != null && result.length() > 0 && result.contains(SystemPropertyUtils.PLACEHOLDER_PREFIX)) {
        result = SystemPropertyUtils.resolvePlaceholders(result, true);
    }//ww w  . ja  va  2s.  c o  m
    return result;
}