com.atlassian.crowd.integration.atlassianuser
Class CacheManagerAtlassianUser

java.lang.Object
  extended by com.atlassian.crowd.integration.atlassianuser.CacheManagerAtlassianUser

public class CacheManagerAtlassianUser
extends Object

The CacheManagerAtlassianUser is a central class for increasing the performance of the JIRA, Confluence and Bamboo integration with Crowd. The cache is used to store information that become redundant calls between request because security information does not change that often. The enabling and length of time the cache has is determined through the Crowd administrationc console.


Field Summary
protected static String GROUP_KEY
           
protected static String GROUPNAMES_KEY
           
protected static String PRINCIPAL_KEY
           
protected static String PRINCIPALMEMBERSHIPS_KEY
           
protected static String PRINCIPALNAMES_KEY
           
protected static Boolean serverCacheCheck
           
 
Constructor Summary
CacheManagerAtlassianUser()
          Default constructor.
 
Method Summary
 void cacheGroup(SOAPGroup group)
          Caches a specific group.
 void cacheGroupNames(List principalNames)
          Gets a list of all known group names.
 void cacheGroups(SOAPGroup[] groups)
          Caches all of the groups.
 void cachePrincipal(SOAPPrincipal principal)
          caches a specific principal.
 void cachePrincipalMemberships(String username, List membership)
          Caches the group memberships of a principal.
 void cachePrincipalNames(List principalNames)
          Caches all of the principal names.
 void cachePrincipals(SOAPPrincipal[] principals)
          Caches all of the principals.
 void flushCaches()
          Flushes all of the cache information.
 int getCacheSeconds()
          Gets the cache TTL in seconds.
protected  Cache getDefaultCache()
          Gets the cache for the integration application.
protected  Object getFromCache(String key)
          Gets a specific item from the application cache.
 SOAPGroup getGroup(String name)
          Gets a specific group by the name from the cache.
 List getGroupNames()
          Gets a list of all known group names.
 List getGroups()
          Gets a list of all known groups.
 SOAPPrincipal getPrincipal(String name)
          Gets a specific principal by the name from the cache.
 List getPrincipalMemberships(String username)
          Gets the memberships of a principal.
 List getPrincipalNames()
          Gets a list of all known principal names.
 List getPrincipals()
          Gets a list of all known principals.
 boolean isCacheEnabled()
          Returns if caching is enabled.
protected  void putInCache(String key, Object object)
          Attemps to put a specific item into the application cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINCIPAL_KEY

protected static final String PRINCIPAL_KEY

PRINCIPALMEMBERSHIPS_KEY

protected static final String PRINCIPALMEMBERSHIPS_KEY

GROUP_KEY

protected static final String GROUP_KEY

PRINCIPALNAMES_KEY

protected static final String PRINCIPALNAMES_KEY

GROUPNAMES_KEY

protected static final String GROUPNAMES_KEY

serverCacheCheck

protected static Boolean serverCacheCheck
Constructor Detail

CacheManagerAtlassianUser

public CacheManagerAtlassianUser()
Default constructor. Sets up the cache for the Crowdified application.

Method Detail

isCacheEnabled

public boolean isCacheEnabled()
Returns if caching is enabled.

Returns:
true if and only if the caching is enabled, otherwise false.

getCacheSeconds

public int getCacheSeconds()
Gets the cache TTL in seconds.

Returns:
The number of seconds an object will be cached before a refresh is needed.

getDefaultCache

protected Cache getDefaultCache()
Gets the cache for the integration application.

Returns:
The cache map.

getFromCache

protected Object getFromCache(String key)
                       throws CacheException
Gets a specific item from the application cache.

Parameters:
key - The object key in the cache.
Returns:
The cached object.
Throws:
CacheException - If the object could not be found, this exception will be thrown.

putInCache

protected void putInCache(String key,
                          Object object)
Attemps to put a specific item into the application cache.

Parameters:
key - The object key to use when caching to the object.
object - The object to cache.

cachePrincipals

public void cachePrincipals(SOAPPrincipal[] principals)
Caches all of the principals.

Parameters:
principals - The principals to cache.

getPrincipal

public SOAPPrincipal getPrincipal(String name)
                           throws CacheException
Gets a specific principal by the name from the cache.

Parameters:
name - The name of the principal.
Returns:
The cached principal
Throws:
CacheException - If the object could not be found, this exception will be thrown.

cacheGroups

public void cacheGroups(SOAPGroup[] groups)
Caches all of the groups.

Parameters:
groups - The groups to cache.

cacheGroup

public void cacheGroup(SOAPGroup group)
Caches a specific group.

Parameters:
group - The group to cache.

getGroups

public List getGroups()
               throws CacheException
Gets a list of all known groups.

Returns:
The group names as a s.
Throws:
CacheException - If the object could not be found, this exception will be thrown.

getGroup

public SOAPGroup getGroup(String name)
                   throws CacheException
Gets a specific group by the name from the cache.

Parameters:
name - The name of the group
Returns:
The cached group
Throws:
CacheException - If the object could not be found, this exception will be thrown.

cachePrincipal

public void cachePrincipal(SOAPPrincipal principal)
caches a specific principal.

Parameters:
principal - The principal to cache.

getPrincipals

public List getPrincipals()
                   throws CacheException
Gets a list of all known principals.

Returns:
The principal names as a s.
Throws:
CacheException - If the object could not be found, this exception will be thrown.

getPrincipalNames

public List getPrincipalNames()
                       throws CacheException
Gets a list of all known principal names.

Returns:
The principal names as a s.
Throws:
CacheException - If the object could not be found, this exception will be thrown.

cachePrincipalNames

public void cachePrincipalNames(List principalNames)
Caches all of the principal names.

Parameters:
principalNames - The principal names as s.

cacheGroupNames

public void cacheGroupNames(List principalNames)
Gets a list of all known group names.

Throws:
CacheException - If the object could not be found, this exception will be thrown.

getGroupNames

public List getGroupNames()
                   throws CacheException
Gets a list of all known group names.

Returns:
The group names as a s.
Throws:
CacheException - If the object could not be found, this exception will be thrown.

getPrincipalMemberships

public List getPrincipalMemberships(String username)
                             throws CacheException
Gets the memberships of a principal.

Parameters:
username - The username.
Returns:
A list of that represend the groups a principal belongs to.
Throws:
CacheException

cachePrincipalMemberships

public void cachePrincipalMemberships(String username,
                                      List membership)
Caches the group memberships of a principal.

Parameters:
username - The name of the principal.
membership - A list of s that the principal is a member of.

flushCaches

public void flushCaches()
Flushes all of the cache information.



Copyright © 2006 Atlassian Software Systems. All Rights Reserved.