本文整理汇总了Java中org.jsmpp.bean.CancelSm类的典型用法代码示例。如果您正苦于以下问题:Java CancelSm类的具体用法?Java CancelSm怎么用?Java CancelSm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CancelSm类属于org.jsmpp.bean包,在下文中一共展示了CancelSm类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
public CancelSm cancelSm(byte[] data) throws PDUStringException {
CancelSm req = new CancelSm();
SequentialBytesReader reader = new SequentialBytesReader(data);
assignHeader(req, reader);
req.setServiceType(reader.readCString());
StringValidator.validateString(req.getServiceType(),
StringParameter.SERVICE_TYPE);
req.setMessageId(reader.readCString());
StringValidator.validateString(req.getMessageId(),
StringParameter.MESSAGE_ID);
req.setSourceAddrTon(reader.readByte());
req.setSourceAddrNpi(reader.readByte());
req.setSourceAddr(reader.readCString());
StringValidator.validateString(req.getSourceAddr(),
StringParameter.SOURCE_ADDR);
req.setDestAddrTon(reader.readByte());
req.setDestAddrNpi(reader.readByte());
req.setDestinationAddress(reader.readCString());
StringValidator.validateString(req.getDestinationAddress(),
StringParameter.DESTINATION_ADDR);
return req;
}
示例2: execute
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
@Override
public void execute(Exchange exchange) throws SmppException {
CancelSm cancelSm = createCancelSm(exchange);
if (log.isDebugEnabled()) {
log.debug("Canceling a short message for exchange id '{}' and message id '{}'",
exchange.getExchangeId(), cancelSm.getMessageId());
}
try {
session.cancelShortMessage(
cancelSm.getServiceType(),
cancelSm.getMessageId(),
TypeOfNumber.valueOf(cancelSm.getSourceAddrTon()),
NumberingPlanIndicator.valueOf(cancelSm.getSourceAddrNpi()),
cancelSm.getSourceAddr(),
TypeOfNumber.valueOf(cancelSm.getDestAddrTon()),
NumberingPlanIndicator.valueOf(cancelSm.getDestAddrNpi()),
cancelSm.getDestinationAddress());
} catch (Exception e) {
throw new SmppException(e);
}
if (log.isDebugEnabled()) {
log.debug("Cancel a short message for exchange id '{}' and message id '{}'",
exchange.getExchangeId(), cancelSm.getMessageId());
}
Message message = getResponseMessage(exchange);
message.setHeader(SmppConstants.ID, cancelSm.getMessageId());
}
示例3: fireAcceptCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
private void fireAcceptCancelSm(CancelSm cancelSm) throws ProcessRequestException {
if (messageReceiverListener != null) {
messageReceiverListener.onAcceptCancelSm(cancelSm, this);
} else {
logger.warn(MESSAGE_RECEIVER_LISTENER_IS_NULL);
throw new ProcessRequestException(NO_MESSAGE_RECEIVER_LISTENER_REGISTERED,
SMPPConstant.STAT_ESME_RX_R_APPN);
}
}
示例4: processCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
public void processCancelSm(CancelSm cancelSm)
throws ProcessRequestException {
try {
fireAcceptCancelSm(cancelSm);
} catch(Exception e) {
String msg = "Invalid runtime exception thrown when processing CancelSm";
logger.error(msg, e);
throw new ProcessRequestException(msg, SMPPConstant.STAT_ESME_RSYSERR);
}
}
示例5: createCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
protected CancelSm createCancelSm(Exchange exchange) {
Message in = exchange.getIn();
CancelSm cancelSm = new CancelSm();
if (in.getHeaders().containsKey(SmppConstants.ID)) {
cancelSm.setMessageId(in.getHeader(SmppConstants.ID, String.class));
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR)) {
cancelSm.setSourceAddr(in.getHeader(SmppConstants.SOURCE_ADDR, String.class));
} else {
cancelSm.setSourceAddr(config.getSourceAddr());
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR_TON)) {
cancelSm.setSourceAddrTon(in.getHeader(SmppConstants.SOURCE_ADDR_TON, Byte.class));
} else {
cancelSm.setSourceAddrTon(config.getSourceAddrTon());
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR_NPI)) {
cancelSm.setSourceAddrNpi(in.getHeader(SmppConstants.SOURCE_ADDR_NPI, Byte.class));
} else {
cancelSm.setSourceAddrNpi(config.getSourceAddrNpi());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR)) {
cancelSm.setDestinationAddress(in.getHeader(SmppConstants.DEST_ADDR, String.class));
} else {
cancelSm.setDestinationAddress(config.getDestAddr());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR_TON)) {
cancelSm.setDestAddrTon(in.getHeader(SmppConstants.DEST_ADDR_TON, Byte.class));
} else {
cancelSm.setDestAddrTon(config.getDestAddrTon());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR_NPI)) {
cancelSm.setDestAddrNpi(in.getHeader(SmppConstants.DEST_ADDR_NPI, Byte.class));
} else {
cancelSm.setDestAddrNpi(config.getDestAddrNpi());
}
if (in.getHeaders().containsKey(SmppConstants.SERVICE_TYPE)) {
cancelSm.setServiceType(in.getHeader(SmppConstants.SERVICE_TYPE, String.class));
} else {
cancelSm.setServiceType(config.getServiceType());
}
return cancelSm;
}
示例6: onAcceptCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source)
throws ProcessRequestException;
示例7: processCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
public void processCancelSm(CancelSm cancelSm)
throws ProcessRequestException {
}
示例8: onAcceptCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
public void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source)
throws ProcessRequestException {
LOGGER.info("Accepting CancelSm, but not implemented");
throw new ProcessRequestException(CANCELSM_NOT_IMPLEMENTED, SMPPConstant.STAT_ESME_RCANCELFAIL);
}
示例9: onAcceptCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
public void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source)
throws ProcessRequestException {
LOGGER.warn("CancelSm not implemented");
throw new ProcessRequestException(CANCELSM_NOT_IMPLEMENTED, SMPPConstant.STAT_ESME_RCANCELFAIL);
}
示例10: onAcceptCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
@Override
public void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source) throws ProcessRequestException {
// nothing to do
}
示例11: cancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
/**
* Decompose the SMPP PDU cancel short message command.
*
* @param data is the PDU.
* @return the cancel short message command object.
* @throws PDUStringException if there is an invalid constraint of string
* parameter found.
*/
CancelSm cancelSm(byte[] data) throws PDUStringException;
示例12: processCancelSm
import org.jsmpp.bean.CancelSm; //导入依赖的package包/类
void processCancelSm(CancelSm cancelSm) throws ProcessRequestException;