use of org.jpos.iso.ISOClientSocketFactory in project jPOS by jpos.
the class OneShotChannelAdaptorMK2 method newChannel.
private ISOChannel newChannel(Element e, QFactory f) throws ConfigurationException {
String channelName = QFactory.getAttributeValue(e, "class");
if (channelName == null) {
throw new ConfigurationException("class attribute missing from channel element.");
}
String packagerName = QFactory.getAttributeValue(e, "packager");
ISOChannel channel = (ISOChannel) f.newInstance(channelName);
ISOPackager packager;
if (packagerName != null) {
packager = (ISOPackager) f.newInstance(packagerName);
channel.setPackager(packager);
f.setConfiguration(packager, e);
}
QFactory.invoke(channel, "setHeader", QFactory.getAttributeValue(e, "header"));
f.setLogger(channel, e);
f.setConfiguration(channel, e);
if (channel instanceof FilteredChannel) {
addFilters((FilteredChannel) channel, e, f);
}
String socketFactoryString = getSocketFactory();
if (socketFactoryString != null && channel instanceof FactoryChannel) {
ISOClientSocketFactory sFac = (ISOClientSocketFactory) getFactory().newInstance(socketFactoryString);
if (sFac != null && sFac instanceof LogSource) {
((LogSource) sFac).setLogger(log.getLogger(), getName() + ".socket-factory");
}
getFactory().setConfiguration(sFac, e);
((FactoryChannel) channel).setSocketFactory(sFac);
}
return channel;
}
Aggregations