Example usage for org.springframework.util SystemPropertyUtils VALUE_SEPARATOR

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

Introduction

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

Prototype

String VALUE_SEPARATOR

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

Click Source Link

Document

Value separator 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);//w w w.  j  a  va 2  s .co m
    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;
}