1 57 58 package org.apache.commons.discovery.resource.classes; 59 60 import org.apache.commons.discovery.*; 61 import org.apache.commons.discovery.ResourceClass; 62 import org.apache.commons.discovery.ResourceClassDiscover; 63 import org.apache.commons.discovery.resource.ClassLoaders; 64 65 66 69 public abstract class ResourceClassDiscoverImpl implements ResourceClassDiscover 70 { 71 private ClassLoaders classLoaders; 72 private ResourceClassListener listener = null; 73 74 75 78 public ResourceClassDiscoverImpl() { 79 this(new ClassLoaders()); 80 } 81 82 85 public ResourceClassDiscoverImpl(ClassLoaders classLoaders) { 86 setClassLoaders(classLoaders); 87 } 88 89 92 public void setClassLoaders(ClassLoaders loaders) { 93 classLoaders = loaders; 94 } 95 96 101 public void addClassLoader(ClassLoader loader) { 102 classLoaders.put(loader); 103 } 104 105 protected ClassLoaders getClassLoaders() { 106 return classLoaders; 107 } 108 109 public void setListener(ResourceClassListener listener) { 110 this.listener = listener; 111 } 112 113 protected boolean notifyListener(ResourceClass resource) { 114 return (listener == null) ? true : listener.found(resource); 115 } 116 } 117 | Popular Tags |