1 33 34 package edu.rice.cs.drjava.model; 35 36 import java.lang.ClassLoader ; 37 import java.net.URL ; 38 39 import edu.rice.cs.drjava.model.repl.WrapperClassLoader; 40 41 42 public class BrainClassLoader extends ClassLoader { 43 44 ClassLoader projectCL; 45 ClassLoader buildCL; 46 ClassLoader projectFilesCL; 47 ClassLoader externalFilesCL; 48 ClassLoader extraCL; 49 ClassLoader systemCL; 50 51 public BrainClassLoader(ClassLoader p, ClassLoader b, ClassLoader pf, ClassLoader ef, ClassLoader e) { 52 projectCL = p; 53 buildCL = b; 54 projectFilesCL = pf; 55 externalFilesCL = ef; 56 extraCL = e; 57 systemCL = new WrapperClassLoader(this.getClass().getClassLoader().getSystemClassLoader()); 58 } 59 60 61 public URL getResource(String name) { 62 URL resource = projectCL.getResource(name); 63 if (resource != null) return resource; 64 65 resource = buildCL.getResource(name); 66 if (resource != null) return resource; 67 68 resource = projectFilesCL.getResource(name); 69 if (resource != null) return resource; 70 71 resource = externalFilesCL.getResource(name); 72 if (resource != null) return resource; 73 74 resource = extraCL.getResource(name); 75 if (resource != null) return resource; 76 77 resource = systemCL.getResource(name); 78 if (resource != null) return resource; 79 80 return resource; 81 } 82 } 83 84 85 86 87 | Popular Tags |