From b03f3b2b6885dae2dd18715162234d57f5ef1b19 Mon Sep 17 00:00:00 2001 From: Mike McKay <mfmckay@wustl.edu> Date: Thu, 8 Sep 2016 10:46:29 -0500 Subject: [PATCH] Moved XnatAppInfo to use new way of accessing site config preferences. --- .../java/org/nrg/xnat/initialization/RootConfig.java | 4 ++-- src/main/java/org/nrg/xnat/services/XnatAppInfo.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/nrg/xnat/initialization/RootConfig.java b/src/main/java/org/nrg/xnat/initialization/RootConfig.java index 4c9aa1ef..ec802fba 100644 --- a/src/main/java/org/nrg/xnat/initialization/RootConfig.java +++ b/src/main/java/org/nrg/xnat/initialization/RootConfig.java @@ -51,8 +51,8 @@ import java.util.Properties; @Import({PropertiesConfig.class, DatabaseConfig.class, SecurityConfig.class, ApplicationConfig.class}) public class RootConfig { @Bean - public XnatAppInfo appInfo(final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException { - return new XnatAppInfo(context, serializerService, template); + public XnatAppInfo appInfo(final SiteConfigPreferences preferences, final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException { + return new XnatAppInfo(preferences, context, serializerService, template); } @Bean diff --git a/src/main/java/org/nrg/xnat/services/XnatAppInfo.java b/src/main/java/org/nrg/xnat/services/XnatAppInfo.java index f0ad26b6..e411df97 100644 --- a/src/main/java/org/nrg/xnat/services/XnatAppInfo.java +++ b/src/main/java/org/nrg/xnat/services/XnatAppInfo.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import org.nrg.framework.services.SerializerService; import org.nrg.prefs.exceptions.InvalidPreferenceName; -import org.nrg.xdat.XDAT; +import org.nrg.xdat.preferences.SiteConfigPreferences; import org.python.google.common.collect.ImmutableMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,8 @@ public class XnatAppInfo { private static final String SECONDS = "seconds"; @Inject - public XnatAppInfo(final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException { + public XnatAppInfo(final SiteConfigPreferences preferences, final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException { + _preferences=preferences; _template = template; final Resource configuredUrls = RESOURCE_LOADER.getResource("classpath:META-INF/xnat/security/configured-urls.yaml"); @@ -175,7 +176,7 @@ public class XnatAppInfo { new Object[]{_foundPreferences.get(pref), pref}, new int[]{Types.VARCHAR, Types.VARCHAR} ); try { - XDAT.getSiteConfigPreferences().set(_foundPreferences.get(pref), pref); + _preferences.set(_foundPreferences.get(pref), pref); } catch (InvalidPreferenceName e) { _log.error("", e); } catch (NullPointerException e) { @@ -452,7 +453,7 @@ public class XnatAppInfo { private final String _nonAdminErrorPath; private final Pattern _nonAdminErrorPathPattern; private final AntPathRequestMatcher _nonAdminErrorPathMatcher; - + private final SiteConfigPreferences _preferences; private final Map<String, AntPathRequestMatcher> _openUrls = new HashMap<>(); private final Map<String, AntPathRequestMatcher> _adminUrls = new HashMap<>(); private final Map<String, AntPathRequestMatcher> _initPaths = new HashMap<>(); -- GitLab