Creates a {@link GroovyResourceLoader} from a {@link ResourceLoader}.
763066
public GroovyResourceLoader createGroovyResourceLoader(final ResourceLoader resourceLoader) {
    checkNotNull(resourceLoader);

    return new GroovyResourceLoader()
    {
      @Override
      public URL loadGroovySource(final String name) throws MalformedURLException {
        return resourceLoader.loadResource(name);
      }
    };
  }
1305028
private static ClassLoader createClassLoader(File toolsJar) throws MalformedURLException {
        final URL urls[] = new URL[] {toolsJar.toURI().toURL() };
        if (System.getSecurityManager() == null) {
            return new URLClassLoader(urls, getParentClassLoader());
        } else {
            return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                /** {@inheritDoc} */
                public ClassLoader run() {
                    return new URLClassLoader(urls, getParentClassLoader());
                }
            });
        }
    }
1337678
def client_resource_factory(self, res_spec, parent, logger):
        
        return KATCPClientResource(res_spec, parent=self, logger=logger)
1354020
public static File getResourceAsFile(ClassLoader loader, String resource) throws IOException {
        return new File(getResourceURL(loader, resource).getFile());
    }
1356071
public static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException {
        return new InputStreamReader(getResourceAsStream(loader, resource));
    }
1166969
public GeneratedClassLoader createClassLoader(ClassLoader parent)
    {
        ContextFactory f = getFactory();
        return f.createClassLoader(parent);
    }
677244
public static ResourceBundle load(String jellyUrl) {
        if(jellyUrl.endsWith(".jelly"))    // cut the trailing .jelly
            jellyUrl = jellyUrl.substring(0,jellyUrl.length()-".jelly".length());

        JellyFacet facet = WebApp.getCurrent().getFacet(JellyFacet.class);
        return facet.resourceBundleFactory.create(jellyUrl);
    }
66959
@SuppressWarnings("static-method")
	protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
		return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
			try {
				final URL url = from.toURI().toURL();
				assert url != null;
				return url;
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}), URL.class), parentClassLoader);
	}
323989
public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) {
        try {
            return cast(resourceLoader.classForName(className));
        } catch (Exception e) {
            CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className);
            CommonLogger.LOG.catchingTrace(e);
        }
        try {
            return cast(Class.forName(className));
        } catch (Exception | LinkageError e) {
            throw CommonLogger.LOG.cannotLoadClass(className, e);
        }
    }
129826
public ClassLoader buildClassLoader(ClassLoader serviceLoader)
  {
    synchronized (_loaderMap) {
      SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
      
      if (extLoaderRef != null) {
        ClassLoader extLoader = extLoaderRef.get();
        
        if (extLoader != null) {
          return extLoader;
        }
      }
    }
    
    String parentId = EnvLoader.getEnvironmentName(serviceLoader);
    
    String id = _id + "!" + parentId;
    
    //DynamicClassLoader extLoader = new PodExtClassLoader(serviceLoader, id);
    DynamicClassLoader extLoader = null;

    /*
    LibraryLoader libLoader
      = new LibraryLoader(extLoader, getRootDirectory().lookup("lib"));
    libLoader.init();
    
    CompilingLoader compLoader
      = new CompilingLoader(extLoader, getRootDirectory().lookup("classes"));
    compLoader.init();
    
    synchronized (_loaderMap) {
      SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
      
      if (extLoaderRef != null) {
        ClassLoader extLoaderOld = extLoaderRef.get();
        
        if (extLoaderOld != null) {
          return extLoaderOld;
        }
      }
      
      _loaderMap.put(serviceLoader, new SoftReference<>(extLoader));
    }
    */
    
    return extLoader;
  }
280123
public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException {

	if (ArrayUtil.isEmpty(resources)) return this;

	String key = hash(resources);
	ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key);

	if (rcl != null) return rcl;

	resources = ResourceUtil.merge(this.getResources(), resources);
	rcl = new ResourceClassLoader(resources, getParent());

	if (customCLs == null) customCLs = new ReferenceMap<String, ResourceClassLoader>();

	customCLs.put(key, rcl);
	return rcl;
    }
