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

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

java 2次浏览

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

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

示例1: setUp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
@Before
public void setUp() {
    endpoint = createMock(SmppEndpoint.class);
    processor = createMock(Processor.class);
    exceptionHandler = createMock(ExceptionHandler.class);
    
    listener = new MessageReceiverListenerImpl(endpoint, processor, exceptionHandler);
    listener.setMessageIDGenerator(new MessageIDGenerator() {
        public MessageId newMessageId() {
            try {
                return new MessageId("1");
            } catch (PDUStringException e) {
                throw new RuntimeException(e);
            }
        }
    });
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:18,
代码来源:MessageReceiverListenerImplTest.java

示例2: processDataSmResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processDataSmResp(Command pduHeader, byte[] pdu,
        BaseResponseHandler responseHandler) throws IOException {
    PendingResponse<Command> pendingResp = responseHandler
            .removeSentItem(pduHeader.getSequenceNumber());
    
    if (pendingResp != null) {
        try {
            DataSmResp resp = pduDecomposer.dataSmResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            logger.error("Failed decomposing data_sm_resp", e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                    .getSequenceNumber());
        }
    } else {
        logger.warn("No request with sequence number {} found", pduHeader.getSequenceNumber());
    }
}
 

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

示例3: processBindResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processBindResp(Command pduHeader, byte[] pdu,
                            OutboundServerResponseHandler responseHandler) throws IOException {
    PendingResponse<Command> pendingResp = responseHandler
        .removeSentItem(pduHeader.getSequenceNumber());
    if (pendingResp != null) {
        try {
            BindResp resp = pduDecomposer.bindResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            String message = "Failed decomposing submit_sm_resp";
            logger.error(message, e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                .getSequenceNumber());
            pendingResp
                .doneWithInvalidResponse(new InvalidResponseException(
                    message, e));
        }
    } else {
        logger.error("No request with sequence number {} found", pduHeader.getSequenceNumber() );
        responseHandler.sendGenerickNack(
            SMPPConstant.STAT_ESME_RINVDFTMSGID, pduHeader
                .getSequenceNumber());
    }
}
 

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

示例4: processSubmitSmResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processSubmitSmResp(Command pduHeader, byte[] pdu,
        ResponseHandler responseHandler) throws IOException {

    PendingResponse<Command> pendingResp = responseHandler
            .removeSentItem(pduHeader.getSequenceNumber());
    if (pendingResp != null) {
        try {
            SubmitSmResp resp = pduDecomposer.submitSmResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            logger.error("Failed decomposing submit_sm_resp", e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                    .getSequenceNumber());
        }
    } else {
        logger.warn("No request with sequence number "
                + pduHeader.getSequenceNumber() + " found");
    }
}
 

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

示例5: processSubmitMultiResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processSubmitMultiResp(Command pduHeader, byte[] pdu,
        ResponseHandler responseHandler) throws IOException {
    PendingResponse<Command> pendingResp = responseHandler
            .removeSentItem(pduHeader.getSequenceNumber());
    if (pendingResp != null) {
        try {
            SubmitMultiResp resp = pduDecomposer.submitMultiResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            logger.error("Failed decomposing submit_multi_resp", e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                    .getSequenceNumber());
        }
    } else {
        logger.warn("No request with sequence number "
                + pduHeader.getSequenceNumber() + " found");
    }
}
 

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

示例6: processQuerySmResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processQuerySmResp(Command pduHeader, byte[] pdu,
        ResponseHandler responseHandler) throws IOException {

    PendingResponse<Command> pendingResp = responseHandler
            .removeSentItem(pduHeader.getSequenceNumber());
    if (pendingResp != null) {
        try {
            QuerySmResp resp = pduDecomposer.querySmResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            logger.error("Failed decomposing submit_sm_resp", e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                    .getSequenceNumber());
        }
    } else {
        logger.error(NO_REQUEST_FIND_FOR_SEQUENCE_NUMBER
                + pduHeader.getSequenceNumber());
        responseHandler.sendGenerickNack(
                SMPPConstant.STAT_ESME_RINVDFTMSGID, pduHeader
                        .getSequenceNumber());
    }
}
 

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

示例7: accept

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
/**
 * Accept the bind request. The provided interface version will be put into the optional parameter 
 * sc_interface_version in the bind response message.
 * 
 * @param systemId is the system identifier that will be send to ESME.
 * @param interfaceVersion is the interface version that will be sent to the ESME
 * @throws PDUStringException if the system id is not valid.
 * @throws IllegalStateException if the acceptance or rejection has been made.
 * @throws IOException is the connection already closed.
 * @see #reject(int errorCode)
 */
public void accept(String systemId, InterfaceVersion interfaceVersion) throws PDUStringException, IllegalStateException, IOException {
    StringValidator.validateString(systemId, StringParameter.SYSTEM_ID);
    lock.lock();
    try {
        if (!done) {
            done = true;
            try {
                responseHandler.sendBindResp(systemId, interfaceVersion, bindType, originalSequenceNumber);
            } finally {
                condition.signal();
            }
        } else {
            throw new IllegalStateException("Response already initiated");
        }
    } finally {
        lock.unlock();
    }
    done = true;
}
 

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

示例8: validateString

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public static void validateString(String value, StringParameter param)
        throws PDUStringException {
    if (param.getType() == StringType.C_OCTET_STRING) {
        if (param.isRangeMinAndMax()) {
            if (!isCOctetStringValid(value, param.getMax())) {
                throw new PDUStringException(C_OCTET_STRING_VALUE
                        + value + "' length must be less than " + param.getMax()
                        + ACTUAL_LENGTH_IS + value.length(),
                        param);
            }
        } else if (!isCOctetStringNullOrNValValid(value, param.getMax())) {
            throw new PDUStringException(
                    C_OCTET_STRING_VALUE + value + "' length should be 1 or " + (param.getMax() - 1)
                            + ACTUAL_LENGTH_IS
                            + value.length(), param);
        }
    } else if (param.getType() == StringType.OCTET_STRING
            && !isOctetStringValid(value, param.getMax())) {
        throw new PDUStringException("Octet String value '" + value
                + "' length must be less than or equal to " + param.getMax()
                + ACTUAL_LENGTH_IS + value.length(), param);
    }
}
 

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

示例9: bind

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public Bind bind(byte[] b) throws PDUStringException {
    Bind req = new Bind();
    SequentialBytesReader reader = new SequentialBytesReader(b);
    assignHeader(req, reader);
    req.setSystemId(reader.readCString());
    StringValidator.validateString(req.getSystemId(),
            StringParameter.SYSTEM_ID);
    req.setPassword(reader.readCString());
    StringValidator.validateString(req.getPassword(),
            StringParameter.PASSWORD);
    req.setSystemType(reader.readCString());
    StringValidator.validateString(req.getSystemType(),
            StringParameter.SYSTEM_TYPE);
    req.setInterfaceVersion(reader.readByte());
    req.setAddrTon(reader.readByte());
    req.setAddrNpi(reader.readByte());
    req.setAddressRange(reader.readCString());
    StringValidator.validateString(req.getAddressRange(),
            StringParameter.ADDRESS_RANGE);
    return req;
}
 

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

示例10: querySmResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public QuerySmResp querySmResp(byte[] b) throws PDUStringException {
    QuerySmResp resp = new QuerySmResp();
    SequentialBytesReader reader = new SequentialBytesReader(b);
    assignHeader(resp, reader);
    if (resp.getCommandLength() > 16 && resp.getCommandStatus() == 0) {
        resp.setMessageId(reader.readCString());
        StringValidator.validateString(resp.getMessageId(),
                StringParameter.MESSAGE_ID);
        resp.setFinalDate(reader.readCString());
        StringValidator.validateString(resp.getFinalDate(),
                StringParameter.FINAL_DATE);
        resp.setMessageState(MessageState.valueOf(reader.readByte()));
        resp.setErrorCode(reader.readByte());
    }
    return resp;
}
 

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

示例11: dataSm

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public DataSm dataSm(byte[] data) throws PDUStringException {
    DataSm req = new DataSm();
    SequentialBytesReader reader = new SequentialBytesReader(data);
    assignHeader(req, reader);
    req.setServiceType(reader.readCString());
    StringValidator.validateString(req.getServiceType(),
            StringParameter.SERVICE_TYPE);

    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.setDestAddress(reader.readCString());
    StringValidator.validateString(req.getDestAddress(),
            StringParameter.DESTINATION_ADDR);

    req.setEsmClass(reader.readByte());
    req.setRegisteredDelivery(reader.readByte());
    req.setDataCoding(reader.readByte());
    req.setOptionalParameters(readOptionalParameters(reader));
    return req;
}
 

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

示例12: cancelSm

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的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;
}
 

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

