Forge - Parent 1.0.7-SNAPSHOT

org.jboss.forge.shell.util
Class PathspecParser

java.lang.Object
  extended by org.jboss.forge.shell.util.PathspecParser

public class PathspecParser
extends Object

Parser of UNIX-style pathspec. The parser accepts a resource, and provides a result set of resources based on the relative path provided.

Example:
List> res = new PathspecParser(factoryInstance, relativeResource, "../../foobar"); Where factoryInstance is an instance of ResourceFactory, relativeResource is a resource, such as a file or directory, for which the relative result for ../../foobar will be calculated.

Wildcards * and ? are accepted.

Author:
Mike Brock

Constructor Summary
PathspecParser(ResourceFactory factory, Resource<?> res, String path)
           
 
Method Summary
static String pathspecToRegEx(String pathSpec)
           
 List<Resource<?>> resolve()
          Resolve the results.
 List<Resource<?>> search()
          Perform a search, by doing a breadth-first traversal of the resource tree for resources that match the path string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathspecParser

public PathspecParser(ResourceFactory factory,
                      Resource<?> res,
                      String path)
Method Detail

resolve

public List<Resource<?>> resolve()
Resolve the results.

Returns:
A list of resources that match the path. Empty if there are no matches.

search

public List<Resource<?>> search()
Perform a search, by doing a breadth-first traversal of the resource tree for resources that match the path string.

Returns:
A list of resources that match the path string. Empty if there are no matches.

pathspecToRegEx

public static String pathspecToRegEx(String pathSpec)

Forge - Parent 1.0.7-SNAPSHOT

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.