oneWay = false ;
defaultProcessing = false ;
}
else
{
throw new ConfigurationException("Unrecognised action MEP: " + mep) ;
}
final boolean validate = config.getBooleanAttribute(ListenerTagNames.VALIDATE_ATTRIBUTE_TAG, false) ;
if (validate)
{
final String inXsd = config.getAttribute(ListenerTagNames.IN_XSD_ATTRIBUTE_TAG) ;
try
{
requestSchema = (inXsd == null ? null : XMLHelper.getSchema(inXsd)) ;
}
catch (final SAXException saxe)
{
throw new ConfigurationException("Failed to parse the request schema: " + inXsd, saxe) ;
}
final String outXsd = config.getAttribute(ListenerTagNames.OUT_XSD_ATTRIBUTE_TAG) ;
try
{
responseSchema = (outXsd == null ? null : XMLHelper.getSchema(outXsd));
}
catch (final SAXException saxe)
{
throw new ConfigurationException("Failed to parse the response schema: " + outXsd, saxe) ;
}
requestPayloadProxy = new MessagePayloadProxy(config.getAttribute(ListenerTagNames.REQUEST_LOCATION_TAG), null) ;
responsePayloadProxy = new MessagePayloadProxy(config.getAttribute(ListenerTagNames.RESPONSE_LOCATION_TAG), null) ;
}
else
{
requestSchema = null ;
responseSchema = null ;
}
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using mep: " + mep + ", oneWay: " + oneWay + ", defaultProcessing: " + defaultProcessing) ;
}
this.oneWay = oneWay ;
this.defaultProcessing = defaultProcessing ;
final ConfigTree[] actionList = config
.getChildren(ListenerTagNames.ACTION_ELEMENT_TAG);
if ((actionList == null) || (actionList.length == 0))
{
throw new ConfigurationException("No actions in list");
}
final ArrayList<ActionPipelineProcessor> processorList = new ArrayList<ActionPipelineProcessor>();
try
{
serviceMessageCounter = ServiceMessageCounterLifecycleResource.getServiceMessageCounter(config);
}
catch (final LifecycleResourceException lre)
{
throw new ConfigurationException("Failed to obtain the service message counter", lre);
}
for (final ConfigTree actionConfig : actionList)
{
final String actionClassTag = actionConfig
.getAttribute(ListenerTagNames.ACTION_CLASS_TAG);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Registering action class " + actionClassTag);
}
final Class<?> actionClass;
try
{
actionClass = ClassUtil.forName(actionClassTag, getClass());
}
catch (final ClassNotFoundException cnfe)
{
throw new ConfigurationException("Could not load action class "
+ actionClassTag);
}
final ActionPipelineProcessor processor;
if (BeanConfiguredAction.class.isAssignableFrom(actionClass))
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using bean configured action processor for "
+ actionClassTag);
}
processor = new BeanConfigActionProcessor(actionConfig,
actionClass);
}
else if (ActionPipelineProcessor.class
.isAssignableFrom(actionClass))
{
final ActionPipelineProcessor currentProcessor = (ActionPipelineProcessor) ActionProcessorMethodInfo
.getActionClassInstance(actionConfig, actionClass);
if (ActionProcessorMethodInfo.checkOverridden(actionConfig))
{
if (LOGGER.isDebugEnabled())
{
LOGGER
.debug("Using overridden action pipeline processor for "
+ actionClassTag);
}
processor = new OverriddenActionPipelineProcessor(
actionConfig, currentProcessor);
}
else
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using normal action pipeline processor for " + actionClassTag);
}
processor = currentProcessor;
}
}
else if (ActionLifecycle.class.isAssignableFrom(actionClass))
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using overridden action lifecycle processor for " + actionClassTag);
}
final ActionLifecycle currentLifecycle = (ActionLifecycle) ActionProcessorMethodInfo
.getActionClassInstance(actionConfig, actionClass);
processor = new OverriddenActionLifecycleProcessor(
actionConfig, currentLifecycle);
}
else if (BeanContainerAction.isAnnotatedActionClass(actionClass))
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using BeanContainerAction for Annotated Action processor for " + actionClassTag);
}
try {
processor = new BeanContainerAction(actionClass.newInstance(), actionConfig);
} catch (InstantiationException e) {
throw new ConfigurationException("Failed to create an instance of Annotated ESB Action class '" + actionClass.getName() + "'. Class must contain a default public constructor.", e);
} catch (IllegalAccessException e) {
throw new ConfigurationException("Failed to create an instance of Annotated ESB Action class '" + actionClass.getName() + "'. Class must contain a default public constructor.", e);
}
}
else
{
LOGGER.warn("Action class " + actionClassTag + " does not: a) implement the ActionLifecycle interface, or b) have any public method annotated with the @ProcessMethod annotation.");
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Using overridden actions processor for " + actionClassTag);
}
processor = new OverriddenActionProcessor(actionConfig, actionClass);
}
processorList.add(processor);
}
processors = processorList.toArray(new ActionPipelineProcessor[processorList.size()]);
ConfigTree[] securityConfigs = config.getChildren( ListenerTagNames.SECURITY_TAG );
String securityPropagatorClass = null;
if (securityConfigs.length > 0)
{
securityConf = SecurityConfigUtil.createSecurityConfig(securityConfigs[0]);
// Check if a security context propagator was specified in the security element.
securityPropagatorClass = securityConf.getProperties().get(Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS);
}
serviceName = config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
try
{
securityContextPropagator = securityPropagatorClass != null ?
SecurityContextPropagatorFactory.create(securityPropagatorClass):
SecurityContextPropagatorFactory.createFromConfig();
}
catch (final SecurityServiceException e)
{
final String errorMsg;
if (securityPropagatorClass != null )
{
errorMsg = "Could not create an instance of class '" + securityPropagatorClass + "' which was configured for service '" +
serviceName + "'. Please check the value of '" + Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS + "'" +
" which is a property element of the security element declared in jboss-esb.xml.";
}
else
{
errorMsg = "Could not create an instance of class the security context propagator configured in jbossesb-properties.xml" +
".Please check the value of '" + Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS + "' in jbossesb-properties.xml";
}
throw new ConfigurationException(errorMsg, e);
}
if (LOGGER.isDebugEnabled())
{
if (securityContextPropagator != null)