Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community.xmpp
Class IMManager

java.lang.Object
  extended by com.jivesoftware.community.xmpp.IMManager
All Implemented Interfaces:
UserListener, com.jivesoftware.base.event.v2.EventSink, com.jivesoftware.community.cache.CacheFactory.ClusteringListener, JiveManager

public class IMManager
extends Object
implements JiveManager, UserListener, com.jivesoftware.community.cache.CacheFactory.ClusteringListener, com.jivesoftware.base.event.v2.EventSink

Manages connection to the Openfire RTC server. Clearspace connects to Openfire as an external component, which allows it to monitor presence information, run commands, link authentication and user accounts, etc. And Openfires connects to Clearspace using Webservices.

In order to connect to Openfire, Clearspace must be configured with the external component address, port, and secret key. A multi-cast DNS service assists Clearspace in discovering all Openfire servers on the local network.

The external component connection is made using the open XMPP protocol. However, Clearspace relies on Ad-Hoc Commands that are specifically implemented in Openfire.


Nested Class Summary
static class IMManager.ConcurrentConnectionCheckClusterTask
           
static class IMManager.ConcurrentPresenceInitCheckClusterTask
           
static class IMManager.LocalRestartTask
           
 
Constructor Summary
IMManager()
           
 
Method Summary
 void addXMPPListener(XMPPListener listener)
          Adds an XMPP listener, which listens for connects and disconnects as well as presence updates.
 void changeSharedSecret(String secret)
          Changes the shared secret and reset the component connection.
 void clusteringStarted()
           
 void clusteringStopped()
           
 void deleteIMHandlesForUser(User user)
           
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 String generateNonce()
          Generates a new nonce.
 String getAdminConsoleInterface()
          Returns the interface where OF's admin console is listening
 int getAdminConsolePort()
          Returns the port where OF's admin console is listening
 int getAdminConsoleSecurePort()
          Returns the secure port where OF's admin console is listening
 com.jivesoftware.base.aaa.AuthenticationProvider getAuthenticationProvider()
           
 com.jivesoftware.community.xmpp.ClearspaceComponent getClearspaceComponent()
           
 String getHttpBindSecureUrl()
          If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the secure URL on which it can be reached.
 String getHttpBindUnsecureUrl()
          If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the unsecure URL on which it can be reached.
 String getHttpBindUrl()
          If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the URL on which it can be reached.
 com.jivesoftware.community.xmpp.InterceptorManager getInterceptorManager()
           
 com.jivesoftware.community.xmpp.disco.IqDiscoHandler getIqDiscoHandler()
           
 String getJavaScriptUrl()
           
 org.xmpp.packet.JID getJIDForUser(User user)
           
 String getNonce()
          Returns a new nonce genereted in Openfire.
 org.xmpp.packet.Presence getPresence(org.xmpp.packet.JID xmppAddress)
          Returns the presence info for a particular XMPP address, or null if is unavailable (offline) or if no presence information is available.
 org.xmpp.packet.Presence getPresence(User user)
          Returns the presence info for a User, or null if is unavailable (offline) or if no presence information is available.
 org.xmpp.packet.Presence getPresenceForResource(org.xmpp.packet.JID xmppAddress)
          Returns the presence info for a particular XMPP address resource, or null if the resource is unavailable (offline) or if no presence information is available.
 Collection<org.xmpp.packet.Presence> getPresences(org.xmpp.packet.JID xmppAddress)
          Returns a collection Presence information for all the user's current resources or null if the user is unavailable (offline) or if no presence information is available.
 com.jivesoftware.community.xmpp.ServerInformation getServerInformation()
          Returns information about the XMPP server as well as some basic statistics.
 String getServerVersion()
          Returns information about the XMPP server version.
 com.jivesoftware.community.xmpp.UserCommandManager getUserCommandManager()
           
 User getUserForJID(org.xmpp.packet.JID jid)
           
 void init()
           
 boolean isChatEnabled(JiveContainer container)
          Returns true if Chat functionality is enabled for a container.
 boolean isConnected()
          Returns true if Clearspace is connected as an external component to a Openfire server.
 boolean isEnabled()
          Returns true if Clearspace is setup as an external component to a Openfire server, or if there is an active task trying to make it.
 boolean isHttpBindEnabled()
          Returns true if the HTTP binding service on the RTC server is currently enabled and false if it is not.
 boolean isValidNonce(String nonce)
          Returns true if the nonce was generated usig generateNonce, if this is the first check for that nonce and it was generated at least one minute ago.
 boolean isWebservicesEnabled()
          Returns true if web services are enabled and the Openfire user is authorized to use them.
 void removeXMPPListener(XMPPListener listener)
          Removes an XMPP listener.
 void reset()
          Restarts the external component connection to Openfire.
 void sendPacket(org.xmpp.packet.Packet packet)
          Sends an XMPP packet to the Openfire server.
 void sendQuery(org.xmpp.packet.IQ packet, org.jivesoftware.whack.IQResultListener iqResultListener)
           
 void setAdminConsoleInterface(String adminConsoleInterface)
          Set the interface where OF's admin console is listening
 void setAdminConsolePort(int adminConsolePort)
          Set the port where OF's admin console is listening
 void setAdminConsoleSecurePort(int adminConsoleSecurePort)
          Set the port where OF's admin console is listening
 void setAuthenticationProvider(com.jivesoftware.base.aaa.AuthenticationProvider authProvider)
           
