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