1 11 package org.eclipse.update.internal.core; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.update.core.IURLEntry; 17 import org.eclipse.update.core.VersionedIdentifier; 18 import org.eclipse.update.internal.model.SiteWithTimestamp; 19 20 public class ExtendedSite extends SiteWithTimestamp { 21 22 private boolean digestExist; 23 private String [] availableLocals; 24 private String digestURL; 25 private LiteFeature[] liteFeatures; 26 private LiteFeature[] allLiteFeatures; 27 private IURLEntry[] associateSites; 28 private boolean pack200 = false; 29 private IURLEntry selectedMirror; 30 31 32 public String getDigestURL() { 33 return digestURL; 34 } 35 public void setDigestURL(String digestURL) { 36 this.digestURL = digestURL; 37 } 38 39 public String [] getAvailableLocals() { 40 return availableLocals; 41 } 42 public void setAvailableLocals(String [] availableLocals) { 43 this.availableLocals = availableLocals; 44 } 45 public boolean isDigestExist() { 46 return digestExist; 47 } 48 public void setDigestExist(boolean digestExist) { 49 this.digestExist = digestExist; 50 } 51 public LiteFeature[] getLiteFeatures() { 52 if (getCurrentConfiguredSite()!=null) 53 return filterFeatures(getNonFilteredLiteFeatures()); 54 else 55 return getNonFilteredLiteFeatures(); 56 } 57 public void setLiteFeatures(LiteFeature[] liteFeatures) { 58 59 if ((liteFeatures == null) || (liteFeatures.length == 0)) 60 return; 61 this.allLiteFeatures = liteFeatures; 62 List temp = new ArrayList (); 63 for(int i = 0; i < allLiteFeatures.length ; i++) { 64 if (getFeatureReference(allLiteFeatures[i]) != null) { 65 temp.add(allLiteFeatures[i]); 66 } 67 } 68 if (!temp.isEmpty()) { 69 this.liteFeatures = (LiteFeature[])temp.toArray( new LiteFeature[temp.size()]); 70 } 71 } 72 73 public LiteFeature getLiteFeature(VersionedIdentifier vid) { 74 if (allLiteFeatures == null) 75 return null; 76 77 for(int i = 0; i < allLiteFeatures.length ; i++) { 78 if (vid.equals(allLiteFeatures[i].getVersionedIdentifier())) { 79 return allLiteFeatures[i]; 80 } 81 } 82 return null; 83 } 84 85 public LiteFeature[] getNonFilteredLiteFeatures() { 86 return liteFeatures; 87 } 88 public void setNonFilteredLiteFeatures(LiteFeature[] liteFeatures) { 89 this.liteFeatures = liteFeatures; 90 } 91 92 93 98 public boolean supportsPack200() { 99 return pack200; 100 } 101 102 107 public void setSupportsPack200(boolean pack){ 108 pack200 = pack; 109 } 110 111 118 private LiteFeature[] filterFeatures(LiteFeature[] allIncluded) { 119 List list = new ArrayList (); 120 if (allIncluded!=null){ 121 for (int i = 0; i < allIncluded.length; i++) { 122 LiteFeature included = allIncluded[i]; 123 if (UpdateManagerUtils.isValidEnvironment(included)) 124 list.add(included); 125 else{ 126 if (UpdateCore.DEBUG && UpdateCore.DEBUG_SHOW_WARNINGS){ 127 UpdateCore.warn("Filtered out feature reference:"+included); } 129 } 130 } 131 } 132 133 LiteFeature[] result = new LiteFeature[list.size()]; 134 if (!list.isEmpty()){ 135 list.toArray(result); 136 } 137 138 return result; 139 } 140 public IURLEntry[] getAssociateSites() { 141 return associateSites; 142 } 143 public void setAssociateSites(IURLEntry[] associateSites) { 144 this.associateSites = associateSites; 145 } 146 147 public IURLEntry getSelectedMirror() { 148 return selectedMirror; 149 } 150 151 public void setSelectedMirror(IURLEntry selectedMirror) { 152 this.selectedMirror = selectedMirror; 153 } 154 155 } 156 | Popular Tags |