package org.saf.application;
import org.saf.cdrs.CdrsWriterAgent;
import org.saf.settings.CdrsSettings;
import org.saf.settings.SMPPSettings;
import org.saf.settings.SMSCChannelSettings;
import org.saf.shutdownhook.ShutdownHookListener;
import org.saf.smppagent.AbstractSMPPAgentFacade;
import org.saf.snmp.SNMPManager;
public abstract class AbstractSMSCChannelController extends AbstractController
implements ShutdownHookListener {
protected CdrsWriterAgent cdrsWriterAgent = null;
protected AbstractSMPPAgentFacade smppAgentFacade = null;
private String channel = null;
@Override
public void run() {
super.run();
this.cdrsWriterAgent.start();
this.smppAgentFacade.start();
}
public Priority getPriority() {
return Priority.HIGH;
}
public void shutdownHookReceived() {
safeStop();
logger.info("Safe stop for SMPP channel " + this.channel);
this.smppAgentFacade.safeStop();
}
public String getChannel() {
return this.channel;
}
protected AbstractSMSCChannelController(String channel,
AbstractSMPPAgentFacade smppAgentFacade, CdrsSettings cdrSettings,
SMSCChannelSettings channelSettings, SMPPSettings smppSetting,
SNMPManager snmpManager) {
init(channel, smppAgentFacade, cdrSettings,
channelSettings, smppSetting, snmpManager);
}
private void init(String channel, AbstractSMPPAgentFacade smppAgentFacade,
CdrsSettings cdrSettings, SMSCChannelSettings channelSettings,
SMPPSettings smppSetting, SNMPManager snmpManager) {
this.smppAgentFacade = smppAgentFacade;
this.cdrsWriterAgent =
new CdrsWriterAgent(channel, cdrSettings, channelSettings,
smppSetting, snmpManager);
this.channel = channel;
}
}