List<TransportInDescription> transportIns = new ArrayList<TransportInDescription>();
List<TransportOutDescription> transportOuts = new ArrayList<TransportOutDescription>();
// process transport senders
TransportPersistenceManager transportPM = new TransportPersistenceManager(axisConfig);
String[] transports = transportPM.getEnabledTransports(false);
if (transports != null) {
for (String transportToInit : transports) {
if (axisConfig.getTransportOut(transportToInit.trim()) == null) {
TransportOutDescription transportOutDesc =
transportPM.getTransportSender(transportToInit, true);
if (transportOutDesc != null) {
transportOuts.add(transportOutDesc);
// No need to init the sender
// ConfigurationContextFactory should take care of that
}
}
}
}
// process transport receivers
transports = transportPM.getEnabledTransports(true);
if (transports != null) {
for (String transportToInit : transports) {
if (axisConfig.getTransportIn(transportToInit.trim()) == null) {
TransportInDescription transportInDesc =
transportPM.getTransportListener(transportToInit, true);
if (transportInDesc != null) {
transportIns.add(transportInDesc);
// No need to init the listener
// ListenerManager should take care of that
}
}
}
}
// Now add the descriptions to the axis configuration
// This ensures that either all the transports in the registry are initialized or none at all
for (TransportOutDescription trpOut : transportOuts) {
axisConfig.addTransportOut(trpOut);
if (log.isDebugEnabled()) {
log.debug(trpOut.getName() + " transport sender added to the configuration");
}
}
for (TransportInDescription trpIn : transportIns) {
axisConfig.addTransportIn(trpIn);
if (log.isDebugEnabled()) {
log.debug(trpIn.getName() + " transport receiver added to the configuration");
}
}
// Save the transport configurations to the registry.
// We do this here to ensure that necessary transport resources are in the registry
// before services start getting deployed.
transportPM.updateEnabledTransports(axisConfig.getTransportsIn().values(),
axisConfig.getTransportsOut().values());
}