PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/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
23package org.mobicents.protocols.smpp.event;
24
25import org.mobicents.protocols.smpp.Session;
26import org.mobicents.protocols.smpp.message.SMPPPacket;
27
28/**
29 * A connection observer implementation is used to receive event updates from an
30 * Connection object. If an application wishes to use asynchronous
31 * communications mode with the API framework, it will need to provide an
32 * implementation of this interface to the Connection to be notified of SMPP
33 * events (such as packet reception).
34 * 
35 * @version $Id: SessionObserver.java 452 2009-01-15 16:56:36Z orank $
36 * @see Session#addObserver
37 */
38public interface SessionObserver {
39    /**
40     * Called when a new SMPP packet has been received from the SMSC. This
41     * method is called by the API framework whenever an SMPP packet has been
42     * read and decoded from the network connection to the SMSC. Identification
43     * of the packet type can be achieved by calling
44     * {@link SMPPPacket#getCommandId}.
45     * 
46     * @param source
47     *            the Connection which received the packet.
48     * @param packet
49     *            the SMPP packet received.
50     */
51    void packetReceived(Session source, SMPPPacket packet);
52
53    /**
54     * Called for all events <b>other </b> than packet reception. This method is
55     * called for all events generated by the API framework <i>except </i> that
56     * of a packet received. The {@link #packetReceived}method is called in
57     * that case. The <code>update</code> method is mostly used for control
58     * events, such as signifying the exit of the receiver thread or notifying
59     * of error conditions.
60     * 
61     * @param source
62     *            the Connection which received the packet.
63     * @param event
64     *            the SMPP event type.
65     * @see com.adenki.smpp.event.SMPPEvent#getType
66     */
67    void update(Session source, SMPPEvent event);
68}
69