Constructor and Description |
---|
IMSessionXMPPImpl() |
Modifier and Type | Method and Description |
---|---|
void |
changeUserStatus(IMUser.IMUserStatus imUserStatus)
Changes the user status related to the connection established with IM
server
|
void |
close()
Closes the connection established with IM server.
|
void |
configure(java.util.Properties properties)
Configures the session using the properties specified.
|
IMMessageHandler |
createMessageHandler(IMUser partner)
Creates a new message handler allowing objects to do operations like
sending new messages, closing the conversation or verifying if the
conversation is still opened
|
IMResolveHandler |
createResolveHandler(boolean onlyUnique,
boolean exhaustiveLookup)
Creates and returns a resolve object
|
IMUserStatusHandler |
createUserStatusHandler()
Creates a new user status handler allowing listener objects to be
registered to be notified when some user changes his/her IM status
|
long |
getConnectionTimeout()
Returns the connection timeout
|
long |
getDefaultConnectionTimeout()
Returns the default connection timeout
|
long |
getDefaultResolveTimeout()
Returns the default resolve timeout
|
IMUser |
getIMUser()
Returns the IMUser object related to the user account used to open this
IM chat session.
|
long |
getResolveTimeout()
Returns the resolve timeout
|
java.lang.String |
getServerHostName() |
int |
getServerPort() |
java.lang.String |
getServiceName() |
java.lang.String |
getSessionName()
Returns the session name
|
java.lang.String |
getUserId() |
java.lang.String |
getUserPassword() |
boolean |
isOpened() |
void |
open()
Connects to the IM server using the information set using
IMSession.configure(Properties) method. |
void |
registerIMSingleListener(IMSingleListener listener)
Registers a new listener for handling incoming messages.
|
void |
removeIMSingleListener(IMSingleListener listener)
Remove the specified IMSingleListener
|
IMUser |
resolve(java.lang.String userDisplayName)
Resolves the user identified by userDisplayName parameter.
|
IMResolveEvent |
resolve(java.lang.String userDisplayName,
boolean onlyUnique,
boolean exhaustiveLookup)
Resolves the user identified by userDisplayName parameter.
|
void |
setConnectionTimeout(long timeout)
Defines the timeout used by method
IMSession.open() . |
void |
setResolveTimeout(long timeout)
Defines the timeout used by method
IMSession.resolve(String, boolean, boolean) . |
public void configure(java.util.Properties properties) throws IMException
IMSession
IMDriver.validateProperties(Properties)
can be used to make sure
that the properties are validconfigure
in interface IMSession
IMException
- if the properties are invalid or if the session could not be
createdpublic java.lang.String getServerHostName()
getServerHostName
in interface IMSession
public int getServerPort()
public java.lang.String getServiceName()
public java.lang.String getSessionName()
IMSession
getSessionName
in interface IMSession
public java.lang.String getUserPassword()
getUserPassword
in interface IMSession
public IMUser getIMUser()
IMSession
public void open() throws IMException
IMSession
IMSession.configure(Properties)
method. This method uses a
connection timeout set by IMSession.setConnectionTimeout(long)
,
and not returns until the timeout is over or the connection opens. So,
this method is blocking (bolcks the current thread). A not blockiing
method to open a session will be available soon.open
in interface IMSession
IMException
- if it is not possible to open the session (invalid user or
password, for example), or if the connection timeout has
finishedpublic void changeUserStatus(IMUser.IMUserStatus imUserStatus) throws IMException
IMSession
changeUserStatus
in interface IMSession
IMException
- if the IM session is not openedpublic void close() throws IMException
IMSession
close
in interface IMSession
IMException
- if some error occurs during the closing operationpublic IMResolveHandler createResolveHandler(boolean onlyUnique, boolean exhaustiveLookup) throws IMException
IMSession
createResolveHandler
in interface IMSession
onlyUnique
- This option determines whether the created resolver object
should resolve successfully only if the provided name is
matched exactly in the IM directoryexhaustiveLookup
- This option determines whether the created resolver object
should perform an exhaustive lookup through all directories or
stop in the first directory where a match is foundIMException
- if this session is not opened yet, or if the partner can not
be resolvedpublic IMUserStatusHandler createUserStatusHandler() throws IMException
IMSession
createUserStatusHandler
in interface IMSession
IMException
- if this session is not opened yetpublic IMMessageHandler createMessageHandler(IMUser partner) throws IMException
IMSession
createMessageHandler
in interface IMSession
IMException
- if this session is not opened yetpublic IMResolveEvent resolve(java.lang.String userDisplayName, boolean onlyUnique, boolean exhaustiveLookup) throws IMException
IMSession
IMResolveHandler
object and a
IMResolveListener
class if you don't want to block your thread to
use this function.resolve
in interface IMSession
onlyUnique
- This option determines if it should resolve successfully only
if the provided name is matched exactly in the IM directoryexhaustiveLookup
- This option determines if it should perform an exhaustive
lookup through all directories or stop in the first directory
where a match is foundSTUser
object or to know the reason that it could not be
generatedIMException
- if the session is not opened, or if the resolve operation is
not concluded in X milliseconds. X can be set using
IMSession.setResolveTimeout(long)
methodIMSession.createResolveHandler(boolean, boolean)
public IMUser resolve(java.lang.String userDisplayName) throws IMException, IMException
IMSession
IMResolveHandler
object and a
IMResolveListener
class if you don't want to block your thread to
use this function. This method returns a user resolve only if the display
name is exactly equal to the existent in serverresolve
in interface IMSession
IMException
- if the session is not opened, or if the resolve operation is
not concluded in X milliseconds. X can be set using
IMSession.setResolveTimeout(long)
methodIMSession.createResolveHandler(boolean, boolean)
public long getDefaultConnectionTimeout()
IMSession
getDefaultConnectionTimeout
in interface IMSession
public void setConnectionTimeout(long timeout)
IMSession
IMSession.open()
. If a
connection timeout is not set, the default value will be used. The
default connection timeout value can be got using the
IMSession.getDefaultConnectionTimeout()
methodsetConnectionTimeout
in interface IMSession
public long getConnectionTimeout()
IMSession
getConnectionTimeout
in interface IMSession
public long getDefaultResolveTimeout()
IMSession
getDefaultResolveTimeout
in interface IMSession
public void setResolveTimeout(long timeout)
IMSession
IMSession.resolve(String, boolean, boolean)
. If a resolve
timeout is not set, the default value will be used. The default resolve
timeout value can be got using the
IMSession.getDefaultResolveTimeout()
methodsetResolveTimeout
in interface IMSession
public long getResolveTimeout()
IMSession
getResolveTimeout
in interface IMSession
public void registerIMSingleListener(IMSingleListener listener) throws IMException
IMSession
registerIMSingleListener
in interface IMSession
IMException
public void removeIMSingleListener(IMSingleListener listener) throws IMException
IMSession
removeIMSingleListener
in interface IMSession
IMException