示例13: submitMultiResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public SubmitMultiResp submitMultiResp(byte[] data)
        throws PDUStringException {
    SubmitMultiResp resp = new SubmitMultiResp();
    SequentialBytesReader reader = new SequentialBytesReader(data);
    assignHeader(resp, reader);
    resp.setMessageId(reader.readCString());
    StringValidator.validateString(resp.getMessageId(),
            StringParameter.MESSAGE_ID);

    int noUnsuccess = 0xff & reader.readByte();
    UnsuccessDelivery[] unsuccessSmes = new UnsuccessDelivery[noUnsuccess];
    for (int i = 0; i < noUnsuccess; i++) {
        byte ton = reader.readByte();
        byte npi = reader.readByte();
        String addr = reader.readCString();
        StringValidator.validateString(addr,
                StringParameter.DESTINATION_ADDR);
        int errorStatusCode = reader.readInt();
        unsuccessSmes[i] = new UnsuccessDelivery(ton, npi, addr,
                errorStatusCode);
    }
    resp.setUnsuccessSmes(unsuccessSmes);
    return resp;
}
 

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

示例14: replaceSm

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public ReplaceSm replaceSm(byte[] data) throws PDUStringException {
    ReplaceSm req = new ReplaceSm();
    SequentialBytesReader reader = new SequentialBytesReader(data);
    assignHeader(req, reader);
    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.setScheduleDeliveryTime(reader.readCString());
    StringValidator.validateString(req.getScheduleDeliveryTime(),
            StringParameter.SCHEDULE_DELIVERY_TIME);
    req.setValidityPeriod(reader.readCString());
    StringValidator.validateString(req.getValidityPeriod(),
            StringParameter.VALIDITY_PERIOD);
    req.setSmDefaultMsgId(reader.readByte());
    byte smLength = reader.readByte();
    req.setShortMessage(reader.readBytes(smLength));
    StringValidator.validateString(req.getShortMessage(),
            StringParameter.SHORT_MESSAGE);
    return req;
}
 

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

示例15: alertNotification

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public AlertNotification alertNotification(byte[] data) throws PDUStringException {
    AlertNotification req = new AlertNotification();
    SequentialBytesReader reader = new SequentialBytesReader(data);
    assignHeader(req, reader);
    req.setSourceAddrTon(reader.readByte());
    req.setSourceAddrNpi(reader.readByte());
    req.setSourceAddr(reader.readCString());
    StringValidator.validateString(req.getSourceAddr(), StringParameter.SOURCE_ADDR);
    req.setEsmeAddrTon(reader.readByte());
    req.setEsmeAddrNpi(reader.readByte());
    /*
     * No validation on esme_addr.
     * There is no response to alert_notificaion command, so error will be 
     * ignored.
     */
    req.setEsmeAddr(reader.readCString());
    req.setOptionalParameters(readOptionalParameters(reader));
    return req;
}
 

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

示例16: bind

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public byte[] bind(int commandId, int sequenceNumber, String systemId,
        String password, String systemType, byte interfaceVersion,
        byte addrTon, byte addrNpi, String addressRange)
        throws PDUStringException {
    StringValidator.validateString(systemId, StringParameter.SYSTEM_ID);
    StringValidator.validateString(password, StringParameter.PASSWORD);
    StringValidator.validateString(systemType, StringParameter.SYSTEM_TYPE);
    StringValidator.validateString(addressRange,
            StringParameter.ADDRESS_RANGE);

    PDUByteBuffer buf = new PDUByteBuffer(commandId, 0, sequenceNumber);

    buf.append(systemId);
    buf.append(password);
    buf.append(systemType);
    buf.append(interfaceVersion);
    buf.append(addrTon);
    buf.append(addrNpi);
    buf.append(addressRange);
    return buf.toBytes();
}
 

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

示例17: cancelSm

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public byte[] cancelSm(int sequenceNumber, String serviceType,
        String messageId, byte sourceAddrTon, byte sourceAddrNpi,
        String sourceAddr, byte destAddrTon, byte destAddrNpi,
        String destinationAddr) throws PDUStringException {

    StringValidator.validateString(serviceType,
            StringParameter.SERVICE_TYPE);
    StringValidator.validateString(messageId, StringParameter.MESSAGE_ID);
    StringValidator.validateString(sourceAddr, StringParameter.SOURCE_ADDR);
    StringValidator.validateString(destinationAddr,
            StringParameter.DESTINATION_ADDR);

    PDUByteBuffer buf = new PDUByteBuffer(SMPPConstant.CID_CANCEL_SM, 0,
            sequenceNumber);
    buf.append(serviceType);
    buf.append(messageId);
    buf.append(sourceAddrTon);
    buf.append(sourceAddrNpi);
    buf.append(sourceAddr);
    buf.append(destAddrTon);
    buf.append(destAddrNpi);
    buf.append(destinationAddr);

    return buf.toBytes();
}
 

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

示例18: submitMultiResp

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public byte[] submitMultiResp(int sequenceNumber, String messageId,
        UnsuccessDelivery... unsuccessDeliveries) throws PDUStringException {
    StringValidator.validateString(messageId, StringParameter.MESSAGE_ID);

    PDUByteBuffer buf = new PDUByteBuffer(
            SMPPConstant.CID_SUBMIT_MULTI_RESP, 0, sequenceNumber);
    buf.append(messageId);
    buf.append((byte)unsuccessDeliveries.length); // no_unsuccess
    for (UnsuccessDelivery delivery : unsuccessDeliveries) {
        StringValidator.validateString(delivery.getDestinationAddress()
                .getAddress(), StringParameter.DESTINATION_ADDR);
        Address destAddr = delivery.getDestinationAddress();
        buf.append(destAddr.getTon());
        buf.append(destAddr.getNpi());
        buf.append(destAddr.getAddress());
        buf.append(delivery.getErrorStatusCode());
    }
    return buf.toBytes();
}
 

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

示例19: alertNotification

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public byte[] alertNotification(int sequenceNumber, byte sourceAddrTon,
        byte sourceAddrNpi, String sourceAddr, byte esmeAddrTon,
        byte esmeAddrNpi, String esmeAddr,
        OptionalParameter... optionalParameters) throws PDUStringException {
    StringValidator.validateString(sourceAddr, StringParameter.SOURCE_ADDR);
    StringValidator.validateString(esmeAddr, StringParameter.ESME_ADDR);
    PDUByteBuffer buf = new PDUByteBuffer(SMPPConstant.CID_ALERT_NOTIFICATION, 0, sequenceNumber);
    buf.append(sourceAddrTon);
    buf.append(sourceAddrNpi);
    buf.append(sourceAddr);
    buf.append(esmeAddrTon);
    buf.append(esmeAddrNpi);
    buf.append(esmeAddr);
    buf.appendAll(optionalParameters);
    return buf.toBytes();
}
 

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

示例20: validateStringOctetStringWithString

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
@Test(groups="checkintest")
public void validateStringOctetStringWithString() throws Exception {
    StringValidator.validateString("", StringParameter.SHORT_MESSAGE);
    StringValidator.validateString("short messages", StringParameter.SHORT_MESSAGE);
    String shortMessage = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"
        + "89012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
        + "234567890123456789012345678901234567890123456789012345678901234";
    StringValidator.validateString(shortMessage, StringParameter.SHORT_MESSAGE);

    try {
        shortMessage = shortMessage + "5";
        StringValidator.validateString(shortMessage, StringParameter.SHORT_MESSAGE);
        fail("PDUStringException expected");
    } catch (PDUStringException e) {
        // expected
        assertEquals(e.getMessage(), "Octet String value '" + shortMessage + "' length must be less than or equal "
            + "to 254. Actual length is 255");
    }
}
 

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

示例21: validateStringOctetStringWithByteArray

点赞 3

import org.jsmpp.PDUStringException; //导入依赖的package包/类
@Test(groups="checkintest")
public void validateStringOctetStringWithByteArray() throws Exception {
    StringValidator.validateString("".getBytes("UTF-8"), StringParameter.SHORT_MESSAGE);
    StringValidator.validateString("short messages".getBytes("UTF-8"), StringParameter.SHORT_MESSAGE);
    String shortMessage = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"
        + "89012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
        + "234567890123456789012345678901234567890123456789012345678901234";
    StringValidator.validateString(shortMessage.getBytes("UTF-8"), StringParameter.SHORT_MESSAGE);

    try {
        shortMessage = shortMessage + "5";
        StringValidator.validateString(shortMessage.getBytes("UTF-8"), StringParameter.SHORT_MESSAGE);
        fail("PDUStringException expected");
    } catch (PDUStringException e) {
        // expected
        assertEquals(e.getMessage(), "Octet String value '" + shortMessage + "' length must be less than or equal "
            + "to 254. Actual length is 255");
    }
}
 

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

示例22: executeTask

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void executeTask(OutputStream out, int sequenceNumber)
        throws PDUStringException, IOException {
    
    pduSender.sendDeliverSm(out, sequenceNumber, serviceType,
            sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon,
            destAddrNpi, destinationAddr, esmClass, protocoId,
            priorityFlag, registeredDelivery, dataCoding, shortMessage,
            optionalParameters);
}
 

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

示例23: sendDataSmResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendDataSmResp(DataSmResult dataSmResult, int sequenceNumber)
        throws IOException {
    try {
				pduSender().sendDataSmResp(out, sequenceNumber,
          		dataSmResult.getMessageId(),
						dataSmResult.getOptionalParameters());
		} catch (PDUStringException e) {
          /*
          * There should be no PDUStringException thrown since creation
          * of MessageId should be save.
          */
				logger.error("SYSTEM ERROR. Failed sending dataSmResp", e);
		}
}
 

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

示例24: executeTask

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void executeTask(OutputStream out, int sequenceNumber)
        throws PDUStringException, IOException {
    pduSender.sendReplaceSm(out, sequenceNumber, messageId, sourceAddrTon,
            sourceAddrNpi, sourceAddr, scheduleDeliveryTime,
            validityPeriod, registeredDelivery, smDefaultMsgId,
            shortMessage);
}
 

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

示例25: processAlertNotification0

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
static void processAlertNotification0(Command pduHeader, byte[] pdu,
        ResponseHandler responseHandler) {
    try {
        AlertNotification alertNotification = pduDecomposer.alertNotification(pdu);
        responseHandler.processAlertNotification(alertNotification);
    } catch (PDUStringException e) {
        logger.error("Failed decomposing alert_notification", e);
        // there is no response for alert notification 
    }
}
 

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

