'Starts the Glob.
This is the main entry point for this flow mixin.
First we convert the pattern into regex components, and then we
interpolate each component. Finally, we generate a cartesian product of all
combinations.
Args:
paths: A list of GlobExpression instances.
pathtype: The pathtype to use for creating pathspecs.
root_path: A pathspec where to start searching from.
process_non_regular_files: Work with all kinds of files - not only with
regular ones.'

def GlobForPaths(self, paths, pathtype='OS', root_path=None, process_non_regular_files=False):

    patterns = []
    if (not paths):
        return
    client = aff4.FACTORY.Open(self.client_id, token=self.token)
    self.state.pathtype = pathtype
    self.state.root_path = root_path
    self.state.process_non_regular_files = process_non_regular_files
    for path in paths:
        patterns.extend(path.Interpolate(client=client))
    patterns.sort(key=len, reverse=True)
    for pattern in patterns:
        curr_node = self.state.component_tree
        components = self.ConvertGlobIntoPathComponents(pattern)
        for (i, curr_component) in enumerate(components):
            is_last_component = (i == (len(components) - 1))
            next_node = curr_node.get(curr_component.SerializeToString(), {})
            if (is_last_component and next_node):
                curr_node[curr_component.SerializeToString()] = {}
            else:
                curr_node = curr_node.setdefault(curr_component.SerializeToString(), {})
    root_path = self.state.component_tree.keys()[0]
    self.CallStateInline(messages=[None], next_state='ProcessEntry', request_data=dict(component_path=[root_path]))
