Search in sources :

Example 1 with ThemeSource

use of org.ambraproject.wombat.config.theme.ThemeSource in project wombat by PLOS.

the class SpringConfiguration method themeGraph.

@Bean
public ThemeGraph themeGraph(ServletContext servletContext, RuntimeConfiguration runtimeConfiguration) throws ThemeGraph.ThemeConfigurationException, IOException {
    String path = "/WEB-INF/themes/";
    InternalTheme root = new InternalTheme(".Root", ImmutableList.of(), servletContext, path + "root/");
    InternalTheme desktop = new InternalTheme(".Desktop", ImmutableList.of(root), servletContext, path + "desktop/");
    InternalTheme mobile = new InternalTheme(".Mobile", ImmutableList.of(root), servletContext, path + "mobile/");
    Collection<InternalTheme> internalThemes = ImmutableList.of(root, desktop, mobile);
    Collection<ThemeSource<?>> themeSources = runtimeConfiguration.getThemeSources();
    Collection<ThemeBuilder<?>> themeBuilders = themeSources.stream().flatMap(ts -> ts.readThemes().stream()).collect(Collectors.toList());
    return ThemeGraph.create(root, internalThemes, themeBuilders);
}
Also used : SiteResolver(org.ambraproject.wombat.config.site.SiteResolver) ArticleTransformServiceImpl(org.ambraproject.wombat.service.ArticleTransformServiceImpl) CommentValidationService(org.ambraproject.wombat.service.CommentValidationService) ArticleArchiveServiceImpl(org.ambraproject.wombat.service.ArticleArchiveServiceImpl) FreeMarkerConfig(org.springframework.web.servlet.view.freemarker.FreeMarkerConfig) BuildInfoDirective(org.ambraproject.wombat.freemarker.BuildInfoDirective) ReplaceParametersDirective(org.ambraproject.wombat.freemarker.ReplaceParametersDirective) BuildInfoServiceImpl(org.ambraproject.wombat.service.BuildInfoServiceImpl) TopLevelLockssManifestService(org.ambraproject.wombat.service.TopLevelLockssManifestService) ThemeSource(org.ambraproject.wombat.config.theme.ThemeSource) ArticleService(org.ambraproject.wombat.service.ArticleService) Map(java.util.Map) HoneypotService(org.ambraproject.wombat.service.HoneypotService) OrcidApiImpl(org.ambraproject.wombat.service.remote.orcid.OrcidApiImpl) EditorialContentApiImpl(org.ambraproject.wombat.service.remote.EditorialContentApiImpl) Iso8601DateDirective(org.ambraproject.wombat.freemarker.Iso8601DateDirective) AbbreviatedNameDirective(org.ambraproject.wombat.freemarker.AbbreviatedNameDirective) CssLinkDirective(org.ambraproject.wombat.freemarker.asset.CssLinkDirective) BuildInfoService(org.ambraproject.wombat.service.BuildInfoService) ArticleExcerptTransformDirective(org.ambraproject.wombat.freemarker.ArticleExcerptTransformDirective) ParseReferenceService(org.ambraproject.wombat.service.ParseReferenceService) AppRootPage(org.ambraproject.wombat.controller.AppRootPage) JsDirective(org.ambraproject.wombat.freemarker.asset.JsDirective) ImmutableMap(com.google.common.collect.ImmutableMap) CommentFeedView(org.ambraproject.wombat.feed.CommentFeedView) GlobalConfigDirective(org.ambraproject.wombat.freemarker.GlobalConfigDirective) Collection(java.util.Collection) ThemeBuilder(org.ambraproject.wombat.config.theme.ThemeBuilder) JournalFilterType(org.ambraproject.wombat.model.JournalFilterType) ParseXmlServiceImpl(org.ambraproject.wombat.service.ParseXmlServiceImpl) Collectors(java.util.stream.Collectors) ArticleFeedView(org.ambraproject.wombat.feed.ArticleFeedView) Configuration(org.springframework.context.annotation.Configuration) SearchFilterService(org.ambraproject.wombat.service.SearchFilterService) RecentArticleServiceImpl(org.ambraproject.wombat.service.RecentArticleServiceImpl) List(java.util.List) RecentArticleService(org.ambraproject.wombat.service.RecentArticleService) GitInfo(org.ambraproject.wombat.util.GitInfo) CommentCensorServiceImpl(org.ambraproject.wombat.service.CommentCensorServiceImpl) CommentService(org.ambraproject.wombat.service.CommentService) ThemeConfigDirective(org.ambraproject.wombat.freemarker.ThemeConfigDirective) CommentServiceImpl(org.ambraproject.wombat.service.CommentServiceImpl) HoneypotServiceImpl(org.ambraproject.wombat.service.HoneypotServiceImpl) AppLinkDirective(org.ambraproject.wombat.freemarker.AppLinkDirective) BrowseTaxonomyServiceImpl(org.ambraproject.wombat.service.BrowseTaxonomyServiceImpl) FreeMarkerConfigurer(org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer) FetchHtmlDirective(org.ambraproject.wombat.freemarker.FetchHtmlDirective) OrcidApi(org.ambraproject.wombat.service.remote.orcid.OrcidApi) IsDevFeatureEnabledDirective(org.ambraproject.wombat.freemarker.IsDevFeatureEnabledDirective) PeerReviewService(org.ambraproject.wombat.service.PeerReviewService) ArticleResolutionService(org.ambraproject.wombat.service.ArticleResolutionService) RequestMappingContextDictionary(org.ambraproject.wombat.config.site.RequestMappingContextDictionary) ArticleMetadata(org.ambraproject.wombat.controller.ArticleMetadata) FreeMarkerViewResolver(org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver) DoiVersionArgumentResolver(org.ambraproject.wombat.controller.DoiVersionArgumentResolver) SearchFilterFactory(org.ambraproject.wombat.model.SearchFilterFactory) AlertService(org.ambraproject.wombat.service.AlertService) ArticleTransformService(org.ambraproject.wombat.service.ArticleTransformService) SearchFilterType(org.ambraproject.wombat.model.SearchFilterType) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) SiteSet(org.ambraproject.wombat.config.site.SiteSet) AssetService(org.ambraproject.wombat.service.AssetService) CommentValidationServiceImpl(org.ambraproject.wombat.service.CommentValidationServiceImpl) ThemeGraph(org.ambraproject.wombat.config.theme.ThemeGraph) Qualifier(org.springframework.beans.factory.annotation.Qualifier) RenderCssLinksDirective(org.ambraproject.wombat.freemarker.asset.RenderCssLinksDirective) CitationDownloadService(org.ambraproject.wombat.service.CitationDownloadService) AssetServiceImpl(org.ambraproject.wombat.service.AssetServiceImpl) ParseXmlService(org.ambraproject.wombat.service.ParseXmlService) PeerReviewServiceImpl(org.ambraproject.wombat.service.PeerReviewServiceImpl) Charsets(com.google.common.base.Charsets) SiteTemplateLoader(org.ambraproject.wombat.config.site.SiteTemplateLoader) CitationDownloadServiceImpl(org.ambraproject.wombat.service.CitationDownloadServiceImpl) ArticleServiceImpl(org.ambraproject.wombat.service.ArticleServiceImpl) CorpusContentApi(org.ambraproject.wombat.service.remote.CorpusContentApi) SiteLinkDirective(org.ambraproject.wombat.freemarker.SiteLinkDirective) IOException(java.io.IOException) PluralizeDirective(org.ambraproject.wombat.freemarker.PluralizeDirective) CommentCensorService(org.ambraproject.wombat.service.CommentCensorService) DoiToJournalResolutionService(org.ambraproject.wombat.service.DoiToJournalResolutionService) InternalTheme(org.ambraproject.wombat.config.theme.InternalTheme) RenderJsDirective(org.ambraproject.wombat.freemarker.asset.RenderJsDirective) BrowseTaxonomyService(org.ambraproject.wombat.service.BrowseTaxonomyService) EditorialContentApi(org.ambraproject.wombat.service.remote.EditorialContentApi) ServletContext(javax.servlet.ServletContext) Bean(org.springframework.context.annotation.Bean) SingletonSearchFilterType(org.ambraproject.wombat.model.SingletonSearchFilterType) ThemeBuilder(org.ambraproject.wombat.config.theme.ThemeBuilder) InternalTheme(org.ambraproject.wombat.config.theme.InternalTheme) ThemeSource(org.ambraproject.wombat.config.theme.ThemeSource) Bean(org.springframework.context.annotation.Bean)

Aggregations

Charsets (com.google.common.base.Charsets)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 IOException (java.io.IOException)1 Charset (java.nio.charset.Charset)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ServletContext (javax.servlet.ServletContext)1 RequestMappingContextDictionary (org.ambraproject.wombat.config.site.RequestMappingContextDictionary)1 SiteResolver (org.ambraproject.wombat.config.site.SiteResolver)1 SiteSet (org.ambraproject.wombat.config.site.SiteSet)1 SiteTemplateLoader (org.ambraproject.wombat.config.site.SiteTemplateLoader)1 InternalTheme (org.ambraproject.wombat.config.theme.InternalTheme)1 ThemeBuilder (org.ambraproject.wombat.config.theme.ThemeBuilder)1 ThemeGraph (org.ambraproject.wombat.config.theme.ThemeGraph)1 ThemeSource (org.ambraproject.wombat.config.theme.ThemeSource)1 AppRootPage (org.ambraproject.wombat.controller.AppRootPage)1 ArticleMetadata (org.ambraproject.wombat.controller.ArticleMetadata)1