use of org.netbeans.spi.autoupdate.UpdateItem in project netbeans-rcp-lite by outersky.
the class ArtificialFeaturesProvider method getUpdateItems.
@Override
public Map<String, UpdateItem> getUpdateItems() throws IOException {
if (!generateArtificialFeatures()) {
return Collections.emptyMap();
}
Map<String, UpdateItem> res = new HashMap<String, UpdateItem>();
// crate features built on installed modules
Map<String, Set<ModuleInfo>> categoryToModules = new HashMap<String, Set<ModuleInfo>>();
for (UpdateItem item : originalItems) {
UpdateItemImpl impl = Utilities.getUpdateItemImpl(item);
if (impl instanceof InstalledModuleItem) {
InstalledModuleItem installedModule = (InstalledModuleItem) impl;
String category = (String) installedModule.getModuleInfo().getLocalizedAttribute("OpenIDE-Module-Display-Category");
Module module = Utilities.toModule(installedModule.getModuleInfo().getCodeNameBase(), installedModule.getModuleInfo().getSpecificationVersion());
assert module != null : "Module found for " + installedModule.getModuleInfo().getCodeNameBase() + ", " + installedModule.getModuleInfo().getSpecificationVersion();
if (module.isAutoload() || module.isFixed()) {
continue;
} else if (module.isEager()) {
continue;
} else if (category == null || category.length() == 0) {
category = UNSORTED_CATEGORY;
}
if (!categoryToModules.containsKey(category)) {
categoryToModules.put(category, new HashSet<ModuleInfo>());
}
categoryToModules.get(category).add(installedModule.getModuleInfo());
} else if (impl instanceof ModuleItem) {
ModuleItem updateModule = (ModuleItem) impl;
String category = (String) updateModule.getModuleInfo().getLocalizedAttribute("OpenIDE-Module-Display-Category");
if (LIBRARIES_CATEGORY.equals(category) || BRIDGES_CATEGORY.equals(category) || FEATURES_CATEGORY.equals(category)) {
continue;
}
if (category == null || category.length() == 0) {
String dn = (String) updateModule.getModuleInfo().getLocalizedAttribute("OpenIDE-Module-Display-Category");
if (dn == null || dn.length() == 0) {
category = UNSORTED_CATEGORY;
} else {
category = dn;
}
}
if (!categoryToModules.containsKey(category)) {
categoryToModules.put(category, new HashSet<ModuleInfo>());
}
categoryToModules.get(category).add(updateModule.getModuleInfo());
} else {
// XXX: ignore other types now
}
}
// make a feature for each one category
for (String category : categoryToModules.keySet()) {
if (true) {
throw new UnsupportedOperationException("Not supported yet.");
}
FeatureItem featureItemImpl = createFeatureItem(category, null, /*categoryToModules.get (category)*/
null, null, null);
log.log(Level.FINE, "Create FeatureItem[" + category + ", " + featureItemImpl.getSpecificationVersion().toString() + "] containing modules " + featureItemImpl.getDependenciesToModules());
UpdateItem featureItem = Utilities.createUpdateItem(featureItemImpl);
res.put(featureItemImpl.getCodeName() + '_' + featureItemImpl.getSpecificationVersion(), featureItem);
}
return res;
}
use of org.netbeans.spi.autoupdate.UpdateItem in project netbeans-rcp-lite by outersky.
the class AutoupdateCatalogProvider method getUpdateItems.
@Override
public Map<String, UpdateItem> getUpdateItems() throws IOException {
URL toParse = cache.getCatalogURL(codeName);
if (toParse == null) {
LOG.log(Level.FINE, "No content in cache for {0} provider. Returns EMPTY_MAP", codeName);
return Collections.emptyMap();
}
Map<String, UpdateItem> map;
synchronized (cache.getLock(toParse)) {
map = AutoupdateCatalogParser.getUpdateItems(toParse, this);
}
for (UpdateItem ui : map.values()) {
UpdateItemImpl impl = Trampoline.SPI.impl(ui);
}
descriptionInitialized = true;
return map;
}
Aggregations