synapseCtxParam.setValue(newSynapseConfiguration);
MessageContextCreatorForAxis2.setSynConfig(newSynapseConfiguration);
//set up synapse env
Parameter synapseEnvParam = new Parameter(SynapseConstants.SYNAPSE_ENV, null);
Axis2SynapseEnvironment synEnv = new Axis2SynapseEnvironment(configurationContext,
newSynapseConfiguration, contextInformation);
synapseEnvParam.setValue(synEnv);
MessageContextCreatorForAxis2.setSynEnv(synEnv);
if (contextInformation != null) {
// set the new information to the server context
contextInformation.setSynapseEnvironment(synEnv);
contextInformation.setSynapseConfiguration(newSynapseConfiguration);
} else {
throw new IllegalStateException("ServerContextInformation not found");
}
try {
axisConfiguration.addParameter(synapseCtxParam);
axisConfiguration.addParameter(synapseEnvParam);
} catch (AxisFault e) {
String msg =
"Could not set parameters '" + SynapseConstants.SYNAPSE_CONFIG +
"' and/or '" + SynapseConstants.SYNAPSE_ENV +
"'to the Axis2 configuration : " + e.getMessage();
throw new ConfigurationInitilizerException(msg, e);
}
// redeploy proxy services
if (log.isTraceEnabled()) {
log.trace("Re-deploying Proxy services...");
}
for (ProxyService proxyService : newSynapseConfiguration.getProxyServices()) {
if (proxyService != null) {
proxyService.buildAxisService(newSynapseConfiguration, axisConfiguration);
if (log.isDebugEnabled()) {
log.debug("Deployed Proxy service : " + proxyService.getName());
}
if (!proxyService.isStartOnLoad()) {
proxyService.stop(newSynapseConfiguration);
}
}
}
if (log.isTraceEnabled()) {
log.trace("Re-deploying Event Sources...");
}
for (SynapseEventSource eventSource : newSynapseConfiguration.getEventSources()) {
if (eventSource != null) {
eventSource.buildService(axisConfiguration);
if (log.isDebugEnabled()) {
log.debug("Deployed Event Source : " + eventSource.getName());
}
}
}
synEnv.getTaskManager().init(repository, taskScheduler);
// init the synapse configuration
newSynapseConfiguration.init(synEnv);
synEnv.setInitialized(true);
}