diff --git a/application-admintools-api/pom.xml b/application-admintools-api/pom.xml
index fba7f3f6..187be39b 100644
--- a/application-admintools-api/pom.xml
+++ b/application-admintools-api/pom.xml
@@ -31,11 +31,20 @@
Admin Tools (Pro) - APIProvides the Java APIs needed by the Admin tools Application.
+
+ javax.ws.rs
+ jsr311-api
+ org.xwiki.commonsxwiki-commons-component-api${commons.version}
+
+ org.xwiki.platform
+ xwiki-platform-job-api
+ ${platform.version}
+ org.xwiki.platformxwiki-platform-rest-server
diff --git a/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheck.java b/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheck.java
new file mode 100644
index 00000000..85820595
--- /dev/null
+++ b/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheck.java
@@ -0,0 +1,42 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.health;
+
+import org.xwiki.component.annotation.Role;
+import org.xwiki.stability.Unstable;
+
+/**
+ * Check for issues in the current wiki.
+ *
+ * @since 1.0
+ * @version $Id$
+ */
+@Role
+@Unstable
+public interface HealthCheck
+{
+ /**
+ * Execute the health check on the wiki instance.
+ *
+ * @return a {@link HealthCheckResult} with {@code null} values if no issue was found, or with initialized values
+ * otherwise.
+ */
+ HealthCheckResult check();
+}
diff --git a/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheckResult.java b/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheckResult.java
new file mode 100644
index 00000000..96d974f4
--- /dev/null
+++ b/application-admintools-api/src/main/java/com/xwiki/admintools/health/HealthCheckResult.java
@@ -0,0 +1,121 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.health;
+
+import org.xwiki.stability.Unstable;
+
+/**
+ * Result of a health check. May store the error message, severity level, recommendation and the current value of the
+ * checked resource. The severity level is used as "info", for informative result, "warn" for warnings and "error"
+ * for critical issues.
+ *
+ * @version $Id$
+ * @since 1.0
+ */
+@Unstable
+public class HealthCheckResult
+{
+ private String message;
+
+ private String recommendation;
+
+ private String level;
+
+ private String currentValue;
+
+ /**
+ * Used for registering a result.
+ *
+ * @param message error message representing the summary of the found issue.
+ * @param recommendation suggestion in context of the message.
+ * @param level severity level of a result.
+ * @param currentValue Current value of the checked resource.
+ */
+ public HealthCheckResult(String message, String recommendation, String level, String currentValue)
+ {
+ this.message = message;
+ this.recommendation = recommendation;
+ this.level = level;
+ this.currentValue = currentValue;
+ }
+
+ /**
+ * Partial result definition.
+ *
+ * @param message error message representing the summary of the found issue.
+ * @param recommendation suggestion in context of the message.
+ * @param level severity level of a result.
+ */
+ public HealthCheckResult(String message, String recommendation, String level)
+ {
+ this(message, recommendation, level, null);
+ }
+
+ /**
+ * Simple result definition.
+ *
+ * @param message error message representing the summary of the found issue.
+ * @param level severity level of a result.
+ */
+ public HealthCheckResult(String message, String level)
+ {
+ this(message, null, level);
+ }
+
+ /**
+ * Get the error body.
+ *
+ * @return a summary of the error.
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * Get the recommendation for the set error.
+ *
+ * @return a suggestion for fixing the error.
+ */
+ public String getRecommendation()
+ {
+ return recommendation;
+ }
+
+ /**
+ * Get the severity level a detected error.
+ *
+ * @return the severity level of an error.
+ */
+ public String getLevel()
+ {
+ return level;
+ }
+
+ /**
+ * Get the value of a checked resource.
+ *
+ * @return the value of a checked resource.
+ */
+ public String getCurrentValue()
+ {
+ return currentValue;
+ }
+}
diff --git a/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobRequest.java b/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobRequest.java
new file mode 100644
index 00000000..0ad1d0a6
--- /dev/null
+++ b/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobRequest.java
@@ -0,0 +1,59 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.jobs;
+
+import java.util.List;
+
+import org.xwiki.job.AbstractRequest;
+import org.xwiki.stability.Unstable;
+
+/**
+ * Represents a request to start a health check on current wiki.
+ *
+ * @version $Id$
+ * @since 1.0
+ */
+@Unstable
+public class HealthCheckJobRequest extends AbstractRequest
+{
+ /**
+ * Default constructor.
+ */
+ public HealthCheckJobRequest()
+ {
+ setDefaultId();
+ }
+
+ /**
+ * Creates a request specific to the wiki from which the call was made.
+ *
+ * @param requestId the ID for the request.
+ */
+ public HealthCheckJobRequest(List requestId)
+ {
+ setId(requestId);
+ }
+
+ private void setDefaultId()
+ {
+ List id = List.of("adminTools", "healthCheck");
+ setId(id);
+ }
+}
diff --git a/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobStatus.java b/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobStatus.java
new file mode 100644
index 00000000..1d70b2ba
--- /dev/null
+++ b/application-admintools-api/src/main/java/com/xwiki/admintools/jobs/HealthCheckJobStatus.java
@@ -0,0 +1,83 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.jobs;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.xwiki.job.DefaultJobStatus;
+import org.xwiki.logging.LoggerManager;
+import org.xwiki.observation.ObservationManager;
+import org.xwiki.stability.Unstable;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * The status of the health check job.
+ *
+ * @version $Id$
+ * @since 1.0
+ */
+@Unstable
+public class HealthCheckJobStatus extends DefaultJobStatus
+{
+ private final List healthCheckResults = new LinkedList<>();
+
+ /**
+ * Create a new health check job status.
+ *
+ * @param jobType the job type
+ * @param request the request provided when the job was started
+ * @param observationManager the observation manager
+ * @param loggerManager the logger manager
+ */
+ public HealthCheckJobStatus(String jobType, HealthCheckJobRequest request, ObservationManager observationManager,
+ LoggerManager loggerManager)
+ {
+ super(jobType, request, null, observationManager, loggerManager);
+ setCancelable(true);
+ }
+
+ /**
+ * Get the list issues list from the job.
+ *
+ * @return list with {@link HealthCheckResult} containing errors.
+ */
+ public List getHealthCheckResults()
+ {
+ return healthCheckResults;
+ }
+
+ /**
+ * Get the list issues list from the job.
+ * @param level the logger manager
+ *
+ * @return boolean with {@link HealthCheckResult} containing errors.
+ */
+ public boolean hasErrorLevel(String level)
+ {
+ for (HealthCheckResult checkResult : healthCheckResults) {
+ if (checkResult.getLevel().equals(level)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/application-admintools-default/pom.xml b/application-admintools-default/pom.xml
index c7138581..5f6b55f8 100644
--- a/application-admintools-default/pom.xml
+++ b/application-admintools-default/pom.xml
@@ -41,6 +41,12 @@
xwiki-platform-oldcore${platform.version}
+
+
+ com.github.oshi
+ oshi-core
+ 5.8.0
+ javax.servletjavax.servlet-api
@@ -66,8 +72,13 @@
${commons.version}test
+
+ org.xwiki.commons
+ xwiki-commons-cache-api
+ ${commons.version}
+
- 0.79
+ 0.76
\ No newline at end of file
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/AdminToolsManager.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/AdminToolsManager.java
index 8a388397..af546c4d 100644
--- a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/AdminToolsManager.java
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/AdminToolsManager.java
@@ -19,14 +19,16 @@
*/
package com.xwiki.admintools.internal;
-import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import org.xwiki.component.annotation.Component;
+import org.xwiki.component.manager.ComponentLookupException;
+import org.xwiki.component.manager.ComponentManager;
import com.xwiki.admintools.DataProvider;
import com.xwiki.admintools.internal.data.identifiers.CurrentServer;
@@ -56,6 +58,10 @@ public class AdminToolsManager
@Inject
private ImportantFilesManager importantFilesManager;
+ @Inject
+ @Named("context")
+ private ComponentManager contextComponentManager;
+
/**
* Get data generated in a specific format, using a template, by each provider and merge it.
*
@@ -78,14 +84,14 @@ public String generateData()
* @param hint {@link String} represents the data provider identifier.
* @return a {@link String} representing a template
*/
- public String generateData(String hint)
+ public String generateData(String hint) throws ComponentLookupException
{
- for (DataProvider dataProvider : this.dataProviderProvider.get()) {
- if (dataProvider.getIdentifier().equals(hint)) {
- return dataProvider.getRenderedData();
- }
+ try {
+ DataProvider dataProvider = contextComponentManager.getInstance(DataProvider.class, hint);
+ return dataProvider.getRenderedData();
+ } catch (ComponentLookupException e) {
+ throw e;
}
- return null;
}
/**
@@ -95,7 +101,7 @@ public String generateData(String hint)
*/
public List getSupportedDBs()
{
- return new ArrayList<>(this.currentServer.getSupportedDBs().values());
+ return this.currentServer.getSupportedDBs();
}
/**
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/data/identifiers/CurrentServer.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/data/identifiers/CurrentServer.java
index 35b7551d..1984b21e 100644
--- a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/data/identifiers/CurrentServer.java
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/data/identifiers/CurrentServer.java
@@ -20,9 +20,7 @@
package com.xwiki.admintools.internal.data.identifiers;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.inject.Inject;
import javax.inject.Provider;
@@ -65,19 +63,13 @@ public ServerIdentifier getCurrentServer()
}
/**
- * Get a {@link Map} with the supported databases.
+ * Get a {@link List} with the supported databases.
*
* @return the supported databases.
*/
- public Map getSupportedDBs()
+ public List getSupportedDBs()
{
- Map supportedDBs = new HashMap<>();
- supportedDBs.put("mysql", "MySQL");
- supportedDBs.put("hsqldb", "HSQLDB");
- supportedDBs.put("mariadb", "MariaDB");
- supportedDBs.put("postgresql", "PostgreSQL");
- supportedDBs.put("oracle", "Oracle");
- return supportedDBs;
+ return List.of("MySQL", "HSQL", "MariaDB", "PostgreSQL", "Oracle");
}
/**
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/files/ImportantFilesManager.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/files/ImportantFilesManager.java
index 426afe94..7e15e5c2 100644
--- a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/files/ImportantFilesManager.java
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/files/ImportantFilesManager.java
@@ -21,19 +21,20 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.zip.ZipOutputStream;
import javax.inject.Inject;
-import javax.inject.Provider;
+import javax.inject.Named;
import javax.inject.Singleton;
import javax.script.ScriptContext;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
+import org.xwiki.component.manager.ComponentLookupException;
+import org.xwiki.component.manager.ComponentManager;
import org.xwiki.script.ScriptContextManager;
import org.xwiki.template.TemplateManager;
@@ -54,7 +55,8 @@ public class ImportantFilesManager
private static final String REQUESTED_FILES_KEY = "files";
@Inject
- private Provider> dataResources;
+ @Named("context")
+ private ComponentManager contextComponentManager;
@Inject
private TemplateManager templateManager;
@@ -141,13 +143,8 @@ public String renderTemplate()
}
}
- private DataResource findDataResource(String hint)
+ private DataResource findDataResource(String hint) throws ComponentLookupException
{
- for (DataResource archiverDataResource : dataResources.get()) {
- if (archiverDataResource.getIdentifier().equals(hint)) {
- return archiverDataResource;
- }
- }
- return null;
+ return contextComponentManager.getInstance(DataResource.class, hint);
}
}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/AbstractConfigurationHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/AbstractConfigurationHealthCheck.java
new file mode 100644
index 00000000..dbc378d1
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/AbstractConfigurationHealthCheck.java
@@ -0,0 +1,63 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.slf4j.Logger;
+
+import com.xwiki.admintools.DataProvider;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.internal.data.ConfigurationDataProvider;
+
+/**
+ * {@link HealthCheck} implementations to simplify the code for configuration related health checks.
+ *
+ * @version $Id$
+ */
+public abstract class AbstractConfigurationHealthCheck implements HealthCheck
+{
+ @Inject
+ protected Logger logger;
+
+ @Inject
+ @Named(ConfigurationDataProvider.HINT)
+ private DataProvider configurationDataProvider;
+
+ /**
+ * Retrieve a JSON containing the necessary instance configuration information required for executing the
+ * configuration health checks.
+ *
+ * @return a {@link Map} with the {@link ConfigurationDataProvider} info, or an empty {@link Map} in case of an
+ * error.
+ */
+ protected Map getConfigurationProviderJSON()
+ {
+ try {
+ return configurationDataProvider.getDataAsJSON();
+ } catch (Exception e) {
+ return new HashMap<>();
+ }
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationDatabaseHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationDatabaseHealthCheck.java
new file mode 100644
index 00000000..3f4d3f00
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationDatabaseHealthCheck.java
@@ -0,0 +1,68 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.configuration;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+import com.xwiki.admintools.internal.data.identifiers.CurrentServer;
+
+/**
+ * Extension of {@link AbstractConfigurationHealthCheck} for checking the database configuration.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(ConfigurationDatabaseHealthCheck.HINT)
+@Singleton
+public class ConfigurationDatabaseHealthCheck extends AbstractConfigurationHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "configurationDatabase";
+
+ private static final String ERROR_KEY = "error";
+
+ @Inject
+ private CurrentServer currentServer;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String usedDatabase = getConfigurationProviderJSON().get("databaseName");
+ if (usedDatabase == null) {
+ logger.warn("Database not found!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.database.warn", ERROR_KEY);
+ }
+ if (currentServer.getSupportedDBs().stream()
+ .anyMatch(d -> usedDatabase.toLowerCase().contains(d.toLowerCase())))
+ {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.database.info", "info");
+ }
+ logger.error("Used database is not supported!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.database.notSupported",
+ "adminTools.dashboard.healthcheck.database.recommendation", ERROR_KEY, usedDatabase);
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationJavaHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationJavaHealthCheck.java
new file mode 100644
index 00000000..e3596c50
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationJavaHealthCheck.java
@@ -0,0 +1,99 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.configuration;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractConfigurationHealthCheck} for checking the Java configuration.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(ConfigurationJavaHealthCheck.HINT)
+@Singleton
+public class ConfigurationJavaHealthCheck extends AbstractConfigurationHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "configurationJava";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ Map configurationJson = getConfigurationProviderJSON();
+ String javaVersionString = configurationJson.get("javaVersion");
+ if (javaVersionString == null) {
+ logger.warn("Java version not found!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.java.warn",
+ "adminTools.dashboard.healthcheck.java.warn.recommendation", "warn");
+ }
+ String xwikiVersionString = configurationJson.get("xwikiVersion");
+ float xwikiVersion = parseFloat(xwikiVersionString);
+ float javaVersion = parseFloat(javaVersionString);
+ if (isNotJavaXWikiCompatible(xwikiVersion, javaVersion)) {
+ logger.error("Java version is not compatible with the current XWiki installation!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.java.error",
+ "adminTools.dashboard.healthcheck.java.error.recommendation", "error",
+ String.format("Java %s - XWiki %s", javaVersion, xwikiVersion));
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.java.info", "info");
+ }
+
+ private static float parseFloat(String javaVersionString)
+ {
+ String[] parts = javaVersionString.split("\\.");
+ return Float.parseFloat(parts[0] + "." + parts[1]);
+ }
+
+ private boolean isNotJavaXWikiCompatible(float xwikiVersion, float javaVersion)
+ {
+ boolean isCompatible = false;
+
+ if (inInterval(xwikiVersion, 0, 6)) {
+ isCompatible = javaVersion != 1.6;
+ } else if (inInterval(xwikiVersion, 6, 8.1f)) {
+ isCompatible = javaVersion != 1.7;
+ } else if (inInterval(xwikiVersion, 8.1f, 11.3f)) {
+ isCompatible = javaVersion != 1.8;
+ } else if (inInterval(xwikiVersion, 11.2f, 14)) {
+ isCompatible = (javaVersion != 1.8) || inInterval(javaVersion, 10.99f, 12);
+ } else if (inInterval(xwikiVersion, 13.9f, 14.10f)) {
+ isCompatible = javaVersion >= 11;
+ } else if (inInterval(xwikiVersion, 14.10f, Float.MAX_VALUE)) {
+ isCompatible = inInterval(javaVersion, 10.99f, 12) || inInterval(javaVersion, 16.99f, 18);
+ }
+
+ return isCompatible;
+ }
+
+ private boolean inInterval(float checkedValue, float lowerBound, float upperBound)
+ {
+ return checkedValue > lowerBound && checkedValue < upperBound;
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationOSHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationOSHealthCheck.java
new file mode 100644
index 00000000..14858eb5
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/configuration/ConfigurationOSHealthCheck.java
@@ -0,0 +1,56 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.configuration;
+
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractConfigurationHealthCheck} for checking the OS configuration.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(ConfigurationOSHealthCheck.HINT)
+@Singleton
+public class ConfigurationOSHealthCheck extends AbstractConfigurationHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "configurationOS";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ Map dataJSON = getConfigurationProviderJSON();
+ if (dataJSON.get("osName") == null || dataJSON.get("osVersion") == null || dataJSON.get("osArch") == null) {
+ logger.warn("There has been an error while gathering OS info!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.os.warn", "warn");
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.os.info", "info");
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/CacheMemoryHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/CacheMemoryHealthCheck.java
new file mode 100644
index 00000000..0acbcf49
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/CacheMemoryHealthCheck.java
@@ -0,0 +1,74 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.memory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.slf4j.Logger;
+import org.xwiki.component.annotation.Component;
+import org.xwiki.configuration.ConfigurationSource;
+
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Implementation of {@link HealthCheck} for checking instance document cache performance.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(CacheMemoryHealthCheck.HINT)
+@Singleton
+public class CacheMemoryHealthCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "CACHE_MEMORY_HEALTH_CHECK";
+
+ private static final String INFO_LEVEL = "info";
+
+ @Inject
+ @Named("xwikicfg")
+ private ConfigurationSource configurationSource;
+
+ @Inject
+ private Logger logger;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String storeCacheCapacity = configurationSource.getProperty("xwiki.store.cache.capacity");
+ if (storeCacheCapacity == null) {
+ logger.warn("Store cache capacity not defined. Set by default at 500.");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.cache.null",
+ "adminTools.dashboard.healthcheck.memory.cache.null.recommendation", INFO_LEVEL);
+ }
+ if (Integer.parseInt(storeCacheCapacity) <= 500) {
+ logger.warn("Store cache capacity is set to [{}].", storeCacheCapacity);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.cache.low", null, "warn",
+ storeCacheCapacity);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.cache.info", null, INFO_LEVEL,
+ storeCacheCapacity);
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/MemoryHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/MemoryHealthCheck.java
new file mode 100644
index 00000000..db3664b6
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/memory/MemoryHealthCheck.java
@@ -0,0 +1,89 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.memory;
+
+import java.text.DecimalFormat;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.slf4j.Logger;
+import org.xwiki.component.annotation.Component;
+
+import com.xpn.xwiki.XWiki;
+import com.xpn.xwiki.XWikiContext;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Implementation of {@link HealthCheck} for checking instance memory performance.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(MemoryHealthCheck.HINT)
+@Singleton
+public class MemoryHealthCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "MEMORY_HEALTH_CHECK";
+
+ private static final String MEMORY_RECOMMENDATION = "adminTools.dashboard.healthcheck.memory.recommendation";
+
+ private static final String MB_UNIT = "MB";
+
+ private static final String ERROR_LEVEL = "error";
+
+ @Inject
+ protected Provider xcontextProvider;
+
+ @Inject
+ private Logger logger;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ XWiki wiki = xcontextProvider.get().getWiki();
+ float maxMemory = wiki.maxMemory();
+ float totalFreeMemory = (maxMemory - (wiki.totalMemory() - wiki.freeMemory())) / (1024.0f * 1024);
+ float maxMemoryGB = maxMemory / (1024.0f * 1024 * 1024);
+ DecimalFormat format = new DecimalFormat("0.#");
+ if (maxMemoryGB < 1) {
+ logger.error("JVM memory is less than 1024MB. Currently: [{}]", maxMemoryGB * 1024);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.maxcapacity.error",
+ MEMORY_RECOMMENDATION, ERROR_LEVEL, format.format(maxMemoryGB * 1024) + MB_UNIT);
+ }
+ if (totalFreeMemory < 512) {
+ logger.error("JVM instance has only [{}]MB free memory left!", totalFreeMemory);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.free.error", MEMORY_RECOMMENDATION,
+ ERROR_LEVEL, format.format(totalFreeMemory) + MB_UNIT);
+ } else if (totalFreeMemory < 1024) {
+ logger.warn("Instance memory is running low. Currently only [{}]MB free left.", totalFreeMemory);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.free.warn", MEMORY_RECOMMENDATION,
+ "warn", format.format(totalFreeMemory) + MB_UNIT);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.memory.info", null, "info",
+ String.format(" %s GB", format.format(totalFreeMemory / 1024)));
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/CPUHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/CPUHealthCheck.java
new file mode 100644
index 00000000..2a86b707
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/CPUHealthCheck.java
@@ -0,0 +1,71 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.performance;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.slf4j.Logger;
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+
+import oshi.SystemInfo;
+import oshi.hardware.CentralProcessor;
+import oshi.hardware.HardwareAbstractionLayer;
+
+/**
+ * Implementation of {@link HealthCheck} for checking if system CPU meets XWiki requirements.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(CPUHealthCheck.HINT)
+@Singleton
+public class CPUHealthCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "cpuPerformance";
+
+ @Inject
+ private Logger logger;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ SystemInfo systemInfo = new SystemInfo();
+ HardwareAbstractionLayer hardware = systemInfo.getHardware();
+ CentralProcessor processor = hardware.getProcessor();
+ int cpuCores = processor.getPhysicalProcessorCount();
+ long maxFreq = processor.getMaxFreq() / (1024 * 1024);
+
+ if (cpuCores > 2 && maxFreq > 2048) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.cpu.info", "info");
+ }
+ String cpuSpecifications = String.format("CPU cores %d - frequency %d", cpuCores, maxFreq);
+ logger.warn("The CPU does not satisfy the minimum system requirements! [{}]", cpuSpecifications);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.cpu.warn",
+ "adminTools.dashboard.healthcheck.performance.cpu.recommendation", "error", cpuSpecifications);
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/LogsSizeCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/LogsSizeCheck.java
new file mode 100644
index 00000000..243b0870
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/LogsSizeCheck.java
@@ -0,0 +1,87 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.performance;
+
+import java.io.File;
+import java.text.DecimalFormat;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.ServerIdentifier;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+import com.xwiki.admintools.internal.data.identifiers.CurrentServer;
+
+@Component
+@Named(LogsSizeCheck.HINT)
+@Singleton
+public class LogsSizeCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "logSize";
+
+ @Inject
+ private CurrentServer currentServer;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ ServerIdentifier server = currentServer.getCurrentServer();
+
+ long logsSize = getFolderSize(server.getLogsFolderPath());
+
+ String[] units = new String[] { "B", "KB", "MB", "GB" };
+ int unitIndex = (int) (Math.log10(logsSize) / 3);
+ double unitValue = 1 << (unitIndex * 10);
+
+ String readableSize = new DecimalFormat("#,##0.#").format(logsSize / unitValue) + " " + units[unitIndex];
+
+ // NEED TO SET SOME METRICS. WHAT LOG SIZE IS TOO BIG?
+ if (logsSize / (1024 * 1024) > 500) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.cpu.info", "info");
+ } else {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.cpu.warn",
+ "adminTools.dashboard.healthcheck.performance.cpu.recommendation", "error", "cpuSpecifications");
+ }
+ }
+
+ public static long getFolderSize(String folderPath)
+ {
+ File folder = new File(folderPath);
+ long length = 0;
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ length += file.length();
+ } else {
+ length += getFolderSize(file.getAbsolutePath());
+ }
+ }
+ }
+ return length;
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalMemoryHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalMemoryHealthCheck.java
new file mode 100644
index 00000000..3eeb9462
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalMemoryHealthCheck.java
@@ -0,0 +1,72 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.performance;
+
+import java.text.DecimalFormat;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.slf4j.Logger;
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+
+import oshi.SystemInfo;
+import oshi.hardware.HardwareAbstractionLayer;
+
+/**
+ * Implementation of {@link HealthCheck} for checking if system memory meets XWiki requirements.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(PhysicalMemoryHealthCheck.HINT)
+@Singleton
+public class PhysicalMemoryHealthCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "physicalMemory";
+
+ @Inject
+ private Logger logger;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ SystemInfo systemInfo = new SystemInfo();
+ HardwareAbstractionLayer hardware = systemInfo.getHardware();
+
+ float totalMemory = (float) hardware.getMemory().getTotal() / (1024 * 1024 * 1024);
+ DecimalFormat format = new DecimalFormat("0.#");
+ String systemCapacityMessage = String.format("%s GB", format.format(totalMemory));
+ if (totalMemory > 2) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.memory.info", "info");
+ }
+ logger.warn("There is not enough memory to safely run the XWiki installation! Physical memory detected: [{}]",
+ systemCapacityMessage);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.memory.warn",
+ "adminTools.dashboard.healthcheck.performance.memory.recommendation", "error", systemCapacityMessage);
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalSpaceHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalSpaceHealthCheck.java
new file mode 100644
index 00000000..70f77550
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/performance/PhysicalSpaceHealthCheck.java
@@ -0,0 +1,88 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.performance;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.slf4j.Logger;
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.ServerIdentifier;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+import com.xwiki.admintools.internal.data.identifiers.CurrentServer;
+
+/**
+ * Implementation of {@link HealthCheck} for checking if system free space XWiki requirements.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(PhysicalSpaceHealthCheck.HINT)
+@Singleton
+public class PhysicalSpaceHealthCheck implements HealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "physicalSpace";
+
+ @Inject
+ private CurrentServer currentServer;
+
+ @Inject
+ private Logger logger;
+
+ @Override
+ public HealthCheckResult check()
+ {
+ File diskPartition;
+ ServerIdentifier server = currentServer.getCurrentServer();
+ if (server == null) {
+ if (System.getProperty("os.name").toLowerCase().contains("windows")) {
+ diskPartition = new File("C:");
+ } else {
+ diskPartition = new File("/");
+ }
+ } else {
+ Path xwikiPath = Paths.get(server.getXwikiCfgFolderPath());
+ Path rootDrive = xwikiPath.getRoot();
+ diskPartition = new File(String.valueOf(rootDrive));
+ }
+ long freePartitionSpace = diskPartition.getFreeSpace();
+ float freeSpace = (float) freePartitionSpace / (1024 * 1024 * 1024);
+
+ String systemFreeSpaceSizeMessage = String.format("%s: %f GB", diskPartition.getAbsolutePath(), freeSpace);
+
+ if (freeSpace > 16) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.space.info", "info");
+ }
+ logger.warn("There is not enough free space for the XWiki installation! Current free space is [{}]",
+ systemFreeSpaceSizeMessage);
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.performance.space.warn",
+ "adminTools.dashboard.healthcheck.performance.space.recommendation", "error", systemFreeSpaceSizeMessage);
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/AbstractSecurityHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/AbstractSecurityHealthCheck.java
new file mode 100644
index 00000000..d724a2ec
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/AbstractSecurityHealthCheck.java
@@ -0,0 +1,69 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.security;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.slf4j.Logger;
+
+import com.xwiki.admintools.DataProvider;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.internal.data.SecurityDataProvider;
+
+/**
+ * {@link HealthCheck} implementations to simplify the code for security related health checks.
+ *
+ * @version $Id$
+ */
+public abstract class AbstractSecurityHealthCheck implements HealthCheck
+{
+ protected final List acceptedEncodings = new ArrayList<>(List.of("UTF8", "UTF-8", "utf8", "utf-8"));
+
+ @Inject
+ protected Logger logger;
+
+ @Inject
+ @Named(SecurityDataProvider.HINT)
+ private DataProvider securityDataProvider;
+
+ protected boolean isSafeEncoding(String encoding, String type)
+ {
+ if (acceptedEncodings.contains(encoding)) {
+ return true;
+ }
+ logger.warn("[{}] encoding is [{}], but should be UTF-8!", type, encoding);
+ return false;
+ }
+
+ protected Map getSecurityProviderJSON()
+ {
+ try {
+ return securityDataProvider.getDataAsJSON();
+ } catch (Exception e) {
+ return new HashMap<>();
+ }
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ActiveEncodingHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ActiveEncodingHealthCheck.java
new file mode 100644
index 00000000..65ffdf05
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ActiveEncodingHealthCheck.java
@@ -0,0 +1,61 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.security;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractSecurityHealthCheck} for checking XWiki active encoding.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(ActiveEncodingHealthCheck.HINT)
+@Singleton
+public class ActiveEncodingHealthCheck extends AbstractSecurityHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "activeEncoding";
+
+ private static final String WARN_LEVEL = "warn";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String activeEnc = getSecurityProviderJSON().get(HINT);
+ if (activeEnc == null) {
+ logger.warn("Active encoding could not be detected!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.active.notFound", WARN_LEVEL);
+ }
+ boolean isActiveEncSafe = isSafeEncoding(activeEnc, "XWiki active");
+ if (!isActiveEncSafe) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.active.warn", null,
+ WARN_LEVEL, activeEnc);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.active.info", "info");
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ConfigurationEncodingHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ConfigurationEncodingHealthCheck.java
new file mode 100644
index 00000000..1060fdc5
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/ConfigurationEncodingHealthCheck.java
@@ -0,0 +1,62 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.security;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractSecurityHealthCheck} for checking XWiki configuration encoding.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(ConfigurationEncodingHealthCheck.HINT)
+@Singleton
+public class ConfigurationEncodingHealthCheck extends AbstractSecurityHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "configurationEncoding";
+
+ private static final String WARN_LEVEL = "warn";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String configEnc = getSecurityProviderJSON().get(HINT);
+ if (configEnc == null) {
+ logger.warn("Configuration encoding could not be detected!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.config.notFound", WARN_LEVEL);
+ }
+ boolean isConfigEncSafe = isSafeEncoding(configEnc, "XWiki configuration");
+
+ if (!isConfigEncSafe) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.config.warn", null,
+ WARN_LEVEL, configEnc);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.xwiki.config.info", "info");
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/FileEncodingHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/FileEncodingHealthCheck.java
new file mode 100644
index 00000000..fb81aefa
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/FileEncodingHealthCheck.java
@@ -0,0 +1,61 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.security;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractSecurityHealthCheck} for checking system file encoding.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(FileEncodingHealthCheck.HINT)
+@Singleton
+public class FileEncodingHealthCheck extends AbstractSecurityHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "fileEncoding";
+
+ private static final String WARN_LEVEL = "warn";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String fileEnc = getSecurityProviderJSON().get(HINT);
+ if (fileEnc == null) {
+ logger.warn("File encoding could not be detected!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.file.notFound", WARN_LEVEL);
+ }
+ boolean isSafeFileEnc = isSafeEncoding(fileEnc, "System file");
+ if (!isSafeFileEnc) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.file.warn",
+ "adminTools.dashboard.healthcheck.security.system.recommendation", WARN_LEVEL, fileEnc);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.file.info", "info");
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/LangEncodingHealthCheck.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/LangEncodingHealthCheck.java
new file mode 100644
index 00000000..6568b23b
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/checks/security/LangEncodingHealthCheck.java
@@ -0,0 +1,61 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.checks.security;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.xwiki.component.annotation.Component;
+
+import com.xwiki.admintools.health.HealthCheckResult;
+
+/**
+ * Extension of {@link AbstractSecurityHealthCheck} for checking system language configuration.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(LangEncodingHealthCheck.HINT)
+@Singleton
+public class LangEncodingHealthCheck extends AbstractSecurityHealthCheck
+{
+ /**
+ * Component identifier.
+ */
+ public static final String HINT = "languageEncoding";
+
+ private static final String WARN_LEVEL = "warn";
+
+ @Override
+ public HealthCheckResult check()
+ {
+ String langEnc = getSecurityProviderJSON().get("LANG");
+ if (langEnc == null) {
+ logger.warn("Language encoding could not be detected!");
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.lang.notFound", WARN_LEVEL);
+ }
+ boolean isSafeLangEnc = isSafeEncoding(langEnc.split("\\.")[1], "System language");
+ if (!isSafeLangEnc) {
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.lang.warn",
+ "adminTools.dashboard.healthcheck.security.system.recommendation", WARN_LEVEL, langEnc);
+ }
+ return new HealthCheckResult("adminTools.dashboard.healthcheck.security.system.lang.info", "info");
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/job/HealthCheckJob.java b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/job/HealthCheckJob.java
new file mode 100644
index 00000000..21803fa7
--- /dev/null
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/internal/health/job/HealthCheckJob.java
@@ -0,0 +1,108 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xwiki.admintools.internal.health.job;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.xwiki.component.annotation.Component;
+import org.xwiki.job.AbstractJob;
+import org.xwiki.job.GroupedJob;
+import org.xwiki.job.JobGroupPath;
+
+import com.xpn.xwiki.XWikiContext;
+import com.xwiki.admintools.health.HealthCheck;
+import com.xwiki.admintools.health.HealthCheckResult;
+import com.xwiki.admintools.jobs.HealthCheckJobRequest;
+import com.xwiki.admintools.jobs.HealthCheckJobStatus;
+
+/**
+ * The Admin Tools health check job.
+ *
+ * @version $Id$
+ */
+@Component
+@Named(HealthCheckJob.JOB_TYPE)
+public class HealthCheckJob extends AbstractJob implements GroupedJob
+{
+ /**
+ * Admin Tools health check job type.
+ */
+ public static final String JOB_TYPE = "admintools.healthcheck";
+
+ @Inject
+ private Provider> healthChecks;
+
+ @Inject
+ private Provider wikiContextProvider;
+
+ @Override
+ public String getType()
+ {
+ return JOB_TYPE;
+ }
+
+ @Override
+ public JobGroupPath getGroupPath()
+ {
+ XWikiContext wikiContext = wikiContextProvider.get();
+ String wikiId = wikiContext.getWikiId();
+ return new JobGroupPath(List.of("adminTools", "healthCheck", wikiId));
+ }
+
+ @Override
+ protected HealthCheckJobStatus createNewStatus(HealthCheckJobRequest request)
+ {
+ return new HealthCheckJobStatus(JOB_TYPE, request, observationManager, loggerManager);
+ }
+
+ /**
+ * Run the health check job.
+ */
+ @Override
+ protected void runInternal()
+ {
+ List healthCheckList = healthChecks.get();
+ this.progressManager.pushLevelProgress(healthCheckList.size(), this);
+ Iterator healthCheckIterator = healthCheckList.iterator();
+ try {
+ while (healthCheckIterator.hasNext()) {
+ if (status.isCanceled()) {
+ break;
+ } else {
+ progressManager.startStep(this);
+ // We start the check for the current HealthCheck in the iterator.
+ HealthCheckResult checkResult = healthCheckIterator.next().check();
+ // If the check return a result with a null error message then no issue was found, so we do not
+ // add the result to the status HealthCheckResult list.
+ status.getHealthCheckResults().add(checkResult);
+ progressManager.endStep(this);
+ Thread.yield();
+ }
+ }
+ } finally {
+ this.progressManager.popLevelProgress(this);
+ }
+ }
+}
diff --git a/application-admintools-default/src/main/java/com/xwiki/admintools/script/AdminToolsScriptService.java b/application-admintools-default/src/main/java/com/xwiki/admintools/script/AdminToolsScriptService.java
index b5941937..7cb773fb 100644
--- a/application-admintools-default/src/main/java/com/xwiki/admintools/script/AdminToolsScriptService.java
+++ b/application-admintools-default/src/main/java/com/xwiki/admintools/script/AdminToolsScriptService.java
@@ -23,13 +23,22 @@
import javax.inject.Inject;
import javax.inject.Named;
+import javax.inject.Provider;
import javax.inject.Singleton;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
+import org.xwiki.component.manager.ComponentLookupException;
+import org.xwiki.job.Job;
+import org.xwiki.job.JobExecutor;
import org.xwiki.script.service.ScriptService;
import org.xwiki.stability.Unstable;
+import com.xpn.xwiki.XWikiContext;
import com.xwiki.admintools.internal.AdminToolsManager;
+import com.xwiki.admintools.internal.health.job.HealthCheckJob;
+import com.xwiki.admintools.jobs.HealthCheckJobRequest;
/**
* Admin Tools script services.
@@ -43,9 +52,18 @@
@Unstable
public class AdminToolsScriptService implements ScriptService
{
+ @Inject
+ private Logger logger;
+
@Inject
private AdminToolsManager adminToolsManager;
+ @Inject
+ private JobExecutor jobExecutor;
+
+ @Inject
+ private Provider wikiContextProvider;
+
/**
* Retrieve all the configuration information in a format given by the associated templates generated by the data
* providers.
@@ -63,9 +81,15 @@ public String getConfigurationData()
* @param hint {@link String} representing the data provider
* @return a {@link String} representing a specific template.
*/
- public String getConfigurationData(String hint)
+ public String getConfigurationData(String hint) throws ComponentLookupException
{
- return this.adminToolsManager.generateData(hint);
+ try {
+ return this.adminToolsManager.generateData(hint);
+ } catch (ComponentLookupException e) {
+ logger.error("Could not retrieve data for the given hint [{}]. Root cause is: [{}]", hint,
+ ExceptionUtils.getRootCauseMessage(e));
+ throw e;
+ }
}
/**
@@ -97,4 +121,38 @@ public String getFilesSection()
{
return this.adminToolsManager.getFilesSection();
}
+
+ /**
+ * Check if an Admin Tools Health Check job for the wiki from where the request was made exists. If it does, return
+ * the job instance, else create a new Admin Tools health check request for the given wiki and start the execution.
+ *
+ * @return the asynchronous background job that will execute the request.
+ */
+ public Job runHealthChecks()
+ {
+ try {
+ List requestId = this.getHealthCheckJobId();
+ Job job = this.jobExecutor.getJob(requestId);
+ if (job == null) {
+ HealthCheckJobRequest healthCheckJobRequest = new HealthCheckJobRequest(requestId);
+ return this.jobExecutor.execute(HealthCheckJob.JOB_TYPE, healthCheckJobRequest);
+ } else {
+ return job;
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Get the Health Check job id for the current wiki.
+ *
+ * @return Health check job id.
+ */
+ public List getHealthCheckJobId()
+ {
+ XWikiContext wikiContext = wikiContextProvider.get();
+ String wikiID = wikiContext.getWikiId();
+ return List.of("adminTools", "healthCheck", wikiID);
+ }
}
diff --git a/application-admintools-default/src/main/resources/META-INF/components.txt b/application-admintools-default/src/main/resources/META-INF/components.txt
index af01748c..a3f0e4c1 100644
--- a/application-admintools-default/src/main/resources/META-INF/components.txt
+++ b/application-admintools-default/src/main/resources/META-INF/components.txt
@@ -12,5 +12,19 @@ com.xwiki.admintools.internal.files.ImportantFilesManager
com.xwiki.admintools.internal.configuration.AdminToolsConfigurationSource
com.xwiki.admintools.internal.configuration.DefaultAdminToolsConfiguration
com.xwiki.admintools.internal.AdminToolsEventListener
+com.xwiki.admintools.internal.health.checks.configuration.ConfigurationDatabaseHealthCheck
+com.xwiki.admintools.internal.health.checks.configuration.ConfigurationJavaHealthCheck
+com.xwiki.admintools.internal.health.checks.configuration.ConfigurationOSHealthCheck
+com.xwiki.admintools.internal.health.checks.security.ActiveEncodingHealthCheck
+com.xwiki.admintools.internal.health.checks.security.ConfigurationEncodingHealthCheck
+com.xwiki.admintools.internal.health.checks.security.FileEncodingHealthCheck
+com.xwiki.admintools.internal.health.checks.security.LangEncodingHealthCheck
+com.xwiki.admintools.internal.health.checks.performance.CPUHealthCheck
+com.xwiki.admintools.internal.health.checks.performance.LogsSizeCheck
+com.xwiki.admintools.internal.health.checks.performance.PhysicalMemoryHealthCheck
+com.xwiki.admintools.internal.health.checks.performance.PhysicalSpaceHealthCheck
+com.xwiki.admintools.internal.health.checks.memory.CacheMemoryHealthCheck
+com.xwiki.admintools.internal.health.checks.memory.MemoryHealthCheck
+com.xwiki.admintools.internal.health.job.HealthCheckJob
com.xwiki.admintools.internal.rest.DefaultAdminToolsResource
com.xwiki.admintools.internal.PingProvider
diff --git a/application-admintools-default/src/main/resources/templates/configurationTemplate.vm b/application-admintools-default/src/main/resources/templates/configurationTemplate.vm
index 45fb435a..21fcb8c9 100644
--- a/application-admintools-default/src/main/resources/templates/configurationTemplate.vm
+++ b/application-admintools-default/src/main/resources/templates/configurationTemplate.vm
@@ -24,12 +24,12 @@
#if ($configuration['serverFound'] == 'true')