Class ExtensibilityContainer
- java.lang.Object
-
- org.springframework.extensions.webscripts.AbstractRuntimeContainer
-
- org.alfresco.repo.web.scripts.RepositoryContainer
-
- org.alfresco.repo.web.scripts.ExtensibilityContainer
-
- All Implemented Interfaces:
java.util.EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener,org.springframework.extensions.surf.extensibility.HandlesExtensibility,org.springframework.extensions.webscripts.Container,org.springframework.extensions.webscripts.RuntimeContainer
public class ExtensibilityContainer extends RepositoryContainer implements org.springframework.extensions.surf.extensibility.HandlesExtensibility
A simple extensibility
Containerfor processing WebScripts. This extends theRepositoryContainerand implements theHandlesExtensibilityinterface to provide extensibility capabilities.- Author:
- David Draper
-
-
Constructor Summary
Constructors Constructor Description ExtensibilityContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtensibilityDirectives(java.util.Map<java.lang.String,java.lang.Object> freeMarkerModel, org.springframework.extensions.surf.extensibility.ExtensibilityModel extModel)Adds the <@markup> directive to the container which allows FreeMarker templates to be extended.voidaddExtensionBundleToCache(java.lang.String webScriptId, org.springframework.extensions.webscripts.WebScriptPropertyResourceBundle extensionBundle)Adds a new extended bundle to the cache.voidcloseExtensibilityModel(org.springframework.extensions.surf.extensibility.ExtensibilityModel model, java.io.Writer out)Flushes theExtensibilityModelprovided and sets its parent as the currentExtensibilityModelfor the current thread.voidexecuteScript(org.springframework.extensions.webscripts.WebScriptRequest scriptReq, org.springframework.extensions.webscripts.WebScriptResponse scriptRes, org.springframework.extensions.webscripts.Authenticator auth)Opens a newExtensibilityModel, defers execution to the extendedRepositoryContainerand then closes theExtensibilityModel.java.util.ResourceBundlegetCachedExtendedBundle(java.lang.String webScriptId)Checks the cache to see if it has cached an extended bundle (that is a basicResourceBundlethat has had extension modules applied to it.org.springframework.extensions.surf.extensibility.ExtensibilityModelgetCurrentExtensibilityModel()Returns theExtensibilityModelfor the current thread.java.util.List<org.springframework.extensions.surf.extensibility.BasicExtensionModule>getEvaluatedModules()Retrieve the list oforg.springframework.extensions.surf.types.ExtensionModuleinstances that have been evaluated as applicable for the current request.org.springframework.extensions.webscripts.ScriptConfigModelgetExtendedScriptConfigModel(java.lang.String xmlConfig)Creates a newExtendedScriptConfigModelinstance using the local configuration generated for this request.org.springframework.extensions.webscripts.TemplateConfigModelgetExtendedTemplateConfigModel(java.lang.String xmlConfig)Creates a newTemplateConfigModelinstance using the local configuration generated for this request.java.util.List<java.lang.String>getExtendingModuleFiles(java.lang.String pathBeingProcessed)Retrieves an files for the evaluated modules that are extending the WebScript files being processed.java.lang.StringgetFileBeingProcessed()Returns the path of the file currently being processed in the model by the current thread.booleanisExtensibilitySuppressed()org.springframework.extensions.surf.extensibility.ExtensibilityModelopenExtensibilityModel()Creates a newExtensibilityModeland sets it on the current threadvoidsetExtensibilityModuleHandler(org.springframework.extensions.surf.extensibility.WebScriptExtensibilityModuleHandler extensibilityModuleHandler)Sets theWebScriptExtensibilityModuleHandlerfor thisContainer.voidsetFileBeingProcessed(java.lang.String file)Sets the path of the file currently being processed in the model by the current thread.voidupdateExtendingModuleDependencies(java.lang.String pathBeingProcessed, java.util.Map<java.lang.String,java.lang.Object> model)This method is implemented to perform no action as it is not necessary for a standalone WebScript container to add dependencies for processing.-
Methods inherited from class org.alfresco.repo.web.scripts.RepositoryContainer
authenticate, executeScriptInternal, getDescription, getNotPublicExceptions, getPublicExceptions, getRequiredAuthentication, getScriptParameters, getTemplateParameters, onApplicationEvent, reset, setAuthorityService, setDescriptorService, setEncryptTempFiles, setFallbackTransactionHelper, setMaxContentSize, setMemoryThreshold, setNotPublicExceptions, setPreserveHeadersPattern, setPublicExceptions, setRepository, setRepositoryImageResolver, setTempDirectoryName, setTransactionService, setup, transactionedExecute
-
Methods inherited from class org.springframework.extensions.webscripts.AbstractRuntimeContainer
allowCallbacks, getApplicationContext, getConfigService, getFormatRegistry, getName, getRegistry, getScriptParameterFactoryRegistry, getScriptProcessorRegistry, getSearchPath, getTemplateProcessorRegistry, setAllowCallbacks, setApplicationContext, setConfigService, setFormatRegistry, setName, setRegistry, setScriptObjects, setScriptParameterFactoryRegistry, setScriptProcessorRegistry, setSearchPath, setTemplateObjects, setTemplateProcessorRegistry
-
-
-
-
Method Detail
-
isExtensibilitySuppressed
public boolean isExtensibilitySuppressed()
- Specified by:
isExtensibilitySuppressedin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
executeScript
public void executeScript(org.springframework.extensions.webscripts.WebScriptRequest scriptReq, org.springframework.extensions.webscripts.WebScriptResponse scriptRes, org.springframework.extensions.webscripts.Authenticator auth) throws java.io.IOExceptionOpens a new
ExtensibilityModel, defers execution to the extendedRepositoryContainerand then closes theExtensibilityModel.- Specified by:
executeScriptin interfaceorg.springframework.extensions.webscripts.RuntimeContainer- Overrides:
executeScriptin classRepositoryContainer- Throws:
java.io.IOException
-
setExtensibilityModuleHandler
public void setExtensibilityModuleHandler(org.springframework.extensions.surf.extensibility.WebScriptExtensibilityModuleHandler extensibilityModuleHandler)
Sets the
WebScriptExtensibilityModuleHandlerfor thisContainer.- Parameters:
extensibilityModuleHandler- WebScriptExtensibilityModuleHandler
-
openExtensibilityModel
public org.springframework.extensions.surf.extensibility.ExtensibilityModel openExtensibilityModel()
Creates a new
ExtensibilityModeland sets it on the current thread- Specified by:
openExtensibilityModelin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
closeExtensibilityModel
public void closeExtensibilityModel(org.springframework.extensions.surf.extensibility.ExtensibilityModel model, java.io.Writer out)Flushes the
ExtensibilityModelprovided and sets its parent as the currentExtensibilityModelfor the current thread.- Specified by:
closeExtensibilityModelin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
getCurrentExtensibilityModel
public org.springframework.extensions.surf.extensibility.ExtensibilityModel getCurrentExtensibilityModel()
Returns the
ExtensibilityModelfor the current thread.- Specified by:
getCurrentExtensibilityModelin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
updateExtendingModuleDependencies
public void updateExtendingModuleDependencies(java.lang.String pathBeingProcessed, java.util.Map<java.lang.String,java.lang.Object> model)This method is implemented to perform no action as it is not necessary for a standalone WebScript container to add dependencies for processing.
- Specified by:
updateExtendingModuleDependenciesin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
getCachedExtendedBundle
public java.util.ResourceBundle getCachedExtendedBundle(java.lang.String webScriptId)
Checks the cache to see if it has cached an extended bundle (that is a basic
ResourceBundlethat has had extension modules applied to it. Extended bundles can only be safely cached once per request as the modules applied can vary for each request.- Specified by:
getCachedExtendedBundlein interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility- Parameters:
webScriptId- The id of the WebScript to retrieve the extended bundle for.- Returns:
- A cached bundle or
nullif the bundle has not previously been cached.
-
addExtensionBundleToCache
public void addExtensionBundleToCache(java.lang.String webScriptId, org.springframework.extensions.webscripts.WebScriptPropertyResourceBundle extensionBundle)Adds a new extended bundle to the cache. An extended bundle is a WebScript
ResourceBundlethat has hadResourceBundleinstances merged into it from extension modules that have been applied. These can only be cached for the lifetime of the request as different modules may be applied to the same WebScript for different requests.- Specified by:
addExtensionBundleToCachein interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility- Parameters:
webScriptId- The id of the WebScript to cache the extended bundle against.extensionBundle- The extended bundle to cache.
-
getFileBeingProcessed
public java.lang.String getFileBeingProcessed()
Returns the path of the file currently being processed in the model by the current thread. This information is primarily provided for the purposes of generating debug information.
- Specified by:
getFileBeingProcessedin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility- Returns:
- The path of the file currently being processed.
-
setFileBeingProcessed
public void setFileBeingProcessed(java.lang.String file)
Sets the path of the file currently being processed in the model by the current thread. This information should be collected to assist with providing debug information.
- Specified by:
setFileBeingProcessedin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility- Parameters:
file- The path of the file currently being processed.
-
getExtendingModuleFiles
public java.util.List<java.lang.String> getExtendingModuleFiles(java.lang.String pathBeingProcessed)
Retrieves an files for the evaluated modules that are extending the WebScript files being processed.
- Specified by:
getExtendingModuleFilesin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
getEvaluatedModules
public java.util.List<org.springframework.extensions.surf.extensibility.BasicExtensionModule> getEvaluatedModules()
Retrieve the list of
org.springframework.extensions.surf.types.ExtensionModuleinstances that have been evaluated as applicable for the current request. If this list has not yet been populated then use theorg.springframework.extensions.surf.extensibility.ExtensibilityModuleHandlerconfigured in the Spring application context to evaluate them.- Returns:
- A list of
org.springframework.extensions.surf.types.ExtensionModuleinstances that are applicable to the current request.
-
getExtendedScriptConfigModel
public org.springframework.extensions.webscripts.ScriptConfigModel getExtendedScriptConfigModel(java.lang.String xmlConfig)
Creates a new
ExtendedScriptConfigModelinstance using the local configuration generated for this request. If configuration for the request will be generated if it does not yet exist. It is likely that this method will be called multiple times within the context of a single request and although the configuration containers will always be the same a newExtendedScriptConfigModelinstance will always be created as the the suppliedxmlConfigstring could be different for each call (because each WebScript invoked in the request will supply different configuration.- Specified by:
getExtendedScriptConfigModelin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
getExtendedTemplateConfigModel
public org.springframework.extensions.webscripts.TemplateConfigModel getExtendedTemplateConfigModel(java.lang.String xmlConfig)
Creates a new
TemplateConfigModelinstance using the local configuration generated for this request. If configuration for the request will be generated if it does not yet exist. It is likely that this method will be called multiple times within the context of a single request and although the configuration containers will always be the same a newTemplateConfigModelinstance will always be created as the the suppliedxmlConfigstring could be different for each call (because each WebScript invoked in the request will supply different configuration.- Specified by:
getExtendedTemplateConfigModelin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
addExtensibilityDirectives
public void addExtensibilityDirectives(java.util.Map<java.lang.String,java.lang.Object> freeMarkerModel, org.springframework.extensions.surf.extensibility.ExtensibilityModel extModel)Adds the <@markup> directive to the container which allows FreeMarker templates to be extended.
- Specified by:
addExtensibilityDirectivesin interfaceorg.springframework.extensions.surf.extensibility.HandlesExtensibility
-
-