Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit

ie.ncl.msg
Class ConnectionManager

java.lang.Object
  extended by ie.ncl.msg.impl.SimpleConnection
      extended by ie.ncl.msg.ConnectionManager
All Implemented Interfaces:
Connection, ErrorListener, Receiver, ReceiverListener, Sender, SenderListener

public class ConnectionManager
extends ie.ncl.msg.impl.SimpleConnection
implements Sender, Receiver, SenderListener, ReceiverListener, ErrorListener


Field Summary
static java.lang.String LISTENER_ATTR
           
 boolean reconnecting
           
 
Fields inherited from interface ie.ncl.msg.Connection
CONNECTED, NOT_CONNECTED, NOT_USED, RECONNECTING
 
Constructor Summary
ConnectionManager()
           
ConnectionManager(java.lang.String factorySettings)
          ConnectionManager is a wrapper around a sender/receiver.
 
Method Summary
 void acknowledge(Message m, boolean success)
          Acknowledge a received messages.
 void close()
          Connection Interface method.
 void connect()
          Connection
 boolean connected()
          Query the connection status.
 void connectionError(Connection c, ConnectionException ce)
           
 int getConnectionStatus()
          Query the status of the link.
 void init(java.util.Properties props)
          Initialise the object with settings specified in the properties.
 void receive(ReceiverListener r)
          Set a received callback - should be done before connect().
 boolean received(Receiver receiver, java.lang.Exception ex, Message m)
          Implements Receiver Listener API.
 void send(Message m, SenderListener applicationSenderListener)
          Send a message.
 void sent(Sender sender, java.lang.Exception ex, Message m)
          Implements Sender Listener API.
 void setErrorListener(ErrorListener listener)
          Implements Connection interface method.
 void setReceiverListener(ReceiverListener listener)
          Registers listener with the underlying transport.
 void shutdown()
          Shutdown the connection.
 
Methods inherited from class ie.ncl.msg.impl.SimpleConnection
getErrorListener, getName, getTypeDefaults, init, mergeDefaultAttributes, putTypeDefaults, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ie.ncl.msg.Connection
getTypeDefaults, init, putTypeDefaults
 

Field Detail

LISTENER_ATTR

public static final java.lang.String LISTENER_ATTR
See Also:
Constant Field Values

reconnecting

public boolean reconnecting
Constructor Detail

ConnectionManager

public ConnectionManager(java.lang.String factorySettings)
ConnectionManager is a wrapper around a sender/receiver.


ConnectionManager

public ConnectionManager()
Method Detail

init

public void init(java.util.Properties props)
          throws ConnectionException
Description copied from interface: Connection
Initialise the object with settings specified in the properties. The properties will be implementation specific.

Specified by:
init in interface Connection
Throws:
ConnectionException

connected

public boolean connected()
Description copied from interface: Connection
Query the connection status. This returns true if connected and false otherwise.

If internally a service connection go down and attempts are made to reconnect/rebind etc. this should continue to return true, so that the application continues to function.

If the application wants to be informed of a temporarily down connection/service then the application should register for errors and specifically catch the TemporaryConnectionException.

Specified by:
connected in interface Connection
Overrides:
connected in class ie.ncl.msg.impl.SimpleConnection
See Also:
Connection.setErrorListener(ie.ncl.msg.ErrorListener), TemporaryConnectionException

getConnectionStatus

public int getConnectionStatus()
Description copied from interface: Connection
Query the status of the link. A link can be in one of 3 states; NOT_CONNECTED, CONNECTED, RECONNECTING.

Unlike the connected() method, the getConnectionStatus indicates if the link has gone down and the underlying protocol is in a process of reconnecting.

Specified by:
getConnectionStatus in interface Connection
Overrides:
getConnectionStatus in class ie.ncl.msg.impl.SimpleConnection
See Also:
Connection.CONNECTED, Connection.NOT_CONNECTED, Connection.RECONNECTING, Connection.setErrorListener(ie.ncl.msg.ErrorListener), TemporaryConnectionException

receive

public void receive(ReceiverListener r)
Set a received callback - should be done before connect().

Specified by:
receive in interface Receiver
See Also:
Message

setReceiverListener

public void setReceiverListener(ReceiverListener listener)
Description copied from interface: Receiver
Registers listener with the underlying transport. The underlying transport should not receive messages until this is setup. Also, the underlying transport should not acknowledge messages until the ReceiverListener returns true or acknowledge is called.

Specified by:
setReceiverListener in interface Receiver
See Also:
Message

acknowledge

public void acknowledge(Message m,
                        boolean success)
                 throws MessageException,
                        ConnectionException
Description copied from interface: Receiver
Acknowledge a received messages. Messages that already have been acknowledged or that require no acknowledgement should be ignored. By default a (receiver) connection will acknowledge messages automatically unless otherwise specified so calls to acknowledge may be unnecessary.

Specified by:
acknowledge in interface Receiver
Throws:
MessageException
ConnectionException

setErrorListener

public void setErrorListener(ErrorListener listener)
Description copied from class: ie.ncl.msg.impl.SimpleConnection
Implements Connection interface method.

Specified by:
setErrorListener in interface Connection
Overrides:
setErrorListener in class ie.ncl.msg.impl.SimpleConnection
See Also:
ErrorListener, TemporaryConnectionException, Connection.connected()

connect

public void connect()
             throws ConnectionException
Connection

Specified by:
connect in interface Connection
Throws:
ConnectionException

connectionError

public void connectionError(Connection c,
                            ConnectionException ce)
Specified by:
connectionError in interface ErrorListener

received

public boolean received(Receiver receiver,
                        java.lang.Exception ex,
                        Message m)
Implements Receiver Listener API.

Specified by:
received in interface ReceiverListener
Returns:
true to indicate the message was received successfully, false otherwise
See Also:
Receiver, Receiver.receive(ReceiverListener)

sent

public void sent(Sender sender,
                 java.lang.Exception ex,
                 Message m)
Implements Sender Listener API.

Specified by:
sent in interface SenderListener

send

public void send(Message m,
                 SenderListener applicationSenderListener)
          throws ConnectionException,
                 MessageException
Send a message.

Specified by:
send in interface Sender
Throws:
ConnectionException
MessageException
See Also:
SenderListener, Message

close

public void close()
Description copied from class: ie.ncl.msg.impl.SimpleConnection
Connection Interface method.

Specified by:
close in interface Connection
Specified by:
close in class ie.ncl.msg.impl.SimpleConnection

shutdown

public void shutdown()
Description copied from interface: Connection
Shutdown the connection. This is used to shutdown a connection ungracefully.

Specified by:
shutdown in interface Connection

Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit