• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java InvalidDeliveryReceiptException类的典型用法和代码示例

java 5次浏览

本文整理汇总了Java中org.jsmpp.util.InvalidDeliveryReceiptException的典型用法代码示例。如果您正苦于以下问题:Java InvalidDeliveryReceiptException类的具体用法?Java InvalidDeliveryReceiptException怎么用?Java InvalidDeliveryReceiptException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

InvalidDeliveryReceiptException类属于org.jsmpp.util包,在下文中一共展示了InvalidDeliveryReceiptException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: DeliveryReceipt

点赞 3

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public DeliveryReceipt(String formattedDeliveryReceipt)
        throws InvalidDeliveryReceiptException {
    /*
     * id:IIIIIIIIII sub:SSS dlvrd:DDD submit date:YYMMDDhhmm done
     * date:YYMMDDhhmm stat:DDDDDDD err:E Text: ..........
     */
    try {
        id = getDeliveryReceiptValue(DeliveryReceipt.DELREC_ID, formattedDeliveryReceipt);
        submitted = getDeliveryReceiptIntValue(DeliveryReceipt.DELREC_SUB, formattedDeliveryReceipt);
        delivered = getDeliveryReceiptIntValue(DeliveryReceipt.DELREC_DLVRD, formattedDeliveryReceipt);
        submitDate = string2Date(getDeliveryReceiptValue(
                DeliveryReceipt.DELREC_SUBMIT_DATE, formattedDeliveryReceipt));
        doneDate = string2Date(getDeliveryReceiptValue(
                DeliveryReceipt.DELREC_DONE_DATE, formattedDeliveryReceipt));
        finalStatus = DeliveryReceiptState
                .getByName(getDeliveryReceiptValue(
                        DeliveryReceipt.DELREC_STAT, formattedDeliveryReceipt));
        error = getDeliveryReceiptValue(DeliveryReceipt.DELREC_ERR, formattedDeliveryReceipt);
        text = getDeliveryReceiptTextValue(formattedDeliveryReceipt);
    } catch (Exception e) {
        throw new InvalidDeliveryReceiptException("There is an error found when parsing delivery receipt", e);
    }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:24,
代码来源:DeliveryReceipt.java

示例2: CustomDeliveryReceipt

点赞 3

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public CustomDeliveryReceipt(String formattedDeliveryReceipt)
    throws InvalidDeliveryReceiptException {
      /*
       * id:IIIIIIIIII sub:SSS dlvrd:DDD submit date:YYMMDDhhmm done
       * date:YYMMDDhhmm stat:DDDDDDD err:E text: ..........
       */
  try {
    Matcher matcher = PATTERN.matcher(formattedDeliveryReceipt);
    if (matcher.find()) {
      id = matcher.group(1);
      submitted = Integer.parseInt(matcher.group(2));
      delivered = Integer.parseInt(matcher.group(3));
      submitDate = string2Date(matcher.group(4));
      doneDate = string2Date(matcher.group(5));
      error = matcher.group(6);
      finalStatus = CustomDeliveryReceiptState.valueOf(matcher.group(7));
      text = matcher.group(8);
    }
  } catch (Exception e) {
    LOG.error("Parse error", e);
    throw new InvalidDeliveryReceiptException("There is an error found when parsing custom delivery receipt", e);
  }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:24,
代码来源:CustomDeliveryReceipt.java

示例3: testParseValid

点赞 3

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
@Test
public void testParseValid() {
  try {
    DeliverSm deliverSm = new DeliverSm();
    deliverSm.setEsmClass(new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT).value());
    deliverSm.setShortMessage(
        ("id:0123456789 sub:002 dlvrd:003 submit date:0809011130 done date:0809021131 err:123 stat:DND_REJECTED text:Hello World")
            .getBytes(Charset.forName("US-ASCII")));
    CustomDeliveryReceipt delReceipt = customDeliveryReceiptStripper.strip(deliverSm);
    assertEquals("0123456789", delReceipt.getId());
    assertEquals(2, delReceipt.getSubmitted());
    assertEquals(3, delReceipt.getDelivered());
    assertEquals(createDate(2008, 9, 1, 11, 30), delReceipt.getSubmitDate());
    assertEquals(createDate(2008, 9, 2, 11, 31), delReceipt.getDoneDate());
    assertEquals("123", delReceipt.getError());
    assertEquals(DND_REJECTED, delReceipt.getFinalStatus());
    assertEquals("Hello World", delReceipt.getText());
  } catch (InvalidDeliveryReceiptException e) {
    fail("Failed parsing delivery receipt: " + e.getMessage());
  }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:22,
代码来源:CustomDeliveryReceiptStripperTest.java

示例4: onAcceptDeliverSm

点赞 3

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
@Override
public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {

    if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {

        try
        {
            DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
            deliveryReceiptProcesor.setDeliveryReceipt(delReceipt);
            processACKinBackground(deliveryReceiptProcesor.getACK());
        }
        catch (InvalidDeliveryReceiptException ignored) {

        }
    }
    else {

        try{
           throw new Exception("Incoming SMSC message : " + new String(deliverSm.getShortMessage()));
        }
        catch (Exception ignore) {}

    }

}
 

开发者ID:amalio,
项目名称:spring-json-sms-gateway,
代码行数:26,
代码来源:SMSCListener.java

示例5: strip

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public DeliveryReceipt strip(DeliverSm deliverSm) throws InvalidDeliveryReceiptException {
    if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
        return DefaultDecomposer.getInstance().deliveryReceipt(deliverSm.getShortMessage());
    } else {
        throw new InvalidDeliveryReceiptException("deliver_sm is not a Delivery Receipt since esm_class value = " + deliverSm.getEsmClass());
    }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:8,
代码来源:DefaultDeliveryReceiptStripper.java

示例6: onAcceptDeliverSm

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public void onAcceptDeliverSm(DeliverSm deliverSm)
        throws ProcessRequestException {
    
    if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
        // this message is delivery receipt
        try {
            DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
            
            // lets cover the id to hex string format
            long id = Long.parseLong(delReceipt.getId()) & 0xffffffff;
            String messageId = Long.toString(id, 16).toUpperCase();
            
            /*
             * you can update the status of your submitted message on the
             * database based on messageId
             */

            LOGGER.info("Receiving delivery receipt for message '{}' from {} to {}: {}",
                messageId, deliverSm.getSourceAddr(), deliverSm.getDestAddress(), delReceipt);
        } catch (InvalidDeliveryReceiptException e) {
            LOGGER.error("Failed getting delivery receipt", e);
        }
    } else {
        // this message is regular short message
        
        /*
         * you can save the incoming message to database.
         */
        
        LOGGER.info("Receiving message : {}", new String(deliverSm.getShortMessage()));
    }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:33,
代码来源:MessageReceiverListenerImpl.java

示例7: strip

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public CustomDeliveryReceipt strip(DeliverSm deliverSm) throws InvalidDeliveryReceiptException {
  if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass()) || MessageType.SME_DEL_ACK.containedIn(deliverSm.getEsmClass())) {
    return new CustomDeliveryReceipt(new String(deliverSm.getShortMessage(), Charset.forName("US-ASCII")));
  } else {
    throw new InvalidDeliveryReceiptException(
        "deliver_sm is not a Delivery Receipt since esm_class value = " + deliverSm.getEsmClass());
  }
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:9,
代码来源:CustomDeliveryReceiptStripper.java

示例8: onAcceptDeliverSm

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {

        if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
            // this message is delivery receipt
            try {
                DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();

                // lets cover the id to hex string format
                long id = Long.parseLong(delReceipt.getId()) & 0xffffffff;
                String messageId = Long.toString(id, 16).toUpperCase();

                /*
                 * you can update the status of your submitted message on the
                 * database based on messageId
                 */

                log.debug("Receiving delivery receipt for message '" + messageId +
                        " ' from " + deliverSm.getSourceAddr() + " to " + deliverSm.getDestAddress()
                        + " : " + delReceipt);
            } catch (InvalidDeliveryReceiptException e) {
                log.debug("Failed getting delivery receipt" , e);

            }
        } else {
            Map<String , Object> properties = new HashMap<String,Object>();

            properties.put(SMPPImplManager.SOURCE_ADDRESS_TON ,
                    TypeOfNumber.valueOf(deliverSm.getSourceAddrTon()).toString());

            properties.put(SMPPImplManager.SOURCE_ADDRESS_NPI ,
                    NumberingPlanIndicator.valueOf(deliverSm.getSourceAddrNpi()).toString());

            properties.put(SMPPImplManager.DESTINATION_ADDRESS_TON ,
                    TypeOfNumber.valueOf(deliverSm.getDestAddrTon()).toString());
            properties.put(SMPPImplManager.DESTINATION_ADDRESS_NPI ,
                    NumberingPlanIndicator.valueOf(deliverSm.getDestAddrNpi()).toString());

            try {
                new SMPPDispatcher(smsManeger).dispatch(deliverSm.getSourceAddr() ,deliverSm.getDestAddress() ,
                        new String(deliverSm.getShortMessage()), properties);

            } catch (AxisFault axisFault) {
                log.debug("Error while dispatching SMPP message" , axisFault);

            }
            log.debug("Receiving message : " + new String(deliverSm.getShortMessage()));
        }

    }
 

