コード例 #1
0
 public void pkgList(List<? extends Package> packagesList) {
   CommandInfo cmdInfo = cset.newCommandInfo(CommandInfo.CMD_LIST);
   try {
     if (packagesList.isEmpty()) {
       log.info("None");
     } else {
       NuxeoConnectClient.getPackageManager().sort(packagesList);
       StringBuilder sb = new StringBuilder();
       for (Package pkg : packagesList) {
         newPackageInfo(cmdInfo, pkg);
         String packageDescription = PackageState.getByValue(pkg.getState()).getLabel();
         packageDescription = String.format("%6s %11s\t", pkg.getType(), packageDescription);
         if (pkg.getState() == PackageState.REMOTE.getValue()
             && pkg.getType() != PackageType.STUDIO
             && pkg.getVisibility() != PackageVisibility.PUBLIC
             && !LogicalInstanceIdentifier.isRegistered()) {
           packageDescription += "Registration required for ";
         }
         packageDescription += String.format("%s (id: %s)\n", pkg.getName(), pkg.getId());
         sb.append(packageDescription);
       }
       log.info(sb.toString());
     }
   } catch (Exception e) {
     log.error(e);
     cmdInfo.exitCode = 1;
   }
 }
コード例 #2
0
 protected String getInstalledPackageIdFromName(String pkgName) {
   List<LocalPackage> localPackages = getPkgList();
   List<LocalPackage> installedPackages = new ArrayList<LocalPackage>();
   for (LocalPackage pkg : localPackages) {
     if (PackageState.getByValue(pkg.getState()).isInstalled()) {
       installedPackages.add(pkg);
     }
   }
   return getBestIdForNameInList(pkgName, installedPackages);
 }
コード例 #3
0
 protected boolean isInstalledPackageName(String pkgName) {
   List<LocalPackage> localPackages = getPkgList();
   boolean foundName = false;
   for (LocalPackage pkg : localPackages) {
     if (pkg.getName().equals(pkgName) && PackageState.getByValue(pkg.getState()).isInstalled()) {
       foundName = true;
       break;
     }
   }
   return foundName;
 }