}
private static SynapseConfiguration getConfiguration(ConfigurationContext cfgCtx) {
cfgCtx.setProperty("addressing.validateAction", Boolean.FALSE);
AxisConfiguration axisConfiguration = cfgCtx.getAxisConfiguration();
SynapseConfiguration synapseConfiguration;
String config = System.getProperty(SynapseConstants.SYNAPSE_XML);
if (config != null) {
if (log.isDebugEnabled()) {
log.debug("System property '" + SynapseConstants.SYNAPSE_XML +
"' specifies Synapse configuration as " + config);
}
synapseConfiguration = SynapseConfigurationBuilder.getConfiguration(config);
} else {
log.warn("System property '" + SynapseConstants.SYNAPSE_XML +
"' is not specified. Using default configuration..");
synapseConfiguration = SynapseConfigurationBuilder.getDefaultConfiguration();
}
// Set the Axis2 ConfigurationContext to the SynapseConfiguration
synapseConfiguration.setAxisConfiguration(cfgCtx.getAxisConfiguration());
// set the Synapse configuration and environment into the Axis2 configuration
Parameter synapseCtxParam = new Parameter(SynapseConstants.SYNAPSE_CONFIG, null);
synapseCtxParam.setValue(synapseConfiguration);
MessageContextCreatorForAxis2.setSynConfig(synapseConfiguration);
Parameter synapseEnvParam = new Parameter(SynapseConstants.SYNAPSE_ENV, null);
Axis2SynapseEnvironment synEnv = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
synapseEnvParam.setValue(synEnv);
MessageContextCreatorForAxis2.setSynEnv(synEnv);
try {
axisConfiguration.addParameter(synapseCtxParam);
axisConfiguration.addParameter(synapseEnvParam);
} catch (AxisFault e) {
String msg =
"Could not set parameters '" + SynapseConstants.SYNAPSE_CONFIG +
"' and/or '" + SynapseConstants.SYNAPSE_ENV +