Example usage for org.apache.commons.digester SimpleRegexMatcher SimpleRegexMatcher

List of usage examples for org.apache.commons.digester SimpleRegexMatcher SimpleRegexMatcher

Introduction

In this page you can find the example usage for org.apache.commons.digester SimpleRegexMatcher SimpleRegexMatcher.

Prototype

SimpleRegexMatcher

Source Link

Usage

From source file:org.bedework.dumprestore.restore.Restore.java

/**
 * @param info - to track status/* www.  j a v a  2 s. c  o  m*/
 * @throws Throwable
 */
public void doRestore(final InfoLines info) throws Throwable {
    if (newSystem) {
        createNewSystem();

        return;
    }

    globals.info = info;
    globals.digester = new Digester();

    RegexMatcher m = new SimpleRegexMatcher();
    globals.digester.setRules(new RegexRules(m));

    globals.digester.addRuleSet(new RestoreRuleSet(globals));
    globals.digester.parse(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
}

From source file:org.carewebframework.ui.icons.IconLibraryRegistry.java

/**
 * Returns the paths to matching icon resources given name, dimensions, and library name, any
 * one of which may contain wildcard characters.
 * //from   w  ww . j a v a2s  . c o m
 * @param library Library name containing the icon (e.g., "silk"). If null, all libraries are
 *            searched.
 * @param iconName Name of the requested icon (e.g., "help*.png").
 * @param dimensions Dimensions of the requested icon (e.g., "16x*").
 * @return The icon path.
 */
public List<String> getMatching(String library, final String iconName, String dimensions) {
    SimpleRegexMatcher matcher = new SimpleRegexMatcher();
    dimensions = dimensions == null ? defaultDimensions : dimensions;

    List<String> results = null;

    for (IIconLibrary lib : this) {
        if (library == null || matcher.match(lib.getId(), library)) {
            List<String> urls = lib.getMatching(iconName, dimensions);

            if (results == null) {
                results = urls;
            } else {
                results.addAll(urls);
            }
        }
    }

    return results == null ? Collections.<String>emptyList() : results;
}