public static DownloadablePackage getSnapshot(List<DownloadablePackage> pkgs) { for (DownloadablePackage pkg : pkgs) { if (isSnapshot(pkg)) { return pkg; } } return null; }
protected void clearInstallParameters(String pkgId) { getContext().getRequest().setAttribute(getStorageKey(pkgId), null); }
@GET @Produces("text/plain") @Path(value = "progress/{pkgId}") public String getDownloadProgress(@PathParam("pkgId") String pkgId) { DownloadingPackage pkg = getDownloadingPackage(pkgId); if (pkg == null) { return null; } return pkg.getDownloadProgress() + ""; }
@GET @Produces("text/html") @Path(value = "studio") public Object getStudio() { PackageManager pm = Framework.getService(PackageManager.class); List<DownloadablePackage> pkgs = pm.listAllStudioRemoteOrLocalPackages(); List<DownloadablePackage> pkgsWithoutSnapshot = StudioSnapshotHelper.removeSnapshot(pkgs); return getView("simpleListing").arg("pkgs", pm.sort(pkgsWithoutSnapshot)) .arg("showCommunityInfo", false) .arg("source", "studio"); }
/** * @since 5.6 */ @GET @Path(value = "cancel/{pkgId}") public Object cancelDownload(@PathParam("pkgId") String pkgId, @QueryParam("source") String source) { PackageManager pm = Framework.getService(PackageManager.class); pm.cancelDownload(pkgId); return redirect(getPrevious().getPath() + "/packages/" + source); }
/** * @since 7.10 */ public DownloadablePackage getStudioProjectSnapshot() { if (!studioSnapshotPackageCached) { PackageManager pm = Framework.getService(PackageManager.class); // TODO NXP-16228: should directly request the SNAPSHOT package (if only we knew its name!) List<DownloadablePackage> pkgs = pm.listRemoteAssociatedStudioPackages(); studioSnapshotPackage = StudioSnapshotHelper.getSnapshot(pkgs); studioSnapshotPackageCached = true; } return studioSnapshotPackage; }
@GET @Produces("text/html") @Path(value = "registerInstanceCallback") public Object registerInstanceCallback(@QueryParam("ConnectRegistrationToken") String token) { return getView("registerInstanceCallback").arg("token", token); } }
@GET @Produces("text/html") @Path(value = "details/{pkgId}") public Object getDetails(@PathParam("pkgId") String pkgId) { PackageManager pm = Framework.getLocalService(PackageManager.class); DownloadablePackage pkg = pm.getPackage(pkgId); if (pkg != null) { return getView("pkgDetails").arg("pkg", pkg); } else { return getView("pkgNotFound").arg("pkgId", pkgId); } }
protected void storeInstallParameters(String pkgId, Map<String, String> params) { getContext().getRequest().setAttribute(getStorageKey(pkgId), params); }
@GET @Produces("text/html") @Path(value = "studio") public Object getStudio() { PackageManager pm = Framework.getLocalService(PackageManager.class); List<DownloadablePackage> pkgs = pm.listAllStudioRemoteOrLocalPackages(); List<DownloadablePackage> pkgsWithoutSnapshot = StudioSnapshotHelper.removeSnapshot(pkgs); return getView("simpleListing").arg("pkgs", pm.sort(pkgsWithoutSnapshot)).arg("showCommunityInfo", false).arg( "source", "studio"); }
/** * @since 7.10 */ public DownloadablePackage getStudioProjectSnapshot() { if (!studioSnapshotPackageCached) { PackageManager pm = Framework.getLocalService(PackageManager.class); // TODO NXP-16228: should directly request the SNAPSHOT package (if only we knew its name!) List<DownloadablePackage> pkgs = pm.listRemoteAssociatedStudioPackages(); studioSnapshotPackage = StudioSnapshotHelper.getSnapshot(pkgs); studioSnapshotPackageCached = true; } return studioSnapshotPackage; }
public static List<DownloadablePackage> removeSnapshot(List<DownloadablePackage> pkgs) { List<DownloadablePackage> result = new ArrayList<>(); for (DownloadablePackage pkg : pkgs) { if (!isSnapshot(pkg)) { result.add(pkg); } } return result; }
@GET @Produces("text/plain") @Path(value = "progress/{pkgId}") public String getDownloadProgress(@PathParam("pkgId") String pkgId) { DownloadingPackage pkg = getDownloadingPackage(pkgId); if (pkg == null) { return null; } return pkg.getDownloadProgress() + ""; }
@GET @Produces("text/html") @Path(value = "registerInstanceCallback") public Object registerInstanceCallback(@QueryParam("ConnectRegistrationToken") String token) { return getView("registerInstanceCallback").arg("token", token); } }
@GET @Produces("text/html") @Path(value = "details/{pkgId}") public Object getDetails(@PathParam("pkgId") String pkgId) { PackageManager pm = Framework.getService(PackageManager.class); DownloadablePackage pkg = pm.getPackage(pkgId); if (pkg != null) { return getView("pkgDetails").arg("pkg", pkg); } else { return getView("pkgNotFound").arg("pkgId", pkgId); } }
protected void clearInstallParameters(String pkgId) { getContext().getRequest().setAttribute(getStorageKey(pkgId), null); }
public static List<DownloadablePackage> removeSnapshot(List<DownloadablePackage> pkgs) { return pkgs.stream().filter(pkg -> !isSnapshot(pkg)).collect(Collectors.toList()); }
protected void storeInstallParameters(String pkgId, Map<String, String> params) { getContext().getRequest().setAttribute(getStorageKey(pkgId), params); }
@SuppressWarnings("unchecked") protected Map<String, String> getInstallParameters(String pkgId) { Map<String, String> params = (Map<String, String>) getContext().getRequest().getAttribute(getStorageKey(pkgId)); if (params == null) { params = new HashMap<>(); } return params; }
@SuppressWarnings("unchecked") protected Map<String, String> getInstallParameters(String pkgId) { Map<String, String> params = (Map<String, String>) getContext().getRequest().getAttribute(getStorageKey(pkgId)); if (params == null) { params = new HashMap<>(); } return params; }