public synchronized TextSource getSource(Path path){
  
    //0. Input checks:
    if (path==null)
      throw new IllegalArgumentException("Internal failure - please contact us - path was null!");
    
    //1. If we already have it, just return it:
    //Log.finest("TextLoadMgr", "getLoader()", path.toString());
    TextSource tl=(TextSource)textSources.get(path);
    if (tl!=null)
      return tl;
     
    //2. Obtain a factory to create it, and return it:
    for (int i=0; i<factories.size(); i++){
      TextLoaderFactory factory=factories.get(i);
      TextLoader loader;
      try {
        loader=factory.create(path);
      } catch (TmplzException e) {
        throw e;
      } catch (Exception e2) {
        throw new TextLoaderCreateException(path, e2);
      }
      if (loader!=null){
        tl=new TextSource(loader, this, path);
        textSources.put(path, tl);
        return tl;
      }
    }
  
    return null;
  }