com.beem.project.beem.smack.caps
Class CapsManager

Package class diagram package CapsManager
java.lang.Object
  extended by com.beem.project.beem.smack.caps.CapsManager
Direct Known Subclasses:
BeemCapsManager

public class CapsManager
extends Object

Capabilities manager to implements XEP-0115. The DiscoverInfo are cached in memory.


Constructor Summary
CapsManager(ServiceDiscoveryManager sdm, Connection conn)
          Create a CapsManager.
 
Method Summary
 DiscoverInfo getDiscoverInfo(String ver)
          Get the discover info associated with a ver attribute.
 DiscoverInfo getDiscoverInfo(String jid, String ver)
          Get the discover info of a contact.
protected  boolean isInCache(String ver)
          Check if the discover info correspondig to the ver hash is in cache.
protected  DiscoverInfo load(String ver)
          Load a persistent DiscoverInfo.
 void setNode(String node)
          Set the node attribute to send in your capability.
protected  void store(String ver, DiscoverInfo info)
          Store a DiscoverInfo for persistence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapsManager

public CapsManager(ServiceDiscoveryManager sdm,
                   Connection conn)
Create a CapsManager.

Parameters:
sdm - The service discovery manager to use.
conn - The connection to manage.
Method Detail

getDiscoverInfo

public DiscoverInfo getDiscoverInfo(String ver)
Get the discover info associated with a ver attribute.

Parameters:
ver - the ver attribute.
Returns:
the discover info or null if it was not cached.

getDiscoverInfo

public DiscoverInfo getDiscoverInfo(String jid,
                                    String ver)
Get the discover info of a contact.

Parameters:
jid - the jid of the contact.
ver - the ver attribute of the contact capability.
Returns:
The info of the client null if the info was not cached.

setNode

public void setNode(String node)
Set the node attribute to send in your capability. This is usually an uri to identify the client.

Parameters:
node - the node attribute to set.

load

protected DiscoverInfo load(String ver)
Load a persistent DiscoverInfo. The default implementation does nothing and always return null.

Parameters:
ver - the ver hash of the discoverInfo.
Returns:
The discover info or null if not present.

store

protected void store(String ver,
                     DiscoverInfo info)
Store a DiscoverInfo for persistence. The default implementation does nothing.

Parameters:
ver - the ver hash of the DiscoverInfo
info - the DiscoverInfo to store

isInCache

protected boolean isInCache(String ver)
Check if the discover info correspondig to the ver hash is in cache. This implementation checks the memory cache. If the info is not in cache it is necessary to request it from the network.

Parameters:
ver - the ver hash
Returns:
true if it is in cache false otherwise


Copyright © 2009 Beem-project.com. All Rights Reserved.