Class PluginModuleXmlConfigurationProvider
- java.lang.Object
-
- com.atlassian.confluence.impl.struts.PluginModuleXmlConfigurationProvider
-
- All Implemented Interfaces:
com.opensymphony.xwork2.config.ConfigurationProvider,com.opensymphony.xwork2.config.ContainerProvider,com.opensymphony.xwork2.config.PackageProvider
public class PluginModuleXmlConfigurationProvider extends Object implements com.opensymphony.xwork2.config.ConfigurationProvider
Parses an XWork module element from a plugin for loading by the Struts configuration.
This class was intended to be a subclass of
XmlConfigurationProvider, however, due to the restricted visibility of some of its members it was not possible to achieve this cleanly.
-
-
Constructor Summary
Constructors Constructor Description PluginModuleXmlConfigurationProvider(org.dom4j.Element element, com.atlassian.plugin.Plugin plugin, Runnable disableModuleDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAction(Element actionElement, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes)protected com.opensymphony.xwork2.config.entities.PackageConfigaddPackage(Element packageElement)Create a PackageConfig from an XML element representing it.protected List<com.opensymphony.xwork2.config.entities.ResultTypeConfig>addResultTypes(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)protected Set<String>buildAllowedMethods(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext)protected List<com.opensymphony.xwork2.config.entities.ExceptionMappingConfig>buildExceptionMappings(Element element)Build a list of exception mapping objects from below a given XML element.protected List<com.opensymphony.xwork2.config.entities.InterceptorMapping>buildInterceptorList(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context)protected com.opensymphony.xwork2.config.entities.PackageConfig.BuilderbuildPackageContext(Element packageElement)This method builds a package context by looking for the parents of this new package.protected Map<String,com.opensymphony.xwork2.config.entities.ResultConfig>buildResults(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes)Build a map of ResultConfig objects from below a given XML element.voiddestroy()protected StringguessResultType(String type)voidinit(com.opensymphony.xwork2.config.Configuration configuration)protected voidloadDefaultActionRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)protected voidloadDefaultClassRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)protected voidloadDefaultInterceptorRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)protected voidloadGlobalAllowedMethods(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement)protected voidloadGlobalExceptionMappings(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement)Load all the global results for this package from the XML element.protected voidloadGlobalResults(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes)Load all the global results for this package from the XML element.protected voidloadInterceptors(com.opensymphony.xwork2.config.entities.PackageConfig.Builder context, Element element)protected com.opensymphony.xwork2.config.entities.InterceptorStackConfigloadInterceptorStack(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context)protected voidloadInterceptorStacks(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context)voidloadPackages()protected voidloadPackagesImpl()booleanneedsReload()voidregister(com.opensymphony.xwork2.inject.ContainerBuilder containerBuilder, com.opensymphony.xwork2.util.location.LocatableProperties locatableProperties)voidsetObjectFactory(com.opensymphony.xwork2.ObjectFactory objectFactory)protected booleanverifyAction(String className, com.opensymphony.xwork2.util.location.Location loc)protected ClassverifyResultType(String className, com.opensymphony.xwork2.util.location.Location loc)
-
-
-
Constructor Detail
-
PluginModuleXmlConfigurationProvider
public PluginModuleXmlConfigurationProvider(org.dom4j.Element element, com.atlassian.plugin.Plugin plugin, Runnable disableModuleDescriptor)
-
-
Method Detail
-
setObjectFactory
public void setObjectFactory(com.opensymphony.xwork2.ObjectFactory objectFactory)
-
init
public void init(com.opensymphony.xwork2.config.Configuration configuration) throws com.opensymphony.xwork2.config.ConfigurationException- Specified by:
initin interfacecom.opensymphony.xwork2.config.ContainerProvider- Specified by:
initin interfacecom.opensymphony.xwork2.config.PackageProvider- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
destroy
public void destroy()
- Specified by:
destroyin interfacecom.opensymphony.xwork2.config.ContainerProvider
-
needsReload
public boolean needsReload()
- Specified by:
needsReloadin interfacecom.opensymphony.xwork2.config.ContainerProvider- Specified by:
needsReloadin interfacecom.opensymphony.xwork2.config.PackageProvider
-
register
public void register(com.opensymphony.xwork2.inject.ContainerBuilder containerBuilder, com.opensymphony.xwork2.util.location.LocatableProperties locatableProperties) throws com.opensymphony.xwork2.config.ConfigurationException- Specified by:
registerin interfacecom.opensymphony.xwork2.config.ContainerProvider- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
loadPackages
public void loadPackages() throws com.opensymphony.xwork2.config.ConfigurationException- Specified by:
loadPackagesin interfacecom.opensymphony.xwork2.config.PackageProvider- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
loadPackagesImpl
protected void loadPackagesImpl() throws com.opensymphony.xwork2.config.ConfigurationException- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
addAction
protected void addAction(Element actionElement, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes) throws com.opensymphony.xwork2.config.ConfigurationException
- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
verifyAction
protected boolean verifyAction(String className, com.opensymphony.xwork2.util.location.Location loc)
-
addPackage
protected com.opensymphony.xwork2.config.entities.PackageConfig addPackage(Element packageElement) throws com.opensymphony.xwork2.config.ConfigurationException
Create a PackageConfig from an XML element representing it.- Parameters:
packageElement- the given XML element- Returns:
- the package config
- Throws:
com.opensymphony.xwork2.config.ConfigurationException- in case of configuration errors
-
addResultTypes
protected List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> addResultTypes(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)
-
verifyResultType
protected Class verifyResultType(String className, com.opensymphony.xwork2.util.location.Location loc)
-
buildInterceptorList
protected List<com.opensymphony.xwork2.config.entities.InterceptorMapping> buildInterceptorList(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context) throws com.opensymphony.xwork2.config.ConfigurationException
- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
buildPackageContext
protected com.opensymphony.xwork2.config.entities.PackageConfig.Builder buildPackageContext(Element packageElement)
This method builds a package context by looking for the parents of this new package.
If no parents are found, it will return a root package.
- Parameters:
packageElement- the package element- Returns:
- the package config builder
-
buildResults
protected Map<String,com.opensymphony.xwork2.config.entities.ResultConfig> buildResults(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes)
Build a map of ResultConfig objects from below a given XML element.- Parameters:
element- the given XML elementpackageContext- the package context- Returns:
- map of result config objects
-
buildExceptionMappings
protected List<com.opensymphony.xwork2.config.entities.ExceptionMappingConfig> buildExceptionMappings(Element element)
Build a list of exception mapping objects from below a given XML element.- Parameters:
element- the given XML element- Returns:
- list of exception mapping config objects
-
buildAllowedMethods
protected Set<String> buildAllowedMethods(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext)
-
loadDefaultInterceptorRef
protected void loadDefaultInterceptorRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)
-
loadDefaultActionRef
protected void loadDefaultActionRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)
-
loadGlobalResults
protected void loadGlobalResults(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement, List<com.opensymphony.xwork2.config.entities.ResultTypeConfig> packageResultTypes)Load all the global results for this package from the XML element.- Parameters:
packageContext- the package contextpackageElement- the given XML element
-
loadGlobalAllowedMethods
protected void loadGlobalAllowedMethods(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement)
-
loadDefaultClassRef
protected void loadDefaultClassRef(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element element)
-
loadGlobalExceptionMappings
protected void loadGlobalExceptionMappings(com.opensymphony.xwork2.config.entities.PackageConfig.Builder packageContext, Element packageElement)Load all the global results for this package from the XML element.- Parameters:
packageContext- the package contextpackageElement- the given XML element
-
loadInterceptorStack
protected com.opensymphony.xwork2.config.entities.InterceptorStackConfig loadInterceptorStack(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context) throws com.opensymphony.xwork2.config.ConfigurationException
- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
loadInterceptorStacks
protected void loadInterceptorStacks(Element element, com.opensymphony.xwork2.config.entities.PackageConfig.Builder context) throws com.opensymphony.xwork2.config.ConfigurationException
- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
loadInterceptors
protected void loadInterceptors(com.opensymphony.xwork2.config.entities.PackageConfig.Builder context, Element element) throws com.opensymphony.xwork2.config.ConfigurationException- Throws:
com.opensymphony.xwork2.config.ConfigurationException
-
-