Package com.logica.smpp.pdu

Examples of com.logica.smpp.pdu.PDU


   * @todo implement functionality to handle Data PDUs.
   */
  @Override
  public boolean receive (SmppResponseInterface response, long timeout)
  {
    PDU pdu = null;
    try {
      myLog.error ("receive - calling getSession ().receive");
      pdu = getSession ().receive (timeout);
    }
    catch (UnknownCommandIdException exc) {
      myLog.error ("receive - unknown command", exc);
      return false;
    }
    catch (TimeoutException exc) {
      myLog.error ("receive - timeout establishing connection", exc);
      return false;
    }
    catch (PDUException exc) {
      myLog.error ("receive - exception in pdu", exc);
      return false;
    }
    catch (NotSynchronousException exc) {
      myLog.error ("receive - non synchronous", exc);
      return false;
    }
    catch (IOException exc) {
      myLog.error ("receive - io exception (socket problem?)", exc);
      return false;
    }

    if (pdu == null) {
      return false;
    }
    else {
      myLog.error ("receive - received pdu: {}", pdu.debugString ());
      response.setCommand (SmppCommandType.decode (pdu.getCommandId ()));
      if (pdu instanceof DeliverSM) {
        DeliverSM deliver = (DeliverSM)pdu;
        updateResponse (response, deliver);

        // send DeliverSMResp
        try {
          getSession ().respond (deliver.getResponse ());
        }
        catch (ValueNotSetException exc) {
          myLog.error ("receive - value not set", exc);
          return false;
        }
        catch (WrongSessionStateException exc) {
          myLog.error ("receive - session state wrong", exc);
          return false;
        }
        catch (IOException exc) {
          myLog.error ("receive - io exception (socket problem?)", exc);
          return false;
        }

        return true;
      }
      else if (pdu instanceof DataSM) {
        DataSM data = (DataSM)pdu;
        myLog.error ("receive - data message not supported: {}", data.debugString ());
        return false;
      }
      else {
        myLog.error ("receive - pdu not recognised {}", pdu.debugString ());
        return false;
      }
    }
  }
View Full Code Here


   * work (i.e. only place objects in the queue) so that PDUs can
   * continue to be received.</p>
   */
  public void handleEvent (ServerPDUEvent event)
  {
    PDU pdu = event.getPDU ();
    if (pdu.isRequest ()) {
      if (pdu instanceof DeliverSM) {
        handleDeliverEvent (event);
      }
      else if (pdu instanceof DataSM) {
        handleDataEvent (event);
      }
      else {
        myLog.warn ("handleEvent -ignored async request: {}", pdu.debugString ());
      }
    }
    else if (pdu.isResponse ()) {
      if (pdu instanceof EnquireLinkResp) {
        if (myQueueEnquireLink) {
          handleEnquireLinkResponseEvent (event);
        }
        else {
          myLog.debug ("handleEvent - async response: {}", pdu.debugString ());
        }
      }
      else if (pdu instanceof SubmitSMResp) {
        handleSubmitResponseEvent (event);
      }
      else if (pdu instanceof QuerySMResp) {
        handleQueryResponseEvent (event);
      }
      else {
        myLog.error ("handleEvent - ignored async response: {}", pdu.debugString ());
      }
    }
    else {
      myLog.error ("handleEvent - unknown class: {}", pdu.debugString ());
    }
  }
View Full Code Here

  @Override
  public boolean receive (SmppResponseInterface response, long timeout)
  {
    ServerPDUEvent server = getEventListener ().getDeliverEvent (timeout);
    if (server != null) {
      PDU pdu = server.getPDU ();
      if (pdu instanceof DeliverSM) {
        return updateResponse (response, (DeliverSM)(pdu));
      }
      else if (pdu instanceof DataSM) {
        myLog.error ("receive - data message not supported: {}", pdu.debugString ());
      }
      else {
        myLog.error ("receive - pdu not recognised {}", pdu.debugString ());
        return false;
      }
    }
    return false;
  }
View Full Code Here

   
    private void receive() {
        boolean working = true;
        long timeout = this.settings.getQuerylinkTimeout() * 1000;
        while(working == true) {
          PDU pdu = null;
            try{
              pdu = this.session.receive(timeout);
            } catch(IOException e) {
                logger.fatal(e.toString() +
                    " receiving pdus, exit from process");
                working = false;
            } catch(TimeoutException e) {
              logger.fatal(e.toString() +
                  " receiving pdus, exit and unbind from process");
              unbind();
              working = false;
             } catch (Exception e) {
               logger.error(
                   "receiving pdus, received an unexpected exception " +
                  e.toString());            
             }
             if(pdu != null) { 
               if(safeStop == false) {
                 if(pdu instanceof DeliverSM) {
                   callMOListeners((DeliverSM)pdu);
                 } else {
                   logger.error("received an unexpected pdu" +
                       pdu.debugString());
                 }  
               } else {
                 logger.fatal("going out no manage of receiving pdu");
                 unbind();
                 working = false;
View Full Code Here

TOP

Related Classes of com.logica.smpp.pdu.PDU

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.