use of org.apache.struts.config.PlugInConfig in project sonar-java by SonarSource.
the class TestTilesPlugin method createModuleConfig.
// ------------------------------------------------------- Individual Tests
/**
* Create a module configuration
* @param moduleName
*/
public ModuleConfig createModuleConfig(String moduleName, String configFileName, boolean moduleAware) {
ModuleConfig moduleConfig = ModuleConfigFactory.createFactory().createModuleConfig(moduleName);
context.setAttribute(Globals.MODULE_KEY + moduleName, moduleConfig);
// Set tiles plugin
PlugInConfig pluginConfig = new PlugInConfig();
pluginConfig.setClassName("org.apache.struts.tiles.TilesPlugin");
pluginConfig.addProperty("moduleAware", (moduleAware == true ? "true" : "false"));
pluginConfig.addProperty("definitions-config", "/org/apache/struts/tiles/config/" + configFileName);
moduleConfig.addPlugInConfig(pluginConfig);
return moduleConfig;
}
use of org.apache.struts.config.PlugInConfig in project sonar-java by SonarSource.
the class ActionServlet method initModulePlugIns.
/**
* <p>Initialize the plug ins for the specified module.</p>
*
* @param config ModuleConfig information for this module
* @throws ServletException if initialization cannot be performed
* @since Struts 1.1
*/
protected void initModulePlugIns(ModuleConfig config) throws ServletException {
if (log.isDebugEnabled()) {
log.debug("Initializing module path '" + config.getPrefix() + "' plug ins");
}
PlugInConfig[] plugInConfigs = config.findPlugInConfigs();
PlugIn[] plugIns = new PlugIn[plugInConfigs.length];
getServletContext().setAttribute(Globals.PLUG_INS_KEY + config.getPrefix(), plugIns);
for (int i = 0; i < plugIns.length; i++) {
try {
plugIns[i] = (PlugIn) RequestUtils.applicationInstance(plugInConfigs[i].getClassName());
BeanUtils.populate(plugIns[i], plugInConfigs[i].getProperties());
// This plugin config object is needed by Tiles
try {
PropertyUtils.setProperty(plugIns[i], "currentPlugInConfigObject", plugInConfigs[i]);
} catch (Exception e) {
;
// FIXME Whenever we fail silently, we must document a valid
// reason for doing so. Why should we fail silently if a
// property can't be set on the plugin?
/**
* Between version 1.138-1.140 cedric made these changes.
* The exceptions are caught to deal with containers
* applying strict security. This was in response to bug
* #15736
*
* Recommend that we make the currentPlugInConfigObject part
* of the PlugIn Interface if we can, Rob
*/
}
plugIns[i].init(this, config);
} catch (ServletException e) {
throw e;
} catch (Exception e) {
String errMsg = internal.getMessage("plugIn.init", plugInConfigs[i].getClassName());
log(errMsg, e);
throw new UnavailableException(errMsg);
}
}
}
use of org.apache.struts.config.PlugInConfig in project sonarqube by SonarSource.
the class ActionServlet method initModulePlugIns.
/**
* <p>Initialize the plug ins for the specified module.</p>
*
* @param config ModuleConfig information for this module
* @throws ServletException if initialization cannot be performed
* @since Struts 1.1
*/
protected void initModulePlugIns(ModuleConfig config) throws ServletException {
if (log.isDebugEnabled()) {
log.debug("Initializing module path '" + config.getPrefix() + "' plug ins");
}
PlugInConfig[] plugInConfigs = config.findPlugInConfigs();
PlugIn[] plugIns = new PlugIn[plugInConfigs.length];
getServletContext().setAttribute(Globals.PLUG_INS_KEY + config.getPrefix(), plugIns);
for (int i = 0; i < plugIns.length; i++) {
try {
plugIns[i] = (PlugIn) RequestUtils.applicationInstance(plugInConfigs[i].getClassName());
BeanUtils.populate(plugIns[i], plugInConfigs[i].getProperties());
// This plugin config object is needed by Tiles
try {
PropertyUtils.setProperty(plugIns[i], "currentPlugInConfigObject", plugInConfigs[i]);
} catch (Exception e) {
;
// FIXME Whenever we fail silently, we must document a valid
// reason for doing so. Why should we fail silently if a
// property can't be set on the plugin?
/**
* Between version 1.138-1.140 cedric made these changes.
* The exceptions are caught to deal with containers
* applying strict security. This was in response to bug
* #15736
*
* Recommend that we make the currentPlugInConfigObject part
* of the PlugIn Interface if we can, Rob
*/
}
plugIns[i].init(this, config);
} catch (ServletException e) {
throw e;
} catch (Exception e) {
String errMsg = internal.getMessage("plugIn.init", plugInConfigs[i].getClassName());
log(errMsg, e);
throw new UnavailableException(errMsg);
}
}
}
use of org.apache.struts.config.PlugInConfig in project sonarqube by SonarSource.
the class ModuleConfigImpl method freeze.
/**
* <p> Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return an
* IllegalStateException. </p>
*/
public void freeze() {
super.freeze();
ActionConfig[] aconfigs = findActionConfigs();
for (int i = 0; i < aconfigs.length; i++) {
aconfigs[i].freeze();
}
matcher = new ActionConfigMatcher(aconfigs);
getControllerConfig().freeze();
ExceptionConfig[] econfigs = findExceptionConfigs();
for (int i = 0; i < econfigs.length; i++) {
econfigs[i].freeze();
}
FormBeanConfig[] fbconfigs = findFormBeanConfigs();
for (int i = 0; i < fbconfigs.length; i++) {
fbconfigs[i].freeze();
}
ForwardConfig[] fconfigs = findForwardConfigs();
for (int i = 0; i < fconfigs.length; i++) {
fconfigs[i].freeze();
}
MessageResourcesConfig[] mrconfigs = findMessageResourcesConfigs();
for (int i = 0; i < mrconfigs.length; i++) {
mrconfigs[i].freeze();
}
PlugInConfig[] piconfigs = findPlugInConfigs();
for (int i = 0; i < piconfigs.length; i++) {
piconfigs[i].freeze();
}
}
use of org.apache.struts.config.PlugInConfig in project sonar-java by SonarSource.
the class ModuleConfigImpl method freeze.
/**
* <p> Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return an
* IllegalStateException. </p>
*/
public void freeze() {
super.freeze();
ActionConfig[] aconfigs = findActionConfigs();
for (int i = 0; i < aconfigs.length; i++) {
aconfigs[i].freeze();
}
matcher = new ActionConfigMatcher(aconfigs);
getControllerConfig().freeze();
ExceptionConfig[] econfigs = findExceptionConfigs();
for (int i = 0; i < econfigs.length; i++) {
econfigs[i].freeze();
}
FormBeanConfig[] fbconfigs = findFormBeanConfigs();
for (int i = 0; i < fbconfigs.length; i++) {
fbconfigs[i].freeze();
}
ForwardConfig[] fconfigs = findForwardConfigs();
for (int i = 0; i < fconfigs.length; i++) {
fconfigs[i].freeze();
}
MessageResourcesConfig[] mrconfigs = findMessageResourcesConfigs();
for (int i = 0; i < mrconfigs.length; i++) {
mrconfigs[i].freeze();
}
PlugInConfig[] piconfigs = findPlugInConfigs();
for (int i = 0; i < piconfigs.length; i++) {
piconfigs[i].freeze();
}
}
Aggregations