示例26: processBindResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void processBindResp(Command pduHeader, byte[] pdu,
        ResponseHandler responseHandler) throws IOException {
    PendingResponse<Command> pendingResp = responseHandler
            .removeSentItem(pduHeader.getSequenceNumber());
    if (pendingResp != null) {
        try {
            logger.debug("Bind Response header ({}, {}, {}, {})",
                pduHeader.getCommandLength(),
                pduHeader.getCommandIdAsHex(),
                IntUtil.toHexString(pduHeader.getCommandStatus()),
                pduHeader.getSequenceNumber());
            BindResp resp = pduDecomposer.bindResp(pdu);
            pendingResp.done(resp);
        } catch (PDUStringException e) {
            String message = "Failed decomposing submit_sm_resp";
            logger.error(message, e);
            responseHandler.sendGenerickNack(e.getErrorCode(), pduHeader
                    .getSequenceNumber());
            pendingResp
                    .doneWithInvalidResponse(new InvalidResponseException(
                            message, e));
        }
    } else {
        logger.error("No request with sequence number {} found", pduHeader.getSequenceNumber() );
        responseHandler.sendGenerickNack(
            SMPPConstant.STAT_ESME_RINVDFTMSGID, pduHeader
                .getSequenceNumber());
    }
}
 

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

示例27: executeTask

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void executeTask(OutputStream out, int sequenceNumber)
        throws PDUStringException, IOException {
    pduSender.sendDataSm(out, sequenceNumber, serviceType, sourceAddrTon,
            sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi,
            destinationAddr, esmClass, registeredDelivery, dataCoding,
            optionalParameters);
}
 

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

示例28: sendBindResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendBindResp(String systemId, InterfaceVersion interfaceVersion, BindType bindType, int sequenceNumber)
    throws IOException {
  SMPPOutboundSession.this.sessionContext.bound(bindType);
  try {
    pduSender().sendBindResp(SMPPOutboundSession.this.out, bindType.responseCommandId(), sequenceNumber, systemId,
        interfaceVersion);
  }
  catch (PDUStringException e) {
    logger.error("Failed sending bind response", e);
    // TODO uudashr: we have double checking when accept the bind request
  }
}
 

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

示例29: sendDataSmResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendDataSmResp(DataSmResult dataSmResult, int sequenceNumber)
    throws IOException {
  try {
    pduSender().sendDataSmResp(out, sequenceNumber,
        dataSmResult.getMessageId(),
        dataSmResult.getOptionalParameters());
  }
  catch (PDUStringException e) {
    /*
     * There should be no PDUStringException thrown since creation
     * of MessageId should be save.
     */
    logger.error("SYSTEM ERROR. Failed sending dataSmResp", e);
  }
}
 

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

示例30: executeTask

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void executeTask(OutputStream out, int sequenceNumber)
        throws PDUStringException, IOException {
    pduSender.sendSubmitSm(out, sequenceNumber, serviceType, sourceAddrTon,
            sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi,
            destinationAddr, esmClass, protocolId, priorityFlag,
            scheduleDeliveryTime, validityPeriod, registeredDelivery,
            replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage,
            optionalParameters);
}
 

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

示例31: alertNotification

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void alertNotification(int sequenceNumber,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber esmeAddrTon,
        NumberingPlanIndicator esmeAddrNpi, String esmeAddr,
        OptionalParameter... optionalParameters) throws PDUStringException,
        IOException {
    
    ensureReceivable("alertNotification");
    
    pduSender().sendAlertNotification(connection().getOutputStream(),
            sequenceNumber, sourceAddrTon.value(), sourceAddrNpi.value(),
            sourceAddr, esmeAddrTon.value(), esmeAddrNpi.value(), esmeAddr,
            optionalParameters);
}
 

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

