List of usage examples for com.liferay.portal.kernel.plugin PluginPackage getContext
public String getContext();
From source file:com.liferay.marketplace.service.impl.AppLocalServiceImpl.java
License:Open Source License
@Override public Map<String, String> getBundledApps() { if (_bundledApps != null) { return _bundledApps; }/*from www . j av a 2s. co m*/ Map<String, String> bundledApps = new HashMap<String, String>(); List<PluginPackage> pluginPackages = DeployManagerUtil.getInstalledPluginPackages(); for (PluginPackage pluginPackage : pluginPackages) { ServletContext servletContext = ServletContextPool.get(pluginPackage.getContext()); InputStream inputStream = null; try { inputStream = servletContext.getResourceAsStream("/WEB-INF/liferay-releng.changelog.md5"); if (inputStream == null) { continue; } String relengHash = StringUtil.read(inputStream); if (Validator.isNotNull(relengHash)) { bundledApps.put(pluginPackage.getContext(), relengHash); } } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Unable to read plugin package MD5 checksum for " + pluginPackage.getContext()); } } finally { StreamUtil.cleanUp(inputStream); } } _bundledApps = bundledApps; return _bundledApps; }
From source file:com.liferay.marketplace.service.impl.AppLocalServiceImpl.java
License:Open Source License
@Override public List<App> getInstalledApps() { if (_installedApps != null) { return _installedApps; }//from w w w. j a v a 2 s .co m List<App> installedApps = new ArrayList<App>(); // Core app App coreApp = appPersistence.create(0); coreApp.setTitle("Liferay Core"); coreApp.setDescription("Plugins bundled with Liferay Portal."); coreApp.setVersion(ReleaseInfo.getVersion()); coreApp.addContextName(PortalUtil.getPathContext()); installedApps.add(coreApp); // Deployed apps List<PluginPackage> pluginPackages = DeployManagerUtil.getInstalledPluginPackages(); for (PluginPackage pluginPackage : pluginPackages) { List<Module> modules = modulePersistence.findByContextName(pluginPackage.getContext()); boolean installedApp = false; for (Module module : modules) { App app = appPersistence.fetchByPrimaryKey(module.getAppId()); if ((app != null) && app.isInstalled()) { installedApp = true; break; } } if (installedApp) { continue; } App app = appPersistence.create(0); app.setTitle(pluginPackage.getName()); app.setDescription(pluginPackage.getLongDescription()); app.setVersion(pluginPackage.getVersion()); app.addContextName(pluginPackage.getContext()); installedApps.add(app); } // Marketplace apps List<App> apps = appPersistence.findAll(); for (App app : apps) { if (app.isInstalled()) { installedApps.add(app); } } installedApps = ListUtil.sort(installedApps, new AppTitleComparator()); _installedApps = installedApps; return _installedApps; }
From source file:com.liferay.server.manager.internal.executor.PluginsExecutor.java
License:Open Source License
@Override public void executeRead(HttpServletRequest request, JSONObject responseJSONObject, Queue<String> arguments) { JSONArray pluginPackagesJSONArray = JSONFactoryUtil.createJSONArray(); List<PluginPackage> pluginPackages = DeployManagerUtil.getInstalledPluginPackages(); for (PluginPackage pluginPackage : pluginPackages) { pluginPackagesJSONArray.put(pluginPackage.getContext()); }/*from w w w . jav a 2s . c o m*/ responseJSONObject.put(JSONKeys.OUTPUT, pluginPackagesJSONArray); }