Class SiteContext
java.lang.Object
org.craftercms.engine.service.context.SiteContext
Wrapper for a
Context that adds properties specific to Crafter Engine.- Author:
- Alfonso Vásquez
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected org.springframework.context.ConfigurableApplicationContextprotected org.craftercms.core.util.cache.CacheTemplateprotected SiteCacheWarmerprotected URLClassLoaderprotected org.apache.commons.configuration2.HierarchicalConfigurationprotected org.craftercms.core.service.Contextprotected Stringprotected booleanprotected org.springframework.web.servlet.view.freemarker.FreeMarkerConfigprotected org.springframework.context.ApplicationContextprotected graphql.GraphQLprotected GraphQLFactoryprotected CountDownLatchprotected Stringprotected longprotected org.springframework.web.servlet.LocaleResolverprotected ExecutorServiceprotected org.apache.commons.configuration2.HierarchicalConfigurationprotected Stringprotected org.quartz.Schedulerprotected ScriptFactoryprotected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptorprotected Stringprotected SiteContext.Stateprotected Stringprotected org.craftercms.core.service.ContentStoreServiceprotected Stringprotected org.apache.commons.configuration2.HierarchicalConfigurationprotected org.tuckey.web.filters.urlrewrite.UrlRewriterprotected org.craftercms.core.url.UrlTransformationEngine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidstatic voidclear()Removes the context from the current thread.voiddestroy()booleanprotected voidString[]org.springframework.context.ConfigurableApplicationContextorg.craftercms.core.util.cache.CacheTemplateorg.apache.commons.configuration2.HierarchicalConfigurationorg.craftercms.core.service.Contextstatic SiteContextReturns the context for the current thread.org.springframework.web.servlet.view.freemarker.FreeMarkerConfig<T> TgetFromCache(org.craftercms.commons.lang.Callback<T> loader, Object... keyElements) static <T> TgetFromCurrentCache(org.craftercms.commons.lang.Callback<T> loader, Object... keyElements) Returns the item from the cache of the current site context.org.springframework.context.ApplicationContextgraphql.GraphQLorg.springframework.web.servlet.LocaleResolverorg.apache.commons.configuration2.HierarchicalConfigurationorg.quartz.SchedulergetState()org.craftercms.core.service.ContentStoreServiceorg.apache.commons.configuration2.HierarchicalConfigurationorg.tuckey.web.filters.urlrewrite.UrlRewriterorg.craftercms.core.url.UrlTransformationEngineinthashCode()voidinit(boolean waitTillFinished) booleanbooleanbooleanisValid()protected voidpublishEvent(SiteEvent event) protected static voidrelease(SiteContext siteContext) voidsetAllowedTemplatePaths(String[] allowedTemplatePaths) voidsetApplicationContext(org.springframework.context.ConfigurableApplicationContext applicationContext) voidsetCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate) voidsetCacheWarmer(SiteCacheWarmer cacheWarmer) voidsetClassLoader(URLClassLoader classLoader) voidsetConfig(org.apache.commons.configuration2.HierarchicalConfiguration config) voidsetContext(org.craftercms.core.service.Context context) voidsetControllerScriptsPath(String controllerScriptsPath) static voidsetCurrent(SiteContext siteContext) Sets the context for the current thread.voidsetFallback(boolean fallback) voidsetFreeMarkerConfig(org.springframework.web.servlet.view.freemarker.FreeMarkerConfig freeMarkerConfig) voidsetGlobalApplicationContext(org.springframework.context.ApplicationContext globalApplicationContext) voidsetGraphQLFactory(GraphQLFactory graphQLFactory) voidsetInitScriptPath(String initScriptPath) voidsetInitTimeout(long initTimeout) voidsetLocaleResolver(org.springframework.web.servlet.LocaleResolver localeResolver) voidsetProxyConfig(org.apache.commons.configuration2.HierarchicalConfiguration proxyConfig) voidsetRestScriptsPath(String restScriptsPath) voidsetScheduler(org.quartz.Scheduler scheduler) voidsetScriptFactory(ScriptFactory scriptFactory) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidsetShutdownTimeout(long shutdownTimeout) voidsetSiteName(String siteName) voidsetStaticAssetsPath(String staticAssetsPath) voidsetStoreService(org.craftercms.core.service.ContentStoreService storeService) voidsetTemplatesPath(String templatesPath) voidsetTranslationConfig(org.apache.commons.configuration2.HierarchicalConfiguration translationConfig) voidsetUrlRewriter(org.tuckey.web.filters.urlrewrite.UrlRewriter urlRewriter) voidsetUrlTransformationEngine(org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine) voidvoidstartCacheClear(Runnable callback) voidvoidstartGraphQLSchemaBuild(Runnable callback) toString()
-
Field Details
-
storeService
protected org.craftercms.core.service.ContentStoreService storeService -
cacheTemplate
protected org.craftercms.core.util.cache.CacheTemplate cacheTemplate -
siteName
-
context
protected org.craftercms.core.service.Context context -
fallback
protected boolean fallback -
staticAssetsPath
-
templatesPath
-
allowedTemplatePaths
-
restScriptsPath
-
controllerScriptsPath
-
initScriptPath
-
freeMarkerConfig
protected org.springframework.web.servlet.view.freemarker.FreeMarkerConfig freeMarkerConfig -
urlTransformationEngine
protected org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine -
scriptFactory
-
config
protected org.apache.commons.configuration2.HierarchicalConfiguration config -
globalApplicationContext
protected org.springframework.context.ApplicationContext globalApplicationContext -
applicationContext
protected org.springframework.context.ConfigurableApplicationContext applicationContext -
classLoader
-
urlRewriter
protected org.tuckey.web.filters.urlrewrite.UrlRewriter urlRewriter -
scheduler
protected org.quartz.Scheduler scheduler -
graphQLFactory
-
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
-
maintenanceTaskExecutor
-
graphQL
protected graphql.GraphQL graphQL -
state
-
scriptSandbox
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor scriptSandbox
-
-
Constructor Details
-
SiteContext
public SiteContext()
-
-
Method Details
-
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 cachekeyElements- the elements that conform the key- Returns:
- the cached item
-
setCurrent
Sets the context for the current thread. -
clear
public static void clear()Removes the context from the current thread. -
release
-
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
-
setSiteName
-
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
-
setStaticAssetsPath
-
getTemplatesPath
-
setTemplatesPath
-
getAllowedTemplatePaths
-
setAllowedTemplatePaths
-
getRestScriptsPath
-
setRestScriptsPath
-
getControllerScriptsPath
-
setControllerScriptsPath
-
getInitScriptPath
-
setInitScriptPath
-
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
-
setScriptFactory
-
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
-
setClassLoader
-
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
-
setGraphQLFactory
-
getCacheWarmer
-
setCacheWarmer
-
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
-
init
-
startCacheClear
public void startCacheClear() -
startCacheClear
-
startGraphQLSchemaBuild
- Throws:
GraphQLBuildException
-
startGraphQLSchemaBuild
- Throws:
GraphQLBuildException
-
destroy
public void destroy() throws org.craftercms.core.exception.CrafterException- Throws:
org.craftercms.core.exception.CrafterException
-
getFromCache
-
cacheClear
protected void cacheClear() -
buildGraphQLSchema
protected void buildGraphQLSchema() -
executeInitScript
protected void executeInitScript() -
publishEvent
-
equals
-
hashCode
public int hashCode() -
toString
-