use of org.jpos.util.LogSource in project jPOS by jpos.
the class DirPollAdaptor method initService.
protected void initService() throws Exception {
QFactory factory = getServer().getFactory();
dirPoll = createDirPoll();
dirPoll.setPath(getPath());
dirPoll.setThreadPool(new ThreadPool(1, poolSize));
dirPoll.setPollInterval(pollInterval);
if (priorities != null)
dirPoll.setPriorities(priorities);
dirPoll.setLogger(getLog().getLogger(), getLog().getRealm());
Configuration cfg = factory.getConfiguration(getPersist());
dirPoll.setConfiguration(cfg);
dirPoll.createDirs();
Object dpp = factory.newInstance(getProcessor());
if (dpp instanceof LogSource) {
((LogSource) dpp).setLogger(getLog().getLogger(), getLog().getRealm());
}
if (dpp instanceof Configurable) {
((Configurable) dpp).setConfiguration(cfg);
}
dirPoll.setProcessor(dpp);
}
use of org.jpos.util.LogSource in project jPOS by jpos.
the class OneShotChannelAdaptorMK2 method newChannel.
private ISOChannel newChannel(Element e, QFactory f) throws ConfigurationException {
String channelName = e.getAttributeValue("class");
if (channelName == null) {
throw new ConfigurationException("class attribute missing from channel element.");
}
String packagerName = e.getAttributeValue("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", e.getAttributeValue("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