开发者ID:wso2,
项目名称:wso2-axis2-transports,
代码行数:50,
代码来源:SMPPListener.java

示例9: onAcceptDeliverSm

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException
{
	if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass()))
	{
		try
		{
			DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
			StatusReportMessage statusReportMessage = new StatusReportMessage(delReceipt.getId(), deliverSm.getDestAddress(), deliverSm.getSourceAddr(), delReceipt.getText(), delReceipt.getSubmitDate(), delReceipt.getDoneDate());
			switch (delReceipt.getFinalStatus())
			{
				case DELIVRD:
					statusReportMessage.setStatus(DeliveryStatuses.DELIVERED);
					break;
				case REJECTD:
				case EXPIRED:
				case UNDELIV:
					statusReportMessage.setStatus(DeliveryStatuses.ABORTED);
					break;
				default:
					statusReportMessage.setStatus(DeliveryStatuses.UNKNOWN);
			}
			statusReportMessage.setGatewayId(getGatewayId());
			Service.getInstance().getNotifyQueueManager().getNotifyQueue().add(new InboundMessageNotification(getMyself(), MessageTypes.STATUSREPORT, statusReportMessage));
		}
		catch (InvalidDeliveryReceiptException e)
		{
			Logger.getInstance().logError("Failed getting delivery receipt.", e, getGatewayId());
		}
	}
	else
	{
		InboundMessage msg = new InboundMessage(new java.util.Date(), deliverSm.getSourceAddr(), new String(deliverSm.getShortMessage()), 0, null);
		msg.setGatewayId(JSMPPGateway.this.getGatewayId());
		if (Alphabet.ALPHA_DEFAULT.value() == deliverSm.getDataCoding())
		{
			msg.setEncoding(MessageEncodings.ENC7BIT);
		}
		else if (Alphabet.ALPHA_8_BIT.value() == deliverSm.getDataCoding())
		{
			msg.setEncoding(MessageEncodings.ENC8BIT);
		}
		else if (Alphabet.ALPHA_UCS2.value() == deliverSm.getDataCoding())
		{
			msg.setEncoding(MessageEncodings.ENCUCS2);
		}
		else
		{
			msg.setEncoding(MessageEncodings.ENCCUSTOM);
		}
		incInboundMessageCount();
		Service.getInstance().getNotifyQueueManager().getNotifyQueue().add(new InboundMessageNotification(getMyself(), MessageTypes.INBOUND, msg));
	}
}
 