protected  void setHttpBindEnabled(boolean enabled)
           
protected  void setHttpBindSecureUrl(String url)
           
protected  void setHttpBindUnsecureUrl(String url)
           
 void setImSettingsDAO(com.jivesoftware.community.impl.dao.IMSettingsDAO imSettingsDAO)
           
 void setJIDNodeForUser(User user, String node)
           
 void setPermissionsManager(com.jivesoftware.community.internal.ExtendedPermissionsManager permissionsManager)
           
 void setPresenceCache(com.jivesoftware.community.cache.Cache<String,Map<String,org.dom4j.tree.DefaultElement>> presenceCache)
           
 void setRegistry(com.jivesoftware.base.event.v2.EventListenerRegistry registry)
           
protected  void setRelativeJavascriptUrl(String javaScriptUrl)
           
 void setTaskEngine(com.jivesoftware.util.task.TaskEngine taskEngine)
           
 void setUserManager(UserManager userManager)
           
 void setWsUtil(com.jivesoftware.community.webservices.server.WSUtil wsUtil)
           
 boolean testComponent(String host, int port, String secret, String domain)
          Tests an external component connection to the Openfire server.
 void userAuthenticating(UserEvent event)
          This method is called when a user begins the authentication process.
 void userCreated(UserEvent event)
          Fired when a user is created.
 void userDeleted(UserEvent event)
          Fired when a user is deleted.
 void userLoggedIn(UserEvent event)
          This method is called whenever a user logs in.
 void userModified(UserEvent event)
          Fired when a user is modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IMManager

public IMManager()
Method Detail

init

public void init()

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

testComponent

public boolean testComponent(String host,
                             int port,
                             String secret,
                             String domain)
Tests an external component connection to the Openfire server.

Parameters:
host - the external component host.
port - the external component port
secret - the shared secret for the component connection.
domain - the XMPP server domain.
Returns:
true if the connection worked.

changeSharedSecret

public void changeSharedSecret(String secret)
Changes the shared secret and reset the component connection. If the connection is already established, the new password will be sent to Openfire. If it is the first time also enables the Openfire user to have access to the webservices.

Parameters:
secret - The new secret.

reset

public void reset()
Restarts the external component connection to Openfire. Use the IMSettingsUtils class to configure external component settings.


sendPacket

public void sendPacket(org.xmpp.packet.Packet packet)
Sends an XMPP packet to the Openfire server. It's recommended to call the isConnected() method before trying to send a packet.

Parameters:
packet - the packet to send.
Throws:
IllegalStateException - if not connected to the server.

sendQuery

public void sendQuery(org.xmpp.packet.IQ packet,
                      org.jivesoftware.whack.IQResultListener iqResultListener)

isEnabled

public boolean isEnabled()
Returns true if Clearspace is setup as an external component to a Openfire server, or if there is an active task trying to make it. This doesn't means that Clearspace is connected to Openfire, it means that the component is either connected to Openfire or trying to connect to it.

Returns:
true if Clearspace is setup as an external component to a Openfire server or there is task trying to make it.

isConnected

public boolean isConnected()
Returns true if Clearspace is connected as an external component to a Openfire server.

Returns:
true if Clearspace is connected as an external component to a Openfire server.

isWebservicesEnabled

public boolean isWebservicesEnabled()
Returns true if web services are enabled and the Openfire user is authorized to use them.

Returns:
true if web services are enabled and the Openfire user is authorized to use them.

isChatEnabled

public boolean isChatEnabled(JiveContainer container)
Returns true if Chat functionality is enabled for a container. Chats can be disabled globally by setting the system property 'jive.feature.chat.disabled'. It is also possible to set a default for whether chat should be enabled or disabled on new creates or containers that were created before this functionality existed.

Parameters:
container - Container object that we will check for chat enabled status of.
Returns:
true if Chat functionality was enabled for a container.

setJIDNodeForUser

public void setJIDNodeForUser(User user,
                              String node)

getUserForJID

public User getUserForJID(org.xmpp.packet.JID jid)

getJIDForUser

public org.xmpp.packet.JID getJIDForUser(User user)

addXMPPListener

public void addXMPPListener(XMPPListener listener)
Adds an XMPP listener, which listens for connects and disconnects as well as presence updates.

Parameters:
listener - the XMPP listener.

removeXMPPListener

public void removeXMPPListener(XMPPListener listener)
Removes an XMPP listener.

Parameters:
listener - an XMPP listener.

getPresence

public org.xmpp.packet.Presence getPresence(org.xmpp.packet.JID xmppAddress)
Returns the presence info for a particular XMPP address, or null if is unavailable (offline) or if no presence information is available.

If the XMPP user has several presences (one for each resource), then the presence with the highest priority is returned. If several presence values have the same priority, the presence that is "most available" is returned.

Parameters:
xmppAddress - an XMPP address. If the address contains a resource, it will be ignored. To retrieve a presence information for a particular resource, see getPresenceForResource(org.xmpp.packet.JID).
Returns:
the user's current presence, or null if the user is unavailable or if no presence information is available..

getPresence

public org.xmpp.packet.Presence getPresence(User user)
Returns the presence info for a User, or null if is unavailable (offline) or if no presence information is available.

getPresence(org.xmpp.packet.JID)

Parameters:
user - the user to test for presence.
Returns:
the user's current presence, or null if the user is unavailable or if no presence information is available..

getPresenceForResource

public org.xmpp.packet.Presence getPresenceForResource(org.xmpp.packet.JID xmppAddress)
Returns the presence info for a particular XMPP address resource, or null if the resource is unavailable (offline) or if no presence information is available.

Parameters:
xmppAddress - a fully qualified XMPP ID, including a resource.
Returns:
the current presence, or null if unavailable or if no presence information is available.

getPresences

public Collection<org.xmpp.packet.Presence> getPresences(org.xmpp.packet.JID xmppAddress)
Returns a collection Presence information for all the user's current resources or null if the user is unavailable (offline) or if no presence information is available.

Parameters:
xmppAddress - an XMPP address (JID). It should be the bare address, e.g. jdoe@example.com, instead of jdoe@example.com/Work.
Returns:
an iterator (of Presence objects) for all the user's current presences, or null if the user is unavailable or if no presence information is available.

getClearspaceComponent

public com.jivesoftware.community.xmpp.ClearspaceComponent getClearspaceComponent()

getUserCommandManager

public com.jivesoftware.community.xmpp.UserCommandManager getUserCommandManager()

getServerInformation

public com.jivesoftware.community.xmpp.ServerInformation getServerInformation()
Returns information about the XMPP server as well as some basic statistics. If no information was found then null will be returned.

Returns:
information about the XMPP server as well as some basic statistics or null if nothing was found.

getServerVersion

public String getServerVersion()
Returns information about the XMPP server version. If no information was found then null will be returned. The version of the server can also be obtained by using the method getServerInformation(), however, that method could return null for older versions of the server. This method exists as a standards way to always get the version of the server.

Returns:
information about the XMPP server version.

getIqDiscoHandler

public com.jivesoftware.community.xmpp.disco.IqDiscoHandler getIqDiscoHandler()

setHttpBindEnabled

protected void setHttpBindEnabled(boolean enabled)

isHttpBindEnabled

public boolean isHttpBindEnabled()
Returns true if the HTTP binding service on the RTC server is currently enabled and false if it is not.

Returns:
true if the HTTP binding service on the RTC server is currently enabled and false if it is not.

setHttpBindUnsecureUrl

protected void setHttpBindUnsecureUrl(String url)

getHttpBindUnsecureUrl

public String getHttpBindUnsecureUrl()
If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the unsecure URL on which it can be reached. If the service is not enabled, this method will return null.

Returns:
the unsecure URL on which the HTTP binding service can be reached.

setHttpBindSecureUrl

protected void setHttpBindSecureUrl(String url)

getHttpBindSecureUrl

public String getHttpBindSecureUrl()
If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the secure URL on which it can be reached. If the service is not enabled, this method will return null.

Returns:
the secure URL on which the HTTP binding service can be reached.

getHttpBindUrl

public String getHttpBindUrl()
If the HTTP binding service is enabled on the RTC server, see isHttpBindEnabled(), this method will return the URL on which it can be reached. If the service is not enabled, this method will return null.

Returns:
the URL on which the HTTP binding service can be reached.

setRelativeJavascriptUrl

protected void setRelativeJavascriptUrl(String javaScriptUrl)

getJavaScriptUrl

