1 11 12 package org.eclipse.osgi.internal.resolver; 13 14 import org.eclipse.osgi.service.resolver.*; 15 16 public class HostSpecificationImpl extends VersionConstraintImpl implements HostSpecification { 17 18 private BundleDescription[] hosts; 19 private boolean multihost = false; 20 21 public boolean isSatisfiedBy(BaseDescription supplier) { 22 if (!(supplier instanceof BundleDescription)) 23 return false; 24 BundleDescription candidate = (BundleDescription) supplier; 25 if (candidate.getHost() != null) 26 return false; 27 if (getName() != null && getName().equals(candidate.getSymbolicName()) && (getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion()))) 28 return true; 29 return false; 30 } 31 32 public BundleDescription[] getHosts() { 33 return hosts; 34 } 35 36 public boolean isResolved() { 37 return hosts != null && hosts.length > 0; 38 } 39 40 43 void setHosts(BundleDescription[] hosts) { 44 this.hosts = hosts; 45 } 46 47 public String toString() { 48 return "Fragment-Host: " + getName() + "; bundle-version=\"" + getVersionRange() + "\""; } 50 51 public BaseDescription getSupplier() { 52 if (hosts == null || hosts.length == 0) 53 return null; 54 return hosts[0]; 55 } 56 57 public boolean isMultiHost() { 58 return multihost; 59 } 60 61 void setIsMultiHost(boolean multihost) { 62 this.multihost = multihost; 63 } 64 } 65 | Popular Tags |