From aa7894a99bfcb1dff0d239223500685c119de050 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Fri, 15 Nov 2024 18:42:39 +0100 Subject: [PATCH] feat: Centralize Cache configuration in Meeds package and Add newly banned dependencies - MEED-7742 - Meeds-io/meeds#2537 (#2579) This change will centralize the Cache configuration into Meeds package to ease its maintainability and evolutivity. In fact, this will allow to override the Meeds caches configurations by one single file override. In addition, this change will delete a useless artifact `exo-plf-tools`. --- .../assemblies/plf-exo-tools-component.xml | 34 - ...ne-default-tomcat-distribution-content.xml | 1 - .../plf-community-tomcat-standalone/pom.xml | 119 +-- packaging/plf-dependencies/pom.xml | 66 ++ packaging/plf-packaging-resources/pom.xml | 211 +++++ packaging/plf-tomcat-resources/pom.xml | 5 + .../src/main/resources/bin/setenv.bat | 5 - .../src/main/resources/bin/setenv.sh | 9 +- pom.xml | 180 ++-- services/plf-exo-tools/pom.xml | 81 -- .../distributions/tools/ExoTools.java | 90 -- .../distributions/tools/JavaVersion.java | 138 --- .../distributions/tools/JavaVersionTest.java | 125 --- services/pom.xml | 1 - .../webapp/WEB-INF/conf/configuration.xml | 1 + .../conf/meeds/cache-configuration.xml | 833 ++++++++++++++++++ 16 files changed, 1216 insertions(+), 683 deletions(-) delete mode 100644 packaging/plf-assemblies/src/main/resources/assemblies/plf-exo-tools-component.xml delete mode 100644 services/plf-exo-tools/pom.xml delete mode 100644 services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/ExoTools.java delete mode 100644 services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/JavaVersion.java delete mode 100644 services/plf-exo-tools/src/test/java/org/exoplatform/distributions/tools/JavaVersionTest.java create mode 100644 webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/meeds/cache-configuration.xml diff --git a/packaging/plf-assemblies/src/main/resources/assemblies/plf-exo-tools-component.xml b/packaging/plf-assemblies/src/main/resources/assemblies/plf-exo-tools-component.xml deleted file mode 100644 index 520625595..000000000 --- a/packaging/plf-assemblies/src/main/resources/assemblies/plf-exo-tools-component.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - ${file.separator}bin - - io.meeds.distribution:plf-exo-tools:jar - - false - 755 - false - exo-tools.jar - - - - diff --git a/packaging/plf-assemblies/src/main/resources/assemblies/plf-standalone-default-tomcat-distribution-content.xml b/packaging/plf-assemblies/src/main/resources/assemblies/plf-standalone-default-tomcat-distribution-content.xml index 28201193c..cfe2ac9b7 100644 --- a/packaging/plf-assemblies/src/main/resources/assemblies/plf-standalone-default-tomcat-distribution-content.xml +++ b/packaging/plf-assemblies/src/main/resources/assemblies/plf-standalone-default-tomcat-distribution-content.xml @@ -249,6 +249,5 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. assemblies/plf-copy-libraries-component.xml assemblies/plf-addons-component.xml - assemblies/plf-exo-tools-component.xml diff --git a/packaging/plf-community-tomcat-standalone/pom.xml b/packaging/plf-community-tomcat-standalone/pom.xml index 7446e1452..3de526825 100644 --- a/packaging/plf-community-tomcat-standalone/pom.xml +++ b/packaging/plf-community-tomcat-standalone/pom.xml @@ -53,12 +53,6 @@ zip runtime - - - ${project.groupId} - plf-exo-tools - runtime - org.exoplatform.resources @@ -67,120 +61,15 @@ ${version.exo-lgpl-license-resource-bundle} runtime - - - io.meeds.wallet - wallet-packaging - zip - provided - - - io.meeds.kudos - kudos-packaging - zip - provided - - - io.meeds.perk-store - perk-store-packaging - zip - provided - - - io.meeds.gamification - gamification-packaging - zip - provided - - - io.meeds.app-center - app-center-packaging - zip - provided - - - io.meeds.notes - notes-packaging - zip - provided - - - org.apache.tomcat - tomcat - zip - provided - - - io.meeds.task - task-management-packaging - zip - provided - - - io.meeds.analytics - analytics-packaging - provided - zip - - - io.meeds.poll - poll-packaging - zip - provided - - - io.meeds.content - content-packaging - zip - provided - - - io.meeds.gamification-github - gamification-github-packaging - zip - provided - - - io.meeds.gamification-twitter - gamification-twitter-packaging - zip - provided - - - io.meeds.deeds-tenant - deeds-tenant-packaging - zip - provided - - - io.meeds.layout - layout-packaging - zip - provided - - - io.meeds.gamification-crowdin - gamification-crowdin-packaging - zip - provided - - - io.meeds.pwa - pwa-packaging - zip - provided - - - io.meeds.ide - ide-packaging - zip - provided - meeds-community-${project.version} + + org.apache.maven.plugins + maven-enforcer-plugin + org.apache.maven.plugins maven-resources-plugin diff --git a/packaging/plf-dependencies/pom.xml b/packaging/plf-dependencies/pom.xml index 8a15b640f..083a73e6e 100644 --- a/packaging/plf-dependencies/pom.xml +++ b/packaging/plf-dependencies/pom.xml @@ -33,12 +33,24 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. portal.web.portal war runtime + + + * + * + + io.meeds.portal portal.web.rest war runtime + + + * + * + + @@ -46,12 +58,24 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. commons-comet-webapp war runtime + + + * + * + + io.meeds.commons commons-extension-webapp war runtime + + + * + * + + @@ -59,6 +83,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. platform-ui-skin war runtime + + + * + * + + @@ -66,30 +96,60 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. plf-meeds-extension war runtime + + + * + * + + ${project.groupId} plf-sites-extension war runtime + + + * + * + + ${project.groupId} plf-root-webapp war runtime + + + * + * + + ${project.groupId} plf-tomcat-integration-webapp war runtime + + + * + * + + ${project.groupId} plf-configuration runtime + + + * + * + + @@ -97,6 +157,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. social-webapp war runtime + + + * + * + + io.meeds.social diff --git a/packaging/plf-packaging-resources/pom.xml b/packaging/plf-packaging-resources/pom.xml index a4c734a17..140273f02 100644 --- a/packaging/plf-packaging-resources/pom.xml +++ b/packaging/plf-packaging-resources/pom.xml @@ -27,12 +27,223 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. pom Meeds:: Meeds:: Meeds Public Distribution - Packaging - Shared Resources + + org.apache.tomcat + tomcat + zip + provided + io.meeds.platform addons-manager zip + + + io.meeds.wallet + wallet-packaging + zip + provided + + + * + * + + + + + io.meeds.kudos + kudos-packaging + zip + provided + + + * + * + + + + + io.meeds.perk-store + perk-store-packaging + zip + provided + + + * + * + + + + + io.meeds.gamification + gamification-packaging + zip + provided + + + * + * + + + + + io.meeds.app-center + app-center-packaging + zip + provided + + + * + * + + + + + io.meeds.notes + notes-packaging + zip + provided + + + * + * + + + + + io.meeds.task + task-management-packaging + zip + provided + + + * + * + + + + + io.meeds.analytics + analytics-packaging + provided + zip + + + * + * + + + + + io.meeds.poll + poll-packaging + zip + provided + + + * + * + + + + + io.meeds.content + content-packaging + zip + provided + + + * + * + + + + + io.meeds.gamification-github + gamification-github-packaging + zip + provided + + + * + * + + + + + io.meeds.gamification-twitter + gamification-twitter-packaging + zip + provided + + + * + * + + + + + io.meeds.deeds-tenant + deeds-tenant-packaging + zip + provided + + + * + * + + + + + io.meeds.layout + layout-packaging + zip + provided + + + * + * + + + + + io.meeds.gamification-crowdin + gamification-crowdin-packaging + zip + provided + + + * + * + + + + + io.meeds.pwa + pwa-packaging + zip + provided + + + * + * + + + + + io.meeds.ide + ide-packaging + zip + provided + + + * + * + + + diff --git a/packaging/plf-tomcat-resources/pom.xml b/packaging/plf-tomcat-resources/pom.xml index 821bffc6e..641d3eb68 100644 --- a/packaging/plf-tomcat-resources/pom.xml +++ b/packaging/plf-tomcat-resources/pom.xml @@ -36,29 +36,34 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. org.apache.tomcat tomcat + runtime zip org.codehaus.janino janino + runtime ${project.groupId} plf-packaging-resources + runtime zip ${project.groupId} plf-tomcat-integration-webapp + runtime war ${project.groupId} plf-tomcat-pc-creator-listener + runtime jakarta.servlet diff --git a/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.bat b/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.bat index bf5d0bdd2..adc411993 100755 --- a/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.bat +++ b/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.bat @@ -190,11 +190,6 @@ IF DEFINED JAVA_HOME ( SET javaExec="%JAVA_HOME%\bin\java.exe" ) -REM # Used JDK_JAVA_OPTIONS for JDK 9 options since this variable is only recognized by JDK 9+ -%javaExec% -jar "%CATALINA_HOME%"\bin\exo-tools.jar isJava11OrSuperior -IF ERRORLEVEL 1 ( - SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-modules java.activation --add-modules java.xml.bind -) REM # Open all required modules for reflective access operations SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens java.base/java.io=ALL-UNNAMED SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens java.base/java.lang=ALL-UNNAMED diff --git a/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.sh b/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.sh index b1f094dc6..52a314946 100755 --- a/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.sh +++ b/packaging/plf-tomcat-resources/src/main/resources/bin/setenv.sh @@ -284,18 +284,13 @@ if [ ! -z "$JAVA_HOME" ]; then javaExec=$JAVA_HOME/bin/java fi -# Used JDK_JAVA_OPTIONS for JDK 9+ options since this variable is only recognized by JDK 9+ -cmd=$($javaExec -jar "$CATALINA_HOME"/bin/exo-tools.jar isJava11OrSuperior) -if [ $? != 0 ]; then - JDK_JAVA_OPTIONS="--add-modules java.activation --add-modules java.xml.bind" -fi # Open all required modules for reflective access operations JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.io=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.lang=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.lang.invoke=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.lang.reflect=ALL-UNNAMED" -JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.lang.module=ALL-UNNAMED" -JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/jdk.internal.module=ALL-UNNAMED" +JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.lang.module=ALL-UNNAMED" +JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/jdk.internal.module=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.math=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.net=ALL-UNNAMED" JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.base/java.nio=ALL-UNNAMED" diff --git a/pom.xml b/pom.xml index 0d4632837..2b16a4dc9 100644 --- a/pom.xml +++ b/pom.xml @@ -292,12 +292,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ${project.version} pom - - ${project.groupId} - plf-exo-tools - ${project.version} - jar - ${project.groupId} plf-packaging-resources @@ -382,6 +376,100 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2.0 + + org.apache.maven.plugins + maven-enforcer-plugin + + + banned-dependencies + + enforce + + + + + + + There are some unwanted dependencies in the dependency tree. Find them with "mvn dependency:tree -Dverbose -Dincludes=groupId:artifactId:version" and remove them at the furthest dependency level in the dependency tree + true + + + org.apache.ant:* + org.apache.axis:axis-ant:* + + log4j:* + org.apache.logging.log4j:log4j-core + + org.slf4j:slf4j-jcl:* + + org.slf4j:slf4j-log4j12:* + org.slf4j:slf4j-simple:* + + org.slf4j:slf4j-jdk14:* + + xstream:xstream:* + + jdom:*:* + + org.exoplatform.portal:*:* + + javax.servlet:* + com.google.gwt:gwt-user:* + javax.servlet.jsp:* + + junit:* + org.testng:* + org.exoplatform.tool:exo.tool.framework.junit + org.jmock:* + jmock:* + org.mockito:* + + jdom:* + + xpp3:xpp3_min + + commons-beanutils:commons-beanutils-core + + org.jboss.logging:jboss-logging-spi + + org.codehaus.woodstox:wstx-asl + + xml-apis:* + org.apache.geronimo.specs:geronimo-stax-api_1.0_spec + stax:* + javax.xml.stream:* + org.apache.geronimo.specs:geronimo-activation_1.0.2_spec + org.jboss.javaee:jboss-transaction-api + org.jboss.spec.javax.transaction:* + org.ow2.spec.ee:ow2-jta-1.1-spec + + rome:modules:* + + *:xmlParserAPIs:* + + org.icepdf:icepdf-core:* + + org.infinispan:*:* + + commons-dbcp:*:* + net.sourceforge.jregex:*:* + com.sun.japex:*:* + org.web3j:web3j-unit:* + org.codehaus.cargo:*:* + + + + org.apache.tomcat:tomcat:zip + + org.apache.logging.log4j:log4j-api:[2.18.0,) + + + + true + + + + @@ -395,86 +483,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. org.apache.maven.plugins maven-enforcer-plugin - - banned-dependencies - - enforce - - - - - - - There are some unwanted dependencies in the dependency tree. Find them with "mvn dependency:tree -Dverbose -Dincludes=groupId:artifactId:version" and remove them at the furthest dependency level in the dependency tree - true - - - org.apache.ant:* - org.apache.axis:axis-ant:* - - log4j:* - org.apache.logging.log4j:log4j-core - - org.slf4j:slf4j-jcl:* - - org.slf4j:slf4j-log4j12:* - org.slf4j:slf4j-simple:* - - org.slf4j:slf4j-jdk14:* - - xstream:xstream:* - - jdom:*:* - - org.exoplatform.portal:*:* - - javax.servlet:* - com.google.gwt:gwt-user:* - javax.servlet.jsp:* - - junit:* - org.testng:* - org.exoplatform.tool:exo.tool.framework.junit - org.jmock:* - jmock:* - org.mockito:* - - jdom:* - - xpp3:xpp3_min - - commons-beanutils:commons-beanutils-core - - org.jboss.logging:jboss-logging-spi - - org.codehaus.woodstox:wstx-asl - - xml-apis:* - org.apache.geronimo.specs:geronimo-stax-api_1.0_spec - stax:* - javax.xml.stream:* - org.apache.geronimo.specs:geronimo-activation_1.0.2_spec - org.jboss.javaee:jboss-transaction-api - org.jboss.spec.javax.transaction:* - org.ow2.spec.ee:ow2-jta-1.1-spec - - rome:modules:* - - *:xmlParserAPIs:* - - org.icepdf:icepdf-core:* - - - - org.apache.tomcat:tomcat:zip - - org.apache.logging.log4j:log4j-api:[2.18.0,) - - - - true - - enforce-bytecode-version diff --git a/services/plf-exo-tools/pom.xml b/services/plf-exo-tools/pom.xml deleted file mode 100644 index e19d1dfb9..000000000 --- a/services/plf-exo-tools/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - 4.0.0 - - io.meeds.distribution - plf-services - 7.0.x-SNAPSHOT - - plf-exo-tools - jar - Meeds:: Meeds:: Meeds Public Distribution - Services - eXo Tools - - 0.47 - - - - junit - junit - test - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - org.exoplatform.distributions.tools.ExoTools - - - - - - - - - - exo-release - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - banned-dependencies - - enforce - - - - false - - - - - - - - - diff --git a/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/ExoTools.java b/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/ExoTools.java deleted file mode 100644 index 088b22fd3..000000000 --- a/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/ExoTools.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 Meeds Association - * contact@meeds.io - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.exoplatform.distributions.tools; - -/** - * Main class for the exo-tools JAR.
- * - * This library is used by the startup scripts to configure the environment (JVM) - * according to system parameters. - * - * The exo-tools.jar is present at the following path: - *
    - *
  • PLF Tomcat: $CATALINA_HOME/bin/exo-tools.jar
  • - *
  • PLF JBoss: $JBOSS_HOME/bin/exo-tools.jar
  • - *
