/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/event/SessionObserver.java

http://mobicents.googlecode.com/ · Java · 69 lines · 7 code · 5 blank · 57 comment · 0 complexity · 4665b6bddea26bc2448c49451ab1b8b3 MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.smpp.event;
  23. import org.mobicents.protocols.smpp.Session;
  24. import org.mobicents.protocols.smpp.message.SMPPPacket;
  25. /**
  26. * A connection observer implementation is used to receive event updates from an
  27. * Connection object. If an application wishes to use asynchronous
  28. * communications mode with the API framework, it will need to provide an
  29. * implementation of this interface to the Connection to be notified of SMPP
  30. * events (such as packet reception).
  31. *
  32. * @version $Id: SessionObserver.java 452 2009-01-15 16:56:36Z orank $
  33. * @see Session#addObserver
  34. */
  35. public interface SessionObserver {
  36. /**
  37. * Called when a new SMPP packet has been received from the SMSC. This
  38. * method is called by the API framework whenever an SMPP packet has been
  39. * read and decoded from the network connection to the SMSC. Identification
  40. * of the packet type can be achieved by calling
  41. * {@link SMPPPacket#getCommandId}.
  42. *
  43. * @param source
  44. * the Connection which received the packet.
  45. * @param packet
  46. * the SMPP packet received.
  47. */
  48. void packetReceived(Session source, SMPPPacket packet);
  49. /**
  50. * Called for all events <b>other </b> than packet reception. This method is
  51. * called for all events generated by the API framework <i>except </i> that
  52. * of a packet received. The {@link #packetReceived}method is called in
  53. * that case. The <code>update</code> method is mostly used for control
  54. * events, such as signifying the exit of the receiver thread or notifying
  55. * of error conditions.
  56. *
  57. * @param source
  58. * the Connection which received the packet.
  59. * @param event
  60. * the SMPP event type.
  61. * @see com.adenki.smpp.event.SMPPEvent#getType
  62. */
  63. void update(Session source, SMPPEvent event);
  64. }