|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.net.Connection
com.echomine.net.TimeableConnection
com.echomine.jabber.JabberConnection
public class JabberConnection
This class represents a connection to a Jabber Server. Multiple Connections can be created to connect to multiple servers. This class never should deal with any high-level filtering or anything. It is essentially a pass through and receive for the protocol. Anything higher up should be handled by the net service or the service handlers. Authentication should be implemented at the high-level as the the connection does not keep any state other than being connected or disconnected, and queuing of messages to send and receive. This class also supports SSL-based connections if specified.
Field Summary |
---|
Fields inherited from class com.echomine.net.Connection |
---|
listenerList |
Constructor Summary | |
---|---|
JabberConnection(JabberSession session,
JabberMessageReceiver receiver)
|
Method Summary | |
---|---|
void |
addConnectionListener(ConnectionListener l)
adds a subscriber to listen for connection events |
void |
addMessageListener(JabberMessageListener l)
|
void |
connect(ConnectionModel cmodel)
This method is synchronous and will not return until connection is established or fails. |
void |
disconnect()
Disconnects from the remote server |
ConnectionModel |
getConnectionModel()
|
boolean |
isConnected()
|
void |
messageReceived(JabberMessageEvent event)
listens for a session init message in case it comes in before us sending a |
void |
removeConnectionListener(ConnectionListener l)
remove from listening to connection events |
void |
removeMessageListener(JabberMessageListener l)
|
void |
send(JabberMessage msg)
Sends a message to the server |
void |
sendLater(java.lang.Runnable sendThread)
this works the same as send() with the exception that the message will be wrapped in a separate thread before sending out the message. |
Methods inherited from class com.echomine.net.TimeableConnection |
---|
fireConnectionClosed, fireConnectionEstablished |
Methods inherited from class com.echomine.net.Connection |
---|
fireConnectionStarting, fireConnectionStartingWithoutVeto |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JabberConnection(JabberSession session, JabberMessageReceiver receiver)
Method Detail |
---|
public void disconnect()
public void connect(ConnectionModel cmodel) throws ConnectionFailedException
ConnectionFailedException
- if connection is not established within the timeout periodpublic void send(JabberMessage msg) throws SendMessageFailedException
SendMessageFailedException
public void sendLater(java.lang.Runnable sendThread)
sendThread
- the thread that will get run to send a messagepublic void addConnectionListener(ConnectionListener l)
Connection
addConnectionListener
in class Connection
public void removeConnectionListener(ConnectionListener l)
Connection
removeConnectionListener
in class Connection
public ConnectionModel getConnectionModel()
public boolean isConnected()
public void addMessageListener(JabberMessageListener l)
public void removeMessageListener(JabberMessageListener l)
public void messageReceived(JabberMessageEvent event)
messageReceived
in interface JabberMessageListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |