Example usage for org.springframework.util StringUtils commaDelimitedListToStringArray

List of usage examples for org.springframework.util StringUtils commaDelimitedListToStringArray

Introduction

In this page you can find the example usage for org.springframework.util StringUtils commaDelimitedListToStringArray.

Prototype

public static String[] commaDelimitedListToStringArray(@Nullable String str) 

Source Link

Document

Convert a comma delimited list (e.g., a row from a CSV file) into an array of strings.

Usage

From source file:org.springframework.yarn.batch.support.YarnJobLauncher.java

private static boolean jobMatches(String patterns, String name) {
    for (String pattern : StringUtils.commaDelimitedListToStringArray(patterns)) {
        if (PatternMatchUtils.simpleMatch(pattern, name)) {
            return true;
        }//from  ww  w. j a v  a2 s . c  o m
    }
    return false;
}

From source file:org.springframework.yarn.fs.DefaultResourceLocalizer.java

@Override
protected void doFileCopy(FileSystem fs) throws Exception {
    for (CopyEntry e : copyEntries) {
        for (String pattern : StringUtils.commaDelimitedListToStringArray(e.src)) {
            if (log.isDebugEnabled()) {
                log.debug("Searching copy entries using pattern=" + pattern);
            }//from  w  ww  . j a  va  2s.c  o  m
            for (Resource res : resolver.getResources(pattern)) {
                Path destinationPath = getDestinationPath(e, res);
                if (log.isDebugEnabled()) {
                    log.debug("For pattern=" + pattern + " found res=" + res + " destinationPath="
                            + destinationPath);
                }
                FSDataOutputStream os = fs.create(destinationPath);
                int bytes = FileCopyUtils.copy(res.getInputStream(), os);
                if (log.isDebugEnabled()) {
                    log.debug("bytes copied:" + bytes);
                }
            }
        }
    }

    if (rawFileContents != null) {
        Path resolvedStagingDirectory = resolveStagingDirectory();
        for (Entry<String, byte[]> entry : rawFileContents.entrySet()) {
            Path path = new Path(resolvedStagingDirectory, entry.getKey());
            FSDataOutputStream os = fs.create(path);
            if (log.isDebugEnabled()) {
                log.debug("Creating a file " + path);
            }
            FileCopyUtils.copy(entry.getValue(), os);
        }
    }
}