1 11 package org.eclipse.osgi.internal.resolver; 12 13 import org.eclipse.osgi.service.resolver.*; 14 import org.eclipse.osgi.service.resolver.BaseDescription; 15 import org.eclipse.osgi.service.resolver.BundleSpecification; 16 17 public class BundleSpecificationImpl extends VersionConstraintImpl implements BundleSpecification { 18 private boolean exported; 19 private boolean optional; 20 21 protected void setExported(boolean exported) { 22 this.exported = exported; 23 } 24 25 protected void setOptional(boolean optional) { 26 this.optional = optional; 27 } 28 29 public boolean isExported() { 30 return exported; 31 } 32 33 public boolean isOptional() { 34 return optional; 35 } 36 37 public boolean isSatisfiedBy(BaseDescription supplier) { 38 if (!(supplier instanceof BundleDescription)) 39 return false; 40 BundleDescription candidate = (BundleDescription) supplier; 41 if (candidate.getHost() != null) 42 return false; 43 if (getName() != null && getName().equals(candidate.getSymbolicName()) && 44 (getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion()))) 45 return true; 46 return false; 47 } 48 49 public String toString() { 50 return "Require-Bundle: " + getName() + "; bundle-version=\"" + getVersionRange() + "\""; } 52 } 53 | Popular Tags |