use of org.schwering.irc.lib.IRCEventListener in project camel by apache.
the class IrcComponent method createConnection.
protected IRCConnection createConnection(IrcConfiguration configuration) {
IRCConnection conn = null;
IRCEventListener ircLogger;
if (configuration.getUsingSSL()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating SSL Connection to {} destination(s): {} nick: {} user: {}", new Object[] { configuration.getHostname(), configuration.getListOfChannels(), configuration.getNickname(), configuration.getUsername() });
}
if (configuration.getSslContextParameters() != null) {
conn = new CamelSSLIRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(), configuration.getNickname(), configuration.getUsername(), configuration.getRealname(), configuration.getSslContextParameters(), getCamelContext());
} else {
SSLIRCConnection sconn = new SSLIRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(), configuration.getNickname(), configuration.getUsername(), configuration.getRealname());
sconn.addTrustManager(configuration.getTrustManager());
conn = sconn;
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating Connection to {} destination(s): {} nick: {} user: {}", new Object[] { configuration.getHostname(), configuration.getListOfChannels(), configuration.getNickname(), configuration.getUsername() });
}
conn = new IRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(), configuration.getNickname(), configuration.getUsername(), configuration.getRealname());
}
conn.setEncoding("UTF-8");
conn.setColors(configuration.isColors());
conn.setPong(true);
if (LOG.isDebugEnabled()) {
LOG.debug("Adding IRC event logging listener");
ircLogger = createIrcLogger(configuration.getHostname());
conn.addIRCEventListener(ircLogger);
}
try {
conn.connect();
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return conn;
}
Aggregations