Class SiteContext


  • public class SiteContext
    extends Object
    Wrapper for a Context that adds properties specific to Crafter Engine.
    Author:
    Alfonso Vásquez
    • Field Detail

      • storeService

        protected org.craftercms.core.service.ContentStoreService storeService
      • cacheTemplate

        protected org.craftercms.core.util.cache.CacheTemplate cacheTemplate
      • siteName

        protected String siteName
      • context

        protected org.craftercms.core.service.Context context
      • fallback

        protected boolean fallback
      • staticAssetsPath

        protected String staticAssetsPath
      • templatesPath

        protected String templatesPath
      • allowedTemplatePaths

        protected String[] allowedTemplatePaths
      • restScriptsPath

        protected String restScriptsPath
      • controllerScriptsPath

        protected String controllerScriptsPath
      • initScriptPath

        protected String initScriptPath
      • freeMarkerConfig

        protected org.springframework.web.servlet.view.freemarker.FreeMarkerConfig freeMarkerConfig
      • urlTransformationEngine

        protected org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine
      • config

        protected org.apache.commons.configuration2.HierarchicalConfiguration config
      • globalApplicationContext

        protected org.springframework.context.ApplicationContext globalApplicationContext
      • applicationContext

        protected org.springframework.context.ConfigurableApplicationContext applicationContext
      • urlRewriter

        protected org.tuckey.web.filters.urlrewrite.UrlRewriter urlRewriter
      • scheduler

        protected org.quartz.Scheduler scheduler
      • proxyConfig

        protected org.apache.commons.configuration2.HierarchicalConfiguration proxyConfig
      • translationConfig

        protected org.apache.commons.configuration2.HierarchicalConfiguration translationConfig
      • localeResolver

        protected org.springframework.web.servlet.LocaleResolver localeResolver
      • initTimeout

        protected long initTimeout
      • maintenanceTaskExecutor

        protected ExecutorService maintenanceTaskExecutor
      • graphQL

        protected graphql.GraphQL graphQL
      • scriptSandbox

        protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor scriptSandbox
    • Constructor Detail

      • SiteContext

        public SiteContext()
    • Method Detail

      • getCurrent

        public static SiteContext getCurrent()
        Returns the context for the current thread.
      • getFromCurrentCache

        public static <T> T getFromCurrentCache​(org.craftercms.commons.lang.Callback<T> loader,
                                                Object... keyElements)
        Returns the item from the cache of the current site context. If there's no current site context, the loader is called directly to get the item.
        Parameters:
        loader - the loader used to retrieve the item if it's not in cache
        keyElements - the elements that conform the key
        Returns:
        the cached item
      • setCurrent

        public static void setCurrent​(SiteContext siteContext)
        Sets the context for the current thread.
      • clear

        public static void clear()
        Removes the context from the current thread.
      • release

        protected static void release​(SiteContext siteContext)
      • getStoreService

        public org.craftercms.core.service.ContentStoreService getStoreService()
      • setStoreService

        public void setStoreService​(org.craftercms.core.service.ContentStoreService storeService)
      • getCacheTemplate

        public org.craftercms.core.util.cache.CacheTemplate getCacheTemplate()
      • setCacheTemplate

        public void setCacheTemplate​(org.craftercms.core.util.cache.CacheTemplate cacheTemplate)
      • getSiteName

        public String getSiteName()
      • setSiteName

        public void setSiteName​(String siteName)
      • getContext

        public org.craftercms.core.service.Context getContext()
      • setContext

        public void setContext​(org.craftercms.core.service.Context context)
      • isFallback

        public boolean isFallback()
      • setFallback

        public void setFallback​(boolean fallback)
      • getStaticAssetsPath

        public String getStaticAssetsPath()
      • setStaticAssetsPath

        public void setStaticAssetsPath​(String staticAssetsPath)
      • getTemplatesPath

        public String getTemplatesPath()
      • setTemplatesPath

        public void setTemplatesPath​(String templatesPath)
      • getAllowedTemplatePaths

        public String[] getAllowedTemplatePaths()
      • setAllowedTemplatePaths

        public void setAllowedTemplatePaths​(String[] allowedTemplatePaths)
      • getRestScriptsPath

        public String getRestScriptsPath()
      • setRestScriptsPath

        public void setRestScriptsPath​(String restScriptsPath)
      • getControllerScriptsPath

        public String getControllerScriptsPath()
      • setControllerScriptsPath

        public void setControllerScriptsPath​(String controllerScriptsPath)
      • getInitScriptPath

        public String getInitScriptPath()
      • setInitScriptPath

        public void setInitScriptPath​(String initScriptPath)
      • getFreeMarkerConfig

        public org.springframework.web.servlet.view.freemarker.FreeMarkerConfig getFreeMarkerConfig()
      • setFreeMarkerConfig

        public void setFreeMarkerConfig​(org.springframework.web.servlet.view.freemarker.FreeMarkerConfig freeMarkerConfig)
      • getUrlTransformationEngine

        public org.craftercms.core.url.UrlTransformationEngine getUrlTransformationEngine()
      • setUrlTransformationEngine

        public void setUrlTransformationEngine​(org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine)
      • setScriptFactory

        public void setScriptFactory​(ScriptFactory scriptFactory)
      • getConfig

        public org.apache.commons.configuration2.HierarchicalConfiguration getConfig()
      • setConfig

        public void setConfig​(org.apache.commons.configuration2.HierarchicalConfiguration config)
      • setServletContext

        public void setServletContext​(javax.servlet.ServletContext servletContext)
      • getGlobalApplicationContext

        public org.springframework.context.ApplicationContext getGlobalApplicationContext()
      • setGlobalApplicationContext

        public void setGlobalApplicationContext​(org.springframework.context.ApplicationContext globalApplicationContext)
      • getApplicationContext

        public org.springframework.context.ConfigurableApplicationContext getApplicationContext()
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ConfigurableApplicationContext applicationContext)
      • setClassLoader

        public void setClassLoader​(URLClassLoader classLoader)
      • getUrlRewriter

        public org.tuckey.web.filters.urlrewrite.UrlRewriter getUrlRewriter()
      • setUrlRewriter

        public void setUrlRewriter​(org.tuckey.web.filters.urlrewrite.UrlRewriter urlRewriter)
      • getScheduler

        public org.quartz.Scheduler getScheduler()
      • setScheduler

        public void setScheduler​(org.quartz.Scheduler scheduler)
      • setGraphQLFactory

        public void setGraphQLFactory​(GraphQLFactory graphQLFactory)
      • setCacheWarmer

        public void setCacheWarmer​(SiteCacheWarmer cacheWarmer)
      • setInitTimeout

        public void setInitTimeout​(long initTimeout)
      • setShutdownTimeout

        public void setShutdownTimeout​(long shutdownTimeout)
      • getGraphQL

        public graphql.GraphQL getGraphQL()
      • getProxyConfig

        public org.apache.commons.configuration2.HierarchicalConfiguration getProxyConfig()
      • setProxyConfig

        public void setProxyConfig​(org.apache.commons.configuration2.HierarchicalConfiguration proxyConfig)
      • getTranslationConfig

        public org.apache.commons.configuration2.HierarchicalConfiguration getTranslationConfig()
      • setTranslationConfig

        public void setTranslationConfig​(org.apache.commons.configuration2.HierarchicalConfiguration translationConfig)
      • isTranslationEnabled

        public boolean isTranslationEnabled()
      • getLocaleResolver

        public org.springframework.web.servlet.LocaleResolver getLocaleResolver()
      • setLocaleResolver

        public void setLocaleResolver​(org.springframework.web.servlet.LocaleResolver localeResolver)
      • isValid

        public boolean isValid()
                        throws org.craftercms.core.exception.CrafterException
        Throws:
        org.craftercms.core.exception.CrafterException
      • startCacheClear

        public void startCacheClear()
      • destroy

        public void destroy()
                     throws org.craftercms.core.exception.CrafterException
        Throws:
        org.craftercms.core.exception.CrafterException
      • getFromCache

        public <T> T getFromCache​(org.craftercms.commons.lang.Callback<T> loader,
                                  Object... keyElements)
      • cacheClear

        protected void cacheClear()
      • buildGraphQLSchema

        protected void buildGraphQLSchema()
      • executeInitScript

        protected void executeInitScript()
      • publishEvent

        protected void publishEvent​(SiteEvent event)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object