1193076
public void load(ResourceLocation resourceLocation)
	{
		IResource res = Silenced.get(() -> Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation));
		if (res == null)
			return;

		GsonBuilder gsonBuilder = new GsonBuilder();
		//we don't want GSON to create a new AnimationImporte but use this current one
		gsonBuilder.registerTypeAdapter(AnimationImporter.class, (InstanceCreator<AnimationImporter>) type -> this);
		//no builtin way to dezerialize multimaps
		gsonBuilder.registerTypeAdapter(Multimap.class, (JsonDeserializer<Multimap<String, Anim>>) this::deserializeAnim);
		Gson gson = gsonBuilder.create();

		try (Reader reader = new InputStreamReader(res.getInputStream(), "UTF-8"))
		{
			JsonReader jsonReader = new JsonReader(reader);
			jsonReader.setLenient(true);
			gson.fromJson(jsonReader, AnimationImporter.class);
		}
		catch (Exception e)
		{
			MalisisCore.log.error("Failed to read {}", resourceLocation, e);
		}
	}
38863
public static ResourceReader getResourceReaderProxy(ResourceGenerator generator,
			ResourceReaderHandler rsReaderHandler, JawrConfig config) {

		ResourceReader proxy = null;

		// Defines the interfaces to be implemented by the ResourceReader
		int nbExtraInterface = 0;
		Class<?>[] extraInterfaces = new Class<?>[2];
		boolean isResourceGenerator = generator instanceof ResourceGenerator;
		boolean isStreamResourceGenerator = generator instanceof StreamResourceGenerator;

		if (isResourceGenerator) {
			extraInterfaces[nbExtraInterface++] = TextResourceReader.class;
		}
		if (isStreamResourceGenerator) {
			extraInterfaces[nbExtraInterface++] = StreamResourceReader.class;
		}

		Class<?>[] generatorInterfaces = getGeneratorInterfaces(generator);
		Class<?>[] implementedInterfaces = new Class[generatorInterfaces.length + nbExtraInterface];
		System.arraycopy(generatorInterfaces, 0, implementedInterfaces, 0, generatorInterfaces.length);
		System.arraycopy(extraInterfaces, 0, implementedInterfaces, generatorInterfaces.length, nbExtraInterface);

		// Creates the proxy
		InvocationHandler handler = new ResourceGeneratorReaderWrapperInvocationHandler(generator, rsReaderHandler,
				config);
		proxy = (ResourceReader) Proxy.newProxyInstance(ResourceGeneratorReaderProxyFactory.class.getClassLoader(),
				implementedInterfaces, handler);

		return proxy;
	}
980299
def create_from_resource_class(cls, resource_class):
        
        mp_reg = get_mapping_registry(cls.content_type)
        mp = mp_reg.find_or_create_mapping(resource_class)
        return cls(resource_class, mp)
644271
protected ResourceReaderHandler initResourceReaderHandler() {
		ResourceReaderHandler rsHandler = null;
		if (servletContext != null) {
			try {
				rsHandler = new ServletContextResourceReaderHandler(servletContext, jawrConfig, generatorRegistry);
			} catch (IOException e) {
				throw new BundlingProcessException(e);
			}
		}

		return rsHandler;
	}
101415
public static JavaCompilerUtil create(ClassLoader loader)
  {
    JavacConfig config = JavacConfig.getLocalConfig();

    String javac = config.getCompiler();

    JavaCompilerUtil javaCompiler = new JavaCompilerUtil();

    if (loader == null) {
      loader = Thread.currentThread().getContextClassLoader();
    }

    javaCompiler.setClassLoader(loader);
    javaCompiler.setCompiler(javac);
    javaCompiler.setArgs(config.getArgs());
    javaCompiler.setEncoding(config.getEncoding());
    javaCompiler.setMaxBatch(config.getMaxBatch());
    javaCompiler.setStartTimeout(config.getStartTimeout());
    javaCompiler.setMaxCompileTime(config.getMaxCompileTime());

    return javaCompiler;
  }
399806
public TemporaryFileBuilder fromClasspathResource(final String pathToResource) {
        final Class<?> callerClass = getCallerClass();
        this.content = getResolver().resolve(pathToResource, callerClass);
        return this;
    }