public CatalogDescriptor(ICatalog catalog) throws MalformedURLException { setLabel(catalog.getName()); setUrl(URLUtil.toURL(catalog.getUrl())); String imageUrl = catalog.getImageUrl(); setIcon(imageDescriptorForUrl(catalog, imageUrl)); setDescription(catalog.getDescription()); setInstallFromAllRepositories(!catalog.isSelfContained()); if (catalog.getDependencyRepository() != null) { setDependenciesRepository(URLUtil.toURL(catalog.getDependencyRepository())); } setCatalogBranding(catalog.getBranding()); if (catalog.getBranding() != null) { imageDescriptorForUrl(catalog, catalog.getBranding().getWizardIcon()); } if (catalog.getNews() != null) { CatalogRegistry.getInstance().addCatalogNews(this, catalog.getNews()); } }
public static SolutionInstallationInfo createSolutionInstallInfo(String url) { String query; try { query = new URL(url).getQuery(); } catch (MalformedURLException e) { return null; } if (query == null) { return null; } String[] params = query.split(PARAM_SPLIT_REGEX); String installId = null; String state = null; for (String param : params) { String[] keyValue = param.split(EQUALS_REGEX); if (keyValue.length == 2) { String key = keyValue[0]; String value = keyValue[1]; if (key.equals(MPC_INSTALL)) { installId = value; } else if (key.equals(MPC_STATE)) { state = value; } } } if (installId != null) { CatalogDescriptor descriptor = CatalogRegistry.getInstance().findCatalogDescriptor(url); SolutionInstallationInfo info = new SolutionInstallationInfo(); info.installId = installId; info.state = state; if (descriptor != null) { info.catalogDescriptor = descriptor; } else { try { info.catalogDescriptor = new CatalogDescriptor(new URL(url), DESCRIPTOR_HINT); } catch (MalformedURLException e) { return null; } } return info; } return null; }