com.echomine.jabber
Class JabberSession

java.lang.Object
  extended by com.echomine.jabber.JabberSession

public class JabberSession
extends java.lang.Object

The main entry into Jabber itself. It will contain all the necessary services that is supported by the module. This is basically an aggregator class that simplifies working with the module.


Constructor Summary
JabberSession(JabberContext context, JabberMessageParser parser)
           
 
Method Summary
 void addMessageListener(JabberMessageListener l)
          convenience method equivalent to calling getConnection().addMessageListner()
 void connect(ConnectionModel cmodel)
          connect using an existing connection model.
 void connect(java.lang.String hostname, int port)
          connect to the specified server.
 void disconnect()
          disconnect from the jabber server.
 JabberChatService getChatService()
           
 JabberClientService getClientService()
           
 JabberConnection getConnection()
           
 JabberContext getContext()
           
 JabberMessageParser getMessageParser()
           
 JabberPresenceService getPresenceService()
           
 JabberRosterService getRosterService()
           
 JabberServerService getServerService()
           
 JabberUserService getUserService()
           
 void removeMessageListener(JabberMessageListener l)
          convenience method equivalent to calling getConnection().removeMessageListner()
 void sendMessage(JabberMessage msg)
          wrapper method to send messages.
 void sendMessageLater(java.lang.Runnable runnable)
          This sends a message later rather than synchronously inside the current thread that called this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JabberSession

public JabberSession(JabberContext context,
                     JabberMessageParser parser)
Method Detail

connect

public void connect(java.lang.String hostname,
                    int port)
             throws ConnectionFailedException,
                    java.net.UnknownHostException
connect to the specified server. The method will not return until a connection is established or fails. Thus, this method is synchronous.

Throws:
ConnectionFailedException
java.net.UnknownHostException

connect

public void connect(ConnectionModel cmodel)
             throws ConnectionFailedException
connect using an existing connection model. This is a synchronous method where control won't be return to the called until either connection is established or failed.

Throws:
ConnectionFailedException

disconnect

public void disconnect()
disconnect from the jabber server. This will shutdown all running connections and services.


sendMessage

public void sendMessage(JabberMessage msg)
                 throws SendMessageFailedException
wrapper method to send messages.

Throws:
SendMessageFailedException

sendMessageLater

public void sendMessageLater(java.lang.Runnable runnable)
This sends a message later rather than synchronously inside the current thread that called this method. This is what you would use if you need to send a synchronous message while within a JabberMessageListener.messageReceived() method. If you do not use this method to send those messages, a thread deadlock will occur.


getContext

public JabberContext getContext()
Returns:
the jabber context associated with this context

getConnection

public JabberConnection getConnection()
Returns:
the connection object associated with this session

getMessageParser

public JabberMessageParser getMessageParser()
Returns:
the message parser associated with this session

getRosterService

public JabberRosterService getRosterService()
Returns:
the roster service associated with this session

getChatService

public JabberChatService getChatService()

getPresenceService

public JabberPresenceService getPresenceService()
Returns:
the presence service associated with this session

getUserService

public JabberUserService getUserService()
Returns:
the user service associated with this session

getServerService

public JabberServerService getServerService()
Returns:
the high level server service

getClientService

public JabberClientService getClientService()
Returns:
the client service

addMessageListener

public void addMessageListener(JabberMessageListener l)
convenience method equivalent to calling getConnection().addMessageListner()


removeMessageListener

public void removeMessageListener(JabberMessageListener l)
convenience method equivalent to calling getConnection().removeMessageListner()



Copyright © 2001-2005 Echomine. All Rights Reserved.