Class SiteContext

java.lang.Object
org.craftercms.engine.service.context.SiteContext

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

    • 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
    • scriptFactory

      protected ScriptFactory scriptFactory
    • config

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

      protected org.springframework.context.ApplicationContext globalApplicationContext
    • applicationContext

      protected org.springframework.context.ConfigurableApplicationContext applicationContext
    • classLoader

      protected URLClassLoader classLoader
    • urlRewriter

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

      protected org.quartz.Scheduler scheduler
    • graphQLFactory

      protected GraphQLFactory graphQLFactory
    • cacheWarmer

      protected SiteCacheWarmer cacheWarmer
    • 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
    • initializationLatch

      protected CountDownLatch initializationLatch
    • maintenanceTaskExecutor

      protected ExecutorService maintenanceTaskExecutor
    • graphQL

      protected graphql.GraphQL graphQL
    • state

      protected SiteContext.State state
    • scriptSandbox

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

    • SiteContext

      public SiteContext()
  • Method Details

    • 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)
    • getScriptFactory

      public ScriptFactory getScriptFactory()
    • 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(jakarta.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)
    • getClassLoader

      public URLClassLoader getClassLoader()
    • 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)
    • getGraphQLFactory

      public GraphQLFactory getGraphQLFactory()
    • setGraphQLFactory

      public void setGraphQLFactory(GraphQLFactory graphQLFactory)
    • getCacheWarmer

      public SiteCacheWarmer getCacheWarmer()
    • 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
    • getState

      public SiteContext.State getState()
    • init

      public void init(boolean waitTillFinished) throws SiteContextInitializationException
      Throws:
      SiteContextInitializationException
    • startCacheClear

      public void startCacheClear()
    • startCacheClear

      public void startCacheClear(Runnable callback)
    • startGraphQLSchemaBuild

      public void startGraphQLSchemaBuild() throws GraphQLBuildException
      Throws:
      GraphQLBuildException
    • startGraphQLSchemaBuild

      public void startGraphQLSchemaBuild(Runnable callback) throws GraphQLBuildException
      Throws:
      GraphQLBuildException
    • 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)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object