Search for the template named {@code name} in the resource file from the
class loader of the current thread.
333964
@Override
    protected URL getURL(String name) {
        return Thread.currentThread().getContextClassLoader().getResource(name);
    }
208618
def get_template_by_name(name,**kwargs):
    
    try:
        tmpl_i = db.DBSession.query(Template).filter(Template.name == name).options(joinedload_all('templatetypes.typeattrs.default_dataset.metadata')).one()
        return tmpl_i
    except NoResultFound:
        log.info("%s is not a valid identifier for a template",name)
        raise HydraError('Template "%s" not found'%name)
322566
public Template getTemplate(String key, ResourceLoader loader)
	{
		return this.getTemplateByLoader(key, loader,true);
	}
108244
public static @CheckForNull URL _findResource(ClassLoader cl, String name) {
        return (URL) invoke(FIND_RESOURCE, RuntimeException.class, cl, name);
    }
1314718
public Template getTemplate(final String parentName, final String name) throws ResourceNotFoundException {
        return getTemplate(this.loader.concat(parentName, name));
    }
968414
protected ResourceHandle getResourceHandle(final String name)
    {
        return AccessController.doPrivileged(new PrivilegedAction<ResourceHandle>()
        {
            @Override
            public ResourceHandle run()
            {
                return URIClassLoader.this.finder.getResource(name);
            }
        }, this.acc);
    }
1144479
def find_name(self, template_name, search_dirs):
        
        file_name = self.make_file_name(template_name)

        return self._find_path_required(search_dirs, file_name)
707774
private File getTemplateFile(String filename) throws IOException {
        File templateFile=null;
        final String resource = TEMPLATE_RESOURCES_PATH + "/" + filename;
        InputStream is = Setup.class.getClassLoader().getResourceAsStream(resource);
        if (null == is) {
            throw new RuntimeException("Unable to load required template: " + resource);
        }
        templateFile = File.createTempFile("temp", filename);
        templateFile.deleteOnExit();
        try {
            return copyToNativeLineEndings(is, templateFile);
        } finally {
            is.close();
        }
    }
924804
@Nullable
  public InputStream getResourceAsStream (final String name)
  {
    InputStream ret = null;
    if (m_aBestCandidate != null)
    {
      ret = m_aBestCandidate.getResourceAsStream (name);
      if (ret != null)
        return ret;
      m_aBestCandidate = null;
    }

    IClassLoadHelper aLoadHelper = null;
    final Iterator <IClassLoadHelper> iter = m_aLoadHelpers.iterator ();
    while (iter.hasNext ())
    {
      aLoadHelper = iter.next ();
      ret = aLoadHelper.getResourceAsStream (name);
      if (ret != null)
        break;
    }

    m_aBestCandidate = aLoadHelper;
    return ret;
  }
414904
@Override
	public Template getTemplate(String resource) {
		return RythmTemplate.wrap(engine.getTemplate(resource));
	}
237462
private LookupResult findDecompiled(String name, CompilationUnit compilationUnit, GroovyClassLoader loader) {
        ClassNode node = ClassHelper.make(name);
        if (node.isResolved()) {
            return new LookupResult(null, node);
        }

        DecompiledClassNode asmClass = null;
        String fileName = name.replace('.', '/') + ".class";
        URL resource = loader.getResource(fileName);
        if (resource != null) {
            try {
                asmClass = new DecompiledClassNode(AsmDecompiler.parseClass(resource), new AsmReferenceResolver(this, compilationUnit));
                if (!asmClass.getName().equals(name)) {
                    // this may happen under Windows because getResource is case insensitive under that OS!
                    asmClass = null;
                }
            } catch (IOException e) {
                // fall through and attempt other search strategies
            }
        }

        if (asmClass != null) {
            if (isFromAnotherClassLoader(loader, fileName)) {
                return tryAsScript(name, compilationUnit, asmClass);
            }

            return new LookupResult(null, asmClass);
        }
        return null;
    }
753299
function loadTemplate(template, name, callback) {
  async.waterfall([
    cb => source(template.path, template.filter, template.readMode, cb),
    (files, cb) => asDataMap(files, template.mapping, cb),
  ], (error, result) => {
    async.nextTick(callback, error, result);
  });
}
276465
def load_template_source(template_name, template_dirs=None):
    """"""
    template_zipfiles = getattr(settings, "TEMPLATE_ZIP_FILES", [])

    # Try each ZIP file in TEMPLATE_ZIP_FILES.
    for fname in template_zipfiles:
        try:
            z = zipfile.ZipFile(fname)
            source = z.read(template_name)
        except (IOError, KeyError):
            continue
        z.close()
        # We found a template, so return the source.
        template_path = "%s:%s" % (fname, template_name)
        return (source, template_path)

    # If we reach here, the template couldn't be loaded
    raise TemplateDoesNotExist(template_name)
225382
def _get_template_name(self):
        '''
        '''

        start_pattern = r"sys application template\s+" \
                        r"(\/[\w\.\-]+\/)?" \
                        r"(?P<name>[\w\.\-]+)\s*\{"

        template_start = re.search(start_pattern, self.template_str)
        if template_start:
            return template_start.group('name')

        raise NonextantTemplateNameException('Template name not found.')
550957
public static Class<?> classForName(String name) throws ClassNotFoundException {
        if ("void".equals(name)) return void.class;
        if ("char".equals(name)) return char.class;
        if ("boolean".equals(name)) return boolean.class;
        if ("byte".equals(name)) return byte.class;
        if ("short".equals(name)) return short.class;
        if ("int".equals(name)) return int.class;
        if ("long".equals(name)) return long.class;
        if ("float".equals(name)) return float.class;
        if ("double".equals(name)) return double.class;
        return Class.forName(name, true, Thread.currentThread().getContextClassLoader());
    }
1042873
def get(self, template_name):
        """"""
        template = db.Template.find_one(template_name=template_name)

        if not template:
            return self.make_response('No such template found', HTTP.NOT_FOUND)

        return self.make_response({'template': template})
225631
@Override
	public Template getTemplate(String resource) {
		try {
			return FreemarkerTemplate.wrap(this.cfg.getTemplate(resource));
		} catch(IOException e) {
			throw new IORuntimeException(e);
		}catch (Exception e) {
			throw new TemplateException(e);
		}
	}