- */ -public final class ExoTools { - - /** Java Version from the system */ - public static final String systemJavaVersion = System.getProperty("java.version"); - - public static final String CMD_JAVA_8 = "isJava8"; - - public static final String CMD_JAVA_8_OR_MORE = "isJava8OrSuperior"; - - public static final String CMD_JAVA_9 = "isJava9"; - - public static final String CMD_JAVA_9_OR_MORE = "isJava9OrSuperior"; - - public static final String CMD_JAVA_11 = "isJava11"; - - public static final String CMD_JAVA_11_OR_MORE = "isJava11OrSuperior"; - - /** - * eXo Tools entrypoint. - * - * @param args the command to execute - */ - public static void main(String args[]) { - int result = doMain(args); - System.exit(result); - } - - /** - * Check the prerequisites and execute the process - * according to the given command. - * - * @param args the command to execute - * @return 0 if the process is OK, -1 otherwise - */ - private static int doMain(String args[]) { - - if (null == systemJavaVersion || systemJavaVersion.equals("") || args.length == 0) { - return -1; - } - final JavaVersion javaVersion = new JavaVersion(systemJavaVersion); - - switch (args[0]) { - case CMD_JAVA_8: - return javaVersion.isMinorVersionEqual(8); - case CMD_JAVA_8_OR_MORE: - return javaVersion.isMinorVersionSuperiorOrEqual(8); - case CMD_JAVA_9: - return javaVersion.isMajorVersionEqual(9); - case CMD_JAVA_9_OR_MORE: - return javaVersion.isMajorVersionSuperiorOrEqual(9); - case CMD_JAVA_11: - return javaVersion.isMajorVersionEqual(11); - case CMD_JAVA_11_OR_MORE: - return javaVersion.isMajorVersionSuperiorOrEqual(11); - default: - return -1; - } - } -} diff --git a/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/JavaVersion.java b/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/JavaVersion.java deleted file mode 100644 index a2ada9f0d..000000000 --- a/services/plf-exo-tools/src/main/java/org/exoplatform/distributions/tools/JavaVersion.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 Meeds Association - * contact@meeds.io - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.exoplatform.distributions.tools; - -import java.util.Objects; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -/** - * Extract Java Minor version as int from a String Java version in official format. - * - *

- * Example of String Java Version: - *

    - *
  • Java 8: 1.8, 1.8.0, 1.8.0_65
  • - *
  • Java 9: 9, 9.0, 9.1.1
  • - *
- *

- * - */ -class JavaVersion { - - /** Pattern based on official Java version format */ - final Pattern regex = Pattern.compile("([\\d]+)(?:[\\.\\+]([\\d]+)(?:.*|$))?"); - - /** Default value for Java major version */ - private int systemJavaMajorVersion = 1; - - /** Default value for Java minor version */ - private int systemJavaMinorVersion = 8; - - JavaVersion(String version) { - extractVersions(version); - } - - /** - * Extract major and minor versions as int from a String Java version. - * - * @param systemJavaVersion Java Version as String ie: 1.8.0_45 - */ - void extractVersions(final String systemJavaVersion) { - try { - Matcher regexMatcher = regex.matcher(systemJavaVersion); - if (regexMatcher.find()) { - String strSystemJavaMajorVersion = regexMatcher.group(1); - systemJavaMajorVersion = Integer.parseInt(strSystemJavaMajorVersion); - if(strSystemJavaMajorVersion.equals(systemJavaVersion)) { - systemJavaMinorVersion = 0; - } else { - String minorVersion = regexMatcher.group(2); - if (minorVersion != null) { - systemJavaMinorVersion = Integer.parseInt(minorVersion); - } - } - } - } catch (Exception ex){ - // By default JDK 8 version is used. - } - } - - /** - * Check if the version is superior or equal to the Java System Major Version. - * @param version Java major version to compare - * @return 0 if true, -1 otherwise - */ - public final int isMajorVersionSuperiorOrEqual(int version) { - return ((systemJavaMajorVersion >= version) ? 0 : -1); - } - - /** - * Check if the version is equal to the Java System Major Version. - * @param version Java major version to compare - * @return 0 if true, -1 otherwise - */ - public final int isMajorVersionEqual(int version) { - return ((systemJavaMajorVersion == version) ? 0 : -1); - } - - - /** - * Check if the version is superior or equal to the Java System Minor Version. - * @param version Java minor version to compare - * @return 0 if true, -1 otherwise - */ - public final int isMinorVersionSuperiorOrEqual(int version) { - return ((systemJavaMinorVersion >= version) ? 0 : -1); - } - - /** - * Check if the version is equal to the Java System Minor Version. - * @param version Java minor version to compare - * @return 0 if true, -1 otherwise - */ - public final int isMinorVersionEqual(int version) { - return ((systemJavaMinorVersion == version) ? 0 : -1); - } - - public int getSystemJavaMajorVersion() { - return systemJavaMajorVersion; - } - - public int getSystemJavaMinorVersion() { - return systemJavaMinorVersion; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - JavaVersion that = (JavaVersion) o; - return Objects.equals(systemJavaMajorVersion, that.systemJavaMajorVersion) && - Objects.equals(systemJavaMinorVersion, that.systemJavaMinorVersion); - } - - @Override - public int hashCode() { - return Objects.hash(systemJavaMajorVersion, systemJavaMinorVersion); - } - -} diff --git a/services/plf-exo-tools/src/test/java/org/exoplatform/distributions/tools/JavaVersionTest.java b/services/plf-exo-tools/src/test/java/org/exoplatform/distributions/tools/JavaVersionTest.java deleted file mode 100644 index f5ee27136..000000000 --- a/services/plf-exo-tools/src/test/java/org/exoplatform/distributions/tools/JavaVersionTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 Meeds Association - * contact@meeds.io - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.exoplatform.distributions.tools; - -import org.junit.Test; - -import static org.junit.Assert.*; - - -public class JavaVersionTest { - - @Test - public final void testBadFormatVersion(){ - JavaVersion jv = new JavaVersion("12_7"); - - // if we can't determine the version, we consider that it's Java 8 - assertTrue(jv.isMinorVersionEqual(8) == 0); - assertTrue(jv.isMinorVersionEqual(9) == -1); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(9) == -1); - } - - @Test - public final void testJava8Version(){ - JavaVersion jv = new JavaVersion("1.8.0_25"); - - assertTrue(jv.isMinorVersionEqual(8) == 0); - assertTrue(jv.isMinorVersionEqual(9) == -1); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(9) == -1); - - jv = new JavaVersion("1.8.0"); - assertTrue(jv.isMinorVersionEqual(8) == 0); - assertTrue(jv.isMinorVersionEqual(9) == -1); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(9) == -1); - - jv = new JavaVersion("1.8"); - assertTrue(jv.isMinorVersionEqual(8) == 0); - assertTrue(jv.isMinorVersionEqual(9) == -1); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(9) == -1); - } - - - @Test - public final void testJava9Version(){ - JavaVersion jv = new JavaVersion("9"); - - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == 0); - assertTrue(jv.isMajorVersionSuperiorOrEqual(9) == 0); - - jv = new JavaVersion("9.0"); - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == 0); - assertTrue(jv.isMinorVersionEqual(0) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == -1); - assertTrue(jv.isMajorVersionSuperiorOrEqual(9) == 0); - - jv = new JavaVersion("9.0.1"); - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == 0); - assertTrue(jv.isMinorVersionEqual(0) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == -1); - assertTrue(jv.isMajorVersionSuperiorOrEqual(9) == 0); - } - - @Test - public final void testJava11Version(){ - JavaVersion jv = new JavaVersion("11"); - - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == -1); - assertTrue(jv.isMajorVersionEqual(11) == 0); - assertTrue(jv.isMajorVersionSuperiorOrEqual(11) == 0); - - jv = new JavaVersion("11.0"); - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == -1); - assertTrue(jv.isMajorVersionEqual(11) == 0); - assertTrue(jv.isMinorVersionEqual(0) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == -1); - assertTrue(jv.isMajorVersionSuperiorOrEqual(9) == 0); - assertTrue(jv.isMajorVersionSuperiorOrEqual(11) == 0); - - jv = new JavaVersion("11.0.1"); - assertTrue(jv.isMinorVersionEqual(8) == -1); - assertTrue(jv.isMajorVersionEqual(9) == -1); - assertTrue(jv.isMajorVersionEqual(11) == 0); - assertTrue(jv.isMinorVersionEqual(0) == 0); - assertTrue(jv.isMinorVersionSuperiorOrEqual(8) == -1); - assertTrue(jv.isMajorVersionSuperiorOrEqual(9) == 0); - assertTrue(jv.isMajorVersionSuperiorOrEqual(11) == 0); - } - - @Test - public void testEquals() { - JavaVersion jv825 = new JavaVersion("1.8.0_25"); - JavaVersion jv845 = new JavaVersion("1.8.0_45"); - JavaVersion jv11 = new JavaVersion("11"); - JavaVersion jv1101 = new JavaVersion("11.0.1"); - - assertEquals(jv825, jv825); - assertEquals(jv825, jv845); - assertEquals(jv825, jv845); - assertNotEquals(jv825, new Object()); - assertEquals(jv11, jv1101); - assertNotEquals(jv825, jv1101); - } -} diff --git a/services/pom.xml b/services/pom.xml index 339b7b50e..9b89efdb9 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -32,7 +32,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. plf-configuration plf-community-edition-service - plf-exo-tools plf-tomcat-pc-creator-listener diff --git a/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/configuration.xml b/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/configuration.xml index 97a003f40..b0983b62d 100644 --- a/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/configuration.xml +++ b/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/configuration.xml @@ -24,5 +24,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. war:/conf/meeds/portal-configuration.xml war:/conf/meeds/portal-upgrade-configuration.xml war:/conf/meeds/resources-bundle-configuration.xml + war:/conf/meeds/cache-configuration.xml diff --git a/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/meeds/cache-configuration.xml b/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/meeds/cache-configuration.xml new file mode 100644 index 000000000..9727e9ee8 --- /dev/null +++ b/webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/meeds/cache-configuration.xml @@ -0,0 +1,833 @@ + + + + + + org.exoplatform.services.cache.CacheService + + addExoCacheConfig + addExoCacheConfig + org.exoplatform.services.cache.ExoCacheConfigPlugin + Configures the cache for analytics queue which must remain a local cache + + + analytics.queue + + + + analytics.queue + + + ${analytics.queue.MaxNodes:2000} + + + ${analytics.queue.TimeToLive:-1} + + + + + + commons.WebNotificationCache + The Cache configuration for the Web Notification Cache + + + commons.WebNotificationCache + + + ${meeds.cache.commons.WebNotificationCache.TimeToLive:86400} + + + ${meeds.cache.commons.WebNotificationCache.MaxNodes:10000} + + + + + + commons.WebNotificationsCache + The Cache configuration for the Web Notification List Cache + + + commons.WebNotificationsCache + + + ${meeds.cache.commons.WebNotificationsCache.TimeToLive:86400} + + + ${meeds.cache.commons.WebNotificationsCache.MaxNodes:1000} + + + + + + commons.WebNotificationCountCache + The Cache configuration for the Web Notification Count Cache + + + commons.WebNotificationCountCache + + + ${meeds.cache.commons.WebNotificationCountCache.TimeToLive:86400} + + + ${meeds.cache.commons.WebNotificationCountCache.MaxNodes:1000} + + + + + + commons.UserSettingService + The Cache configuration for the UserSettingService + + + commons.UserSettingService + + + ${meeds.cache.commons.UserSettingService.MaxNodes:500} + + + ${meeds.cache.commons.UserSettingService.TimeToLive:86400} + + + + + + commons.UserStateService + The Cache configuration for the UserStateService + + + commons.UserStateService + + + ${meeds.cache.commons.UserStateService.MaxNodes:1000} + + + ${meeds.cache.commons.UserStateService.TimeToLive:86400} + + + + + gamification.domain + + + gamification.domain + + + ${meeds.cache.gamification.domain.MaxNodes:1000} + + + ${meeds.cache.gamification.domain.TimeToLive:-1} + + + + + gamification.rule + + + gamification.rule + + + ${meeds.cache.gamification.rule.MaxNodes:2000} + + + ${meeds.cache.gamification.rule.TimeToLive:-1} + + + + + gamification.realization + + + gamification.realization + + + ${meeds.cache.gamification.realization.MaxNodes:5000} + + + ${meeds.cache.gamification.realization.TimeToLive:-1} + + + + + wiki.PageRenderingCache + The wiki markup cache configuration + + + wiki.PageRenderingCache + + + ${meeds.cache.wiki.PageRenderingCache.MaxNodes:1000} + + + ${meeds.cache.wiki.PageRenderingCache.TimeToLive:86400} + + + + + wiki.PageAttachmentCache + The Cache configuration for wiki page attachment count + + + wiki.PageAttachmentCache + + + ${meeds.cache.wiki.PageAttachmentCache.MaxNodes:1000} + + + ${meeds.cache.wiki.PageAttachmentCache.TimeToLive:86400} + + + + + perkstore.product + + + perkstore.product + + + ${meeds.cache.perkstore.product.MaxNodes:1000} + + + ${meeds.cache.perkstore.product.TimeToLive:-1} + + + + + perkstore.order + + + perkstore.order + + + ${meeds.cache.perkstore.order.MaxNodes:2000} + + + ${meeds.cache.perkstore.order.TimeToLive:-1} + + + + + portal.User + Exo Cache cluster configuration for IDM User entity + + + portal.User + + + ${meeds.cache.portal.user.MaxNodes:5000} + + + ${meeds.cache.portal.user.TimeToLive:3600} + + + + + portal.Profile + Exo Cache cluster configuration for IDM User Profile entity + + + portal.Profile + + + ${meeds.cache.portal.profile.MaxNodes:5000} + + + ${meeds.cache.portal.profile.TimeToLive:3600} + + + + + portal.Membership + Exo Cache cluster configuration for IDM Membership entity + + + portal.Membership + + + ${meeds.cache.portal.membership.MaxNodes:5000} + + + ${meeds.cache.portal.membership.TimeToLive:86400} + + + + + + portal.Role + Exo Cache cluster configuration for IDM Membership Type entity + + + portal.Role + + + ${meeds.cache.portal.role.MaxNodes:5000} + + + ${meeds.cache.portal.role.TimeToLive:-1} + + + + + + portal.Group + Exo Cache cluster configuration for IDM Group entity + + + portal.Group + + + ${meeds.cache.portal.group.MaxNodes:5000} + + + ${meeds.cache.portal.group.TimeToLive:-1} + + + + + + commons.SettingService + The Cache configuration for the setting service + + + commons.SettingService + + + ${meeds.cache.commons.SettingService.MaxNodes:100000} + + + ${meeds.cache.commons.SettingService.TimeToLive:86400} + + + + + + portal.PortletPreferences + The cache configuration for Portlet Preferences + + + portal.PortletPreferences + + + ${meeds.cache.portal.preferences.MaxNodes:10000} + + + ${meeds.cache.portal.preferences.TimeToLive:86400} + + + + + portal.NavigationNode + The Cache configuration for the MOP session Manager + + + portal.NavigationNode + + + ${meeds.cache.portal.mop.MaxNodes:5000} + + + ${meeds.cache.portal.mop.TimeToLive:86400} + + + + + portal.NavigationService + The cache configuration for the navigation Trees service + + + portal.NavigationService + + + ${meeds.cache.portal.navigation.MaxNodes:1000} + + + ${meeds.cache.portal.navigation.TimeToLive:86400} + + + + + portal.SiteService + The cache configuration for Site layout service + + + portal.SiteService + + + ${meeds.cache.portal.site.MaxNodes:5000} + + + ${meeds.cache.portal.site.TimeToLive:86400} + + + + + portal.SiteKeysByFilterService + The cache configuration for Site layout service + + + portal.SiteKeysByFilterService + + + ${meeds.cache.portal.site.MaxNodes:1000} + + + ${meeds.cache.portal.site.TimeToLive:86400} + + + + + portal.DescriptionService + The Cache configuration for the description service + + + portal.DescriptionService + + + ${meeds.cache.portal.description.MaxNodes:10000} + + + ${meeds.cache.portal.description.TimeToLive:86400} + + + + + portal.PageService + The Cache configuration for the page service + + + portal.PageService + + + ${meeds.cache.portal.page.MaxNodes:1000} + + + ${meeds.cache.portal.page.TimeToLive:86400} + + + + + + portal.TemplateService + The Cache configuration for the template service + + + portal.TemplateService + + + ${meeds.cache.portal.template.MaxNodes:5000} + + + ${meeds.cache.portal.template.TimeToLive:-1} + + + + + portal.ResourceBundleData + + + + portal.ResourceBundleData + + + ${meeds.cache.portal.ResourceBundleData.MaxNodes:10000} + + + ${meeds.cache.portal.ResourceBundleData.TimeToLive:-1} + + + + + + social.IdentityCache + The Cache configuration for the IdentityCache + + + social.IdentityCache + + + ${meeds.cache.social.IdentityCache.MaxNodes:5000} + + + ${meeds.cache.social.IdentityCache.TimeToLive:86400} + + + + + social.IdentityIndexCache + The Cache configuration for the IdentityIndexCache + + + social.IdentityIndexCache + + + ${meeds.cache.social.IdentityIndexCache.MaxNodes:5000} + + + ${meeds.cache.social.IdentityIndexCache.TimeToLive:86400} + + + + + social.ProfileCache + The Cache configuration for the ProfileCache + + + social.ProfileCache + + + ${meeds.cache.social.ProfileCache.MaxNodes:5000} + + + ${meeds.cache.social.ProfileCache.TimeToLive:86400} + + + + + social.IdentitiesCountCache + The Cache configuration for the IdentitiesCountCache + + + social.IdentitiesCountCache + + + ${meeds.cache.social.IdentitiesCountCache.MaxNodes:5000} + + + ${meeds.cache.social.IdentitiesCountCache.TimeToLive:86400} + + + + + social.IdentitiesCache + The Cache configuration for the IdentitiesCache + + + social.IdentitiesCache + + + ${meeds.cache.social.IdentitiesCache.MaxNodes:5000} + + + ${meeds.cache.social.IdentitiesCache.TimeToLive:86400} + + + + + + + social.RelationshipCache + The Cache configuration for the RelationshipCache + + + social.RelationshipCache + + + ${meeds.cache.social.RelationshipCache.MaxNodes:100000} + + + ${meeds.cache.social.RelationshipCache.TimeToLive:86400} + + + + + social.RelationshipFromIdentityCache + The Cache configuration for the RelationshipFromIdentityCache + + + social.RelationshipFromIdentityCache + + + ${meeds.cache.social.RelationshipFromIdentityCache.MaxNodes:100000} + + + ${meeds.cache.social.RelationshipFromIdentityCache.TimeToLive:86400} + + + + + social.RelationshipsCountCache + The Cache configuration for the RelationshipsCountCache + + + social.RelationshipsCountCache + + + ${meeds.cache.social.RelationshipsCountCache.MaxNodes:10000} + + + ${meeds.cache.social.RelationshipsCountCache.TimeToLive:86400} + + + + + social.RelationshipsCache + The Cache configuration for the RelationshipsCache + + + social.RelationshipsCache + + + ${meeds.cache.social.RelationshipsCache.MaxNodes:10000} + + + ${meeds.cache.social.RelationshipsCache.TimeToLive:86400} + + + + + social.SuggestionsCache + The Cache configuration for the SuggestionsCache + + + social.SuggestionsCache + + + ${meeds.cache.social.SuggestionsCache.MaxNodes:1000} + + + ${meeds.cache.social.SuggestionsCache.TimeToLive:86400} + + + + + + + social.ActivityCache + The Cache configuration for the ActivityCache + + + social.ActivityCache + + + ${meeds.cache.social.ActivityCache.MaxNodes:20000} + + + ${meeds.cache.social.ActivityCache.TimeToLive:86400} + + + + + social.ActivitiesCountCache + + + + social.ActivitiesCountCache + + + ${meeds.cache.social.ActivitiesCountCache.MaxNodes:20000} + + + ${meeds.cache.social.ActivitiesCountCache.TimeToLive:86400} + + + + + social.ActivitiesCache + + + + social.ActivitiesCache + + + ${meeds.cache.social.ActivitiesCache.MaxNodes:20000} + + + ${meeds.cache.social.ActivitiesCache.TimeToLive:86400} + + + + + + + social.SpaceCache + The Cache configuration for the SpaceCache + + + social.SpaceCache + + + ${meeds.cache.social.SpaceCache.MaxNodes:5000} + + + ${meeds.cache.social.SpaceCache.TimeToLive:86400} + + + + + social.SpaceSimpleCache + + + + social.SpaceSimpleCache + + + ${meeds.cache.social.SpaceSimpleCache.MaxNodes:5000} + + + ${meeds.cache.social.SpaceSimpleCache.TimeToLive:86400} + + + + + social.SpaceRefCache + The Cache configuration for the SpaceRefCache + + + social.SpaceRefCache + + + ${meeds.cache.social.SpaceRefCache.MaxNodes:20000} + + + ${meeds.cache.social.SpaceRefCache.TimeToLive:86400} + + + + + social.SpacesCountCache + The Cache configuration for the SpacesCountCache + + + social.SpacesCountCache + + + ${meeds.cache.social.SpacesCountCache.MaxNodes:4000} + + + ${meeds.cache.social.SpacesCountCache.TimeToLive:86400} + + + + + social.SpacesCache + The Cache configuration for the SpacesCache + + + social.SpacesCache + + + ${meeds.cache.social.SpacesCache.MaxNodes:4000} + + + ${meeds.cache.social.SpacesCache.TimeToLive:86400} + + + + + social.translation + The Cache configuration for the TranslationStorage + + + social.translation + + + ${meeds.cache.social.TranslationCache.MaxNodes:5000} + + + ${meeds.cache.social.TranslationCache.TimeToLive:86400} + + + + + social.linkSettings + The Cache configuration for the LinkStorage + + + social.linkSettings + + + ${meeds.cache.social.LinkSettingsCache.MaxNodes:5000} + + + ${meeds.cache.social.LinkSettingsCache.TimeToLive:86400} + + + + + social.cmsSetting + The Cache configuration for the CMSStorage + + + social.cmsSetting + + + ${meeds.cache.social.cmsSettingCache.MaxNodes:5000} + + + ${meeds.cache.social.cmsSettingCache.TimeToLive:86400} + + + + + + social.ProfileAvatar + The Cache configuration for the ProfileAvatar + + + social.ProfileAvatar + + + ${meeds.cache.social.ProfileAvatar.MaxNodes:300} + + + ${meeds.cache.social.ProfileAvatar.TimeToLive:600} + + + + + wallet.transactions + Wallet application transactions cache + + + wallet.transactions + + + ${meeds.cache.wallet.transactions.MaxNodes:2000} + + + ${meeds.cache.wallet.transactions.TimeToLive:-1} + + + + + wallet.account + + + + wallet.account + + + ${meeds.cache.wallet.account.MaxNodes:2000} + + + ${meeds.cache.wallet.account.TimeToLive:-1} + + + + + + + +