1 11 package org.eclipse.osgi.framework.internal.core; 12 13 import java.net.URL ; 14 import java.util.Enumeration ; 15 16 public class SingleSourcePackage extends PackageSource { 17 BundleLoaderProxy supplier; 18 protected int expid; 22 public SingleSourcePackage(String id, int expid, BundleLoaderProxy supplier) { 23 super(id); 24 this.expid = expid; 25 this.supplier = supplier; 26 } 27 28 public SingleSourcePackage[] getSuppliers() { 29 return new SingleSourcePackage[] {this}; 30 } 31 32 public String toString() { 33 return id + " -> " + supplier; } 35 36 public Class loadClass(String name) throws ClassNotFoundException { 37 return supplier.getBundleLoader().findLocalClass(name); 38 } 39 40 public URL getResource(String name) { 41 return supplier.getBundleLoader().findLocalResource(name); 42 } 43 44 public Enumeration getResources(String name) { 45 return supplier.getBundleLoader().findLocalResources(name); 46 } 47 48 public boolean equals(Object source) { 49 if (this == source) 50 return true; 51 if (!(source instanceof SingleSourcePackage)) 52 return false; 53 SingleSourcePackage singleSource = (SingleSourcePackage) source; 54 return supplier == singleSource.supplier && expid == singleSource.expid; 55 } 56 } 57 | Popular Tags |