Class ExtensibilityContainer
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener,HandlesExtensibility,Container,RuntimeContainer
A simple extensibility Container for processing WebScripts. This extends the PresentationContainer and
implements the HandlesExtensibility interface so that a standalone WebScript runtime (i.e. one that is not
used within Surf) can process extensions.
- Author:
- David Draper
-
Field Summary
FieldsFields inherited from class org.springframework.extensions.webscripts.AbstractRuntimeContainer
applicationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtensibilityDirectives(Map<String, Object> freeMarkerModel, ExtensibilityModel extModel) Adds any custom FreeMarker directives required for rendering templates when being processed.voidaddExtensionBundleToCache(String webScriptId, WebScriptPropertyResourceBundle extensionBundle) Adds a new extended bundle to the cache.voidcloseExtensibilityModel(ExtensibilityModel model, Writer out) Flushes theExtensibilityModelprovided and sets its parent as the currentExtensibilityModelfor the current thread.getCachedExtendedBundle(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.Returns theExtensibilityModelfor the current thread.Retrieve the list ofExtensionModuleinstances that have been evaluated as applicable for the current request.getExtendedScriptConfigModel(String xmlConfig) Creates a newExtendedScriptConfigModelinstance using the local configuration generated for this request.getExtendedTemplateConfigModel(String xmlConfig) Creates a newTemplateConfigModelinstance using the local configuration generated for this request.getExtendingModuleFiles(String pathBeingProcessed) Returns aListof the files that should be applied to anExtensibilityModelbeing processed.Returns the path of the file currently being processed in the model by the current thread.booleanThis indicates that although extensibility is handled it has been temporarily suppressedCreates a newExtensibilityModeland sets it on the current threadvoidsetExtensibilityModuleHandler(WebScriptExtensibilityModuleHandler extensibilityModuleHandler) Sets theWebScriptExtensibilityModuleHandlerfor thisContainer.voidsetFileBeingProcessed(String file) Sets the path of the file currently being processed in the model by the current thread.voidupdateExtendingModuleDependencies(String pathBeingProcessed, Map<String, 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.springframework.extensions.webscripts.PresentationContainer
executeScript, getDescription, getUrlModelFactory, reset, setBeanNameMethods inherited from class org.springframework.extensions.webscripts.AbstractRuntimeContainer
allowCallbacks, authenticate, getApplicationContext, getConfigService, getFormatRegistry, getName, getRegistry, getRequiredAuthentication, getScriptParameterFactoryRegistry, getScriptParameters, getScriptProcessorRegistry, getSearchPath, getTemplateParameters, getTemplateProcessorRegistry, onApplicationEvent, setAllowCallbacks, setApplicationContext, setConfigService, setFormatRegistry, setName, setRegistry, setScriptObjects, setScriptParameterFactoryRegistry, setScriptProcessorRegistry, setSearchPath, setTemplateObjects, setTemplateProcessorRegistryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Field Details
-
MARKUP_DIRECTIVE_NAME
- See Also:
-
-
Constructor Details
-
ExtensibilityContainer
public ExtensibilityContainer()
-
-
Method Details
-
setExtensibilityModuleHandler
public void setExtensibilityModuleHandler(WebScriptExtensibilityModuleHandler extensibilityModuleHandler) Sets the
WebScriptExtensibilityModuleHandlerfor thisContainer.- Parameters:
extensibilityModuleHandler- WebScriptExtensibilityModuleHandler
-
openExtensibilityModel
Creates a new
ExtensibilityModeland sets it on the current thread- Specified by:
openExtensibilityModelin interfaceHandlesExtensibility- Returns:
- A reference to a new nested
ExtensibilityModel.
-
closeExtensibilityModel
Flushes the
ExtensibilityModelprovided and sets its parent as the currentExtensibilityModelfor the current thread.- Specified by:
closeExtensibilityModelin interfaceHandlesExtensibility- Parameters:
model- The model to close.out- TheWriterto render the output of the closed model to.
-
getCurrentExtensibilityModel
Returns the
ExtensibilityModelfor the current thread.- Specified by:
getCurrentExtensibilityModelin interfaceHandlesExtensibility- Returns:
- ExtensibilityModel
-
updateExtendingModuleDependencies
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 interfaceHandlesExtensibility- Parameters:
pathBeingProcessed- Stringmodel- Map<String, Object>
-
getCachedExtendedBundle
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 interfaceHandlesExtensibility- 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(String webScriptId, 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 interfaceHandlesExtensibility- Parameters:
webScriptId- The id of the WebScript to cache the extended bundle against.extensionBundle- The extended bundle to cache.
-
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 interfaceHandlesExtensibility- Returns:
- The path of the file currently being processed.
-
setFileBeingProcessed
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 interfaceHandlesExtensibility- Parameters:
file- The path of the file currently being processed.
-
getExtendingModuleFiles
Description copied from interface:HandlesExtensibilityReturns a
Listof the files that should be applied to anExtensibilityModelbeing processed.- Specified by:
getExtendingModuleFilesin interfaceHandlesExtensibility- Parameters:
pathBeingProcessed- The path of the file being processed. This will typically be a FreeMarker template, JavaScript controller or NLS properties file.- Returns:
- A
Listof the files that extend the current file being processed.
-
getEvaluatedModules
Retrieve the list of
ExtensionModuleinstances that have been evaluated as applicable for the current request. If this list has not yet been populated then use theExtensibilityModuleHandlerconfigured in the Spring application context to evaluate them.- Returns:
- A list of
ExtensionModuleinstances that are applicable to the current request.
-
getExtendedScriptConfigModel
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 interfaceHandlesExtensibility- Parameters:
xmlConfig- Optional additional XML configuration to include. This is typically provided by WebScripts.- Returns:
- A new
ExtendedScriptConfigModelornullif one could not be created.
-
getExtendedTemplateConfigModel
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 interfaceHandlesExtensibility- Parameters:
xmlConfig- Optional additional XML configuration to include. This is typically provided by WebScripts.- Returns:
- A new
ExtendedTemplateConfigModelornullif one could not be created.
-
addExtensibilityDirectives
public void addExtensibilityDirectives(Map<String, Object> freeMarkerModel, ExtensibilityModel extModel) Description copied from interface:HandlesExtensibilityAdds any custom FreeMarker directives required for rendering templates when being processed.
- Specified by:
addExtensibilityDirectivesin interfaceHandlesExtensibility- Parameters:
freeMarkerModel- The model to add the directives to.extModel- The currentExtensibilityModelbeing worked on.
-
isExtensibilitySuppressed
public boolean isExtensibilitySuppressed()Description copied from interface:HandlesExtensibilityThis indicates that although extensibility is handled it has been temporarily suppressed
- Specified by:
isExtensibilitySuppressedin interfaceHandlesExtensibility- Returns:
- boolean
-