public List<String> getLiferayPlugins() { List<String> retval = new ArrayList<String>(); Object response = null; try { response = getJSONAPI(getPluginsAPI()); } catch (APIException e1) { LiferayServerCore.logError(e1); } if (response instanceof JSONObject) { JSONObject json = (JSONObject) response; try { if (isSuccess(json)) { JSONArray jsonPlugins = getJSONOutput(json); for (int i = 0; i < jsonPlugins.length(); i++) { retval.add(jsonPlugins.get(i).toString()); } } } catch (Exception e) { LiferayServerCore.logError(e); } } return retval; }
private void saveConfigInfoIntoCache(String configType, String configInfo, IPath portalDir) { IPath versionsInfoPath = null; if (configType.equals(CONFIG_TYPE_VERSION)) { versionsInfoPath = LiferayServerCore.getDefault().getStateLocation().append("version.properties"); } else if (configType.equals(CONFIG_TYPE_SERVER)) { versionsInfoPath = LiferayServerCore.getDefault().getStateLocation().append("serverInfos.properties"); } if (versionsInfoPath != null) { File versionInfoFile = versionsInfoPath.toFile(); if (configInfo != null) { String portalDirKey = CoreUtil.createStringDigest(portalDir.toPortableString()); Properties properties = new Properties(); try (FileInputStream fileInput = new FileInputStream(versionInfoFile)) { properties.load(fileInput); } catch (Exception e) { } try (FileOutputStream fileOutput = new FileOutputStream(versionInfoFile)) { properties.put(portalDirKey, configInfo); properties.store(fileOutput, StringPool.EMPTY); } catch (Exception e) { LiferayServerCore.logError(e); } } } }
private String getConfigInfoFromManifest(String configType, IPath portalDir) { File implJar = portalDir.append("/WEB-INF/lib/portal-impl.jar").toFile(); String version = null; String serverInfo = null; if (implJar.exists()) { try (JarFile jar = new JarFile(implJar)) { Manifest manifest = jar.getManifest(); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue("Liferay-Portal-Version"); serverInfo = attributes.getValue("Liferay-Portal-Server-Info"); if (CoreUtil.compareVersions(Version.parseVersion(version), MANIFEST_VERSION_REQUIRED) < 0) { version = null; serverInfo = null; } } catch (IOException e) { LiferayServerCore.logError(e); } } if (configType.equals(CONFIG_TYPE_VERSION)) { return version; } if (configType.equals(CONFIG_TYPE_SERVER)) { return serverInfo; } return null; }
protected void initMap() { try { wsdlNameURLMap = new HashMap<String, String>(); String webServicesString = CoreUtil.readStreamToString(webServicesListURL.openStream()); List<String> wsdlUrls = pullLinks(webServicesString); for (String url : wsdlUrls) { String name = pullServiceName(url); if (!CoreUtil.isNullOrEmpty(name)) { wsdlNameURLMap.put(name, url); } } } catch (IOException e1) { LiferayServerCore.logError("Unable to initial web services list."); // $NON-NLS-1$ } }
private String getConfigInfoFromCache(String configType, IPath portalDir) { File configInfoFile = getConfigInfoPath(configType).toFile(); String portalDirKey = CoreUtil.createStringDigest(portalDir.toPortableString()); Properties properties = new Properties(); if (configInfoFile.exists()) { try (FileInputStream fileInput = new FileInputStream(configInfoFile)) { properties.load(fileInput); String configInfo = (String) properties.get(portalDirKey); if (!CoreUtil.isNullOrEmpty(configInfo)) { return configInfo; } } catch (IOException e) { LiferayServerCore.logError(e); } } return null; }