List<Image.FmriState> installed = image.getInventory(null, false);
Map<String, Fmri> updateListMap = new HashMap();
List<String> nameList = new ArrayList();
for(Image.FmriState fs: installed){
if (fs.upgradable){
Fmri fmri = fs.fmri;
updateListMap.put(fmri.getName(),fmri);
nameList.add(fmri.getName());
}
}
List result = new ArrayList();
String[] pkgsName = nameList.toArray(new String[nameList.size()]);
try{
Image.ImagePlan ip = image.makeInstallPlan(pkgsName, "list");
Fmri[] proposed = ip.getProposedFmris();
if (countOnly){
result.add(Integer.valueOf(proposed.length));
return result;
}
for( Fmri newPkg : proposed){
Map oneRow = new HashMap();
try{
String name = newPkg.getName();
Fmri oldPkg = updateListMap.get(name);
Manifest manifest = image.getManifest(newPkg);
int changedSize = manifest.getPackageSize() - image.getManifest(oldPkg).getPackageSize();
oneRow.put("selected", false);
oneRow.put("fmri", newPkg);
oneRow.put("fmriStr", newPkg.toString());
putInfo(oneRow, "pkgName", name);
putInfo(oneRow, "newVersion", getPkgVersion(newPkg.getVersion()));
putInfo(oneRow, "version", getPkgVersion(oldPkg.getVersion()));
putInfo(oneRow, "category", getCategory(manifest));
putInfo(oneRow, "pkgSize", convertSizeForDispay(changedSize));
oneRow.put( "size", Integer.valueOf(changedSize));
putInfo(oneRow, "auth", newPkg.getAuthority());
String tooltip = manifest.getAttribute(PKG_SUMMARY);