示例32: sendBindResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendBindResp(String systemId, InterfaceVersion interfaceVersion, BindType bindType, int sequenceNumber) throws IOException {
    sessionContext.bound(bindType);
    try {
        pduSender().sendBindResp(out, bindType.responseCommandId(), sequenceNumber, systemId, interfaceVersion);
    } catch (PDUStringException e) {
        logger.error("Failed sending bind response", e);
        // TODO uudashr: we have double checking when accept the bind request
    }
}
 

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

示例33: sendQuerySmResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendQuerySmResp(String messageId, String finalDate,
        MessageState messageState, byte errorCode, int sequenceNumber) throws IOException {
    try {
        pduSender().sendQuerySmResp(out, sequenceNumber, messageId,
                finalDate, messageState, errorCode);
    } catch (PDUStringException e) {
        /*
         * There should be no PDUStringException thrown since creation
         * of parsed messageId has been validated.
         */
        logger.error("SYSTEM ERROR. Failed sending cancelSmResp", e);
    }
}
 

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

示例34: sendDataSmResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendDataSmResp(DataSmResult dataSmResult, int sequenceNumber)
        throws IOException {
    try {
        pduSender().sendDataSmResp(out, sequenceNumber,
                dataSmResult.getMessageId(),
                dataSmResult.getOptionalParameters());
    } catch (PDUStringException e) {
        /*
         * There should be no PDUStringException thrown since creation
         * of MessageId should be save.
         */
        logger.error("SYSTEM ERROR. Failed sending dataSmResp", e);
    }
}
 

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

示例35: sendDataSmResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public void sendDataSmResp(DataSmResult dataSmResult, int sequenceNumber)
    throws IOException {
  try {
    pduSender().sendDataSmResp(out, sequenceNumber,
        dataSmResult.getMessageId(),
        dataSmResult.getOptionalParameters());
  }
  catch (PDUStringException e) {
    /*
    * There should be no PDUStringException thrown since creation
    * of MessageId should be save.
    */
    logger.error("Failed sending data_sm_resp", e);
  }
}
 

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

示例36: submitMulti

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
byte[] submitMulti(int sequenceNumber, String serviceType,
byte sourceAddrTon, byte sourceAddrNpi, String sourceAddr,
DestinationAddress[] destinationAddresses, byte esmClass, byte protocolId,
byte priorityFlag, String scheduleDeliveryTime,
String validityPeriod, byte registeredDelivery,
byte replaceIfPresentFlag, byte dataCoding, byte smDefaultMsgId,
byte[] shortMessage, OptionalParameter... optionalParameters)
throws PDUStringException, InvalidNumberOfDestinationsException;
 

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

示例37: newMessageId

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public MessageId newMessageId() {
    /*
     * use database sequence convert into hex representation or if not using
     * database using random
     */
    try {
        synchronized (random) {
            return new MessageId(Integer.toString(random.nextInt(Integer.MAX_VALUE), 16));
        }
    } catch (PDUStringException e) {
        throw new RuntimeException("Failed creating message id", e);
    }
}
 

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

示例38: newMessageId

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public MessageId newMessageId() {
    /*
     * use random into decimal representation
     */
    try {
        synchronized (random) {
            return new MessageId(String.format("%010d", random.nextInt(Integer.MAX_VALUE), 10));
        }
    } catch (PDUStringException e) {
        throw new RuntimeException("Failed creating message id", e);
    }
}
 

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

示例39: bindResp

点赞 2

import org.jsmpp.PDUStringException; //导入依赖的package包/类
public BindResp bindResp(byte[] b) throws PDUStringException {
    BindResp resp = new BindResp();
    SequentialBytesReader reader = new SequentialBytesReader(b);
    assignHeader(resp, reader);
    if (resp.getCommandLength() > 16 && resp.getCommandStatus() == 0) {
        resp.setSystemId(reader.readCString());
        StringValidator.validateString(resp.getSystemId(),
                StringParameter.SYSTEM_ID);

        resp.setOptionalParameters(readOptionalParameters(reader));
    }
    return resp;
}
 

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


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