Class ScriptingServiceInternalImpl

java.lang.Object
org.craftercms.studio.impl.v2.service.scripting.internal.ScriptingServiceInternalImpl
All Implemented Interfaces:
ScriptingServiceInternal, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class ScriptingServiceInternalImpl extends Object implements ScriptingServiceInternal, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Default implementation of ScriptingServiceInternal
Since:
4.0
Author:
joseross
  • Field Details

    • KEY_SITE_ID

      public static final String KEY_SITE_ID
      See Also:
    • KEY_PARAMS

      public static final String KEY_PARAMS
      See Also:
    • KEY_PLUGIN_ID

      public static final String KEY_PLUGIN_ID
      See Also:
    • KEY_PLUGIN_CONFIG

      public static final String KEY_PLUGIN_CONFIG
      See Also:
    • KEY_REQUEST

      public static final String KEY_REQUEST
      See Also:
    • KEY_RESPONSE

      public static final String KEY_RESPONSE
      See Also:
    • KEY_LOGGER

      public static final String KEY_LOGGER
      See Also:
    • KEY_APP_CONTEXT

      public static final String KEY_APP_CONTEXT
      See Also:
    • pattern

      protected Pattern pattern
    • scriptEngineManager

      protected ScriptEngineManager scriptEngineManager
    • sandboxInterceptor

      protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor
    • scriptExtension

      protected String scriptExtension
    • scriptPathFormat

      protected String scriptPathFormat
    • enableVariableRestrictions

      protected boolean enableVariableRestrictions
    • allowedBeans

      protected String[] allowedBeans
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • applicationContextAccessor

      protected org.craftercms.engine.util.spring.ApplicationContextAccessor applicationContextAccessor
    • marketplaceService

      protected MarketplaceService marketplaceService
    • contentService

      protected ContentService contentService
    • studioConfiguration

      protected StudioConfiguration studioConfiguration
  • Constructor Details

    • ScriptingServiceInternalImpl

      @ConstructorProperties({"scriptEngineManager","sandboxInterceptor","scriptExtension","scriptPathFormat","enableVariableRestrictions","allowedBeans","marketplaceService","contentService","studioConfiguration"}) public ScriptingServiceInternalImpl(ScriptEngineManager scriptEngineManager, org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor, String scriptExtension, String scriptPathFormat, boolean enableVariableRestrictions, String[] allowedBeans, MarketplaceService marketplaceService, ContentService contentService, StudioConfiguration studioConfiguration)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • executeRestScript

      public Object executeRestScript(String siteId, String scriptUrl, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws groovy.util.ResourceException, groovy.util.ScriptException, ConfigurationException
      Description copied from interface: ScriptingServiceInternal
      Executes a REST script from the site repository
      Specified by:
      executeRestScript in interface ScriptingServiceInternal
      Parameters:
      siteId - the id of the site
      scriptUrl - the path of the script
      request - the current request
      response - the current response
      Returns:
      the value returned by the script
      Throws:
      groovy.util.ResourceException - if there is any error loading the script
      groovy.util.ScriptException - if there is any error executing the script
      ConfigurationException
    • createBinding

      protected groovy.lang.Binding createBinding(String siteId, String scriptUrl, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws ConfigurationException
      Throws:
      ConfigurationException
    • reload

      public void reload(String siteId)
      Description copied from interface: ScriptingServiceInternal
      Reloads the classpath for the given site
      Specified by:
      reload in interface ScriptingServiceInternal
      Parameters:
      siteId - the id of the site
    • getPluginId

      protected String getPluginId(String siteId, String scriptUrl)
    • getPluginConfiguration

      protected org.apache.commons.configuration2.Configuration getPluginConfiguration(String siteId, String pluginId) throws ConfigurationException
      Throws:
      ConfigurationException