All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsmpp.session.BaseResponseHandler Maven / Gradle / Ivy

There is a newer version: 3.0.1
Show newest version
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package org.jsmpp.session;

import java.io.IOException;

import org.jsmpp.bean.Command;
import org.jsmpp.bean.DataSm;
import org.jsmpp.extra.PendingResponse;
import org.jsmpp.extra.ProcessRequestException;

/**
 * @author uudashr
 *
 */
public interface BaseResponseHandler {

//    void sendBindResp(String systemId, InterfaceVersion interfaceVersion, BindType bindType, int sequenceNumber)
//        throws IOException;

    /**
     * Remove the previously {@link PendingResponse} that set when the request
     * was sent.
     * 
     * @param sequenceNumber the sequence number of the request.
     * @return the {@link PendingResponse} correspond to specified
     *         sequenceNumber. Return null if the the mapped
     *         sequenceNumber not found
     */
    PendingResponse removeSentItem(int sequenceNumber);
    
    /**
     * Response by sending GENERICK_NACK.
     * 
     * @param commandStatus is the command status.
     * @param sequenceNumber is the sequence number original PDU if can be decoded.
     * @throws IOException if an IO error occur.
     */
    void sendGenerickNack(int commandStatus, int sequenceNumber)
            throws IOException;
    /**
     * Response by sending negative response.
     * 
     * @param originalCommandId is the original command id.
     * @param commandStatus is the command status.
     * @param sequenceNumber is the sequence number of original PDU request.
     * @throws IOException if an IO error occur.
     */
    void sendNegativeResponse(int originalCommandId, int commandStatus,
            int sequenceNumber) throws IOException;
    
    /**
     * Response by sending ENQUIRE_LINK_RESP.
     * 
     * @param sequenceNumber is the sequence number of original ENQUIRE_LINK
     *          request.
     * @throws IOException if an IO error occur.
     */
    void sendEnquireLinkResp(int sequenceNumber) throws IOException;
    
    /**
     * Response by send UNBIND_RESP.
     * 
     * @param sequenceNumber is the sequence number of original UNBIND request.
     * @throws IOException if an IO error occur.
     */
    void sendUnbindResp(int sequenceNumber) throws IOException;
    
    /**
     * Process the data short message.
     * 
     * @param dataSm is the data short message.
     * @return the result for response.
     * @throws ProcessRequestException if there is a failure when processing
     *         data_sm.
     */
    DataSmResult processDataSm(DataSm dataSm) throws ProcessRequestException;
    
    /**
     * Response by sending DATA_SM_RESP to SMSC.
     * 
     * @param dataSmResult is the result of data_sm.
     * @param sequenceNumber is the sequence number of original DATA_SM
     *        request.
     * @throws IOException if an IO error occur.
     */
    void sendDataSmResp(DataSmResult dataSmResult, int sequenceNumber) throws IOException;
    
    /**
     * Notify for unbind.
     */
    void notifyUnbonded();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy