Find all templates
@param root dir within the classpath
@return a list of templates
@throws IOException if connection with elasticsearch is failing
@throws URISyntaxException this should not happen
483585
public static List<String> findTemplates(String root) throws IOException, URISyntaxException {
        if (root == null) {
            return findTemplates();
        }

        logger.debug("Looking for templates in classpath under [{}].", root);

        final List<String> templateNames = new ArrayList<>();
        String[] resources = ResourceList.getResources(root + "/" + Defaults.TemplateDir + "/"); // "es/_template/"
        for (String resource : resources) {
            if (!resource.isEmpty()) {
                String withoutIndex = resource.substring(resource.indexOf("/")+1);
                String template = withoutIndex.substring(0, withoutIndex.indexOf(Defaults.JsonFileExtension));
                logger.trace(" - found [{}].", template);
                templateNames.add(template);
            }
        }

        return templateNames;
    }
846162
public static List<File> listAll(File rootDir) {
		return Files.fileTreeTraverser().preOrderTraversal(rootDir).toList();
	}
462883
protected static IPackageFragmentRoot[] findRootsForClasspath(IPath entry, IJavaProject[] searchOrder) {
		for (int i= 0; i < searchOrder.length; i++) {
			IPackageFragmentRoot[] elements= findRootsInProject(entry, searchOrder[i]);
			if (elements.length != 0) {
				return elements;
			}
		}
		return null;
	}
780849
public List<String> paths(Node dir, Filter filter) throws IOException {
    	List<String> result;

    	result = new ArrayList<>();
    	paths(dir, filter, result);
    	return result;
    }
1093226
@Override
  public TemplateSource find(String path) throws IOException {
    return new URLTemplateSource(new URL("file", null, path));
  }
543466
public TemplateResources templateResources() {
        if (templates.get() == null) {
            templates.compareAndSet(null, new TemplateResourcesImpl(this));
        }
        return templates.get();
    }
823065
def find(root: Union[Path, str], dirs: bool = True) -> str:
    
    if isinstance(root, str):
        root = Path(root)

    results: List[Path] = []
    for dirpath, dirnames, filenames in os.walk(root):
        names = filenames
        if dirs:
            names += dirnames
        for name in names:
            results.append(Path(dirpath) / name)
    results.sort()
    return "\n".join(str(result.relative_to(root)) for result in results)
1064230
def _find_collections(root):
  
  packages = []
  for dirname, subdirs, files in os.walk(root):
    for filename in files:
      if filename.endswith('.xml'):
        xmlfile = os.path.join(dirname, filename)
        yield ElementTree.parse(xmlfile).getroot()
1210710
private void loadTemplates( Element parent )
    {
        // Load templates
        List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE );
        for ( int i = 0; i < templates.size(); i++ )
        {
            Element template = ( Element ) templates.get( i );
            String name = getElementText( template, NAME );
            if ( name == null )
            {
                _log.error( "Malformed URL template descriptor in " + _configFilePath
                            + ". The url-template name is missing." );
                continue;
            }

            String value = getElementText( template, VALUE );
            if ( value == null )
            {
                _log.error( "Malformed URL template descriptor in " + _configFilePath
                            + ". The url-template value is missing for template " + name );
                continue;
            }

            if ( _log.isDebugEnabled() )
            {
                _log.debug( "[URLTemplate] " + name + " = " + value );
            }

            URLTemplate urlTemplate = new URLTemplate( value, name );
            if ( urlTemplate.verify( _knownTokens, _requiredTokens ) )
            {
                _urlTemplates.addTemplate( name, urlTemplate );
            }
        }
    }
18699
public static String findSingleMainClass(File rootFolder) throws IOException {
        MainClassesCallback callback = new MainClassesCallback();
        MainClassFinder.doWithMainClasses(rootFolder, callback);
        return callback.getMainClass();
    }
850159
static <T> List<Template> getTemplates(T objectType) {
        try {
            List<Template> templates = new ArrayList<>();
            TEMP_FINDER.findAnnotations(templates, objectType);
            return templates;
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
382138
public void dumpTemplate(String templatePath) throws IOException
    {
        BufferedWriter bw = IOUtil.newBufferedWriter(templatePath);
        String template = getTemplate();
        bw.write(template);
        bw.close();
    }
1130790
def find_template_from_path(filepath, paths=None):
    
    if paths is None or not paths:
        paths = [os.path.dirname(filepath), os.curdir]

    for path in paths:
        candidate = os.path.join(path, filepath)
        if os.path.exists(candidate):
            return candidate

    LOGGER.warning("Could not find template=%s in paths=%s", filepath, paths)
    return None
589161
public static List<File> listFile(File rootDir) {
		return Files.fileTreeTraverser().preOrderTraversal(rootDir).filter(Files.isFile()).toList();
	}
1266296
@Override
    public Enumeration<URL> findResources(final String name) throws IOException
    {
        return AccessController.doPrivileged(new PrivilegedAction<Enumeration<URL>>()
        {
            @Override
            public Enumeration<URL> run()
            {
                return URIClassLoader.this.finder.findResources(name);
            }
        }, this.acc);
    }
308133
protected void buildIndexMap(RootDoc root)  {
        PackageDoc[] packages = root.specifiedPackages();
        ClassDoc[] classes = root.classes();
        if (!classesOnly) {
            if (packages.length == 0) {
                Set<PackageDoc> set = new HashSet<PackageDoc>();
                PackageDoc pd;
                for (int i = 0; i < classes.length; i++) {
                    pd = classes[i].containingPackage();
                    if (pd != null && pd.name().length() > 0) {
                        set.add(pd);
                    }
                }
                adjustIndexMap(set.toArray(packages));
            } else {
                adjustIndexMap(packages);
            }
        }
        adjustIndexMap(classes);
        if (!classesOnly) {
            for (int i = 0; i < classes.length; i++) {
                if (shouldAddToIndexMap(classes[i])) {
                    putMembersInIndexMap(classes[i]);
                }
            }
        }
        sortIndexMap();
    }
1072024
public LinkedList<UriTemplateComponent> scan(String templateString) throws MalformedUriTemplateException
    {
        char[] template = templateString.toCharArray();
        startTemplate();
        int i;
        for (i = 0; i < template.length; i++)
        {
            char c = template[i];

            if (c == EXPR_START)
            {
                if (literalCaptureOn)
                {
                    endLiteral(i);
                }
                startExpression(i);
            }

            if (c != EXPR_START)
            {
                startLiteral(i);
            }


            if (expressionCaptureOn || literalCaptureOn)
            {
                capture(c);
            }

            if (c == EXPR_END)
            {
                endExpression(i);
                startLiteral(i);
            }
        }
        if (literalCaptureOn)
        {
            endLiteral(i);
        }
        endTemplate(i);
        return components;
    }