1 11 package org.eclipse.osgi.framework.internal.core; 12 13 import java.net.URL ; 14 import java.util.Enumeration ; 15 16 public class MultiSourcePackage extends PackageSource { 17 SingleSourcePackage[] suppliers; 18 19 MultiSourcePackage(String id, SingleSourcePackage[] suppliers) { 20 super(id); 21 this.suppliers = suppliers; 22 } 23 24 public SingleSourcePackage[] getSuppliers() { 25 return suppliers; 26 } 27 28 public Class loadClass(String name) throws ClassNotFoundException { 29 Class result = null; 30 for (int i = 0; i < suppliers.length; i++) { 31 result = suppliers[i].loadClass(name); 32 if (result != null) 33 return result; 34 } 35 return result; 36 } 37 38 public URL getResource(String name) { 39 URL result = null; 40 for (int i = 0; i < suppliers.length; i++) { 41 result = suppliers[i].getResource(name); 42 if (result != null) 43 return result; 44 } 45 return result; 46 } 47 48 public Enumeration getResources(String name) { 49 Enumeration results = null; 50 for (int i = 0; i < suppliers.length; i++) 51 results = BundleLoader.compoundEnumerations(results, suppliers[i].getResources(name)); 52 return results; 53 } 54 } 55 | Popular Tags |