开发者ID:tdelenikas,
项目名称:smslib-v3,
代码行数:54,
代码来源:JSMPPGateway.java

示例10: onAcceptDeliverSm

点赞 2

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
public void onAcceptDeliverSm(DeliverSm deliverSm)
        throws ProcessRequestException {
    if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
       
        try {
            DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
      
            StatusReportMessage statusReportMessage=new StatusReportMessage(delReceipt.getId(),deliverSm.getDestAddress(), deliverSm.getSourceAddr(), delReceipt.getText(),  delReceipt.getSubmitDate(),  delReceipt.getDoneDate());
            
            switch(delReceipt.getFinalStatus()){
            case DELIVRD:
           	 statusReportMessage.setStatus(DeliveryStatuses.DELIVERED);
           	 break;
            case REJECTD:
            case EXPIRED:
            case UNDELIV:
           	 statusReportMessage.setStatus(DeliveryStatuses.ABORTED);
           	 break;
            default:
           	 statusReportMessage.setStatus(DeliveryStatuses.UNKNOWN);
            }
            
            statusReportMessage.setGatewayId(getGatewayId());
            Service.getInstance().getNotifyQueueManager().getNotifyQueue().add(new InboundMessageNotification(getMyself(), MessageTypes.STATUSREPORT, statusReportMessage));
        } catch (InvalidDeliveryReceiptException e) {
       	 Logger.getInstance().logError("Failed getting delivery receipt.", e, getGatewayId());
           
        }
    } else {        
        InboundMessage msg = new InboundMessage(new java.util.Date(), deliverSm.getSourceAddr(), new String(deliverSm.getShortMessage()), 0, null);
		msg.setGatewayId(JSMPPGateway.this.getGatewayId());
		if(Alphabet.ALPHA_DEFAULT.value()==deliverSm.getDataCoding()){
      	 msg.setEncoding(MessageEncodings.ENC7BIT);
       }else if(Alphabet.ALPHA_8_BIT.value()==deliverSm.getDataCoding()){
       	msg.setEncoding(MessageEncodings.ENC8BIT);
       }else if(Alphabet.ALPHA_UCS2.value()==deliverSm.getDataCoding()){
       	msg.setEncoding(MessageEncodings.ENCUCS2);
       }else{
       	msg.setEncoding(MessageEncodings.ENCCUSTOM);
       }
		incInboundMessageCount();
		Service.getInstance().getNotifyQueueManager().getNotifyQueue().add(new InboundMessageNotification(getMyself(), MessageTypes.INBOUND, msg));
    }
}
 

