Class SiteContext
- java.lang.Object
-
- org.craftercms.engine.service.context.SiteContext
-
public class SiteContext extends Object
Wrapper for aContext
that adds properties specific to Crafter Engine.- Author:
- Alfonso Vásquez
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SiteContext.State
-
Field Summary
Fields Modifier and Type Field Description protected String[]
allowedTemplatePaths
protected org.springframework.context.ConfigurableApplicationContext
applicationContext
protected org.craftercms.core.util.cache.CacheTemplate
cacheTemplate
protected SiteCacheWarmer
cacheWarmer
protected URLClassLoader
classLoader
protected org.apache.commons.configuration2.HierarchicalConfiguration
config
protected org.craftercms.core.service.Context
context
protected String
controllerScriptsPath
protected boolean
fallback
protected org.springframework.web.servlet.view.freemarker.FreeMarkerConfig
freeMarkerConfig
protected org.springframework.context.ApplicationContext
globalApplicationContext
protected graphql.GraphQL
graphQL
protected GraphQLFactory
graphQLFactory
protected CountDownLatch
initializationLatch
protected String
initScriptPath
protected long
initTimeout
protected org.springframework.web.servlet.LocaleResolver
localeResolver
protected ExecutorService
maintenanceTaskExecutor
protected org.apache.commons.configuration2.HierarchicalConfiguration
proxyConfig
protected String
restScriptsPath
protected org.quartz.Scheduler
scheduler
protected ScriptFactory
scriptFactory
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor
scriptSandbox
protected String
siteName
protected SiteContext.State
state
protected String
staticAssetsPath
protected org.craftercms.core.service.ContentStoreService
storeService
protected String
templatesPath
protected org.apache.commons.configuration2.HierarchicalConfiguration
translationConfig
protected org.tuckey.web.filters.urlrewrite.UrlRewriter
urlRewriter
protected org.craftercms.core.url.UrlTransformationEngine
urlTransformationEngine
-
Constructor Summary
Constructors Constructor Description SiteContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildGraphQLSchema()
protected void
cacheClear()
static void
clear()
Removes the context from the current thread.void
destroy()
boolean
equals(Object o)
protected void
executeInitScript()
String[]
getAllowedTemplatePaths()
org.springframework.context.ConfigurableApplicationContext
getApplicationContext()
org.craftercms.core.util.cache.CacheTemplate
getCacheTemplate()
SiteCacheWarmer
getCacheWarmer()
URLClassLoader
getClassLoader()
org.apache.commons.configuration2.HierarchicalConfiguration
getConfig()
org.craftercms.core.service.Context
getContext()
String
getControllerScriptsPath()
static SiteContext
getCurrent()
Returns the context for the current thread.org.springframework.web.servlet.view.freemarker.FreeMarkerConfig
getFreeMarkerConfig()
<T> T
getFromCache(org.craftercms.commons.lang.Callback<T> loader, Object... keyElements)
static <T> T
getFromCurrentCache(org.craftercms.commons.lang.Callback<T> loader, Object... keyElements)
Returns the item from the cache of the current site context.org.springframework.context.ApplicationContext
getGlobalApplicationContext()
graphql.GraphQL
getGraphQL()
GraphQLFactory
getGraphQLFactory()
String
getInitScriptPath()
org.springframework.web.servlet.LocaleResolver
getLocaleResolver()
org.apache.commons.configuration2.HierarchicalConfiguration
getProxyConfig()
String
getRestScriptsPath()
org.quartz.Scheduler
getScheduler()
ScriptFactory
getScriptFactory()
String
getSiteName()
SiteContext.State
getState()
String
getStaticAssetsPath()
org.craftercms.core.service.ContentStoreService
getStoreService()
String
getTemplatesPath()
org.apache.commons.configuration2.HierarchicalConfiguration
getTranslationConfig()
org.tuckey.web.filters.urlrewrite.UrlRewriter
getUrlRewriter()
org.craftercms.core.url.UrlTransformationEngine
getUrlTransformationEngine()
int
hashCode()
void
init(boolean waitTillFinished)
boolean
isFallback()
boolean
isTranslationEnabled()
boolean
isValid()
protected void
publishEvent(SiteEvent event)
protected static void
release(SiteContext siteContext)
void
setAllowedTemplatePaths(String[] allowedTemplatePaths)
void
setApplicationContext(org.springframework.context.ConfigurableApplicationContext applicationContext)
void
setCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate)
void
setCacheWarmer(SiteCacheWarmer cacheWarmer)
void
setClassLoader(URLClassLoader classLoader)
void
setConfig(org.apache.commons.configuration2.HierarchicalConfiguration config)
void
setContext(org.craftercms.core.service.Context context)
void
setControllerScriptsPath(String controllerScriptsPath)
static void
setCurrent(SiteContext siteContext)
Sets the context for the current thread.void
setFallback(boolean fallback)
void
setFreeMarkerConfig(org.springframework.web.servlet.view.freemarker.FreeMarkerConfig freeMarkerConfig)
void
setGlobalApplicationContext(org.springframework.context.ApplicationContext globalApplicationContext)
void
setGraphQLFactory(GraphQLFactory graphQLFactory)
void
setInitScriptPath(String initScriptPath)
void
setInitTimeout(long initTimeout)
void
setLocaleResolver(org.springframework.web.servlet.LocaleResolver localeResolver)
void
setProxyConfig(org.apache.commons.configuration2.HierarchicalConfiguration proxyConfig)
void
setRestScriptsPath(String restScriptsPath)
void
setScheduler(org.quartz.Scheduler scheduler)
void
setScriptFactory(ScriptFactory scriptFactory)
void
setServletContext(javax.servlet.ServletContext servletContext)
void
setShutdownTimeout(long shutdownTimeout)
void
setSiteName(String siteName)
void
setStaticAssetsPath(String staticAssetsPath)
void
setStoreService(org.craftercms.core.service.ContentStoreService storeService)
void
setTemplatesPath(String templatesPath)
void
setTranslationConfig(org.apache.commons.configuration2.HierarchicalConfiguration translationConfig)
void
setUrlRewriter(org.tuckey.web.filters.urlrewrite.UrlRewriter urlRewriter)
void
setUrlTransformationEngine(org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine)
void
startCacheClear()
void
startGraphQLSchemaBuild()
String
toString()
-
-
-
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
-
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
-
-
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 cachekeyElements
- 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(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)
-
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
-
startCacheClear
public void startCacheClear()
-
startGraphQLSchemaBuild
public void startGraphQLSchemaBuild() 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)
-
-