public void addFalseConditionIfExpressionIsContained(String fileName, String regExp) { List<String> matches = TextFileUtil.getTrimmedLinesMatching(fileName, regExp); if (matches.size() > 0) { conditions.add(new FalseCondition("Invalid entries", "The file '" + fileName + "' contains " + matches.size() + " line(s) matching " + regExp + ". Please remove it.")); } } }
public void servletIsPresent(String servletName) { if (!webXmlUtil.isServletRegistered(servletName)) { conditions.add(new FalseCondition("web.xml updates", "The " + servletName + " servlet is not installed. Please configure a <servlet> and an appropriate mapping with name " + servletName + " in your web.xml file.")); } }
public void filterIsDeprecated(final String deprecatedFilterClass, final String replacementFilterClass) { if (webXmlUtil.isFilterRegistered(deprecatedFilterClass)) { conditions.add(new FalseCondition("web.xml updates", "The " + deprecatedFilterClass + " filter class is now deprecated. Please replace it with " + replacementFilterClass + ": please update the corresponding <filter-class> element in your web.xml file.")); } }
public void addFalseConditionIfExpressionIsNotContained(String fileName, String regExp) { List<String> matches = TextFileUtil.getTrimmedLinesMatching(fileName, regExp); if (matches.isEmpty()) { conditions.add(new FalseCondition("Missing required entries.", "The file '" + fileName + "' must contain a line matching " + regExp + ". Please add it.")); } }
public void listenerIsDeprecated(final String deprecatedListenerClass, final String replacementListenerClass) { if (webXmlUtil.isListenerRegistered(deprecatedListenerClass)) { conditions.add(new FalseCondition("web.xml updates", "The " + deprecatedListenerClass + " listener class is now deprecated. Please replace it with " + replacementListenerClass + ": please update the corresponding <listener> element in your web.xml file.")); } }
public void accessControlProviderIsSet() { List<String> names = WorkspaceXmlUtil.getWorkspaceNames("/Workspace/WorkspaceSecurity/AccessControlProvider/@class", null); if (names.size() > 0) { for (int i = 0; i < names.size(); i++) { conditions.add(new FalseCondition("workspace.xml updates", "Workspace definition in workspace " + names.get(i) + " must have an AccessControlProvider set.")); } } } }
public void servletIsNowWrapped(final String servletName) { if (webXmlUtil.isServletOrMappingRegistered(servletName)) { conditions.add(new FalseCondition("web.xml updates", "Since Magnolia 3.5, servlets are wrapped in ServletDispatchingFilter; please remove the <servlet> and <servlet-mapping> elements for " + servletName + " from your web.xml file.")); } }
public void servletIsDeprecated(final String servletName) { if (webXmlUtil.isServletOrMappingRegistered(servletName)) { conditions.add(new FalseCondition("web.xml updates", "The " + servletName + " servlet is deprecated and not in use; please remove the corresponding <servlet> and <servlet-mapping> elements from your web.xml file.")); } }
public void textFilterClassesAreNotSet() { List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='textFilterClasses']/@value"); if (names.size() > 0) { for (int i = 0; i < names.size(); i++) { conditions.add(new FalseCondition("workspace.xml updates", "Workspace definition in workspace " + names.get(i) + " references indexer which has changed; please remove the parameter 'textFilterClasses'.")); } } }
public void servletIsRemoved(final String servletName) { if (webXmlUtil.isServletOrMappingRegistered(servletName)) { conditions.add(new FalseCondition("web.xml updates", "The " + servletName + " servlet does not exist anymore; please remove the corresponding <servlet> and <servlet-mapping> elements from your web.xml file.")); } }
public void listenerMustBeRegistered(String listenerClass) { if (!webXmlUtil.isListenerRegistered(listenerClass)) { conditions.add(new FalseCondition("web.xml updates", "The " + listenerClass + " listener is not installed. Please configure a <listener> with class " + listenerClass + " in your web.xml file.")); } } }
public void filterMustBeRegisteredWithCorrectDispatchers(final String filterClass) { final String conditionName = "web.xml updates"; final String message = "Since Magnolia 4.4, the main Magnolia filter is " + filterClass + ", and it must be mapped with dispatchers REQUEST, FORWARD, INCLUDE and, optionally, ERROR."; final String additionalMessage = " Please add \n" + " <dispatcher>REQUEST</dispatcher>\n" + " <dispatcher>FORWARD</dispatcher>\n" + " <dispatcher>INCLUDE</dispatcher>\n" + " <dispatcher>ERROR</dispatcher>\n" + " to the filter-mapping element in your web.xml file."; if (!webXmlUtil.isFilterRegistered(filterClass)) { conditions.add(new FalseCondition(conditionName, message)); } else { final int result = webXmlUtil.checkFilterDispatchersConfiguration(filterClass, Arrays.asList("REQUEST", "FORWARD", "INCLUDE"), Collections.singletonList("ERROR")); if (result > 0) { conditions.add(new TrueCondition(conditionName, message)); } else if (result == 0) { conditions.add(new WarnCondition(conditionName, message)); } else if (result < 0) { conditions.add(new FalseCondition(conditionName, message + additionalMessage)); } } }
public static DeltaBuilder checkPrecondition(String minimalVersion, String newVersion) { return update(minimalVersion, "minimal version required for updating to " + newVersion).addCondition( new FalseCondition("checkPrerequisite", "Updating to " + newVersion + " is only supported from " + minimalVersion + " or higher.")); }