开发者ID:pioryan,
项目名称:smslib,
代码行数:45,
代码来源:JSMPPGateway.java

示例11: getShortMessageAsDeliveryReceipt

点赞 1

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
/**
    * Get the short message as {@link DeliveryReceipt}. This method will be
    * valid if the parsed short message valid and Message Type (esm_class)
    * contains SMSC Delivery Receipt.
    * 
    * @return the {@link DeliveryReceipt}.
    * @throws InvalidDeliveryReceiptException if there is an error found while parsing delivery receipt.
    */
public DeliveryReceipt getShortMessageAsDeliveryReceipt()
           throws InvalidDeliveryReceiptException {
    return getDeliveryReceipt(DefaultDeliveryReceiptStripper.getInstance());
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:13,
代码来源:DeliverSm.java

示例12: getDeliveryReceipt

点赞 1

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
/**
 * Get delivery receipt based on specified strategy/stripper.
 * 
 * @param <T>
 * @param stripper is the stripper.
 * @return the delivery receipt as an instance of T.
 * @throws InvalidDeliveryReceiptException if there is an error found while parsing delivery receipt.
 */
public <T> T getDeliveryReceipt(DeliveryReceiptStrip<T> stripper)
           throws InvalidDeliveryReceiptException {
    return stripper.strip(this);
}
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:13,
代码来源:DeliverSm.java

示例13: strip

点赞 1

import org.jsmpp.util.InvalidDeliveryReceiptException; //导入依赖的package包/类
/**
 * Strip and return the delivery receipt as an object of T.
 * 
 * @param deliverSm is the deliver_sm.
 * @return the delivery receipt.
 * @throws InvalidDeliveryReceiptException if there is an error found while
 *         stripping the delivery receipt from deliver_sm.
 */
T strip(DeliverSm deliverSm) throws InvalidDeliveryReceiptException;
 

开发者ID:opentelecoms-org,
项目名称:jsmpp,
代码行数:10,
代码来源:DeliveryReceiptStrip.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)