public String getJavaScriptUrl()

getInterceptorManager

public com.jivesoftware.community.xmpp.InterceptorManager getInterceptorManager()

getAdminConsoleInterface

public String getAdminConsoleInterface()
Returns the interface where OF's admin console is listening

Returns:
the interface where OF's admin console is listening

setAdminConsoleInterface

public void setAdminConsoleInterface(String adminConsoleInterface)
Set the interface where OF's admin console is listening

Parameters:
adminConsoleInterface - the interface where OF's admin console is listening

getAdminConsolePort

public int getAdminConsolePort()
Returns the port where OF's admin console is listening

Returns:
the port where OF's admin console is listening

setAdminConsolePort

public void setAdminConsolePort(int adminConsolePort)
Set the port where OF's admin console is listening

Parameters:
adminConsolePort - the interface where OF's admin console is listening

getAdminConsoleSecurePort

public int getAdminConsoleSecurePort()
Returns the secure port where OF's admin console is listening

Returns:
the secure port where OF's admin console is listening

setAdminConsoleSecurePort

public void setAdminConsoleSecurePort(int adminConsoleSecurePort)
Set the port where OF's admin console is listening

Parameters:
adminConsoleSecurePort - the interface where OF's admin console is listening

deleteIMHandlesForUser

public void deleteIMHandlesForUser(User user)

userCreated

public void userCreated(UserEvent event)
Description copied from interface: UserListener
Fired when a user is created.

Specified by:
userCreated in interface UserListener
Parameters:
event - the UserEvent

userDeleted

public void userDeleted(UserEvent event)
Description copied from interface: UserListener
Fired when a user is deleted.

Specified by:
userDeleted in interface UserListener
Parameters:
event - the UserEvent

userModified

public void userModified(UserEvent event)
Description copied from interface: UserListener
Fired when a user is modified.

Specified by:
userModified in interface UserListener
Parameters:
event - the UserEvent

userLoggedIn

public void userLoggedIn(UserEvent event)
Description copied from interface: UserListener
This method is called whenever a user logs in.

Specified by:
userLoggedIn in interface UserListener
Parameters:
event - method is called whenever a user logs in.

userAuthenticating

public void userAuthenticating(UserEvent event)
Description copied from interface: UserListener
This method is called when a user begins the authentication process.

Specified by:
userAuthenticating in interface UserListener
Parameters:
event - method is called whenever a user logs in.

setImSettingsDAO

public void setImSettingsDAO(com.jivesoftware.community.impl.dao.IMSettingsDAO imSettingsDAO)

generateNonce

public String generateNonce()
Generates a new nonce. The isValidNonce method will return true when using nonces generated by this method.

Returns:
a unique nonce

isValidNonce

public boolean isValidNonce(String nonce)
Returns true if the nonce was generated usig generateNonce, if this is the first check for that nonce and it was generated at least one minute ago.

Parameters:
nonce - the nonce to be checked
Returns:
true if the nonce if the nonce was generated and this is the first check for that nonce

getNonce

public String getNonce()
Returns a new nonce genereted in Openfire. This nonce can be used to SSO to Openfire admin console. Returns null if there is a problem getting the nonce.

Returns:
a new nonce or null if there is a problem getting it.

setRegistry

public void setRegistry(com.jivesoftware.base.event.v2.EventListenerRegistry registry)
Specified by:
setRegistry in interface com.jivesoftware.base.event.v2.EventSink

clusteringStarted

public void clusteringStarted()
Specified by:
clusteringStarted in interface com.jivesoftware.community.cache.CacheFactory.ClusteringListener

clusteringStopped

public void clusteringStopped()
Specified by:
clusteringStopped in interface com.jivesoftware.community.cache.CacheFactory.ClusteringListener

setTaskEngine

public void setTaskEngine(com.jivesoftware.util.task.TaskEngine taskEngine)

setUserManager

public void setUserManager(UserManager userManager)

setPermissionsManager

public void setPermissionsManager(com.jivesoftware.community.internal.ExtendedPermissionsManager permissionsManager)

setAuthenticationProvider

public void setAuthenticationProvider(com.jivesoftware.base.aaa.AuthenticationProvider authProvider)

setPresenceCache

public void setPresenceCache(com.jivesoftware.community.cache.Cache<String,Map<String,org.dom4j.tree.DefaultElement>> presenceCache)

getAuthenticationProvider

public com.jivesoftware.base.aaa.AuthenticationProvider getAuthenticationProvider()

setWsUtil

public void setWsUtil(com.jivesoftware.community.webservices.server.WSUtil wsUtil)

Clearspace Project Page

Copyright © 1999-2007 Jive Software.